SUMMARY
This article describes how to use an OpScript node to copy attributes between scene graph locations.
MORE INFORMATION
When working in Katana, attributes on locations can easily be set using a SetAttribute node. However, if you would like to copy an attribute that is set in one location to another location, you can achieve this using an OpScript node and a few lines of code.
Despite the name suggesting a similar function, the AttributeCopy node cannot be used for this purpose.
CopyAttr() command. You can do this as follows:- Create an OpScript node and set its
applyWhereparameter toat locations matching CEL. - Add three user parameters called
attrFrom,attrToandsourceLocation. For instructions on how to add user parameters to a node, please refer to the Adding User Parameters section in the Katana User Guide. - The value of the
sourceLocationparameter should be the path to the scene graph location you want to copy the attribute from. - The CEL statement should be the path to the scene graph location you want to copy the attribute to.
- Type the name of the attribute you want to copy from in the
attrFromtext field. - Add the name of the attribute you want to copy to as the
attrToparameter value. - In the
Scriptparameter of the OpScript node add the following LUA code:
local attrFrom = Interface.GetOpArg("user.attrFrom"):getValue()
local attrTo = Interface.GetOpArg("user.attrTo"):getValue()
local sourceLocation = Interface.GetOpArg("user.sourceLocation"):getValue()
Interface.CopyAttr(attrTo, attrFrom, true, sourceLocation)
Interface.SetAttr(attrTo, Interface.GetGlobalAttr(attrFrom, sourceLocation))
FURTHER READING
If you are encountering any issues with this, then please open a Support ticket and let us know about the problem and which troubleshooting steps you have taken so far.
For more information on how to open a Support ticket, please refer to Q100064: How to raise a support ticket.
We're sorry to hear that
Please tell us why