View Full Version : quering maya folder?


shenmue
10 October 2007, 08:40 PM
Hi,I just want to query the route of maya main folder.Iīve created there personal folders wich roots are called,and I need to create a string variable querying just the root of maya.
Because I have many images in personal folders that are queried to be loaded,and if the computer is diferent,or maya version is diferent,Iīll run into errors.
I know I could just put the images in my documents,en query internalVal variables,but I donīt want to store them in there.

for example:

string $mayaRoot = `-q whatever maya folder root is`;

global proc Bla()
{
window;
columnLayout;
symbolButton -i ($mayaRoot + \\myfolder\\myImage.bmp (file://\myfolder\myImage.bmp));
showWindow.
}

thx again

Buexe
10 October 2007, 08:45 PM
getenv MAYA_APP_DIR

shenmue
10 October 2007, 09:09 PM
thanks,but this is in my documents.I am looking to query where maya is installed.
For me it is
C:\Program Files\Autodesk\Maya2008
this is what I want to query.

Am I asking for weird stuff??I honestly have no idea.Maybe I should just use what you said,but my idea is creating folders there.

Any way thanks.

Buexe
10 October 2007, 09:24 PM
Okay, thought you wanted the maya dir in the personal settings, sorry. I guess the install dir should be somehow queryable, but I don`t know how. Another way to store your stuff might be a module. A module has an icon directory where you could store stuff and Maya should find it. Also if you edit the XBMLANGPATH environment variable, you can store your images anywhere and Maya should be able to find it.

shenmue
10 October 2007, 10:10 PM
ok,thanks buexe.I am going to investigate about what that.:thumbsup:

GennadiyKorol
10 October 2007, 10:46 PM
How about using:

system ("cd");

That's a windows example, on Unix/Linux you could use system("pwd") instead.

Hope it helps :)

shenmue
10 October 2007, 12:24 PM
yea,thanks!how do you know that stuff?!:bounce:
just one thing.I get white system "cd"
C:\Program Files\Autodesk\Maya2008\bin
but I want
C:\Program Files\Autodesk\Maya2008\

GennadiyKorol
10 October 2007, 01:03 PM
I remember there was another hack to get Maya path, but i can't recall what it was :) But well, this one works too.

To get the parent of the "bin", you can "cut" the path with the "\" symbol and then combine it back without the last element. Like so:

C:\Program Files\Autodesk\Maya2008\bin

After cut (tokenize):

C: ____ Program Files ____ Autodesk ____ Maya2008 ____ bin


Combine leaving the last - "bin" element out:

C: + "\" + Program Files + "\" + Autodesk + "\" + Maya2008 + "\"

= C:\Program Files\Autodesk\Maya2008\



//Pseudo MEL:
string $nodes[];
string $nodesInPath = `tokenize $path $nodes "\"`;

$parentPath = "";
for ($i = 0; $i < $nodesInPath -1; $i++) {
$parentPath += $nodes[$i] + "\";
}

shenmue
10 October 2007, 06:57 PM
okey!!thatīs great thanks.:thumbsup:
I guess you are a programmer?
thx

strarup
10 October 2007, 10:59 AM
Hi,

you can use `getenv MAYA_LOCATION`;

e.g. string $daMayaInstallPath = `getenv MAYA_LOCATION`;

regards

Strarup

CGTalk Moderation
10 October 2007, 10:59 AM
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.


1