AWS Thinkbox Discussion Forums

Easier to share KCMs are awesome!

(–MAGMAFLOW2–
global MagmaFlowEditor_EditBLOPHistory = #()
node0 = magmaNode.createNode “Multiply”
magmaNode.setNumNodeInputs node0 2
magmaNode.setNumNodeOutputs node0 1
magmaNode.setNodeInputDefaultValue node0 1 1.0
magmaNode.setNodeInputDefaultValue node0 2 1.0
magmaNode.DeclareExtensionProperty node0 “Position”
magmaNode.SetNodeProperty node0 “Position” [1000,15]
magmaNode.DeclareExtensionProperty node0 “Selected”
magmaNode.SetNodeProperty node0 “Selected” true

node1 = magmaNode.createNode “InputChannel”
magmaNode.setNumNodeInputs node1 0
magmaNode.setNumNodeOutputs node1 1
magmaNode.setNodeProperty node1 “channelName” “Normal”
magmaNode.setNodeProperty node1 “channelType” “”
magmaNode.DeclareExtensionProperty node1 “Position”
magmaNode.SetNodeProperty node1 “Position” [480,75]
magmaNode.DeclareExtensionProperty node1 “Selected”
magmaNode.SetNodeProperty node1 “Selected” true

node2 = magmaNode.createNode “Output”
magmaNode.setNumNodeInputs node2 1
magmaNode.setNumNodeOutputs node2 0
magmaNode.setNodeProperty node2 “channelName” “PRTViewportColor”
magmaNode.setNodeProperty node2 “channelType” “float16[3]”
magmaNode.DeclareExtensionProperty node2 “Position”
magmaNode.SetNodeProperty node2 “Position” [269.231,119.538]
magmaNode.DeclareExtensionProperty node2 “Selected”
magmaNode.SetNodeProperty node2 “Selected” true

node3 = magmaNode.createNode “PropertyQuery”
magmaNode.setNumNodeInputs node3 1
magmaNode.setNumNodeOutputs node3 3
magmaNode.setNodeProperty node3 “properties” “Pos,color,multiplier”
magmaNode.DeclareExtensionProperty node3 “Position”
magmaNode.SetNodeProperty node3 “Position” [220,150]
magmaNode.DeclareExtensionProperty node3 “Selected”
magmaNode.SetNodeProperty node3 “Selected” true

node4 = magmaNode.createNode “InputObject”
magmaNode.setNumNodeInputs node4 0
magmaNode.setNumNodeOutputs node4 1
magmaNode.setNodeProperty node4 “object” (getNodeByName “Omni001”)
magmaNode.DeclareExtensionProperty node4 “Notes”
magmaNode.SetNodeProperty node4 “Notes” “Connect the “light” here.”
magmaNode.DeclareExtensionProperty node4 “Position”
magmaNode.SetNodeProperty node4 “Position” [90,195]
magmaNode.DeclareExtensionProperty node4 “Selected”
magmaNode.SetNodeProperty node4 “Selected” true

node5 = magmaNode.createNode “VectorDot”
magmaNode.setNumNodeInputs node5 2
magmaNode.setNumNodeOutputs node5 1
magmaNode.DeclareExtensionProperty node5 “Position”
magmaNode.SetNodeProperty node5 “Position” [610,60]
magmaNode.DeclareExtensionProperty node5 “Selected”
magmaNode.SetNodeProperty node5 “Selected” true

node6 = magmaNode.createNode “Multiply”
magmaNode.setNumNodeInputs node6 2
magmaNode.setNumNodeOutputs node6 1
magmaNode.setNodeInputDefaultValue node6 1 1.0
magmaNode.setNodeInputDefaultValue node6 2 1.0
magmaNode.DeclareExtensionProperty node6 “Position”
magmaNode.SetNodeProperty node6 “Position” [1130,0]
magmaNode.DeclareExtensionProperty node6 “Selected”
magmaNode.SetNodeProperty node6 “Selected” true

node7 = magmaNode.createNode “InputChannel”
magmaNode.setNumNodeInputs node7 0
magmaNode.setNumNodeOutputs node7 1
magmaNode.setNodeProperty node7 “channelName” “Position”
magmaNode.setNodeProperty node7 “channelType” “”
magmaNode.DeclareExtensionProperty node7 “Position”
magmaNode.SetNodeProperty node7 “Position” [90,255]
magmaNode.DeclareExtensionProperty node7 “Selected”
magmaNode.SetNodeProperty node7 “Selected” true

node8 = magmaNode.createNode “Subtract”
magmaNode.setNumNodeInputs node8 2
magmaNode.setNumNodeOutputs node8 1
magmaNode.setNodeInputDefaultValue node8 1 1.0
magmaNode.setNodeInputDefaultValue node8 2 0.0
magmaNode.DeclareExtensionProperty node8 “Position”
magmaNode.SetNodeProperty node8 “Position” [350,135]
magmaNode.DeclareExtensionProperty node8 “Selected”
magmaNode.SetNodeProperty node8 “Selected” true

node9 = magmaNode.createNode “InputChannel”
magmaNode.setNumNodeInputs node9 0
magmaNode.setNumNodeOutputs node9 1
magmaNode.setNodeProperty node9 “channelName” “Color”
magmaNode.setNodeProperty node9 “channelType” “”
magmaNode.DeclareExtensionProperty node9 “Position”
magmaNode.SetNodeProperty node9 “Position” [1000,90]
magmaNode.DeclareExtensionProperty node9 “Selected”
magmaNode.SetNodeProperty node9 “Selected” true

node10 = magmaNode.createNode “Normalize”
magmaNode.setNumNodeInputs node10 1
magmaNode.setNumNodeOutputs node10 1
magmaNode.DeclareExtensionProperty node10 “Position”
magmaNode.SetNodeProperty node10 “Position” [480,120]
magmaNode.DeclareExtensionProperty node10 “Selected”
magmaNode.SetNodeProperty node10 “Selected” true

node11 = magmaNode.createNode “Clamp”
magmaNode.setNumNodeInputs node11 3
magmaNode.setNumNodeOutputs node11 1
magmaNode.setNodeInputDefaultValue node11 2 0.0
magmaNode.setNodeInputDefaultValue node11 3 1.0
magmaNode.DeclareExtensionProperty node11 “Position”
magmaNode.SetNodeProperty node11 “Position” [740,45]
magmaNode.DeclareExtensionProperty node11 “Selected”
magmaNode.SetNodeProperty node11 “Selected” true

node12 = magmaNode.createNode “Multiply”
magmaNode.setNumNodeInputs node12 2
magmaNode.setNumNodeOutputs node12 1
magmaNode.setNodeInputDefaultValue node12 1 1.0
magmaNode.setNodeInputDefaultValue node12 2 1.0
magmaNode.DeclareExtensionProperty node12 “Position”
magmaNode.SetNodeProperty node12 “Position” [870,30]
magmaNode.DeclareExtensionProperty node12 “Selected”
magmaNode.SetNodeProperty node12 “Selected” true

node13 = magmaNode.createNode “ToWorld”
magmaNode.setNumNodeInputs node13 1
magmaNode.setNumNodeOutputs node13 1
magmaNode.setNodeProperty node13 “inputType” “Point”
magmaNode.DeclareExtensionProperty node13 “Position”
magmaNode.SetNodeProperty node13 “Position” [220,240]
magmaNode.DeclareExtensionProperty node13 “Selected”
magmaNode.SetNodeProperty node13 “Selected” true

try(magmaNode.setNodeInput node0 1 node12 1)catch()
try(magmaNode.setNodeInput node0 2 node3 3)catch()
try(magmaNode.setNodeInput node2 1 node6 1)catch()
try(magmaNode.setNodeInput node3 1 node4 1)catch()
try(magmaNode.setNodeInput node5 1 node1 1)catch()
try(magmaNode.setNodeInput node5 2 node10 1)catch()
try(magmaNode.setNodeInput node6 1 node0 1)catch()
try(magmaNode.setNodeInput node6 2 node9 1)catch()
try(magmaNode.setNodeInput node8 1 node3 1)catch()
try(magmaNode.setNodeInput node8 2 node13 1)catch()
try(magmaNode.setNodeInput node10 1 node8 1)catch()
try(magmaNode.setNodeInput node11 1 node5 1)catch()
magmaNode.setNodeInput node11 2 -1 1
magmaNode.setNodeInput node11 3 -1 1
try(magmaNode.setNodeInput node12 1 node11 1)catch()
try(magmaNode.setNodeInput node12 2 node3 2)catch()
try(magmaNode.setNodeInput node13 1 node7 1)catch()

)

