THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/09/2010 at 07:06, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12.021
Platform: Mac OSX ;
Language(s) : PYTHON ;
---------
My first post here ;)
Problem: when I use Python to set up a userdata output port on an xpresso node on the active object, it turns yellow and won't work, yet when I drag the same object into the xpresso tag setup and set the output port to the userdata it looks and works as expected. Seems to be just the userdata output port that is the problem, as other output ports work fine when set using Python.
I suspect that I am not making an internal connection somewhere--or that it possibly is broken.
Any ideas?
Here's the Python code I am using:
import c4d
def main() :
ActObj = doc.GetActiveObject()
Make the user data boole button on active object
bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_BOOL) #create default container
bc[c4d.DESC_NAME] = "Pucker" #rename the entry
Pucker = ActObj.AddUserData(bc) #add userdata and set to container
ActObj[Pucker] = False #assign a value
#c4d.EventAdd() #update
Create the xPresso tag on the active object
xtag = c4d.BaseTag(c4d.Texpresso)
if ActObj is not None: #check if there is no object
ActObj.InsertTag(xtag)
tag = op.GetFirstTag() # returns the first tag of the object
nodemaster = tag.GetNodeMaster()
Generate node with port
nodeObjOut = nodemaster.CreateNode(nodemaster.GetRoot(), c4d.ID_OPERATOR_OBJECT, insert=None, x=250, y=200)
nodeObjOut.AddPort(c4d.GV_PORT_OUTPUT, [c4d.ID_USERDATA, 1])
nodemaster.Message(c4d.MSG_UPDATE) #send update to nodemaster
c4d.EventAdd() #set an event to c4d core to update (never use in an expression)
main()