PDA

View Full Version : Changing selectType automatically when a scene opens


kletterget
10-05-2007, 07:13 AM
I want to be able to run this script:

selectType -joint off -nurbsSurface off -polymesh off;

when a particular scene is opened. I tried creating a scriptNode with this command, setting the command as the "beforeScript" of the scriptNode and setting the type to 1 or 2. The command executes, but for some reason it doesn't work. I suspect that Maya refreshes the selectType every time a new scene is loaded, after any scriptNode are run.

Is there any way of overriding this? Or is there anyway of a scriptNode having "the last say", so to speak?

any help or insight appreciated.
/k

Segmoria
10-05-2007, 02:29 PM
What I would do is create a scriptjob with the sceneOpened flag to trigger a proc in which I would check the name of the scene that was just opened and then decide whether to change the selectType or not.
Plus try placing the code that creates the scriptJob in your userSetup.mel so it initialises each time Maya is opened, if you want this to work indefinately.
Quick code example:

{
scriptJob -e SceneOpened checkScene;
proc checkScene()
{
if (`file -q -sn -shn` == "myScene.mb")
selectType -joint off -nurbsSurface off -polymesh off;
}}

kletterget
10-05-2007, 03:37 PM
ah thanks for that. Using a scriptJob probably works because the script is already run before the maya file is opened, not in the same instant. I guess I cuold run it in userSetup.mel like you suggested, the only problem is that I'll have to change everyone's userSetup.mel, which can be tedious.

I'll also have to keep in mind that the maya file in question is a rig file which will be referenced into a whole lotta other files. So instead of querying the scene name I'll have to search for a referenced file. But I guess that won't be too hard to sort out.

Anyway, thanks for that. Have a good weekend now!

/k

CGTalk Moderation
10-05-2007, 03:37 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.