Scripted modifier for texture controlled animation

Hello! I am new to maxscript and will be very appreciate for advice.
I have interesting idea to make link between texture color on object parameters like position, rotation etc. The texture will be animated and it will create interesting objects movements. For doing that I have this procedure:

1. Create objects
2. Create one planar UVW map for all objects.
3. Volume select modifier with vertex selection level and Texture map for "select by".
4. Scripted modifier that will take Vertex Select Weight for the first vertex and set it to simple float variable.
5. Wire that variable to object parameter with wire or scripted controller.
6. Killer animation ready!))
The problem is with scripted modifier. I only make it work in one frame when button pushed, but it must work every frame like distance in tape helper.

Here the script:

plugin modifier vertexselectectionweight
name:"Vertex Weight Parameter"
classID:#(685315,452281)
version:1
(

parameters main rollout:Roll1
(
amount type:#float ui:spiner default:0
)

rollout Roll1 "vertexselectectionweight" width:162 height:300
(
button but1 "push" pos:[51,37] width:60 height:21 across:2
spinner spiner "Amount: " pos:[26,84] width:114 height:16 range:[0,10000,0] type:#float

on but1 pressed do
( spiner.value = meshop.getVSelectWeight $ 1)
)
)

I hope its understandable)) thanks!

Comments

Comment viewing options

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

...

Using object names in expresion is bad idea. Use variable and Add Node instead. For example:

-- adding controller to original object...
obj = selection[1]
ctr = obj.position.x_position.controller = \
float_script script:"(meshop.getVSelectWeight obj 1) * 20"
ctr.addNode "obj" obj

Now when you clone that object will need only to change the Node reference in "obj" variable:

-- cloned object...
clonedObj = selection[1]
ctr = clonedObj.position.x_position.controller
ctr.SetNode "obj" clonedObj

my recent MAXScripts RSS (archive here)

danry's picture

Ok. I found another way is to

Ok. I found another way is to make scripted controller with expression:
(meshop.getVSelectWeight $Box001 1)*20

But if I want to clone this object I need to write new name in expression. How to set mesh name in expression automaticaly?

Comment viewing options

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