Notifications
Clear all

[Closed] Script doesn't work as button

I have the following script I am trying to make a mirror that works with morphers. And I am doing with an skinwrap and a morpher.
the scripts works quite well but when I try to make it a macroscript and put it as a button something happens that it doesnt work any longer, is like if the instructions didnt wait for the skinwrap to make its calculations, so the morpher deforms before the skinwrap mesh list is updated.

Any Ideas to solve this problem?

ObjectDeformed=selection[2];
ObjectOriginal=selection[1];

a=copy ObjectOriginal;

addmodifier a (morpher());
WM3_MC_BuildFromNode a.Morpher 1 ObjectDeformed;
addmodifier a (mirror());

a.position=ObjectOriginal.position;

b=copy ObjectOriginal;

addmodifier b (skin_wrap());
b.skin_wrap.meshList=#(a);
b.skin_wrap.falloff =0.01;
b.skin_wrap.Distance=0.01;
a.Morpher.Autoload_of_targets=1;
WM3_MC_SetValue a.Morpher 1 100.0;
convertTo b Editable_Poly;

delete a;
b.position.y=ObjectDeformed.position.y;

3 Replies

Any error messages?

Noup it doesn’t give any error messages, it just doesnt work.
If I run the script with cntl +e i runs great
but If I dragdropit in a toolbar it doesn’t work any more.

See if calling it from a macro with “filein” works instead

ie.

macroScript rockMaker
buttontext: "Rock Maker" 
Category: "Lukes' Tools" 
internalCategory:"Lukes' Tools" 
Tooltip:"Makes Rocks" 
Icon:#("Lukes' Tools",4)
(
	filein "$max\\scripts\\Lukes Scripts\\Rock Maker 2\\Rockmaker2.mse"
)