Home Technical Talk

Relative path for Maya Shelf Icons?

polycounter lvl 19
Offline / Send Message
kodde polycounter lvl 19
Hey people,

Anyone know how to set relative paths for Maya's Shelf Icons?

I came up with an idea earlier today. After installing Maya 2009 and starting to tailor a new custom shelf I realized how boring all the default MEL command icons area. So to spice up my shelf I said to myself "Every time I add a new shelf command I HAVE to make an icon for it". They do make it look a wee bit better imo.

mayaShelfIcons.jpg

Aaaaanyway, now I want to move these to another computer. Problem is the icon paths are absolute paths and I do not know how the correct syntax is for setting them as relative.

Right now my Shelf MEL file is in:
\\maya\2009\prefs\shelves\koddeShelf.mel
My icons are in:
\\maya\2009\prefs\icons\koddeShelfIcons\****.bmp

Now if I were to move the whole "koddeShelfIcons" folder to the \shelves\ folder instead, making it a subfolder in relation to the "koddeShelf.mel" I should be able to utilize relative paths? Making it possible to easily copy-paste this shelf with icons to another computer?

Am I thinking correctly here? How is this done?

Thanks!

Replies

  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    You should be able to set the icon paths in the MEL to "koddeShelfIcons\****.bmp"
    Since Maya has a default search path for icon images, which is oddly enough your documents folder \maya\2009\prefs\icons\

    Any paths you pass it which aren't absolute will be checked in that folder first, and if it can't find them it'll fall back to any other default folders, before failing.

    Nice icons btw, I did something similar with my shelves, except my icons are fugly :)
  • kodde
    Offline / Send Message
    kodde polycounter lvl 19
    Works just fine. Thanks MoP!

    Now why does Maya store an absolute path when I was a good boy to place them nestled under the \icons\ folder to begin with. It's like they designed it to screw with you. ;)
    MoP wrote: »
    Nice icons btw, I did something similar with my shelves, except my icons are fugly :)

    Thanks. Well it does make working Maya a bit less of a grey experience ;)
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Yeah, I've made all the icons for our in-house tools the SD orange/grey theme, and it really helps :)
  • Illusions
    Offline / Send Message
    Illusions polycounter lvl 18
    MoP wrote: »
    Yeah, I've made all the icons for our in-house tools the SD orange/grey theme, and it really helps :)

    I don't know why, but I have a fondness for the green, grey, red, blue color scheme maya uses and made some of mine to match that.
  • Yozora
    Offline / Send Message
    Yozora polycounter lvl 11
    hmm your yellow buttons should really be hotkeyed imo!
  • kodde
    Offline / Send Message
    kodde polycounter lvl 19
    Yozora wrote: »
    hmm your yellow buttons should really be hotkeyed imo!

    How do you figure? Do you know my habits of using these? :)

    I generally don't use that many hotkeys in Maya, don't really know why. The shelves was always my favorite way of accessing commands. Don't really like the hotbox either.
  • claydough
    Offline / Send Message
    claydough polycounter lvl 10
    why don't you jes put yer nested icon folder in the XBMLANGPATH variable?
  • kodde
    Offline / Send Message
    kodde polycounter lvl 19
    claydough wrote: »
    why don't you jes put yer nested icon folder in the XBMLANGPATH variable?

    Because judging by my initial post I'm not that into editing variables and such in Maya.... yet. This seems very interesting though, especially for distributing stuff though a common server. Thanks for the url.
  • claydough
    Offline / Send Message
    claydough polycounter lvl 10
    create yer own env directory MAYA_YOURENVNAMEHERE_DIR

    like:
    MAYA_KODDE_DIR = C:/Users/Administrator/Documents/maya/Kodde
    
    where Kodde is a folder in the Maya folder where you will put yer collections.
    ( back slash/forward slash inverted cuz code tags strips dem out ).

    then in subsequent variables jes begin formatted thusly:
    %MAYA_KODDE_DIR%
    


    create yer personal directories ( scripts, icons ) in this kodde folder and point the Maya variables to them. icons fer instance:
    XBMLANGPATH = %MAYA_KODDE_DIR%icons
    
  • claydough
    Offline / Send Message
    claydough polycounter lvl 10
    Maya online docs link

    if yer not comfortable with editing the maya env text file you can
    create and edit an XBMLANGPATH from yer system control panel.

    system > advanced system settings > click environment variables button

    if XBMLANGPATH doesn't already exist click "new" and add it. Then add yer directories.
    ( seperate any multiple directories with a semi colon. no spaces )

    If it already exists click edit and then jes add yer directories
    ( seperate any multiple directories with a semi colon. no spaces )
  • kodde
    Offline / Send Message
    kodde polycounter lvl 19
    This is nice.

    I got the example working that you posted, added the MAYA_SHELF_PATH as well to point the env file to both a shelf & icon path.

    Thanks claydough, definitely going to play around with this more.
  • kodde
    Offline / Send Message
    kodde polycounter lvl 19
    Is there a way to for instance have several MAYA_SHELF_PATH variables? Lets say I would have one shelf stored on a server, and another locally.

    Do I add another MAYA_SHELF_PATH1, MAYA_SHELF_PATH2, etc? Or do I add more locations in the MAYA_SHELF_PATH somehow?

    Thanks
  • claydough
    Offline / Send Message
    claydough polycounter lvl 10
    add directories to yer var seperated with semi colons ; ( no spaces ! )
    MAYA_SHELF_PATH = c:/user/folder1;c:/user/folder2;hostname/usr/folder1
    
  • kodde
    Offline / Send Message
    kodde polycounter lvl 19
  • The Dag Node
    Offline / Send Message
    The Dag Node polycounter lvl 15
    I'd like to use this with combination with the modules interface. However instead of using absolute paths as in the examples I need to use relative paths as I need to move this over between systems that don't share a network. I have managed to get it right in the maya.env file, so I got shelves showing up, but sadly my scripts won't work since the path defined in the modules must be using the wrong syntax. Can't think of anything else that'd be the cause. I assume defining the modules in the maya.env would suffice so I never bothered defining the "maya_script_path", perhaps I should've?

    So this is what my Maya.env looks like
    2ujtvzn.jpg

    and this is how I've written my module file path. Also the userSetup is placed inside this script folder of mine as shown with the blue guides =).
    28gwieq.jpg
  • The Dag Node
    Offline / Send Message
    The Dag Node polycounter lvl 15
    I'm aware bumping is bad custom, but I really do need some help on this matter. so which is the correct way to write the path syntax in the modules text-files?
Sign In or Register to comment.