以下ソース
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import maya.cmds as mc | |
import maya.mel as mel | |
def FBXImportToTargetNamespace(ns='targetNamespace'): | |
#set namespace | |
currentNs = mc.namespaceInfo(cur=True) | |
if not mc.namespace(ex=':%s'%ns): | |
mc.namespace(add=':%s'%ns) | |
mc.namespace(set=':%s'%ns) | |
#import FBX | |
pathList = mc.fileDialog2(fm=1,ds=2,ff=('FBX(*.fbx)')) | |
if not pathList: | |
return | |
mel.eval('FBXImport -f "%s"'%pathList[0]) | |
#return current ns | |
mc.namespace(set=currentNs) | |
FBXImportToTargetNamespace(ns='testNs') |
fileコマンドからインポートした時、namespaceを指定しても無反応。
カレントネームスペースを設定したうえでインポートするところがポイント。