Check Gamma on/off on new scene load
Hello! I have a little script that checks Gamma on/off on script open:
on MyRollout open do
(
if IDisplayGamma.colorCorrectionMode == #gamma then
(
EnbGamma.checked = true
)
else
(
EnbGamma.checked = false
)
)
but how to do the same check on new scene load?
regards
Comments
.
Open maxscript reference file, search for General Event Callback Mechanism, then go File Notifications: and choose the callbacks that will fit your needs best.
Tools and Scripts for Autodesk 3dsMax
callback
I'm new at maxscript, for now I don't understand how the callbacks work.. But thanx, I'll try to figure it out!
.
This is how to use it:
And inside the rollout
Tools and Scripts for Autodesk 3dsMax
callbacks
why it is necessary to "remove" callbacks script? and why "callbacks.removeScripts" is located before "callbacks.addScript"? can't understand the logic of it.
.
You have to remove callbacks because it will stay active in current 3dsmax session. So, you may need to use your script(callbacks) whit scene_01.max on which you are working on, but 3 hours later you(without restarting 3dsmax) are ready with the scene_01.max and start working with scene_02.max. The callbacks will stay active, but you may not need it and it can cause problems with scene_02.max.
So, it is prefered to remove callbacks when you will not need them to avoid possible problems.
"callbacks.removeScripts" is located before "callbacks.addScript" just for safe. You have to be sure that the callbacks with approriate ID is removed before to start the callbacks with the same ID, because there is possibility the callbacks with the same name and ID to be already started from someone else(user or script).
The same is the situation with the global variables. You may use my script where I have global variable with name "nextPoint = #()". Then you may start your script where you have the global variable with the same name, but your global variable is a point3("nextPoint = [10, 20, 30]"), not an array(as mine). Since both variables are global and have the same name, they will overwrite themselves. When your global var is used, its value will be point3, when my script uses the same variable it will expect an array, but will receive point3 value, which will causes an error and the script will stop working. The same if the global variable is an array and your script expect point3 value.
Tools and Scripts for Autodesk 3dsMax
callbacks
thank you for your help! now i understood something.