OBJECT_OPERATOR_OBJECT_OUT

On 18/11/2014 at 06:52, xxxxxxxx wrote:

Hi,

I'm working on a python script.
I want to make some expresso nodes with it.
Adding the node and a position-output port works fine, but when I try to add an object-output port it does nothing.
No errors, but no port as well.

Here is the code I use:

import c4d
from c4d import gui
#Welcome to the world of Python

def main() :
doc = c4d.documents.GetActiveDocument()
pointobject = doc.GetActiveObject()

xpressotag = c4d.BaseTag(c4d.Texpresso)
xpressotag.SetName("PointLock XPresso")
op.InsertTag(xpressotag)
nodemaster = xpressotag.GetNodeMaster()
basenode = nodemaster.CreateNode(nodemaster.GetRoot(), c4d.ID_OPERATOR_OBJECT, None, 100, 100)
basenodeobjectoutput = basenode.AddPort(c4d.GV_PORT_OUTPUT, c4d.GV_OBJECT_OPERATOR_OBJECT_OUT)
basenodepositionoutput = basenode.AddPort(c4d.GV_PORT_OUTPUT, c4d.ID_BASEOBJECT_REL_POSITION)
c4d.modules.graphview.RedrawMaster(nodemaster)
c4d.EventAdd()

if __name__=='__main__':
main()

I think there isn't anything wrong with my code, and I found "GV_OBJECT_OPERATOR_OBJECT_OUT inside Applications -> CINEMA 4D R16 -> resource -> modules -> expression tag -> description -> gvobject.res

What I want is the port to be added.

Thanks in advance for your help and time!
Greetings,

Casimir

On 18/11/2014 at 07:26, xxxxxxxx wrote:

Correct me if I'm wrong but I am pretty sure this Port is broken in python. I haven't used that bit of code in R16 yet but from the sound of it, it's still broken? What I have done to bypass this is to add a link userdata to the object and add the object to the link and then make an output port for the link. (A lot of unnecessary code)

On 19/11/2014 at 03:55, xxxxxxxx wrote:

Hello,

thanks for reporting this. A bug report was filed.

Best wishes,
Sebastian

On 20/11/2014 at 03:05, xxxxxxxx wrote:

Hi Sebastian,

Do you know when (approximately) the bug will be fixed?

@ShawnFrueh, thanks, I'll look into it!

On 20/11/2014 at 08:15, xxxxxxxx wrote:

Hello,

I don't know when this bug will be fixed. Also I can't make any statements about future Cinema 4D releases.

best wishes,
Sebastian

On 21/11/2014 at 06:58, xxxxxxxx wrote:

@ShawnFrueh,

Hi,

Thanks again for your answer!
After a bit of digging how to make user data I came up with a perfectly working script to create an object port, like you did it!

Here is my code, for the people not yet understanding it:

import c4d
from c4d import gui
#Welcome to the world of Python

def main() :
  doc = c4d.documents.GetActiveDocument()
  pointobject = doc.GetActiveObject()
 
  userdata = c4d.GetCustomDatatypeDefault(c4d.DTYPE_BASELISTLINK)
  userdata[c4d.DESC_NAME] = "Object Data"
 
  linkobject = op.AddUserData(userdata)
  op[linkobject] = op

xpressotag = c4d.BaseTag(c4d.Texpresso)
  xpressotag.SetName("PointLock XPresso")
  op.InsertTag(xpressotag)
  nodemaster = xpressotag.GetNodeMaster()
  basenode = nodemaster.CreateNode(nodemaster.GetRoot(), c4d.ID_OPERATOR_OBJECT, None, 100, 100)
  basenodeobjectoutput = basenode.AddPort(c4d.GV_PORT_OUTPUT, c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA, c4d.DTYPE_SUBCONTAINER, 0), c4d.DescLevel(1)), message = True)
  basenodepositionoutput = basenode.AddPort(c4d.GV_PORT_OUTPUT, c4d.ID_BASEOBJECT_REL_POSITION)
  c4d.modules.graphview.RedrawMaster(nodemaster)
  c4d.EventAdd()

if __name__=='__main__':
  main()

Greetings,
Casimir

On 21/11/2014 at 09:15, xxxxxxxx wrote:

Glad I could help 🙂