Create Xpresso Python node
-
Hi. I ask you to forgive me for my English. I have to use a translator. My problem is this: I'm trying to create a Xpresso Python node in my script, using a command GvNodeMaster.CreateNode. I`m use node ID_OPERATOR_COFFEE. The node appears in the editor window, but for some reason it is dead, and its title is red. Once created, I can't do anything with the node. Can't fill the script window or anything. I'm creating this node because there was already advice here: to create a Python node, contact the coffee operator. What am I doing wrong?
Sample code:
from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: tag = op.GetTag(c4d.Texpresso) nodemaster = tag.GetNodeMaster() noderoot = nodemaster.GetRoot() mynode = nodemaster.CreateNode(noderoot, c4d.ID_OPERATOR_COFFEE, None, 0, 0) c4d.EventAdd() if __name__ == '__main__': main()
-
Hi you can create it this way:
from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: tag = op.GetTag(c4d.Texpresso) nodemaster = tag.GetNodeMaster() noderoot = nodemaster.GetRoot() mynode = nodemaster.CreateNode(noderoot, c4d.GVpython, None, 0, 0) print(mynode.GetOperatorID() == c4d.GVpython) c4d.EventAdd() if __name__ == '__main__': main()
Cheers,
Maxime. -
WOW!!! It turns out that there is a node specifically for python. But in the documentation, in the list GV Node Types, it is not indicated. This fact forced me to look for workarounds. Thanks for the help