THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/10/2010 at 21:24, xxxxxxxx wrote:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : PYTHON ;
I want to dynamically create an XPresso node which references the current active material (or some other object).
Using the python code below successfully creates a node, but it seems to reference the object the Xpresso tag belongs to by default (Cube). The code tries to use SetLink to change the object reference to a material, however in the Xpresso editor it still references the original Cube object.
Any idea how to create a node which references a specific object?
Aside: I saw the note about using GetParameter rather than GetDataInstance, but Python doesn't seem to support that method.
_def main() :
# Get Node master for selected Xpresso tag
nm = doc.GetActiveTag().GetNodeMaster()
# This creates a Xpresso reference node
# to the Cube object containing the active tag
node = nm.CreateNode(nm.GetRoot(), c4d.ID_OPERATOR_OBJECT)
# prints out 'Cube' as the node link
# Attempt to reference the active material instead
con = node.GetOperatorContainer()
# prints out 'Mat' as the node link
# Add the new node to root XGroup
# Node is now added to XPresso but is still a reference to Cube