« Soon to Come: C++ Plugins! | Main | New Python Scripts Comming »
Thursday
Sep292011

userSetup.py

Finally a new script!  This is my standard userSetup.py script I use to load my scripts into Maya.

 userSetup.py

 

 

Just a note... I often will reply to "HELP ME" emails to my scripts, however I don't support them.

Reader Comments (13)

Hello, and thank you for this great script ;)

I´m having a problem, the scripts are not loading in the script menu in maya tough i specified the scripts folder path

( i put them inside a folder named "scripts" inside the maya 2011x64 scripts folder)

scriptsFolder = 'C:\Users\Kosuta\Documents\maya\2011-x64\scripts\scripts'

Can you help me?

October 1, 2011 | Unregistered CommenterHELP ME

The first thing I recommend is changing your back slashes to for forward slashes. (Change \ to /) . Give that a try and let me know if it helps.

scriptsFolder = 'C:/Users/Kosuta/Documents/maya/2011-x64/scripts/scripts'

October 1, 2011 | Registered CommenterBrent Tyler

Nevermind, the path was wrong, i used a \ instead of a / :P

Sorry, works great now thanks :D

October 1, 2011 | Unregistered CommenterHELP ME

Wow that was a fast ereply :D thanks again and keep the good work ;)

October 1, 2011 | Unregistered CommenterHELP ME

Sorry to bother you again :P
All is working great, the script listing works and updates fine except a few scripts i get 2 types of errors:

(The script doesnt load)

# Error: AttributeError: file <maya console> line 2: 'module' object has no attribute 'Checker_Size_Tool_v_1_0' #

(The script loads but with this error message)

# Error: RuntimeError: file <maya console> line 1: Error occurred during execution of MEL script
line 1: line 1: Cannot find procedure "GMH_creator". #

Do i need to add a python path to my may.env?

Sorry for this but i don´t know anything about scripting.

thanks

October 1, 2011 | Unregistered CommenterHELP ME

# Error: RuntimeError: file <maya console> line 1: Error occurred during execution of MEL script
line 1: line 1: Cannot find procedure "GMH_creator". #

This type of error means that the script name, "GMH_creator" is not the name of the main procedure. You can probably change the name of procedure and run the script again and it will work. This isn't anything wrong with my script, but with the way this particular script works.

# Error: AttributeError: file <maya console> line 2: 'module' object has no attribute 'Checker_Size_Tool_v_1_0' #

This error looks like there's a problem when either running or sourcing the script. It's probably a similar issue as above, however this is probably because their isn't a procedure. Again, this is definitely something up with the script, since my userSetup.py script doesn't have anything on line 2 that says 'Checker_Size_Tool_v_1_0'. I'd check these couple of things out.

October 1, 2011 | Registered CommenterBrent Tyler

Ok , how do i change the procedure name? Sorry. Again, i don´t know anything about scripting :P

October 1, 2011 | Unregistered CommenterHELP ME

It's going to take a bit of knowledge to look at the script, find the procedure name and change it to the name of the script. the proceedure will look like this: global proc procedure()
{
procedure
}

October 1, 2011 | Registered CommenterBrent Tyler

Ok ;) i´ll look for that.
Thanks for your help and patience :D

October 1, 2011 | Unregistered CommenterHELP ME

Genius!!!

October 2, 2011 | Unregistered CommenterIvan

Genius!!!

October 2, 2011 | Unregistered CommenterIvan

Hey man, that is a neat idea !
I love the last line of your code :)

cheers

October 5, 2011 | Unregistered Commenterrenatopolimeno

Thanks for the great little script. I'm not sure if I overlooked something but I had to make a few tweaks to get submenu python scripts to work.
(I haven't tested it with mel scripts yet)
Here's what's working for me now between lines 53 and 64

for relativeFile in relativeFiles:
split = relativeFile.split('/')
fileName = split[-1].split('.')
i=0
subPath = "/"
while i<(len(split)):
### Create Folders ###
if i==0 and len(split) != 1:
if cmds.menu(split[i] ,ex=1) == 0:
subPath += (split[i] + "/")
if not (scriptsFolder + subPath) in sys.path: sys.path.append(scriptsFolder + subPath)
split[i] = cmds.menuItem(split[i], p=scriptsMenu, bld=1, sm=1, to=1, l=split[i])
if i > 0 and i < (len(split)-1):
if cmds.menu(split[i] ,ex=1) == 0:
subPath += (split[i] + "/")
if not (scriptsFolder + subPath) in sys.path: sys.path.append(scriptsFolder + subPath)
split[i] = cmds.menuItem(split[i], p=split[i-1], bld=1, sm=1, to=1, l=split[i])

May 9, 2012 | Unregistered CommenterSimon

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>