Object node object port [SOLVED]
-
On 16/07/2015 at 08:00, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;---------
Hi,How does one add an object-outport on an object-node?
I'm currently playing around with this: DescID(GV_OBJECT_OPERATOR_OBJECT_OUT)
But this doesn't get the port.Does somebody know how to do this?
Thanks in advance for your help and time! -
On 17/07/2015 at 01:43, xxxxxxxx wrote:
Hello,
why do you use DescID()? The object port of the object node is no parameter.
Something like this should work:
GvNode* newNode = nodeMaster->CreateNode(nodeMaster->GetRoot(), ID_OPERATOR_OBJECT, nullptr, x, y); newNode->OperatorSetData(GV_ATOM, object, GV_OP_DROP_IN_BODY); GvPort* output = newNode->AddPort(GV_PORT_OUTPUT, GV_OBJECT_OPERATOR_OBJECT_OUT, GV_PORT_FLAG_IS_VISIBLE, TRUE);
best wishes,
Sebastian -
On 17/07/2015 at 01:51, xxxxxxxx wrote:
Hey Sebastian,
adding the port does not to work, at least from Python. Didn't check it in C++ yet.
Create a single object node in XPresso to test this script.import c4d def main() : tag = op.GetTag(c4d.Texpresso) master = tag.GetNodeMaster() root = master.GetRoot() node = root.GetDown() print node.GetName() print node[c4d.GV_OBJECT_OBJECT_ID] print node.AddPort(c4d.GV_PORT_OUTPUT, c4d.GV_OBJECT_OPERATOR_OBJECT_OUT, c4d.GV_PORT_FLAG_IS_VISIBLE, True) c4d.EventAdd() if __name__ == "__main__": main()
-
On 17/07/2015 at 01:57, xxxxxxxx wrote:
Hi Sebastian,
Your code works great!
I thought you needed a GvCall to create ports, but I guess I was wrong.Thanks for your help and time!
-
On 17/07/2015 at 03:42, xxxxxxxx wrote:
Hi,
Could somebody please tell me when to use GvCall, and when not?
I'm quite a bit confused about this, and I can't find anything in the docs.
Searching the forum also didn't gave me the information when to use it.Thanks in advance for your help and time!
-
On 17/07/2015 at 10:02, xxxxxxxx wrote:
Hello,
since this is the C++ subforum, please post Python related comments in the Python subforum and bug reports in the Bug subforum.
There is a known bug with OBJECT_OPERATOR_OBJECT_OUT in Python as described here:
best wishes,
Sebastian -
On 17/07/2015 at 10:08, xxxxxxxx wrote:
Hello,
one adds ports to an Xpresso node by using AddPort() and the corresponding ID. Different nodes have different ports that can be added; these ports are defined in the resource files of the node.
But in the case of the Object node it is possible to add ports for the parameters of the referenced object. Since the Object node can reference any object it is unknown what ports might be added. So you have to create a special port ID based on the description of the parameter of the referenced object. This is done using the GvCall() hack.
Best wishes,
Sebastian -
On 18/07/2015 at 04:52, xxxxxxxx wrote:
Hi Sebastian,
Thanks for explaining that to me!
But, why is the port creation different for the rotation than for the object port?
Shouldn't that be the same? -
On 23/07/2015 at 05:36, xxxxxxxx wrote:
Somebody?
-
On 23/07/2015 at 08:34, xxxxxxxx wrote:
Hello,
could you explain what exactly do you mean with "port creation different for the rotation than for the object port"? If possible, please provide some code.
Best wishes,
Sebastian -
On 23/07/2015 at 09:22, xxxxxxxx wrote:
Hi Sebastian,
Originally posted by xxxxxxxx
But in the case of the Object node it is possible to add ports for the parameters of the referenced object. Since the Object node can reference any object it is unknown what ports might be added. So you have to create a special port ID based on the description of the parameter of the referenced object. This is done using the GvCall() hack.
My question is, why do you need the GvCall for the rotation, but not for the object-port?
But I think I just found out the answer by re-reading your comment.
The object-port is no real parameter of the object, since it's a reference to the object itself, right?But what about the matrix? Shouldn't that be done with GvCall as well, since tags have no matrix?
Or is the matrix simply no parameter?Here is the code for the rotation Y outport and the object outport:
GvPort* rotationOutPort = myNode->AddPort(GV_PORT_OUTPUT, GvCall(myData, GetMainID) (myNode, GV_PORT_OUTPUT, DescID(DescLevel(ID_BASEOBJECT_REL_ROTATION), DescLevel(VECTOR_Y)))); if (!rotationOutPort) return false; GvPort* objectOutPort = myNode->AddPort(GV_PORT_OUTPUT, GV_OBJECT_OPERATOR_OBJECT_OUT, GV_PORT_FLAG_IS_VISIBLE, true); if (!objectOutPort) return false;
Thanks for your help and time!
-
On 24/07/2015 at 03:13, xxxxxxxx wrote:
Hello,
the object port is a well known port of the Object node so it is added the standard way. What do you mean with "But what about the matrix?"? Are you referring to GV_OBJECT_OPERATOR_OLD_POS_OUT etc.? These ports don't really reference parameters since all BaseObjects have a transformation matrix and methods to access positions, rotation and scale. Therefore these ports only work when the referenced element is a BaseObject.
Best wishes,
Sebastian -
On 24/07/2015 at 03:27, xxxxxxxx wrote:
Hi Sebastian,
I mean GV_OBJECT_OPERATOR_GLOBAL_IN, but this will probably the same as your explanation about OLD_POS_OUT. I guess I get it now.
I'll probably look in the header files first if I want to add another portThanks for your help and time, Sebastian!
You can mark this thread as solved.