Urgent help needed on dynamicly switching a bunch of modifiers on and off.

I have really only done basic expressions before in wire parameters so I don't even know if it is possible, but I have a bunch of shapes setup with a bunch of modifiers.

Basically want it to do is globally check

If a Dummies rotation is equal to multiple of 90 degrees on any axis
then switch modifiers on
specifically Face Extrude on/off or amount 0/100
and
ScalpelMax on/off or Kill and Fill check boxes on/off.
if not then keep them off

Any help would be greatly appreciated
Thanks in advance.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
raven's picture

Thanks a lot Miauu, will give

Thanks a lot Miauu, will give it a try.

miauu's picture

The ScalpelMax is commersial

The ScalpelMax is commersial modifier and I do not have it, so try to adapt the code for scalpelMax as it is for face_extrude

(	
	local mainDummy = $Dummy01		-- put here the name of your dummy, or if the dummy is selected use selection[1]
	local dumRot = mainDummy.rotation as eulerangles
	--	if rotation is equal to multiple of 90 degrees on any axis then switch modifiers on
	if ((abs (mod dumRot.x 90) <= 0.0001) and dumRot.x != 0.0 ) or \
		((abs (mod dumRot.y 90) <= 0.0001) and dumRot.y != 0.0 ) or \
		((abs (mod dumRot.z 90) <= 0.0001) and dumRot.z != 0.0 ) then
	(
		--	turn on all face_extrude modifiers in the scene
		(getClassInstances face_extrude).enabled = true			
		--	replace ScalpeMax with the proper name/class of the scalpelMax modifier	
		-- (getClassInstances ScalpelMax).enabled = true	
	)
	else
	(
		--	turn off all face_extrude modifiers in the scene
		(getClassInstances face_extrude).enabled = false
		-- (getClassInstances ScalpelMax).enabled = false	
	)
)

About animation - I don't know. Try it.

:)

raven's picture

thanks for the reply miauu.I

thanks for the reply miauu.

I would want it to turn off all the face extrude and all of the scalpelmax modifiers in the whole scene.

Also they just listen to one specific dummy.
So would it work that if the dummy is animated that it will switch the modifiers on and off as the timeline progresses?

Thanks again

miauu's picture

This will print in the

This will print in the listener the name of dummys which rotation is equal to multiple of 90 degrees on any axis:

(	
	for d in helpers where ( classof d == Dummy ) do 
	(
		dumRot = d.rotation as eulerangles
		if ((abs (mod dumRot.x 90) <= 0.0001) and dumRot.x != 0.0 ) or \
			((abs (mod dumRot.y 90) <= 0.0001) and dumRot.y != 0.0 ) or \
			((abs (mod dumRot.z 90) <= 0.0001) and dumRot.z != 0.0 ) do
		(
			format "%  rotation is equal to multiple of 90 degrees on any axis: %\n" d.name "YES"
		)
	)
)

I use this:

(mod dumRot.x 90) <= 0.0001

because,sometismes MAX use -2.28882e-005 instead of 0.0.

I can'r understand which modifiers you want to turn on/off - all Face Extrude mods in the scene(mean on all objects that have this mod) or this is related to the Dummy, that is processed.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.