|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
OK I just have a quick question. I’m using the RedrawViewsCallback to do something and its working just fine during my current max session.
However, once I restart max and open up that max file my callback is no longer available. I have to re-run the script.
So my thought was maybe to do some kind of persistent global but that just doesn’t seem to work either.
I can get my globals in the script to be persistent but is it possible to make the RedrawViewsCallback persistent as well?
So when you restart max and open up this particular file the madness would be retained.
thanks
max2008-11
|
|
|
|
The “Persistent” parameter to callbacks.addScript would seem to do what you want, unless I’m mistaken. Described in the “General Event Callback System” topic, pretty much right at the top.
If Persistent is True the callback is saved with the scene, otherwise it’s global - always installed until you remove it.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
Thanks for the reply Steve. I did look at the .addscript stuff in the maxscript help file. It just didn’t seem to make sense to me. I’ll have to give that a go.
Author: joegunn
|
| Replied: 01 September 2010 03:47 PM
|
|
|
|
|
Ok, I see your problem.
What’s needed, I think, is this:-
callbacks.addScript #filePostOpen [script] id:[id] persistent:true
That will install a callback into the current scene which will trigger once when the scene is loaded.
[script] would contain the code to registerRedrawViewsCallback [fn] and the [fn] itself. This would be essentially the script you’re running manually at present.
The #filePostOpen callback will run once (for that scene only, after you’ve saved the scene), on load, thus performing automatically the script you’re running manually.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
|
Thanks again Steve. I will have to give it a try and see how it works. The ID also needs to be in the script that gets executed as well correct?
Author: joegunn
|
| Replied: 02 September 2010 11:29 AM
|
|
|
|
|
Thanks again for your help.
It works well!
max2008-11
|
|
|
|
|
|