Notifications
Clear all

[Closed] MAX Current State?

I have a scripted controller that i want to be evaluated only at render time or/and during preview creation. Any idea how to get what MAX is Currently doing?

In brief trigger for the expression must be Something like

if RENDERING NOW = true then DO THE STAFF else DO NOTHING

or IS MAKING PREVIEW and etc.

thanks in advance

10 Replies

Hi,

Maybe you could use a callback so the script is called #prerender?

I’m not sure about preview generation.

Check the help for details.

Josh.

Callback is not a solution, in my case its a complicated controller for track and wheels motion , its used as XREF in many cases so calbacks mechanism doesnt work for this. In the MAX help i cant find something related to current max state.

How about the callback setting a flag that you check in your scripted controller?

Could be like that but its a bit ugly solution, need something simple. Any way if somebody has idea other than calback, please share it.

 JHN

Maybe you could create a scripted modifier that somhow sets that flag Pier mentioned. A (scripted) modifier can be toggled on and of for rendering… Still wouldn’t solve the preview problem, though…

-Johan

Ahhh so simple things sometimes are so complicated… cant belive that autodesk missed such usefull type of controll…

There is no way to test for preview, and the only way to do the render thing is a pre/postrender callback. So like others said create a persistent (so it sticks with the file) pre/post render variable where it sets a value (RenderingNow) to true or false, then in your script controller use something like

if RenderingNow do DO THE STAFF

Not sure how that is much different from what you are wanting.

-Eric

1 Reply
(@pjanssen)
Joined: 11 months ago

Posts: 0

That’s a little inappropriate sir! doing the staff…
(sorry couldn’t resist).

I don’t think you’d need a persistent variable though, do you? As long as there is any variable that is accessible to the controller, a simple global could do. And a callback that makes sure it is set to the correct value, you should be fine.

Hey I was just reusing his example.

If it is being sent off to render and it needs to execute it, then it probably needs to be persistent. That way it follows the scene and doesn’t need to be created before you do anything else.

-Eric

“do the staff” is not a mistake, just a joke hehe