Macroscript Problem

Macroscript Problem

Anonymous
Not applicable
960 Views
3 Replies
Message 1 of 4

Macroscript Problem

Anonymous
Not applicable

Hello,

I am trying to create a script to add a visibility track by going to object properties turn off by layers in rendering control then add a visibility Track in the Track View. 

Using MacroRecorder in the Listener I get this-

 

max move
actionMan.executeAction 0 "40022" -- Edit: Properties
max properties
macros.run "Track View" "LaunchFCurveEditor"
actionMan.executeAction 1 "640"

I drag that to the toolbar from the listener. 

It seems to work sometimes and sometimes not. It might work on a new primitive then not on an existing object.

Any idea what I do wrong?

Thanks.

0 Likes
961 Views
3 Replies
Replies (3)
Message 2 of 4

Swordslayer
Advisor
Advisor

MacroRecorder will only get you so far - it records what all the actions you've gone through, not necessarily what you wanted to record. For anything a bit more advanced, you may want to look inside the maxscript reference instead. This will assign Bezier Float controller to the object's visibility track and set its value to 1:

 

selection.renderByLayer = false
for obj in selection do
(
	obj.visibility = bezier_float()
	obj.visibility.controller.value = 1.0
)
select selection
0 Likes
Message 3 of 4

Anonymous
Not applicable

I have noticed that a bezier float controller on visibility can sometimes not work right with xref scenes. Assigning a boolean value works great to animate visibility completely on or off, even with xref scenes!

 

selection.Visibility = on
selection.Visibility = off

 

 

It uses some other kind of controller (boolean?).  I'm out.

 

-Miles

0 Likes
Message 4 of 4

Anonymous
Not applicable

Yes, it did seem to work on a new file but not the one I wanted which is full of xref scenes. I will test that and see if that is the culprit. Thanks.

Jerry

0 Likes