I was surprised I couldn’t find an answer to this by searching the Maya sites.
Although not clearly specified anywhere, I gather from everything I read so far that when I save a script to one of the 2 script directories - maya\scripts or \maya\7.0\scripts, Maya should be able to run the script without restarting, however I can do that only after restarting Maya.
Is this how it is suppose to work?

Also: from one reading, It was suggested that I change the Maya.env file by adding this-
MAYA_SCRIPT_PATH =
C:\Documents and Settings\User\My Documents\maya\7.0\scripts ;
C:\Documents and Settings\User\My Documents\maya\scripts;

I have two Maya.env files - one in Maya and the other in 7.0 folder and I have added to both of them the above code.

Will appreciate you help a lot.

mhovland

10-25-2005, 09:51 PM

Type

rehash;

into the command line and hit enter. Since Maya 6, they added in the script cache. Maya reads all of the scripts in the locations specified in your script path, and stores a cache at startup. Adding a script while Maya is running, means you need to tell Maya to rebuild the cache file, hence the rehash; command.

Emil3d

10-26-2005, 02:42 AM

Perfect help and perfect explanation. Thanks a lot Mhovland.

Migugi

10-26-2005, 06:11 AM

Hey, thanks! Nice to know this.
That saves me from a bit of trouble next time.

Mikademius

10-26-2005, 02:02 PM

When I script I always have a sourcecommand on a shelfbutton + the proc to run the script.
(If it doesn't execute by sourcing) So whenever you edit this you just click the button to re-source it. Should work with new saved scripts too.

mhovland

10-26-2005, 03:33 PM

Mikademius,

Your method will work as long as the script was present at start up. If you add a script after Maya is running, you will need to do a rehash. Try it out, create a new script and save it into the script path, after Maya is running. Then try sourcing it. You will get an error that says it can't find the command for the source statement.

Mikademius

10-26-2005, 03:46 PM

Ok, no time to try, but I believe you :)

EigenPuff

10-26-2005, 04:39 PM

I can vouch for that - I run maya mostly to write scripts and test them out, so I've gotten into the habit of shutting maya down and bringing it back up everytime I write a new one. I've suspected that there was some caching behavior under the hood somewhere, but didn't know what to do about it until now - thanks mhovland (^_^)!

Now I just need to find the command that will do the same thing when I've updated a plugin but Maya still remembers the screwed up state ...

mhovland

10-26-2005, 06:46 PM

Eigen,

To do the same, in effect, when coding plugs, you need to write a script that wil unload the old plug, then re-load the newly compiled plug.

Here is the code to check if the Iges.mll plug is loaded, and if it is, unload and reload it, otherwise (not loaded), just load the plug. Modify for your specific plug.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us