mxs: PFlow State

Often when dealing with complex effects it’s necessary to split those into smaller parts. Isn’t only better to render specific elements separately but also working with particular portion is a straight way to get work done more quickly.  

Script below let you quickly turn off/on Particle Flow systems:

for o in objects where classOf o == PF_Source do

(

o.Enable_Particles = not o.Enable_Particles

)

 

This can be pretty usefull, when you want just quick turn off/on all particle flow systems. But what if you want manage not all PFlow systems at the time?

Exceptions

Problem was how to mark some PFlow system wich I don’t wanna work with and use this everytime when turning off/on specifically branch. My solution was to use 3dsmax user defined Object Properties (Right click –> Object Properties –> User Defined).  

You can add this manually or by script below:

 — Add PFlow State Exception to SELECTED PFLOW systems

 for o in $ where classOf o == PF_Source do

(

setUserProp o “pf_State_Except” True

print (“Exception Added: ” + o.name)

)

 

Now our main MacroScript will look like:

macroScript pFlowstate category:”deko.lt” toolTip:”Turn On/Off PFlow” buttonText:”PFlow On/Off” Icon:#(“Particles”,6)

(

global pf_state=true

on isChecked return not pf_state

on execute do 

(

for o in objects where classOf o == PF_Source and getUserProp o “pf_State_Except” == undefined do

(

o.Enable_Particles = pf_state

)

pf_state = not pf_state

)

)

*Tip: Try to add this as toolbar button, it can be checked, so you can always know what state is

 

https://deko.lt/lab/mxs/PFlowState_1_2.zip

In above archive there is also 3 additional macroscript to ADD exception, CLEAR exception and List/Select marked PFlow systems as exceptions. Just Drag&Drop those macros to 3dsmax and add to toolbar, menu or hotkey from deko.lt category.