Yay plaintext copy/paste!

Love the PropertyQuery, too!

Of course to use this, you still need to supply the “Omni001”. Maybe on paste if the scene object is missing, you could put the name into the notes of the node?

  • Chad

Found a bug in that code - I was not escaping special characters in notes, so “light” in the middle of the note caused it to crash.

I fixed your post by escaping the " with .
I also fixed the code and attached the updated files to this post.
Please BACK UP the existing files before replacing, just in case.
MagmaFlow2_NotesFix_20110912.zip (65.2 KB)

Ha. I actually didn’t realize it was broken. I pasted, then copied back into a new max file, then realized that the object was missing and silently failing so I added the note and copy/pasted again. I didn’t check to see if the newly pasted version would actually work. :frowning:

  • Chad

hi chad

im still not sure how i can use this magmaflow to illuminate particles through emission?

i loaded the flow on my prt loader but not really sure how it would do that, it outputs viewport prt color, and needs an object as input?

sorry im a magma newb, what does this flow do?

Yes, it outputs viewport color, since we already have illumination working in the render color. :slight_smile: You could apply this to emission, if you wanted to make your own shading for the render, of course. Probably more interesting if you had a different shading applied. There are limitations to this approach of course, you have to explicitly define ALL the lights in the KCM. You can’t say “get me all the lights assigned to this object and iterate through this function”.

The InputObject is the light you want to use to generate the illumination.

  • Chad
Privacy | Site terms | Cookie preferences