本文整理汇总了Python中maya.cmds.lockNode函数的典型用法代码示例。如果您正苦于以下问题:Python lockNode函数的具体用法?Python lockNode怎么用?Python lockNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lockNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __preCreateUI
def __preCreateUI(self):
self.grp = cmds.createNode('transform', name="CURVE_TOOLS_NULL", ss=True)
self.ns = 'curve_tools'
try:
self.ns = cmds.namespace(add=self.ns)
except:
pass
cmds.lockNode(self.grp, l=True)
tmp = cmds.ls(sl=True)
self.viewport_cam = cmds.camera(
name="Curve_Tools_CAM",
p=[-15, 15, 21],
wci=[0,0,0]
)[0]
cmds.parent(self.viewport_cam, self.grp)
if tmp:
cmds.select(tmp)
else:
cmds.select(clear=True)
开发者ID:MagSec-Arts,项目名称:maya_tools,代码行数:25,代码来源:__init__.py
示例2: remove_unknown_nodes
def remove_unknown_nodes():
removed_count = 0
unknown_nodes = cmds.ls(type="unknown")
for node in unknown_nodes:
if cmds.objExists(node):
sys.stdout.write("Remove unknown node '{}'.\n".format(node))
cmds.lockNode(node, lock=False)
cmds.delete(node)
removed_count += 1
if cmds.pluginInfo("Turtle.mll", q=True, loaded=True):
cmds.pluginInfo("Turtle.mll", e=True, autoload=False)
cmds.unloadPlugin("Turtle.mll", force=True)
turtle_nodes = ["TurtleDefaultBakeLayer",
"TurtleBakeLayerManager",
"TurtleRenderOptions",
"TurtleUIOptions"]
for node in turtle_nodes:
if cmds.objExists(node):
sys.stdout.write("Remove Turtle node '{}'.\n".format(node))
cmds.lockNode(node, lock=False)
cmds.delete(node)
removed_count += 1
sys.stdout.write(str(removed_count) + " unknown nodes removed.\n")
开发者ID:Kapukw,项目名称:vfxutils,代码行数:26,代码来源:SceneTweaks.py
示例3: deleteIt
def deleteIt(self):
coral.Node.deleteIt(self)
if self._mayaNode:
cmds.lockNode(self._mayaNode, lock = False)
cmds.delete(self._mayaNode)
self._mayaNode = ""
开发者ID:BigMacchia,项目名称:coral-repo,代码行数:7,代码来源:mayaContextNode.py
示例4: editPivotHandle
def editPivotHandle(self):
qt_maya_window.installEventFilter(self.keypressFilter)
#create transform
self.pivotHandle = mc.group(em=True, name='Adjust_Pivot')
mc.setAttr(self.pivotHandle+'.rotate', lock=True)
mc.setAttr(self.pivotHandle+'.rx', keyable=False)
mc.setAttr(self.pivotHandle+'.ry', keyable=False)
mc.setAttr(self.pivotHandle+'.rz', keyable=False)
mc.setAttr(self.pivotHandle+'.scale', lock=True)
mc.setAttr(self.pivotHandle+'.sx', keyable=False)
mc.setAttr(self.pivotHandle+'.sy', keyable=False)
mc.setAttr(self.pivotHandle+'.sz', keyable=False)
mc.setAttr(self.pivotHandle+'.visibility', lock=True, keyable=False)
mc.setAttr(self.pivotHandle+'.displayHandle', True)
self.pivotHandle = mc.parent(self.pivotHandle, self.node)[0]
mc.addAttr(self.pivotHandle, ln='ml_pivot_handle', at='bool', keyable=False)
#set initial position
mc.setAttr(self.pivotHandle+'.translate', *mc.getAttr(self.node+'.rotatePivot')[0])
#lock it so you don't delete it or something.
mc.lockNode(self.pivotHandle, lock=True)
self.scriptJob = mc.scriptJob(event=['SelectionChanged', self.cleanup], runOnce=True)
mc.setToolTo('Move')
mc.inViewMessage( amg='After moving the pivot, press <hl>Return</hl> to bake or <hl>Esc</hl> to cancel.', pos='midCenterTop', fade=True, fadeStayTime=4000, dragKill=True)
开发者ID:liudger,项目名称:ml_tools,代码行数:32,代码来源:ml_pivot.py
示例5: rehook
def rehook(self, newHookObject):
oldHookObject = self.findHookObject()
self.hookObject = (self.moduleNamespace + ':unhookedTarget')
if newHookObject != None:
if newHookObject.find('_translation_control') != -1:
splitString = newHookObject.split('_translation_control')
if splitString[1] == '':
if utils.stripLeadingNamespace(newHookObject)[0] != self.moduleNamespace:
self.hookObject = newHookObject
if self.hookObject == oldHookObject:
return
self.unconstrainRootFromHook()
cmds.lockNode(self.containerName, lock=False, lockUnpublished=False)
hookConstraint = (self.moduleNamespace + ':hook_pointConstraint')
cmds.connectAttr((self.hookObject + '.parentMatrix[0]'), (hookConstraint + '.target[0].targetParentMatrix'), force=True)
cmds.connectAttr((self.hookObject + '.translate'), (hookConstraint + '.target[0].targetTranslate'), force=True)
cmds.connectAttr((self.hookObject + '.rotatePivot'), (hookConstraint + '.target[0].targetRotatePivot'), force=True)
cmds.connectAttr((self.hookObject + '.rotatePivotTranslate'), (hookConstraint + '.target[0].targetRotateTranslate'), force=True)
cmds.lockNode(self.containerName, lock=True, lockUnpublished=True)
开发者ID:pouyaz123,项目名称:Python-character-pipeline,代码行数:27,代码来源:blueprint.py
示例6: exportSetup
def exportSetup(self):
altCharacterName = cmds.textField(self.UIElements['nameTxt'], q=True, tx=True)
if altCharacterName == self.characterName:
exportPath =(self.dirExt.paths['setupPath'] + self.characterName + '.ma')
else:
exportPath =(self.dirExt.paths['setupPath'] + altCharacterName + '.ma')
# Remove the setup_grp and geometry group from it's container.
cmds.lockNode(self.exportContainer, l=False, lu=False)
self.removeConstraints()
cmds.select(cl=True)
cmds.select(self.exportContainer)
self.dirExt.verifyDirectory(self.dirExt.paths['setupPath'])
if cmds.file(exportPath, q=True, exists=True):
turbineUtils.archiveFile(exportPath)
cmds.file(exportPath, exportSelected=True, con=True, type="mayaAscii", f=True)
wipPath = self.exportWip()
try:
cmds.file(wipPath, open=True, f=True)
except:pass
cmds.lockNode(self.exportContainer, l=True, lu=True)
开发者ID:griffinanimator,项目名称:MPR,代码行数:30,代码来源:altSetupTools.py
示例7: _ls
def _ls(nodeType = '', topTransform = True, stringFilter = '', unlockNode = False):
if nodeType:
nodes = cmds.ls(type = nodeType)
if nodes:
final_nodes = []
for each in nodes:
each = cmds.ls(each, long = True)[0]
top_transform = cmds.listRelatives(each, parent = True, fullPath = True) if topTransform else None
final_node = top_transform[0] if top_transform else each
if unlockNode:
try: cmds.lockNode(final_node, lock = False)
except: mel.eval('warning "Failed to unlock %s, skipping...";' % final_node)
if stringFilter:
if stringFilter in final_node:
if final_node not in final_nodes:
final_nodes.append(final_node)
else:
if final_node not in final_nodes:
final_nodes.append(final_node)
return final_nodes
return []
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:25,代码来源:fx_lib.py
示例8: lock_phase3
def lock_phase3(self, hook_obj):
module_container = self.module_namespace+":module_container"
if hook_obj != None:
hook_obj_module_node = utils.strip_leading_namespace(hook_obj)
hook_obj_module = hook_obj_module_node[0]
hook_obj_joint = hook_obj_module_node[1].split("_translation_control")[0]
hook_obj = hook_obj_module+":blueprint_"+hook_obj_joint
parent_con = cmds.parentConstraint(
hook_obj,
self.module_namespace+":HOOK_IN",
maintainOffset=True,
name=self.module_namespace+":hook_parent_constraint"
)[0]
scale_con = cmds.scaleConstraint(
hook_obj,
self.module_namespace+":HOOK_IN",
maintainOffset=True,
name=self.module_namespace+":hook_scale_constraint"
)[0]
module_container = self.module_namespace+":module_container"
utils.add_node_to_container(module_container, [parent_con, scale_con])
cmds.lockNode(module_container, lock=True, lockUnpublished=True)
开发者ID:firstPeterParker,项目名称:mlRig,代码行数:29,代码来源:blueprint.py
示例9: match
def match(self, *args):
# Unlock all the containers
characterContainer = self.characterNamespaceOnly + ":character_container"
blueprintContainer = self.blueprintNamespace + ":module_container"
moduleContainer = self.blueprintNamespace + ":" + self.moduleNamespace +":module_container"
containers = [characterContainer, blueprintContainer, moduleContainer]
for c in containers:
cmds.lockNode(c, lock=False, lockUnpublished=False)
joints = utils.findJointChain(self.blueprintNamespace+":"+self.moduleNamespace+":joints_grp")
blueprintJoints = utils.findJointChain(self.blueprintNamespace+":blueprint_joints_grp")
ikHandleControl = self.blueprintNamespace + ":" + self.moduleNamespace + ":ikHandleControl"
cmds.setAttr(ikHandleControl+".stretchiness", 1)
endPos = cmds.xform(blueprintJoints[ len(blueprintJoints)-1], q=True, ws=True, t=True)
cmds.xform(ikHandleControl, ws=True, a=True, t=endPos)
joints.pop(0)
blueprintJoints.pop(0)
utils.matchTwistAngle(ikHandleControl+".twist", joints, blueprintJoints)
for c in containers:
cmds.lockNode(c, lock=True, lockUnpublished=True)
开发者ID:griffinanimator,项目名称:MPR,代码行数:29,代码来源:basicIK.py
示例10: match
def match(self, *args):
characterContainer = self.characterNamespaceOnly + ':character_container'
blueprintContainer = self.blueprintNamespace + ':module_container'
moduleContainer = self.blueprintNamespace + ':' + self.moduleNamespace + ':module_container'
containers = [characterContainer, blueprintContainer, moduleContainer]
for c in containers:
cmds.lockNode(c, lock=False, lockUnpublished=False)
joints = utils.findJointChain(self.blueprintNamespace+':' + self.moduleNamespace+':joints_grp')
blueprintJoints = utils.findJointChain(self.blueprintNamespace+':blueprint_joints_grp')
ikHandleControl = self.blueprintNamespace + ':' + self.moduleNamespace + ':ikHandleControl'
cmds.setAttr(ikHandleControl + '.stretchiness',1)
endPos = cmds.xform(blueprintJoints[len(blueprintJoints)-1], q=1, worldSpace=True, translation=True)
cmds.xform(ikHandleControl, worldSpace=True, absolute=True, translation=endPos)
joints.pop(0)
blueprintJoints.pop(0)
utils.matchTwistAngle(ikHandleControl + '.twist', joints, blueprintJoints)
for c in containers:
cmds.lockNode(c, lock=True, lockUnpublished=True)
开发者ID:pouyaz123,项目名称:Python-character-pipeline,代码行数:27,代码来源:basicIK.py
示例11: __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
示例12: _deleteTurtleNodes
def _deleteTurtleNodes(*args):
pluginName = 'Turtle'
dn = cmds.pluginInfo(pluginName,q=True,dn=True)
turtleNodes = cmds.ls(type=dn)
cmds.lockNode(turtleNodes,l=False)
cmds.delete(turtleNodes)
return 0
开发者ID:ShuheiArai,项目名称:maya,代码行数:7,代码来源:deleteTurtlePlugin.py
示例13: match
def match(self, *args):
characterContainer = self.characterNamespaceOnly + ":character_container"
blueprintContainer = self.blueprintNamespace + ":module_container"
moduleContainer = self.blueprintNamespace + ":" + self.moduleNamespace +":module_container"
containers = [characterContainer, blueprintContainer, moduleContainer]
for c in containers:
cmds.lockNode(c, lock=False, lockUnpublished=False)
ikJointsAll = utils.findJointChain(self.blueprintNamespace + ":" + self.moduleNamespace + ":joints_grp")
blueprintJointsAll = utils.findJointChain(self.blueprintNamespace + ":blueprint_joints_grp")
ikJoints = [ikJointsAll[1], ikJointsAll[2], ikJointsAll[3]]
blueprintJoints = [blueprintJointsAll[1], blueprintJointsAll[2], blueprintJointsAll[3]]
ikHandleControl = self.blueprintNamespace + ":" + self.moduleNamespace + ":ikHandleControl"
if cmds.objExists(ikHandleControl):
cmds.setAttr(ikHandleControl+".stretchiness", 1)
endPos = cmds.xform(blueprintJoints[2], q=True, worldSpace=True, translation=True)
cmds.xform(ikHandleControl, worldSpace=True, absolute=True, translation=endPos)
twistControl = self.blueprintNamespace + ":" + self.moduleNamespace + ":twistControl"
utils.matchTwistAngle(twistControl+".rotateZ", ikJoints, blueprintJoints)
for c in containers:
cmds.lockNode(c, lock=True, lockUnpublished=True)
开发者ID:griffinanimator,项目名称:MPR,代码行数:27,代码来源:circleControlStretchyIK.py
示例14: nuke
def nuke():
ilrNodeTypes = [
u"ilrAshikhminShader",
u"ilrBakeLayer",
u"ilrBakeLayerManager",
u"ilrBasicPhotonShader",
u"ilrBssrdfShader",
u"ilrDielectricPhotonShader",
u"ilrDielectricShader",
u"ilrHwBakeVisualizer",
u"ilrLuaNode",
u"ilrNormalMap",
u"ilrOccData",
u"ilrOccSampler",
u"ilrOptionsNode",
u"ilrOrenNayarShader",
u"ilrOutputShaderBackendNode",
u"ilrPhysicPhotonShader",
u"ilrPointCloudShape",
u"ilrPolyColorPerVertex",
u"ilrRaySampler",
u"ilrShadowMask",
u"ilrSurfaceThickness",
u"ilrUIOptionsNode",
u"ilrUVMappingVisualizer",
]
nodes = mc.ls(type=ilrNodeTypes)
if nodes:
mc.lockNode(nodes, l=False)
mc.delete(nodes)
mc.flushUndo()
mc.unloadPlugin("Turtle.mll")
else:
mc.warning("No Turtle nodes found.")
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:34,代码来源:nuke_turtle.py
示例15: removeAllNodeInNamespace
def removeAllNodeInNamespace( ns='' ) :
# Remove every nodes that belong to the given namespace.
# Input : namespace
# Output : Nonde
nodes = mc.ls( '%s:*' % ns )
mc.namespace( set=':' )
if nodes :
# If current namespace contains nodes,
# delete them.
for node in nodes :
if mc.objExists( node ) :
lockState = mc.lockNode( node , q=True )[0]
if lockState :
mc.lockNode( node , l=False )
try :
newName = mc.rename( node , node.split( ':' )[-1] )
print '%s has been renamed to %s' % ( node , newName )
except :
pass
mc.lockNode( newName , l=lockState )
开发者ID:myCodeTD,项目名称:pkmel,代码行数:28,代码来源:pkTools.py
示例16: clean_up_scene
def clean_up_scene (self, *args):
delete_names = ['ikSystem', 'Turtle', 'xgen', 'xgm']
delete_types = ['mentalray', 'container']
delete_list = []
all_nodes = cmds.ls()
# Append all the nodes that specified in deletion_names
for node in all_nodes:
for node_name in delete_names:
if node.startswith(node_name):
delete_list.append(node)
for node_type in delete_types:
if cmds.nodeType(node).startswith(node_type):
delete_list.append(node)
for node in delete_list:
print node
do_delete = cmds.confirmDialog( title='Confirm Deletion', message='Do you want to delete nodes listed in the console?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
if do_delete == 'Yes':
# Delete node tha in delete_list
for node in delete_list:
try:
cmds.lockNode(node, lock=False)
cmds.delete(node)
print node, 'Deleted'
except:
print node, 'Can not be deleted'
pass
else:
print 'Operation canceled.'
开发者ID:Kif11,项目名称:curpigeon_tools,代码行数:34,代码来源:app.py
示例17: cleanCacheNodes
def cleanCacheNodes():
historySwitches = cmds.ls(type='historySwitch')
for switch in historySwitches:
his = cmds.listHistory(switch)
for h in his:
if cmds.objExists(h):
if cmds.nodeType(h) != 'time':
cmds.delete(h)
OpenMaya.MGlobal.displayInfo('== %s has been deleted ==' % h)
# begin the dumbest fucking hack ever
# maya will delete any sets that connected to the orig node. The connection
# only becomes visible when the Relationship Editor is open. Locking the nodes
# prevents their deletion
sets = cmds.ls(type='objectSet')
for s in sets:
# lock-em up...dumb as shitty way of doing things
cmds.lockNode(s, l=True)
nodes = cmds.ls(type='mesh')
for node in nodes:
if cmds.getAttr(node + '.intermediateObject'):
cmds.delete(node)
OpenMaya.MGlobal.displayInfo('== %s has been deleted ==' % node)
# end the dumbest fucking hack ever
for s in sets:
# unlock the nodes
cmds.lockNode(s, l=False)
开发者ID:boochos,项目名称:work,代码行数:27,代码来源:key_util_lib.py
示例18: rename_module_instance
def rename_module_instance(self, new_name):
if new_name == self.user_specified_name:
return True
if utils.does_blueprint_user_specified_name_exist(new_name):
cmds.confirmDialog(
title="Name Confilct",
message="Name \""+new_name+"\" already exists, aborting rename",
button=["Accept"],
defaultButton="Accept"
)
return False
else:
new_namespace = self.module_name+"__"+new_name
cmds.lockNode(self.container_name, lock=False, lockUnpublished=False)
cmds.namespace(setNamespace=":")
cmds.namespace(add=new_namespace)
cmds.namespace(setNamespace=":")
cmds.namespace(moveNamespace=[self.module_namespace, new_namespace])
cmds.namespace(removeNamespace=self.module_namespace)
self.module_namespace = new_namespace
self.container_name = self.module_namespace+"::module_container"
cmds.lockNode(self.container_name, lock=True, lockUnpublished=True)
return True
开发者ID:firstPeterParker,项目名称:mlRig,代码行数:34,代码来源:blueprint.py
示例19: rehook
def rehook(self, new_hook_obj):
old_hook_obj = self.find_hook_obj()
self.hook_obj =self.module_namespace+":unhookedTarget"
if new_hook_obj != None:
if new_hook_obj.find("_translation_control") != -1:
split_string = new_hook_obj.split("_translation_control")
if split_string[1] == "":
if utils.strip_leading_namespace(new_hook_obj)[0] != self.module_namespace:
self.hook_obj = new_hook_obj
if self.hook_obj == old_hook_obj:
return
self.unconstrain_root_from_hook()
cmds.lockNode(self.container_name, lock=False, lockUnpublished=False)
hook_constraint = self.module_namespace+":hook_pointConstraint"
cmds.connectAttr(self.hook_obj+".parentMatrix[0]", hook_constraint+".target[0].targetParentMatrix", force=True)
cmds.connectAttr(self.hook_obj+".translate", hook_constraint+".target[0].targetTranslate", force=True)
cmds.connectAttr(self.hook_obj+".rotatePivot", hook_constraint+".target[0].targetRotatePivot", force=True)
cmds.connectAttr(self.hook_obj+".rotatePivotTranslate", hook_constraint+".target[0].targetRotateTranslate", force=True)
cmds.lockNode(self.container_name, lock=True, lockUnpublished=True)
开发者ID:firstPeterParker,项目名称:mlRig,代码行数:34,代码来源:blueprint.py
示例20: main
def main(log=None):
if not log:
import logging
log = logging.getLogger()
# use ' ' as a fill char and center aligned
log.debug('{0:-<40}'.format('delete_unknow_node'))
allUnknow = cmds.ls(dep=True)
if allUnknow:
for n in allUnknow:
try:
node_type = cmds.nodeType(n)
# TODO: No object matches name: rmanFinalGlobals
# so use try and except to catch this
except:
pass
else:
if( node_type == 'unknown' ):
try:
cmds.lockNode(n, l=False)
cmds.delete(n)
except:
log.error('can not delete%s' % n)
log.error(traceback.format_exc())
else:
log.warning('delete %s success' % n)
开发者ID:hongloull,项目名称:digital37,代码行数:26,代码来源:delete_unknow_node.py
注:本文中的maya.cmds.lockNode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论