Adding ports to nodes.
-
I apologize for re-creating the post, I forgot to include my system details:
Windows 10
Cinema 4d 2023.2.1Hi, I'm trying to figure out node creation via script manager and have run into a place I can't get past on my own. I want to create an output port with global data for a node, but I don't understand how to do it. In one of the parameters "GvNode.AddPort(self, io, id, flag=GV_PORT_FLAG_IS_VISIBLE, message=False)" I need to enter id, but I don't understand where I can see the id I need. Please tell me how to add ports to nodes correctly, and if possible, tell me how to connect them. Thank you very much. Here is my code:
import c4d cube1 = c4d.BaseObject(c4d.Ocube) cube1.SetName('Куб 1') cube2 = c4d.BaseObject(c4d.Ocube) cube2.SetName('Куб 2') doc.InsertObject(cube1) doc.InsertObject(cube2) xpresso = c4d.modules.graphview.XPressoTag() cube1.InsertTag(xpresso) NodeMaster = xpresso.GetNodeMaster() node_1 = NodeMaster.CreateNode(NodeMaster.GetRoot(), c4d.ID_OPERATOR_OBJECT) node_2 = NodeMaster.CreateNode(NodeMaster.GetRoot(), c4d.ID_OPERATOR_OBJECT, x=100) node_1.AddPort(c4d.GV_PORT_OUTPUT, 1, c4d.GV_PORT_FLAG_IS_VISIBLE) node_2.OperatorSetData(c4d.GV_ATOM, cube2, c4d.GV_OP_DROP_IN_BODY) c4d.EventAdd()
-
Hello @ll2pakll ,
Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:
- Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
- Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
- Forum Structure and Features: Lines out how the forum works.
- Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.
About your First Question
Please avoid deleting posts in the future. You got things almost right, but seem to struggle a bit with the concept of
DescID
. Find my answer below.I would also recommend having a look at these resources:
Cheers,
FerdinandResult:
-
@ferdinand said in Adding ports to nodes.:
DescID
Thank you so much. I am pleasantly surprised at the level of your responsiveness. When I wrote "Global Data" I accidentally used the wrong word, I meant "Global Coordinates". I have read your links and code very carefully. Actually the concept of DescID is not so much complicated as confusing, the easiest thing would be to have something like an interactive online converter that could show the attributes of the desired objects and their corresponding id. I will try to understand the concept of DescID, deeper. And thank you again for your very detailed answer. Have a nice day.