本文整理汇总了Python中maya.cmds.namespaceInfo函数的典型用法代码示例。如果您正苦于以下问题:Python namespaceInfo函数的具体用法?Python namespaceInfo怎么用?Python namespaceInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了namespaceInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: getAllNS
def getAllNS():
#set the current naemspace to world
curNS = mc.namespaceInfo(cur=True)
mc.namespace(set=":")
#because maya can only list the child namespaces of the current set namespace, we have to recursively go through setting
#and checking child namespaces
#start by getting the worlds children
namespaces = []
childspaces = mc.namespaceInfo(lon=True)
while childspaces:
#move the current add spaces into the namespaces list (what we will return)
namespaces.extend(childspaces)
#create a list from the childspaces so that we can check for their children
checkspaces = childspaces
#empty the childspaces so all new children can be added to it for the next round
childspaces = []
#cycle through the current checkspaces and get their child namespaces
for check in checkspaces:
mc.namespace(set=(":" + check))
grandchildspaces = mc.namespaceInfo(lon=True)
if grandchildspaces:
childspaces.extend(grandchildspaces)
#remove default namespaces
if namespaces.count('UI'): namespaces.remove('UI')
if namespaces.count('shared'): namespaces.remove('shared')
mc.namespace(set=(":" + curNS))
namespaces.sort()
return namespaces
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:namespacer.py
示例2: addCharacter
def addCharacter(self, close, *args):
project = cmds.optionMenu(self.widgets["project"], q=True, value=True)
selectedCharacter = cmds.textScrollList(self.widgets["characterList"], q=True, si=True)[0]
rigPath = os.path.join(
self.mayaToolsDir, "General", "ART", "Projects", project, "AnimRigs", selectedCharacter + ".mb"
)
# find existing namespaces in scene
namespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
# reference the rig file
cmds.file(
rigPath, r=True, type="mayaBinary", loadReferenceDepth="all", namespace=selectedCharacter, options="v=0"
)
# clear selection and fit view
cmds.select(clear=True)
cmds.viewFit()
panels = cmds.getPanel(type="modelPanel")
# turn on smooth shading
for panel in panels:
editor = cmds.modelPanel(panel, q=True, modelEditor=True)
cmds.modelEditor(editor, edit=True, displayAppearance="smoothShaded", displayTextures=True, textures=True)
# find new namespaces in scene (this is here in case I need to do something later and I need the new name that was created)
newCharacterName = selectedCharacter
newNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
for name in newNamespaces:
if name not in namespaces:
newCharacterName = name
# launch UI
import ART_animationUI
reload(ART_animationUI)
ART_animationUI.AnimationUI()
if close:
cmds.deleteUI(self.widgets["window"])
开发者ID:Slugnifacent,项目名称:UnrealEngine,代码行数:33,代码来源:ART_addCharacter_UI.py
示例3: resolveNamespaceClashes
def resolveNamespaceClashes(self, tempNamespace):
returnNames = []
cmds.namespace(setNamespace=tempNamespace)
namespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
cmds.namespace(setNamespace=':')
existingNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
for i in range(len(namespaces)):
namespaces[i] = namespaces[i].partition(tempNamespace+ ':')[2]
for name in namespaces:
newName = str(name)
oldName = tempNamespace + ':' + name
if name in existingNamespaces:
highestSuffix = utils.findHighestTrailingNumber(existingNamespaces, name+'_')
highestSuffix += 1
newName = str(name) + '_' + str(highestSuffix)
returnNames.append([oldName,newName])
self.resolveNameChangeMirrorLinks(returnNames,tempNamespace)
self.renameNamespaces(returnNames)
return returnNames
开发者ID:pouyaz123,项目名称:Python-character-pipeline,代码行数:28,代码来源:blueprint_UI.py
示例4: deleteNsContents
def deleteNsContents(self, nameSpace):
mc.namespace(set=":")
mc.namespace(set=":"+nameSpace)
if self.debug: print"current ns: ", mc.namespaceInfo(currentNamespace=True)
nsContent = mc.namespaceInfo(ls=True, listOnlyDependencyNodes=True)
if not nsContent:
return
for i in mc.namespaceInfo(ls=True, listOnlyDependencyNodes=True):
delStr = i.split(":")[-1]
try:
print "deleting:", delStr
#print mc.nodeType(i)
mc.delete(i)
self.count += 1
except:
if self.debug:print "can not delete: ", i
pass
if self.debug: print "renaming namespace: ", nameSpace
self.setNsCleaned(nameSpace)
开发者ID:chichang,项目名称:ccLookdevToolkit,代码行数:25,代码来源:sceneBuildPostCleanup.py
示例5: bdImportGeneric
def bdImportGeneric(args):
basicFilter = "Maya Files (*.ma *.mb);;Maya ASCII (*.ma);;Maya Binary (*.mb)"
genericFile = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=0,cap='Import Generic',fm=1)
if genericFile:
print genericFile
#cmds.file( genericFile[0], namespace="generic", import = True)
cmds.file( genericFile[0], i=True,namespace = 'genericchar' )
#remove namespaces
sceneNS = cmds.namespaceInfo(lon=True,r=True)
importNS = []
for ns in sceneNS:
if 'genericchar' in ns:
importNS.append(ns)
importNS.reverse()
for ns in importNS:
cmds.namespace(setNamespace=ns)
parentNS = cmds.namespaceInfo( parent = True)
nemName = ":" + ns
cmds.namespace( force = True, moveNamespace = [ nemName, ':' ] )
cmds.namespace( rm = nemName)
else:
print 'No file was selected'
bipsInScene = cmds.ls('Bip??')
if len(bipsInScene) == 1:
target = bipsInScene[0]
dest = 'Generic|Controllers|World_Anim_grp|Global_Scale_Anim'
const = cmds.parentConstraint(target,dest)
cmds.delete(const)
cmds.setAttr(dest + ".translateZ", 0)
cmds.setAttr(dest + ".rotateX", 0)
cmds.setAttr(dest + ".rotateY", 0)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:34,代码来源:bd_MultiCopyMocap_UI.py
示例6: __init__
def __init__(self):
character = self.findSelectedCharacter()
if character == None:
return
niceName = character.partition('__')[2]
result = cmds.confirmDialog(title='Delete Character',message='Are you sure you want to delete the character \'' + niceName + '\'?\nCharacter deletion cannot be undone.',button=['Yes','Cancel'],defaultButton='Yes',cancelButton='Cancel',dismissString='Cancel')
if result == 'Cancel':
return
characterContainer = character + ':character_container'
cmds.lockNode(characterContainer, lock=False, lockUnpublished=False)
cmds.delete(characterContainer)
cmds.namespace(setNamespace=character)
blueprintNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
for blueprintNamespace in blueprintNamespaces:
cmds.namespace(setNamespace=':')
cmds.namespace(setNamespace=blueprintNamespace)
moduleNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
cmds.namespace(setNamespace=':')
if moduleNamespaces != None:
for moduleNamespace in moduleNamespaces:
cmds.namespace(removeNamespace=moduleNamespace)
cmds.namespace(removeNamespace=blueprintNamespace)
cmds.namespace(removeNamespace=character)
开发者ID:pouyaz123,项目名称:Python-character-pipeline,代码行数:34,代码来源:deleteCharacter.py
示例7: retrieveListEmptyNamespaces
def retrieveListEmptyNamespaces(self, root):
del self.listEmptyNamespace[:]
listNs = cmds.namespaceInfo(root, listOnlyNamespaces=True, recurse = True )
if listNs != None:
for namespace in listNs:
if namespace != "UI" and namespace != "shared":
if cmds.namespaceInfo(namespace, listNamespace=True ) == None:
self.listEmptyNamespace.append(namespace)
开发者ID:BenoitValdes,项目名称:PipelineTools_Maya,代码行数:8,代码来源:NamespaceManager.py
示例8: deleteModule
def deleteModule(self, *args):
""" Delete the Guide, ModuleLayout and Namespace.
"""
# delete mirror preview:
try:
cmds.delete(self.moduleGrp[:self.moduleGrp.find(":")]+"_MirrorGrp")
except:
pass
# delete the guide module:
utils.clearNodeGrp(nodeGrpName=self.moduleGrp, attrFind='guideBase', unparent=True)
# clear default 'dpAR_GuideMirror_Grp':
utils.clearNodeGrp()
# remove the namespaces:
allNamespaceList = cmds.namespaceInfo(listOnlyNamespaces=True)
if self.guideNamespace in allNamespaceList:
cmds.namespace(moveNamespace=(self.guideNamespace, ':'), force=True)
cmds.namespace(removeNamespace=self.guideNamespace, force=True)
try:
# delete the moduleFrameLayout from window UI:
cmds.deleteUI(self.moduleFrameLayout)
self.clearSelectedModuleLayout()
# edit the footer A text:
self.currentText = cmds.text("footerAText", query=True, label=True)
cmds.text("footerAText", edit=True, label=str(int(self.currentText[:self.currentText.find(" ")]) - 1) +" "+ self.langDic[self.langName]['i005_footerA'])
except:
pass
# clear module from instance list (clean dpUI list):
delIndex = self.dpUIinst.moduleInstancesList.index(self)
self.dpUIinst.moduleInstancesList.pop(delIndex)
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:29,代码来源:dpBaseClass.py
示例9: import_taskfile
def import_taskfile(self, refobj, taskfileinfo):
"""Import the given taskfileinfo and update the refobj
:param refobj: the refobject
:type refobj: refobject
:param taskfileinfo: the taskfileinfo to reference
:type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:raises: None
"""
# work in root namespace
with common.preserve_namespace(":"):
jbfile = JB_File(taskfileinfo)
filepath = jbfile.get_fullpath()
ns_suggestion = reftrack.get_namespace(taskfileinfo)
nodes = cmds.file(filepath, i=True, namespace=ns_suggestion, returnNewNodes=True, preserveReferences=True) # import
assert nodes, 'Nothing was imported! this is unusual!'
ns = common.get_top_namespace(nodes[0]) # get the actual namespace
cmds.setAttr("%s.namespace" % refobj, ns, type="string")
nscontent = cmds.namespaceInfo(ns, listOnlyDependencyNodes=True, dagPath=True) # get the content
scenenode = self.get_scenenode(nscontent)
self.get_refobjinter().connect_reftrack_scenenode(refobj, scenenode)
dagcontent = cmds.ls(nodes, ap=True, assemblies=True) # get only the dagnodes so we can group them
if not dagcontent:
return # no need for a top group if there are not dagnodes to group
# group the dagnodes in the new namespace
grpname = reftrack.get_groupname(taskfileinfo)
reftrack.group_content(dagcontent, ns, grpname, "jb_asset")
return
开发者ID:JukeboxPipeline,项目名称:jukeboxmaya,代码行数:30,代码来源:asset.py
示例10: importSkinByRef
def importSkinByRef(ref, file, skip=[], **kwargs):
"""Import skin for every dag node in reference."""
if not os.path.exists(file):
rigUtils.log('Skin file not found - skipping: %s' % file)
return
rigUtils.log('Reading file: %s' % file)
f = open(file, 'r')
j = json.loads(f.read())
f.close()
cmds.namespace(set=ref)
dagnodes = cmds.namespaceInfo(lod=True)
cmds.namespace(set=':')
skinned = []
for dagnode in dagnodes:
if skip:
if dagnode in skip:
continue
if dagnode in j:
dict = j[dagnode]
try: skindict = dict['skinCluster']
except: continue
importSkin(skindict, dagnode, **kwargs)
skinned.append(dagnode)
return skinned
开发者ID:timm-gitHub,项目名称:fbRepo,代码行数:31,代码来源:bodyIO.py
示例11: iterNamespaces
def iterNamespaces( namespace=':' ):
'''
iterates over all namespaces under and including the one given... holy sH1t namespaces suck
b4lls in maya
'''
if namespace.endswith( ':' ):
namespace = namespace[ :-1 ]
namespaces = [ namespace ]
idx = 0
while True:
try:
curNS = namespaces[ idx ]
except IndexError: break
idx += 1
try:
cmd.namespace( set=curNS )
except RuntimeError: continue
subs = cmd.namespaceInfo( listOnlyNamespaces=True )
if subs is None:
continue
namespaces += subs
return iter( namespaces )
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:29,代码来源:api.py
示例12: install_module
def install_module(self,module,*args):
basename = "instance_"
cmds.namespace(setNamespace =":")
namespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
for i in range(len(namespaces)):
if namespaces[i].find("__") != -1:
namespaces[i] = namespaces[i].partition("__")[2]
new_suffix = utils.find_highest_trailing_number(namespaces, basename)+1
user_specified_name = basename+str(new_suffix)
hook_obj = self.find_hook_obj_from_selection()
mod = __import__("blueprint."+module, {}, {}, [module])
reload(mod)
module_class = getattr(mod, mod.CLASS_NAME)
module_instance = module_class(user_specified_name, hook_obj)
module_instance.install()
module_trans = mod.CLASS_NAME+"__"+user_specified_name+":module_transform"
cmds.select(module_trans,replace=True)
cmds.setToolTo("moveSuperContext")
开发者ID:firstPeterParker,项目名称:mlRig,代码行数:29,代码来源:blueprint_ui.py
示例13: _fixTheFuckingCores
def _fixTheFuckingCores(self):
"""
This is used to clean sweep the static scenes and remove the duplicate Namespaces and reconnect the bases to the duplicates
"""
removedNameSpaces = []
## Remove duplicate root core namespaces
getAllNameSpaces = cmds.namespaceInfo(listOnlyNamespaces = True)
for eachNS in getAllNameSpaces:
if eachNS.endswith('1'):
print 'Removing %s' % eachNS
cmds.namespace(removeNamespace = eachNS, mergeNamespaceWithRoot = True)
removedNameSpaces.append(eachNS.replace('1', '').replace('_CORE', ''))
## Remove duplicate base cores
for each in cmds.ls(type = 'core_archive'):
if '1'in each:
print 'Cleaned rootCore %s from scene...' % each
cmds.delete(each)
## Now find all geo with the core name in it and proceess it for reconnection
for eachCore in removedNameSpaces:
#print eachCore
## Check child _hrc grps for processing
getAllGeo = [eachGeo for eachGeo in cmds.ls('*%s*' % eachCore) if cmds.nodeType(eachGeo) == 'transform']
for eachGeo in getAllGeo:
self._reconnectDuplicates(eachGeo, '%s_CORE_Geoshader' % eachCore)
coreLib.cleanupDeadCoreArchives()
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:29,代码来源:app.py
示例14: namespaceList
def namespaceList(current= None):
"""
"""
if not current:
cmds.namespace(set = ':')
return cmds.namespaceInfo(lon= 1, r= 1, an= 1)
开发者ID:davidpower,项目名称:MS_Research,代码行数:7,代码来源:mGeneral.py
示例15: createModuleButtonCommand
def createModuleButtonCommand(self, moduleClassName, *args):
## DEALING WITH NAMESPACES
moduleName = cmds.textFieldGrp(self.UIwidgets[moduleClassName + "ModuleName"], q=True, text=True)
if moduleName == "":
moduleName = moduleClassName
## need to check if name has "_" character in it. If so we need to remove it.
## if name does not have "_" at the end, add it
if moduleName.partition("_")[1] == "":
moduleName = moduleName + "_"
## gather all namespaces
allNamespaces = cmds.namespaceInfo(listNamespace=True)
## gather the highest number
index = util.findHighestTrailingNumber(allNamespaces, moduleName)
## check to see if module name is in the list of namespaces. if so, add 1. if not leave alone
if moduleName + str(index) in allNamespaces:
moduleName = moduleName + str(index + 1)
else:
moduleName = moduleName + str(index)
# need to find correct module file
modName = util.findModule(RIGGING_TOOL_ROOT, moduleClassName)
# import that module
mod = __import__(environ.BlueprintModulePath + modName, {}, {}, [modName])
reload(mod)
# Get class reference for Blueprint module class, then create user specified instance of Blueprint module class and call it's Constructor and install method.
# getAttr returns import reference,
moduleClass = getattr(mod, mod.ClassName)
moduleInstance = moduleClass(moduleName)
moduleInstance.install_joints()
开发者ID:jeffhong21,项目名称:scripts,代码行数:31,代码来源:blueprintUI.py
示例16: removeAllNS
def removeAllNS(deleteContent = False):
## Now remove all the nameSpaces!! This is to remove any clashes with the core_assemblies later on...
safeNS = ['UI', 'shared']
getAllNameSpaces = cmds.namespaceInfo(listOnlyNamespaces = True)
for eachNS in getAllNameSpaces:
if eachNS not in safeNS:
try:
if deleteContent:
cmds.namespace(removeNamespace = eachNS, deleteNamespaceContent = True)
else:
cmds.namespace(removeNamespace = eachNS, mergeNamespaceWithRoot = True)
except RuntimeError:
pass
if cmds.namespaceInfo(listOnlyNamespaces = True) != ['UI', 'shared']:
removeAllNS()
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:16,代码来源:sg_asset_lib.py
示例17: cmd_makeRefOfSelection
def cmd_makeRefOfSelection(pathField='', fileField='', nsField='', *args):
path = cmds.textFieldGrp(pathField, q=True, text=True)
fyle = cmds.textFieldGrp(fileField, q=True, text=True)
ns = cmds.textFieldGrp(nsField, q=True, text=True)
nsList = cmds.namespaceInfo(lon=True)
sel = cmds.ls(sl=True)
if sel:
f = fyle
if f:
path = os.path.join(path, f)
else:
message('Provide a file name, excluding path.', warning=True)
return None
if ns:
if ns not in nsList:
try:
cmds.file(path, type='mayaAscii', er=True, namespace=ns)
except:
message('Export Failed... In case your object is already a reference, make a duplicate or import it. Then try again.', warning=True)
else:
message('Namespace "' + ns + '" already exists. Choose another!', warning=True)
else:
message('Provide a namespace for the reference.', warning=True)
return None
else:
message( 'Select and object', warning=True)
开发者ID:boochos,项目名称:work,代码行数:26,代码来源:fileMan_lib.py
示例18: current
def current( cls ):
""":return: the currently set absolute namespace """
# will return namespace relative to the root - thus is absolute in some sense
nsname = cmds.namespaceInfo( cur = 1 )
if not nsname.startswith( ':' ): # assure we return an absoslute namespace
nsname = ":" + nsname
return cls( nsname )
开发者ID:adamcobabe,项目名称:mrv,代码行数:7,代码来源:ns.py
示例19: searchCharsName
def searchCharsName():
"""检索当前场景中的所有角色名
Description:
根据绑定文件的命名规范与reference原则,从命名空间中就可获得角色名称
Arguments:
无
Returns:
allCharsNameList:所有角色名列表(无重复)
"""
cmds.namespace(set = ":")
allNamespace = cmds.namespaceInfo(listOnlyNamespaces = True) #拿到所有根目录下的命名空间名称
allCharsName = []
for eachNamespace in allNamespace:
#拿到带有_Char_的命名空间名称,从中拿到角色名
if eachNamespace.find("_chr_") < 0:
print "This Is Not A Char!"
else:
namesapceWithChar = eachNamespace
charName = namesapceWithChar.split("_")[2] #charName存放角色名
allCharsName.append(charName)
allCharsNameList = cT.delDupFromList(allCharsName) #调用函数去除list中的重复元素
return allCharsNameList
开发者ID:chloechan,项目名称:clothAndHair,代码行数:29,代码来源:dynInfor.py
示例20: getNamespace
def getNamespace(self):
returnNamespaces = []
namespaces = cmds.namespaceInfo(lon=True)
for namespace in namespaces:
if namespace != 'UI' and namespace != 'shared':
returnNamespaces.append(namespace)
return returnNamespaces
开发者ID:adamfok,项目名称:afok_toolset,代码行数:7,代码来源:namespace_tool.py
注:本文中的maya.cmds.namespaceInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论