Copy Bounds OpScript



Here's a little OpScript that copies the bounds attribute from the geo's child to the geo group itself! This is handy if you are making a template and want to have the bounds on the geo level but don't want to have to set a hard path. make sure the CEL selection is set to /root/world/geo


Node (Paste into nodegraph)


<katana release="4.0v1" version="4.0.1.000004">
  <node name="__SAVE_exportedNodes" type="Group">
    <node baseType="OpScript" edited="true" name="rf_CopyBounds" ns_basicDisplay="1" ns_errorGlow="0.000000" ns_fromContext="legacy" selected="true" type="OpScript" viewed="true" x="-31.999998" y="511.999984">
      <port name="i0" source="In_Asset.default" 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>
</katana>

OpScript (Paste into OpScript Node)


--finds name of child
local child = Interface.GetPotentialChildren("/root/world/geo"):getValue()


--sets child path
local childPath = "/root/world/geo/"..child


--gets bound from child
local boundsAttr = Interface.GetAttr("bound", childPath):getNearestSample(0)


--sets the height
Interface.SetAttr("bound", DoubleAttribute(boundsAttr))




07388935727

  • Twitter
  • 27_Artstation_logo_logos-512

©2020 by Rich Fry