Help with importing .mb relative path

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  05 May 2013
Help with importing .mb relative path

hi i use this site a lot when im stuck but couldn't find an answer to this but sorry if its been asked before it seems simple.
Is there a way to use mel script to load a .mb file but relative to the mel script file, so its in the same folder on a different computer it would still work? Thanks in advance
  05 May 2013
not mel but this should work (python).

import maya.cmds as mc
import os

newFileName = 'testFile.mb'

newFilePath = os.path.join(os.path.split(mc.file(q=True, loc=True))[0], newFileName)
mc.file(filePath, o=True)

Thinking bout it there should be a simpler way, will have a butchers.
  05 May 2013
if the mel script is already on the MAYA_SCRIPT_PATH, like in "My Documents/maya/2012/scripts", then you can get the path to the MEL script using "whatIs".

for example:

whatIs "myMelScript.mel";

returns the path to the script file.
  05 May 2013
ah i mis-read. cheers.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:05 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.