I'm trying to create a math node and modify its corresponding Input. However, it gives me an error TypeError: __setitem__ got unexpected type 'float' I tried with an integer but it also gives me an error.
TypeError: __setitem__ got unexpected type 'float'
Is there a way around this?
Thank you for looking at the problem.
You can see the code here:
# Main function
cube = c4d.BaseObject(c4d.Ocube)
expresso = cube.MakeTag((c4d.Texpresso))
nodemaster = expresso.GetNodeMaster()
math_node = nodemaster.CreateNode(nodemaster.GetRoot(), c4d.ID_OPERATOR_MATH, None, x=0, y=0)
# This line works
math_node[c4d.GV_MATH_FUNCTION_ID] = 2
# This line does not work. The '[2000,1001]' was retrieved by dragging the Input to the console.
math_node[2000,1001] = -1.0
# Execute main()
the "input" parameters are dynamically created parameters. So it appears they need a little bit more love.
It seems to work using the fully qualified DescID and SetParamter().
subContainerID = c4d.DescLevel(2000, c4d.DTYPE_SUBCONTAINER, c4d.ID_OPERATOR_MATH)
inputID = c4d.DescLevel(1001, c4d.DTYPE_REAL, c4d.ID_OPERATOR_MATH);
paramID = c4d.DescID(subContainerID, inputID)
math_node.SetParameter(paramID, 99.9, c4d.DESCFLAGS_SET_0)
RE: appears they need a little bit more love.
Thanks for the clarification. The code works as expected!