Frame Asset Tool




Here's a quick yet useful tool which creates a render camera and automatically frames the asset in Katana. All you need to do is plug the asset into the node!


Copy this into your node graph!


<katana release="4.0v1" version="4.0.1.000004">
  <node name="__SAVE_exportedNodes" type="Group">
    <node baseType="Group" comment="Made by Rich Fry | https://www.richfry.net" edited="true" name="rf_FrameAsset" ns_bubbleZoom="0.000000" ns_fromContext="legacy" ns_offsetX="-6.000000" ns_offsetY="-4.788831" selected="true" type="Group" x="-33.500005" y="-2262.500002">
      <port name="asset" source="MaterialAssign.out" type="in"/>
      <port name="o0" type="out"/>
      <group_parameter name="rf_FrameAsset">
        <group_parameter hints="{}" name="user">
          <number_parameter name="fov" value="50"/>
          <string_parameter hints="{&apos;readOnly&apos;: &apos;True&apos;, &apos;label&apos;: &apos;Made By&apos;}" name="MadeBy" value="Rich Fry | https://www.richfry.net"/>
        </group_parameter>
      </group_parameter>
      <node baseType="DollyConstraint" name="DollyConstraint" ns_errorGlow="0.000000" type="DollyConstraint" x="531.100525" y="-527.200746">
        <port name="input" source="CameraOffset.out" type="in"/>
        <port name="out" returns="o0" type="out"/>
        <group_parameter name="DollyConstraint">
          <string_parameter name="basePath" value="/root/world/cam/renderCam"/>
          <stringarray_parameter name="targetPath" size="1" tupleSize="1">
            <string_parameter name="i0" value="/root/world/geo"/>
          </stringarray_parameter>
          <string_parameter name="targetBounds" value="sphere"/>
          <number_parameter expression="(getParam(&quot;rf_FrameAsset.user.fov&quot;)*-1)+getParam(&quot;rf_FrameAsset.user.fov&quot;)/2" isexpression="true" name="angleOffset"/>
          <number_parameter name="allowMissingTargets" value="0"/>
          <number_parameter name="addToConstraintList" value="0"/>
          <number_parameter name="setRelativeTargets" value="0"/>
        </group_parameter>
      </node>
      <node baseType="Merge" name="Merge_renderCam" ns_errorGlow="0.000000" type="Merge" x="528.401398" y="-396.147034">
        <port name="i" source="rf_FrameAsset.asset" type="in"/>
        <port name="i1" source="Dot17.output" type="in"/>
        <port name="out" type="out"/>
        <group_parameter name="Merge_renderCam">
          <string_parameter name="showAdvancedOptions" value="No"/>
          <group_parameter name="advanced">
            <string_parameter name="sumBounds" value="No"/>
            <string_parameter name="preserveWorldSpaceXform" value="No"/>
            <stringarray_parameter name="preserveInheritedAttributes" size="0" tupleSize="1"/>
            <group_parameter name="preferredInputAttributes">
              <stringarray_parameter name="name" size="0" tupleSize="1"/>
              <numberarray_parameter name="index" size="0" tupleSize="1"/>
            </group_parameter>
            <string_parameter name="preferRightmostInputWithAttribute" value=""/>
            <stringarray_parameter name="mergeGroupAttributes" size="0" tupleSize="1"/>
          </group_parameter>
        </group_parameter>
      </node>
      <node baseType="OpScript" name="CameraOffset" ns_errorGlow="0.000000" type="OpScript" x="524.520569" y="-470.647034">
        <port name="i0" source="rf_CopyBounds.out" type="in"/>
        <port name="out" type="out"/>
        <group_parameter name="CameraOffset">
          <string_parameter name="CEL" value="(( /root/world/cam/renderCam))"/>
          <string_parameter name="location" value="/root/world/location"/>
          <group_parameter name="script">
            <string_parameter name="lua" value="--finds name of child&#0010;local child = Interface.GetPotentialChildren(&quot;/root/world/geo&quot;):getValue()&#0010;&#0010;--sets child path&#0010;local childPath = &quot;/root/world/geo/&quot;..child&#0010;&#0010;--gets bound from child&#0010;local boundsAttr = Interface.GetAttr(&quot;bound&quot;, childPath):getNearestSample(0)&#0010;&#0010;--gets height bound&#0010;local boundsHeight = boundsAttr[4]&#0010;&#0010;--halves the height&#0010;local camHeight = boundsHeight/2&#0010;&#0010;--gets cmaera xform attribute&#0010;camTransformAttr = Interface.GetAttr(&quot;xform.interactive.translate&quot;, &quot;/root/world/cam/renderCam&quot;):getNearestSample(0)&#0010;local camTransform = DoubleAttribute({{0, camHeight, 0}, })&#0010;&#0010;--sets the height&#0010;Interface.SetAttr(&quot;xform.interactive.translate&quot;, camTransform)&#0010;&#0010;&#0010;&#0010;&#0010;"/>
          </group_parameter>
          <string_parameter name="executionMode" value="immediate"/>
          <string_parameter name="applyWhere" value="at locations matching CEL"/>
          <string_parameter name="applyWhen" value="during op resolve"/>
          <string_parameter name="modifierNameMode" value="node name"/>
          <string_parameter name="modifierName" value="modifier"/>
          <string_parameter name="resolveIds" value=""/>
          <number_parameter name="recursiveEnable" value="0"/>
          <string_parameter name="disableAt" value=""/>
          <string_parameter name="inputBehavior" value="by index"/>
          <number_parameter name="multisampleUserOpArgs" value="1"/>
        </group_parameter>
      </node>
      <node baseType="Dot" name="Dot17" type="Dot" x="661.239746" y="-354.179256">
        <port name="input" source="renderCam.out" type="in"/>
        <port name="output" type="out"/>
        <group_parameter name="Dot17"/>
      </node>
      <node baseType="CameraCreate" name="renderCam" ns_errorGlow="0.000000" type="CameraCreate" x="660.637237" y="-296.097018">
        <port name="out" type="out"/>
        <group_parameter name="renderCam">
          <string_parameter name="name" useNodeDefault="false" value="/root/world/cam/renderCam"/>
          <string_parameter name="projection" value="perspective"/>
          <number_parameter expression="getParam(&quot;rf_FrameAsset.user.fov&quot;)" isexpression="true" name="fov" useNodeDefault="false"/>
          <number_parameter name="near" value="0.1"/>
          <number_parameter name="far" value="100000"/>
          <group_parameter name="screenWindow">
            <number_parameter name="left" value="-1"/>
            <number_parameter name="right" value="1"/>
            <number_parameter name="bottom" value="-1"/>
            <number_parameter name="top" value="1"/>
          </group_parameter>
          <number_parameter name="centerOfInterest" useNodeDefault="true" value="20"/>
          <number_parameter name="orthographicWidth" value="30"/>
          <number_parameter name="includeInCameraList" value="1"/>
          <group_parameter hints="{&apos;widget&apos;: &apos;homogeneousTransform&apos;, &apos;closed&apos;: &apos;False&apos;, &apos;open&apos;: &apos;True&apos;}" name="transform">
            <string_parameter hints="{&apos;widget&apos;:&apos;popup&apos;, &apos;options&apos;:&apos;SRT Values|Transform Matrix&apos;}" name="interface" value="SRT Values"/>
            <string_parameter hints="{&apos;widget&apos;: &apos;popup&apos;, &apos;options&apos;: &apos;Scale Rotate Translate|Scale Translate Rotate|Rotate Scale Translate|Rotate Translate Scale|Translate Scale Rotate|Translate Rotate Scale&apos;}" name="transformOrder" value="Scale Rotate Translate"/>
            <string_parameter hints="{&apos;widget&apos;: &apos;popup&apos;, &apos;options&apos;:&apos;XYZ|XZY|YXZ|YZX|ZXY|ZYX&apos;}" name="rotationOrder" value="XYZ"/>
            <group_parameter hints="{&apos;widget&apos;:&apos;multi&apos;,&apos;conditionalVisOp&apos;:&apos;equalTo&apos;, &apos;conditionalVisPath&apos;:&apos;../interface&apos;, &apos;conditionalVisValue&apos;:&apos;SRT Values&apos;}" name="translate">
              <number_parameter name="x" value="0"/>
              <number_parameter name="y" value="0"/>
              <number_parameter name="z" value="0"/>
            </group_parameter>
            <group_parameter hints="{&apos;widget&apos;:&apos;multi&apos;,&apos;conditionalVisOp&apos;:&apos;equalTo&apos;, &apos;conditionalVisPath&apos;:&apos;../interface&apos;, &apos;conditionalVisValue&apos;:&apos;SRT Values&apos;}" name="rotate">
              <number_parameter name="x" value="0"/>
              <number_parameter name="y" value="0"/>
              <number_parameter name="z" value="0"/>
            </group_parameter>
            <group_parameter hints="{&apos;widget&apos;:&apos;multi&apos;,&apos;conditionalVisOp&apos;:&apos;equalTo&apos;, &apos;conditionalVisPath&apos;:&apos;../interface&apos;, &apos;conditionalVisValue&apos;:&apos;SRT Values&apos;}" name="scale">
              <number_parameter name="x" value="1"/>
              <number_parameter name="y" value="1"/>
              <number_parameter name="z" value="1"/>
            </group_parameter>
            <group_parameter hints="{&apos;widget&apos;:&apos;multi&apos;,&apos;conditionalVisOp&apos;:&apos;equalTo&apos;, &apos;conditionalVisPath&apos;:&apos;../interface&apos;, &apos;conditionalVisValue&apos;:&apos;Transform Matrix&apos;}" name="matrix">
              <number_parameter name="m00" value="1"/>
              <number_parameter name="m01" value="0"/>
              <number_parameter name="m02" value="0"/>
              <number_parameter name="m03" value="0"/>
              <number_parameter name="m10" value="0"/>
              <number_parameter name="m11" value="1"/>
              <number_parameter name="m12" value="0"/>
              <number_parameter name="m13" value="0"/>
              <number_parameter name="m20" value="0"/>
              <number_parameter name="m21" value="0"/>
              <number_parameter name="m22" value="1"/>
              <number_parameter name="m23" value="0"/>
              <number_parameter name="m30" value="0"/>
              <number_parameter name="m31" value="0"/>
              <number_parameter name="m32" value="0"/>
              <number_parameter name="m33" value="1"/>
            </group_parameter>
          </group_parameter>
          <string_parameter name="makeInteractive" useNodeDefault="true" value="Yes"/>
        </group_parameter>
      </node>
      <node baseType="OpScript" name="rf_CopyBounds" ns_basicDisplay="1.000000" ns_errorGlow="0.000000" type="OpScript" x="524.361755" y="-432.193542">
        <port name="i0" source="Merge_renderCam.out" type="in"/>
        <port name="out" type="out"/>
        <group_parameter name="rf_CopyBounds">
          <string_parameter name="CEL" value="((/root/world/geo))"/>
          <string_parameter name="location" value="/root/world/location"/>
          <group_parameter name="script">
            <string_parameter name="lua" value="--Made by Rich Fry | https://www.richfry.net/&#0010;&#0010;&#0010;&#0010;--finds name of child&#0010;local child = Interface.GetPotentialChildren(&quot;/root/world/geo&quot;):getValue()&#0010;&#0010;--sets child path&#0010;local childPath = &quot;/root/world/geo/&quot;..child&#0010;&#0010;--gets bound from child&#0010;local boundsAttr = Interface.GetAttr(&quot;bound&quot;, childPath):getNearestSample(0)&#0010;&#0010;--sets the height&#0010;Interface.SetAttr(&quot;bound&quot;, DoubleAttribute(boundsAttr))&#0010;&#0010;"/>
          </group_parameter>
          <string_parameter name="executionMode" value="immediate"/>
          <string_parameter name="applyWhere" value="at locations matching CEL"/>
          <string_parameter name="applyWhen" value="during op resolve"/>
          <string_parameter name="modifierNameMode" value="node name"/>
          <string_parameter name="modifierName" value="modifier"/>
          <string_parameter name="resolveIds" value=""/>
          <number_parameter name="recursiveEnable" value="0"/>
          <string_parameter name="disableAt" value=""/>
          <string_parameter name="inputBehavior" value="by index"/>
          <number_parameter name="multisampleUserOpArgs" value="1"/>
        </group_parameter>
      </node>
    </node>
  </node>
</katana>