CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 05-08-2013, 05:54 PM   #1
New Member
John Gregory
CRAMLINGTON, United Kingdom
Join Date: May 2013
Posts: 1
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
Old 05-10-2013, 08:14 PM   #2
Character TD
Lee Dunham
Character Rigger
Surrey, United Kingdom
Join Date: Feb 2008
Posts: 179
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.
Old 05-10-2013, 09:04 PM   #3
austin, USA
Join Date: Nov 2006
Posts: 364
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.
Old 05-10-2013, 09:29 PM   #4
Character TD
Lee Dunham
Character Rigger
Surrey, United Kingdom
Join Date: Feb 2008
Posts: 179
ah i mis-read. cheers.
Old 05-10-2013, 09:29 PM   #5
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
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 03:16 PM.

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