THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2011 at 15:12, xxxxxxxx wrote:
I think you'll have to use DescID for this.
The kind of code only a mother (or a C++ user) could love.
#This example creates an xpresso node with positionX & scaleY output ports
#Make sure you have an xpresso tag selected before executing it
import c4d
def main() :
#Get the node master of selected xpresso tag...Make sure you have the xpresso tag selected first!
nm = doc.GetActiveTag().GetNodeMaster()
#Create the object's xpresso node
node = nm.CreateNode(nm.GetRoot(), c4d.ID_OPERATOR_OBJECT,insert=None, x=200, y=200)
#Using DescID... Combine the POSITION option, with the VECTOR option. And then assign them to a variable("posX")
#Using DescID... Combine the SCALE option, with the VECTOR option. And then assign them to a variable("scaleY")
posX = c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_ABS_POSITION), c4d.DescLevel(c4d.VECTOR_X));
scaleY = c4d.DescID(c4d.DescLevel(c4d.ID_BASEOBJECT_ABS_SCALE), c4d.DescLevel(c4d.VECTOR_Y));
#Add the position.x output port to the object node using the stuff we have in memory
#Add the scale.y output port to the object node using the stuff we have in memory
node.AddPort(c4d.GV_PORT_OUTPUT, posX)
node.AddPort(c4d.GV_PORT_OUTPUT, scaleY)
#prints the name of the node to the console
print node.GetOperatorContainer()[c4d.GV_OBJECT_OBJECT_ID].GetName()
c4d.EventAdd()
if __name__=='__main__':
main()
-ScottA