Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/12/2012 at 14:44, xxxxxxxx wrote:
Pretty self explanatory I think. The reason I am wanting to do this is to work around the object port object operator bug.
Basically, I want to just add the port myself, then query the already made node so I can access it's port info. I tried all the selection methods I can think of, but it seems C4D doesn't treat nodes as objects. Thanks for the help.
Rick
On 04/12/2012 at 01:39, xxxxxxxx wrote:
Hi Rick,
You have to first get the XPResso node master from the XPresso tag calling XPressoTag.GetNodeMaster(). Then to get the root node use GvNodeMaster.GetRoot() returning a GvNode, which is a subclass of GeListNode (so you can navigate the node tree with node.GetNext(), node.GetChildren() etc.).
On 04/12/2012 at 06:14, xxxxxxxx wrote:
So I tried to use the .GetChildren() and the other GeListNode stuff, but instead of getting the one node that is in there, I get an empty list or just a None. Figured i would post my code so maybe it will make it easier. I am currently testing it with just a cube at the top of the Object Manager with the said xpresso tag with the object operator inside already set up, along with a couple of spheres below to test the list function. Thanks for the help.
import c4d from c4d import gui _ _ _ _ def main() : _ _ _ op = doc.GetFirstObject()_ _ tag = op.GetFirstTag()_ _ nodeMaster = tag.GetNodeMaster()_ _ selected = doc.GetActiveObjects(0)_ _ bc = c4d.BaseContainer_ _ for sel in selected:_ _ _ _ l=100 * selected.index(sel)_ _ _ _ controllerNode = nodeMaster.GetChildren()_ _ pointNode = nodeMaster.CreateNode(nodeMaster.GetRoot(), c4d.ID_OPERATOR_POINT, insert=None, x=300, y=l)_ _ objNode = nodeMaster.CreateNode(nodeMaster.GetRoot(), c4d.ID_OPERATOR_OBJECT, insert=None, x=500, y=l)_ _ objNode[c4d.GV_OBJECT_OBJECT_ID] = sel_ _ objNode.AddPort(c4d.GV_PORT_INPUT, c4d.ID_BASEOBJECT_GLOBAL_POSITION)_ _ _ _ _ _ CPport = controllerNode[0].GetOutPort(0)_ _ OPport = pointNode.GetInPort(0)_ _ PPport = pointNode.GetOutPort(1)_ _ GPport = objNode.GetInPort(0)_ _ _ _ CPport.Connect(OPport)_ _ PPport.Connect(GPport)_ _ _ _ nodeMaster.Message(c4d.MSG_UPDATE)_ _ c4d.EventAdd()_ _if _name__=='_main__': _ main()
On 04/12/2012 at 06:33, xxxxxxxx wrote:
op = doc.GetFirstObject() tag = op.GetFirstTag() **nodeMaster = tag.GetNodeMaster()**
does this actually work ? because GetNodeMaster() is a c4d.modules.graphview.GvNode member and not a GeListNode member, you have to call it from an actual GraphView node. edit : and please use a monospace font to post your code or the code, /code tags.
On 04/12/2012 at 10:36, xxxxxxxx wrote:
THANK YOU! I just realized it was Gv NodeMaster, and not Get NodeMaster that I needed to use to get the root node. I need to pay better attention to these things. Anyway here is the final code snippet if anyone is interested. Thanks for the help everyone.
import c4d from c4d import gui _ _ _ _ def main() : _ _ _ op = doc.GetFirstObject()_ _ tag = op.GetFirstTag()_ _ nodeMaster = tag.GetNodeMaster()_ _ selected = doc.GetActiveObjects(0)_ _ bc = c4d.BaseContainer_ _ for sel in selected:_ _ _ _ l = 100 * selected.index(sel)_ _ _ _ rootNode = nodeMaster.GetRoot()_ _ controllerNode = rootNode.GetChildren()_ _ pointNode = nodeMaster.CreateNode(nodeMaster.GetRoot(), c4d.ID_OPERATOR_POINT, insert=None, x=300, y=l)_ _ objNode = nodeMaster.CreateNode(nodeMaster.GetRoot(), c4d.ID_OPERATOR_OBJECT, insert=None, x=500, y=l)_ _ objNode[c4d.GV_OBJECT_OBJECT_ID] = sel_ _ objNode.AddPort(c4d.GV_PORT_INPUT, c4d.ID_BASEOBJECT_GLOBAL_POSITION)_ _ _ _ _ _ CPport = controllerNode[0].GetOutPort(0)_ _ OPport = pointNode.GetInPort(0)_ _ PPport = pointNode.GetOutPort(1)_ _ GPport = objNode.GetInPort(0)_ _ _ _ CPport.Connect(OPport)_ _ PPport.Connect(GPport)_ _ _ _ nodeMaster.Message(c4d.MSG_UPDATE)_ _ c4d.EventAdd()_ _if _name__=='_main__': _ main()