Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / RedrawViewsCallback
  RSS 2.0 ATOM  

RedrawViewsCallback
Rate this thread
 
46810
 
Permlink of this thread  
avatar
  • joegunn
  • Posted: 01 September 2010 04:05 AM
  • Location: NYC
  • Total Posts: 113
  • Joined: 23 August 2006 11:21 AM

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

Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

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.

Replies: 1
/img/forum/dark/default_avatar.png

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  
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14445
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

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.

Replies: 1
/img/forum/dark/default_avatar.png

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  
avatar
  • joegunn
  • Posted: 02 September 2010 11:50 AM

Thanks again for your help.

It works well!



max2008-11

Replies: 0