AWS Thinkbox Discussion Forums

Creating magma nodes with max script question.

Hi,
I tried to recreate a simple magma with help from thinkboxsoftware.com/kraka-m … -maxscript and the connections are ok however I`m getting this error --> CURRENT Modifier: Magma internal error at line 182 of file “src\simple_compiler\base_compiler.cpp”(3 1)

I found out that its coming from the “InputValues” and when I switch them with “InputValue” from the menu it works, however I dont know what exactly is the problem within the code.
Code:

mody=MagmaModifier()
addModifier $ mody
magma=mody.magmaHolder
outputA=magma.createNode “Output”
magma.setNodeProperty outputA “channelName” “Color”
magma.setNodeProperty outputA “channelType” “float16[3]”

switchyA=magma.createNode “Switch”

magma.setNodeInput outputA 1 switchyA 1

input_true=magma.createNode “InputValue”
ctrl_true=Point3_XYZ(); ctrl_true.value = [1,1,1]
magma.setNodeProperty input_true “controller” ctrl_true
magma.setNodeInput switchyA 1 input_true 1

input_false=magma.createNode “InputValue”
ctrl_false=Point3_XYZ(); ctrl_false.value = [0,0,0]
magma.setNodeProperty input_false “controller” ctrl_false
magma.setNodeInput switchyA 2 input_false 2

in_volume=magma.createNode “InVolume”
magma.setNodeInput switchyA 3 in_volume 1

to_world=magma.createNode “ToWorld”
magma.setNodeInput in_volume 2 to_world 1

ic_position=magma.createNode “InputChannel”
magma.setNodeProperty ic_position “channelName” “Position”
magma.setNodeInput to_world 1 ic_position 1

input_geo=magma.createNode “InputGeometry”
magma.setNodeInput in_volume 1 input_geo 1

Very simple typo, but not exactly obvious:

magma.setNodeInput switchyA 2 input_false 2

should be

magma.setNodeInput switchyA 2 input_false 1

Basically you were connecting the second input socket of the Switch to the SECOND (non-existent) output socket of the InputValue. This is why manually switching the type of the Black color input to something else and back would destroy the wire and not preserve it - this particular input node does not have more than one output (but some do).

Note that the numbers in brackets at the end of the error denote the location of the error in the flow - the first number is the ID of the node, the second number is the ZERO-based output socket index. In your case, (3 1) means node 3, output 2 has a problem. If you fix that, but intentionally introduce an error in the other (true value) node trying to connect to a non-existent 3rd output socket

magma.setNodeInput switchyA 1 input_true 3

…you would get an error like

I will log a wish for a better error message in this case, but since it is not possible to introduce this bug via the UI and only via scripting, the developer probably felt it was enough to say “something bad happened, figure out what you did” :laughing:

Ahhh I see.Thank you very much for the fast replay :>.

Privacy | Site terms | Cookie preferences