Link slice modifier slice plane to an object

Hi,
I made a simple script to link slice modifier slice plane to an object with wireparameters
But if the object with slice modifier is rotated it don't work as I don't understand how to use node transfoem or matrix.
Can somebody can help ? thanks.

How to use : select object with slice modifier then run the script, with the rubberband click on the target object

		CurrentMod = modpanel.getCurrentObject()
		theModifier_ID = modPanel.getModifierIndex $ CurrentMod 
		MODD = $.modifiers[theModifier_ID]
		POSS= $.position
		clearSelection()		
		(			
		TARG = pickObject rubberBand:POSS rubberBandColor:yellow 
 
		PX= "X_Position - " + ( POSS.x )as string 
		paramWire.connect TARG.pos.controller[#X_Position] MODD.Slice_Plane.controller.Position.controller[#X_Position]  PX
 
		PY= "Y_Position - " + ( POSS.y )as string 
		paramWire.connect TARG.pos.controller[#Y_Position] MODD.Slice_Plane.controller.Position.controller[#Y_Position]  PY
 
		PZ= "Z_Position - " + ( POSS.z )as string 
		paramWire.connect TARG.pos.controller[#Z_Position] MODD.Slice_Plane.controller.Position.controller[#Z_Position]  PZ
		paramWire.connect TARG.rotation.controller[#X_Rotation] MODD.Slice_Plane.controller.Rotation.controller[#X_Rotation]  "X_Rotation"
		paramWire.connect TARG.rotation.controller[#Y_Rotation] MODD.Slice_Plane.controller.Rotation.controller[#Y_Rotation]  "Y_Rotation"
		paramWire.connect TARG.rotation.controller[#Z_Rotation] MODD.Slice_Plane.controller.Rotation.controller[#Z_Rotation]  "Z_Rotation"		
		)

Comments

Comment viewing options

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

Thank you very much to show

Thank you very much to show me how useless i am in coding !!! :-)

Yes I should have do this.... ;-)

AEI's picture

with wire parameter , you

with wire parameter , you should matrix calculate , the main point is transpose matrix of modifier's node left multiply target matrix , then set back position to in modifier's node target's position

by extend slice modifier ,replaced by controller instance , it will be faster when update and easy to use

a simple example

plugin modifier ceshi111
name:"ceshi111"
classID:#(14531456,54132110)
extends:SliceModifier
(
parameters main rollout:params
(
nodeobj type:#node ui:aa
on nodeobj set val do 
(
	if val != undiasdf do
	(
		c=transform_script()
		c.AddNode "a" (refs.dependentNodes this)[1]
		c.AddNode "b" val 
		c.script = "matrix=if IsValidNode b then(m=b.transform*inverse a.transform;m.row4=in coordsys a b.pos;m)else m=matrix3 1;matrix"
		this.Slice.Slice_Plane.controller=c
	)
)
)
rollout params "Parameters"
(
pickbutton aa "pick node"
)
)

run script , and modifier ceshi111,it is a slice modifier with a pick button , pick a node the slice plane will link the node

Automatic Efficient Intelligent

We change the work state

titane357's picture

Hi, thanks but I wanted to do

Hi, thanks but I wanted to do it for other tools too.....

AEI's picture

you can upgrade your max ,

you can upgrade your max , new version has built-in method

Automatic Efficient Intelligent

We change the work state

Comment viewing options

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