本文整理汇总了Python中maya.cmds.attributeQuery函数的典型用法代码示例。如果您正苦于以下问题:Python attributeQuery函数的具体用法?Python attributeQuery怎么用?Python attributeQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了attributeQuery函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: blendSetups
def blendSetups(self):
constraintsList=[]
for i, jnt in enumerate(self._originalJoints):
const=cmds.parentConstraint(self._ikJoints[i], self._bakingJoints[i], jnt)[0]
constraintsList.append(const)
cmds.addAttr(const, longName="settingsGrp", attributeType="message")
cmds.connectAttr(self.settingsGrp+".blendConstraints", const+".settingsGrp")
#add blending attribute to the settings GRP
if not cmds.attributeQuery("dynamicsSwitch", node=self.settingsGrp, exists=True):
cmds.addAttr(self.settingsGrp, longName="dynamicsSwitch", attributeType="double", keyable=True, min= 0, max=1 ,dv=1)
if not cmds.attributeQuery("bakingRig", node=self.settingsGrp, exists=True):
cmds.addAttr(self.settingsGrp, longName="bakingRig", attributeType="double", keyable=True, min= 0, max=1 ,dv=0)
#create the blendshape Node
splineCurveBS=cmds.blendShape(self.dynamicOutCurve, self.ikCurve, name="%s_BS"%getShortName(self.ikCurve))[0]
#connect blending attrs
cmds.connectAttr("%s.dynamicsSwitch"%self.settingsGrp, "%s.%s"%(splineCurveBS, self.dynamicOutCurve))
#create the reverse node
reverseNode=cmds.shadingNode("reverse", asUtility=True, name="%s_rev"%getShortName(self.settingsGrp))
cmds.connectAttr("%s.bakingRig"%self.settingsGrp, "%s.inputX"%reverseNode)
for const in constraintsList:
weights=cmds.parentConstraint(const, weightAliasList=True, query=True)
cmds.connectAttr("%s.outputX"%reverseNode, "%s.%s"%(const, weights[0]))
cmds.connectAttr("%s.bakingRig"%self.settingsGrp, "%s.%s"%(const, weights[1]))
#connect the reverse output to the ik setup controllers visibility
for ctrl in self.ikControllers:
cmds.connectAttr("%s.outputX"%reverseNode, "%s.visibility"%cmds.listRelatives(ctrl, shapes=True)[0])
for ctrl in self.bakeControllers:
cmds.connectAttr("%s.bakingRig"%self.settingsGrp, "%s.visibility"%cmds.listRelatives(ctrl, shapes=True)[0])
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:28,代码来源:dynamicChainSetup.py
示例2: getattributes
def getattributes(self):
for key, nodes in self.oldNodes.iteritems():
if key == 'expression':
expression = True
else:
expression = False
for oldNode in nodes:
listAttr = cmds.listAttr(oldNode)
if listAttr:
self.attributes[nodes[oldNode]] = {}
for attr in listAttr:
try:
self.attributes[nodes[oldNode]].update({attr: {'value': cmds.getAttr(oldNode + '.' + attr)}})
self.attributes[nodes[oldNode]][attr].update({'type': cmds.getAttr(oldNode + '.' + attr, type=True)})
if expression and attr == 'expression':
self.expressions.update({nodes[oldNode]: self.attributes[nodes[oldNode]][attr]['value']})
except RuntimeError as e:
pass
except ValueError as e:
pass
listAttrCustom = cmds.listAttr(oldNode, userDefined=True)
if listAttrCustom:
self.newAttributes[nodes[oldNode]] = {}
for attr in listAttrCustom:
try:
self.newAttributes[nodes[oldNode]].update({attr: {'type': cmds.getAttr(oldNode + '.' + attr, type=True)}})
if cmds.attributeQuery(attr, node=oldNode, minExists=True):
self.newAttributes[nodes[oldNode]][attr].update({'min': cmds.attributeQuery(attr, node=oldNode, min=True)})
if cmds.attributeQuery(attr, node=oldNode, maxExists=True):
self.newAttributes[nodes[oldNode]][attr].update({'max': cmds.attributeQuery(attr, node=oldNode, max=True)})
except RuntimeError as e:
pass
except ValueError as e:
pass
开发者ID:Regnareb,项目名称:Maya,代码行数:35,代码来源:autorig.py
示例3: testImport
def testImport(self):
"""
Tests that the built-in metadata attribute converters can import
hidden, instanceable, and kind metadata properly.
"""
# pCube1 and pCube2 have USD_kind.
self.assertEqual(cmds.getAttr('pCube1.USD_kind'), 'potato')
self.assertEqual(cmds.getAttr('pCube2.USD_kind'), 'bakedpotato')
# pCube2, pCube4, and pCube5 have USD_hidden. pCube1 and pCube3 do not.
self.assertTrue(
cmds.attributeQuery('USD_hidden', node='pCube2', exists=True))
self.assertTrue(
cmds.attributeQuery('USD_hidden', node='pCube4', exists=True))
self.assertTrue(
cmds.attributeQuery('USD_hidden', node='pCube5', exists=True))
self.assertFalse(
cmds.attributeQuery('USD_hidden', node='pCube1', exists=True))
self.assertFalse(
cmds.attributeQuery('USD_hidden', node='pCube3', exists=True))
self.assertTrue(cmds.getAttr('pCube2.USD_hidden'))
self.assertTrue(cmds.getAttr('pCube4.USD_hidden'))
self.assertFalse(cmds.getAttr('pCube5.USD_hidden'))
# pCube3 and pCube4 have USD_instanceable.
self.assertTrue(cmds.getAttr('pCube3.USD_instanceable'))
self.assertTrue(cmds.getAttr('pCube4.USD_instanceable'))
开发者ID:lvxejay,项目名称:USD,代码行数:28,代码来源:testUsdMetadataAttributeConverters.py
示例4: hijackHybridScale
def hijackHybridScale(obj1='', obj2='', lengthAttr='scaleZ', attrPrefix='', attrSuffix='', connectExisting=False):
'''
obj1 = slave
obj2 = master
lengthAttr = given attr is used as length scale
remaining scales are combined to control girth of object
'''
# find girth attrs
girthAttrs = []
if lengthAttr == 'scaleX':
girthAttrs = ['scaleY', 'scaleZ']
elif lengthAttr == 'scaleY':
girthAttrs = ['scaleX', 'scaleZ']
else:
girthAttrs = ['scaleX', 'scaleY']
# connects
length = attrPrefix + 'Length' + attrSuffix
girth = attrPrefix + 'Girth' + attrSuffix
if not cmds.attributeQuery(length, node=obj2, exists=True):
hijackAttrs(obj1, obj2, attrOrig=lengthAttr, attrNew=length, set=False, default=None)
else:
if connectExisting is True:
cmds.connectAttr(obj2 + '.' + length, obj1 + '.' + lengthAttr)
if not cmds.attributeQuery(girth, node=obj2, exists=True):
hijackAttrs(obj1, obj2, attrOrig=girthAttrs[0], attrNew=girth, set=False, default=None)
# cmds.connectAttr(obj2 + '.' + girth, obj1 + '.' + girthAttrs[1])
#
hijackForceAttr(name=girthAttrs[1], objAttr1=(obj1 + '.' + girthAttrs[1]), objAttr2=(obj2 + '.' + girth))
else:
if connectExisting is True:
# cmds.connectAttr(obj2 + '.' + girth, obj1 + '.' + girthAttrs[0])
# cmds.connectAttr(obj2 + '.' + girth, obj1 + '.' + girthAttrs[1])
#
hijackForceAttr(name=girthAttrs[0], objAttr1=(obj1 + '.' + girthAttrs[0]), objAttr2=(obj2 + '.' + girth))
hijackForceAttr(name=girthAttrs[1], objAttr1=(obj1 + '.' + girthAttrs[1]), objAttr2=(obj2 + '.' + girth))
开发者ID:boochos,项目名称:work,代码行数:35,代码来源:atom_miscellaneous_lib.py
示例5: setSoftMinMaxValue
def setSoftMinMaxValue(fieldName, nodeName):
# Some values do not have a sotft min / max -> set manually
# Dynaimc Simulation
if fieldName == 'viscosity':
minSoft = 0
maxSoft = 1
# Velocity
elif fieldName == 'velocitySwirl':
minSoft = 0
maxSoft = 10
# Turbulence
elif fieldName == 'turbulenceStrength':
minSoft = 0
maxSoft = 1
elif fieldName == 'turbulenceFrequency':
minSoft = 0
maxSoft = 2
elif fieldName == 'turbulenceSpeed':
minSoft = 0
maxSoft = 2
else:
minSoft = cmds.attributeQuery(fieldName, node=nodeName, softMin=True)
maxSoft = cmds.attributeQuery(fieldName, node=nodeName, softMax=True)
minSoft = minSoft[0]
maxSoft = maxSoft[0]
return [minSoft, maxSoft]
开发者ID:wolfpatrick,项目名称:FluidExplorerPlugin,代码行数:29,代码来源:ParamterTabDefaultValues.py
示例6: messageConnect
def messageConnect(fromNode=None, toNode=None, fromName=None, toName=None, category=None):
'''
Creates a message attributes on fromNode and toNode with the names fromName and toName respectively
Connects the two new attributes
'''
#validation
if not fromNode or not toNode and (len(cmds.ls(sl=1)) == 2):
fromNode = cmds.ls(sl=1)[0]
toNode = cmds.ls(sl=1)[1]
if not fromNode or not toNode:
return 'Argument Error, messageConnect requires fromNode and toNode as either arguments or 2 selected nodes'
if not fromName or not toName:
return 'Argument Error, messageConnect requires fromName and toName arguments for newly created attrs'
# Add attributes
if cmds.attributeQuery(fromName, node = fromNode, exists=1):
print '%s.%s: Attribute exists' % (fromNode, fromName)
else:
cmds.addAttr(fromNode, ln=fromName, at='message', category=category)
print '%s.%s: Attribute created' % (fromNode, fromName)
if cmds.attributeQuery(toName, node = toNode, exists=1):
print '%s.%s: Attribute exists' % (toNode, toName)
else:
cmds.addAttr(toNode, ln=toName, at='message', category=category)
print '%s.%s: Attribute created' % (toNode, toName)
# Connect attributes
cmds.connectAttr('%s.%s' % (fromNode, fromName), '%s.%s' % (toNode, toName), f=1)
print '%s.%s connected to %s.%s' % (fromNode, fromName, toNode, toName)
开发者ID:duncanrudd,项目名称:rooftops,代码行数:33,代码来源:metadata.py
示例7: makeSelection
def makeSelection(s):
"""
Finalize Selection
"""
intersection = s.getPointer()
if intersection:
# Pick nearest bone with influence
mesh, faceID = intersection
bone = s.pickSkeleton(mesh, faceID)
if bone:
# If the bone has an attribute "control"
# Follow that attribute to the source.
if cmds.attributeQuery("control", n=bone, ex=True):
controller = cmds.getAttr("%s.control" % bone)
else:
controller = bone
s.expectedChange = True
s.select.ignore = True
cmds.select(controller, r=True)
s.boneSetColour(bone, (0.3, 0.8, 0.1))
# If we have previously selected a joint. Turn off selected flag
if s.lastControl:
cmds.setAttr(s.lastControl, 0)
if cmds.attributeQuery("selected", n=controller, ex=True):
s.lastControl = "%s.selected" % controller
cmds.setAttr(s.lastControl, 1)
else:
print "Nothing to select."
s.revertTool()
开发者ID:internetimagery,项目名称:RigTool,代码行数:29,代码来源:__init__.py
示例8: editPivotDriver
def editPivotDriver(self, driver):
self.pivotDriver = driver
#get driver range
node,attr = driver.split('.',1)
value = mc.getAttr(driver)
minValue = mc.attributeQuery(attr, node=node, minimum=True)[0]
maxValue = mc.attributeQuery(attr, node=node, maximum=True)[0]
#create a ui with a slider
self.pivotDriverWindow = 'ml_pivot_editPivotDriverUI'
if mc.window(self.pivotDriverWindow, exists=True):
mc.deleteUI(self.pivotDriverWindow)
window = mc.window(self.pivotDriverWindow, width=1, height=1)
mc.columnLayout()
self.floatSlider = mc.floatSliderButtonGrp(label=attr,
field=True,
value=value,
buttonLabel='Bake',
minValue=minValue,
maxValue=maxValue,
buttonCommand=self.doEditPivotDriver )
mc.showWindow( window )
mc.window(self.pivotDriverWindow, edit=True, width=1, height=1)
开发者ID:liudger,项目名称:ml_tools,代码行数:27,代码来源:ml_pivot.py
示例9: exec_import_policy
def exec_import_policy(selection, node_name, file_name):
""" Import policy example
:param selection: (list) of selected objects
:param node_name: (string) created shading node
:param file_name: (string) texture file name
"""
file_name = file_name.split('.')[0]
if file_name.endswith('_DIF'):
for obj in selection:
if cmds.attributeQuery('color', node=obj, exists=True):
cmds.connectAttr('%s.outColor' % node_name, '%s.color' % obj)
elif file_name.endswith('_SPE'):
for obj in selection:
if cmds.attributeQuery('specularColor', node=obj, exists=True):
cmds.connectAttr('%s.outColor' % node_name, '%s.specularColor' % obj)
elif file_name.endswith('_NOR'):
for obj in selection:
if cmds.attributeQuery('normalCamera', node=obj, exists=True):
# create bump node
current_bump_node = cmds.shadingNode('bump2d', name='%s_bump' % node_name, asUtility=True)
cmds.setAttr('%s.bumpInterp' % current_bump_node, 1)
# connect nodes
cmds.connectAttr('%s.outAlpha' % node_name, '%s.bumpValue' % current_bump_node)
cmds.connectAttr('%s.outNormal' % current_bump_node, '%s.normalCamera' % obj)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:29,代码来源:mttImportPolicy.py
示例10: get_bounds
def get_bounds(obj, attr, min_default, max_default):
"""
Try to retrieve the range for the given attribute, if min or max fail it'll set default values
:param obj: the object's name
:type obj: str
:param attr: attribute's name
:type attr: str
:param min_default: minimum default value
:param max_default: max default value
:type min_default: float | int
:type max_default: float | int
:return: minimum, maximum
:rtype : tuple
"""
try:
assert cmds.attributeQuery(attr, n=obj, mxe=True)
maxi = cmds.attributeQuery(attr, n=obj, max=True)[0]
except (RuntimeError, AssertionError):
maxi = max_default
try:
assert cmds.attributeQuery(attr, n=obj, mne=True)
mini = cmds.attributeQuery(attr, n=obj, min=True)[0]
except (RuntimeError, AssertionError):
mini = min_default
return mini, maxi
开发者ID:DavideAlidosi,项目名称:May9,代码行数:25,代码来源:mass_attr.py
示例11: checkDisp
def checkDisp(self):
getExistingText = self.outWindow.toPlainText()
if len(getExistingText) > 0:
self.outputText = []
getSelect = cmds.ls(sl=True)[0]
if cmds.objectType(getSelect, isType='objectSet') == True:
theSet = getSelect
if self.dispHeightButton.isChecked()==True:
if cmds.attributeQuery('aiDispHeight',node=theSet,ex=True) == False:
addDispHeight = cmds.addAttr(ln='aiDispHeight',at='float')
self.outputText.append('Created Displacement Height attribute')
else:
self.outputText.append("<font color=yellow>Displacement Height Already Exists<font/><br>")
if self.dispPadButton.isChecked()==True:
if cmds.attributeQuery('aiDispPadding',node=theSet,ex=True) == False:
addBoundsPad = cmds.addAttr(ln='aiDispPadding',at='float')
self.outputText.append('Created Displacement Padding attribute')
else:
self.outputText.append("<font color=yellow>Displacement Padding Already Exists<font/><br>")
if self.dispZeroButton.isChecked()==True:
if cmds.attributeQuery('aiDispZeroValue',node=theSet,ex=True) == False:
addScalarZeroValue = cmds.addAttr(ln='aiDispZeroValue',at='float')
self.outputText.append('Created Displacement Zero Value attribute')
else:
self.outputText.append("<font color=yellow>Disp Zero Already Exists<font/><br>")
if self.autoBumpButton.isChecked()==True:
if cmds.attributeQuery('aiDispAutobump',node=theSet,ex=True) == False:
addBoundsPad = cmds.addAttr(ln='aiDispAutobump',at='bool',dv=1)
self.outputText.append('Created Disp Auto Bump attribute')
else:
self.outputText.append("<font color=yellow>AutoBump Already Exists<font/>")
else:
self.outputText.append("<font color=yellow>Select a Set to Add Attributes<font/>")
self.getOutputText()
开发者ID:scomly,项目名称:myStuff,代码行数:35,代码来源:arnoldObjectProperties.py
示例12: createAttribute
def createAttribute():
if(not cmds.textField(tf01, text = True, query = True) == ''):
niceName, longName = attrNameDefC()
sel = selectListC()
if(dataTypeC == 'float3'):
for obj in sel:
if(not cmds.attributeQuery(longName, node = obj, exists = True)):
cmds.addAttr(obj, niceName = niceName, longName = longName, usedAsColor = True, attributeType = dataTypeC)
cmds.addAttr(obj, longName = '%sR' % longName, attributeType = 'float', parent = longName)
cmds.addAttr(obj, longName = '%sG' % longName, attributeType = 'float', parent = longName)
cmds.addAttr(obj, longName = '%sB' % longName, attributeType = 'float', parent = longName)
elif(dataTypeC == 'double3'):
for obj in sel:
if(not cmds.attributeQuery(longName, node = obj, exists = True)):
cmds.addAttr(obj, niceName = niceName, longName = longName, attributeType = dataTypeC)
cmds.addAttr(obj, longName = '%sX' % longName, attributeType = 'double', parent = longName)
cmds.addAttr(obj, longName = '%sY' % longName, attributeType = 'double', parent = longName)
cmds.addAttr(obj, longName = '%sZ' % longName, attributeType = 'double', parent = longName)
elif(dataTypeC == 'string'):
for obj in sel:
if(not cmds.attributeQuery(longName, node = obj, exists = True)):
cmds.addAttr(obj, niceName = niceName, longName = longName, dataType = dataTypeC)
else:
for obj in sel:
if(not cmds.attributeQuery(longName, node = obj, exists = True)):
cmds.addAttr(obj, niceName = niceName, longName = longName, attributeType = dataTypeC)
cmds.textField(tf01, text = '', edit = True)
开发者ID:diegoinacio,项目名称:coding,代码行数:27,代码来源:mayaAiAttribManager.py
示例13: lock_attributes
def lock_attributes(obj=None, attr=None, lock=True, hide=True):
#--- check parameters
assert obj, check.error(obj, 1, `obj`)
assert attr, check.error(attr, 1, `attr`)
assert isinstance(attr, list), check.error(obj, 12, `attr`)
if isinstance(obj, list):
for i in obj:
for a in attr:
compound = cmds.attributeQuery(a, node=i, listChildren=True)
if compound:
for c in compound:
if hide:
cmds.setAttr(i + '.' + c, lock=lock, keyable=False)
else:
cmds.setAttr(i + '.' + c, lock=lock, keyable=True)
else:
if hide:
cmds.setAttr(i + '.' + a, lock=lock, keyable=False)
else:
cmds.setAttr(i + '.' + a, lock=lock, keyable=True)
return
for a in attr:
compound = cmds.attributeQuery(a, node=obj, listChildren=True)
if compound:
for c in compound:
if hide:
cmds.setAttr(obj + '.' + c, lock=lock, keyable=False)
else:
cmds.setAttr(obj + '.' + c, lock=lock, keyable=True)
else:
if hide:
cmds.setAttr(obj + '.' + a, lock=lock, keyable=False)
else:
cmds.setAttr(obj + '.' + a, lock=lock, keyable=True)
开发者ID:jonntd,项目名称:Public,代码行数:35,代码来源:attribute.py
示例14: shapeIsExportable
def shapeIsExportable(node_name):
#check the node exists
if not cmds.objExists(node_name):
return False
#check if the node has a visibility attribute meaning ita a dag node
if not cmds.attributeQuery('visibility', node=node_name, exists=True):
return False
#check visibility flag
if not cmds.getAttr(node_name+'.visibility'):
return False
#check to see if its an intermediate mesh
if cmds.attributeQuery('intermediateObject', node=node_name, exists=True):
if cmds.getAttr(node_name+'.intermediateObject'):
return False
#is it in a hidden display layer
if (cmds.attributeQuery('overrideEnabled', node=node_name, exists=True) and cmds.getAttr(node_name+'.overrideEnabled')):
if not cmds.getAttr(node_name+'.overrideVisibility'):
return False
#has it got a parent and is it visible
if cmds.listRelatives(node_name, parent=True):
if not shapeIsExportable(cmds.listRelatives(node_name, parent=True)[0]):
return False
return True
开发者ID:Len3d,项目名称:appleseed,代码行数:32,代码来源:ms_commands.py
示例15: rsChangeCheck
def rsChangeCheck(i_b_state, i_s_floatField):
if i_s_floatField == "rsMinField":
i_b_state = cmds.checkBox("rsMinBox", query=True, value=True)
else:
i_b_state = cmds.checkBox("rsMaxBox", query=True, value=True)
l_oSels = rsObjList()
if i_b_state == True:
if i_s_floatField == "rsMinField":
b_minimum = cmds.attributeQuery(l_oSels[1], node=l_oSels[0], minExists=True)
f_atValue = 0.0
if b_minimum == 1:
f_atValue = (cmds.attributeQuery(l_oSels[1], node=l_oSels[0], minimum=True))[0]
else:
cmds.addAttr(l_oSels[2], edit=True, hasMinValue=True)
if i_s_floatField == "rsMaxField":
b_maximum = cmds.attributeQuery(l_oSels[1], node=l_oSels[0], maxExists=True)
f_atValue = 1.0
if b_maximum == 1:
f_atValue = (cmds.attributeQuery(l_oSels[1], node=l_oSels[0], maximum=True))[0]
else:
cmds.addAttr(l_oSels[2], edit=True, hasMaxValue=True)
cmds.addAttr(l_oSels[2], edit=True, maxValue=f_atValue)
cmds.floatField(i_s_floatField, edit=True, value=f_atValue, enable=True)
else:
cmds.floatField(i_s_floatField, edit=True, value=0, enable=False)
if i_s_floatField == "rsMinField":
cmds.addAttr(l_oSels[2], edit=True, hasMinValue=False)
else:
cmds.addAttr(l_oSels[2], edit=True, hasMaxValue=False)
return True
开发者ID:RigStudio,项目名称:rsEditAttributes,代码行数:30,代码来源:rsEditAttributes.py
示例16: __init__
def __init__( self, fullAttrName ):
self.className = 'AnimCurveForBake'
nodeName, attr = fullAttrName.split( '.' )
attrType = cmds.attributeQuery( attr, node=nodeName, attributeType=1 )
self.nodeType = ''
if attrType == 'doubleLinear':
self.nodeType = 'animCurveTL'
elif attrType == 'doubleAngle':
self.nodeType = 'animCurveTA'
else:
self.nodeType = 'animCurveTU'
self.attrName = fullAttrName
self.times = []
self.values = []
self.connectionExists = True
if not cmds.listConnections( fullAttrName, s=1, d=0 ):
node, attr = fullAttrName.split( '.' )
parentAttrs = cmds.attributeQuery( attr, node=node, listParent=1 )
if parentAttrs:
if cmds.listConnections( node+'.'+parentAttrs[0] ):pass
else:
self.connectionExists = False
self.times.append( 1 )
self.values.append( cmds.getAttr( fullAttrName ) )
else:
self.connectionExists = False
self.times.append( 1 )
self.values.append( cmds.getAttr( fullAttrName ) )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:sgModelDg.py
示例17: __init__
def __init__(self, targetObj, attr ):
chBox = cmds.attributeQuery( attr, node=targetObj, channelBox=1 )
key = cmds.attributeQuery( attr, node=targetObj, keyable=1 )
atType= cmds.attributeQuery( attr, node=targetObj, attributeType=1 )
listEnum = cmds.attributeQuery( attr, node=targetObj, listEnum=1 )
minvalue = None
maxValue = None
if cmds.attributeQuery( attr, node=targetObj, minExists=1 ):
minvalue = cmds.attributeQuery( attr, node=targetObj, min=1 )
if cmds.attributeQuery( attr, node=targetObj, maxExists=1 ):
maxValue = cmds.attributeQuery( attr, node=targetObj, max=1 )
shortName = cmds.attributeQuery( attr, node=targetObj, shortName=1 )
longName = cmds.attributeQuery( attr, node=targetObj, longName=1 )
options = { 'sn':shortName, 'ln':longName, 'k':key, 'cb':chBox }
if listEnum:
options.update( {'listEnum':listEnum} )
if minvalue:
options.update( {'min':minvalue[0]} )
if maxValue:
options.update( {'max':maxValue[0]} )
value = cmds.getAttr( targetObj+'.'+attr )
self.attr = attr
self.value = value
self.atType = atType
self.options = options
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:sgBModel_data.py
示例18: testImport_HiddenInstanceableKind
def testImport_HiddenInstanceableKind(self):
"""
Tests that the adaptor mechanism can import
hidden, instanceable, and kind metadata properly.
"""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none')
# pCube1 and pCube2 have USD_kind.
self.assertEqual(cmds.getAttr('pCube1.USD_kind'), 'potato')
self.assertEqual(cmds.getAttr('pCube2.USD_kind'), 'bakedpotato')
# pCube2, pCube4, and pCube5 have USD_hidden. pCube1 and pCube3 do not.
self.assertTrue(
cmds.attributeQuery('USD_hidden', node='pCube2', exists=True))
self.assertTrue(
cmds.attributeQuery('USD_hidden', node='pCube4', exists=True))
self.assertTrue(
cmds.attributeQuery('USD_hidden', node='pCube5', exists=True))
self.assertFalse(
cmds.attributeQuery('USD_hidden', node='pCube1', exists=True))
self.assertFalse(
cmds.attributeQuery('USD_hidden', node='pCube3', exists=True))
self.assertTrue(cmds.getAttr('pCube2.USD_hidden'))
self.assertTrue(cmds.getAttr('pCube4.USD_hidden'))
self.assertFalse(cmds.getAttr('pCube5.USD_hidden'))
# pCube3 and pCube4 have USD_instanceable.
self.assertTrue(cmds.getAttr('pCube3.USD_instanceable'))
self.assertTrue(cmds.getAttr('pCube4.USD_instanceable'))
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:32,代码来源:testUsdMayaAdaptorMetadata.py
示例19: addDistanceAttrs
def addDistanceAttrs(attrObject,dist=0.0):
'''
Add basic distance attributes to the specified object
@param attrObject: Object to add distance attributes to
@type attrObject: str
@param dist: Rest distance value
@type dist: int or float
'''
# ==========
# - Checks -
# ==========
if not mc.objExists(attrObject):
raise Exception('Attribute object "'+attrObject+'" does not exist!')
# ===========================
# - Add Distance Attributes -
# ===========================
if not mc.attributeQuery('distance',n=attrObject,ex=True):
mc.addAttr(attrObject,ln='distance',min=0,dv=dist,k=True)
if not mc.attributeQuery('restDistance',n=attrObject,ex=True):
mc.addAttr(attrObject,ln='restDistance',min=0,dv=dist,k=True)
# =================
# - Return Result -
# =================
return attrObject+'.distance'
开发者ID:auqeyjf,项目名称:glTools,代码行数:29,代码来源:distanceDriver.py
示例20: addLengthAttrs
def addLengthAttrs(attrObject, length=0.0):
"""
Add basic curve length attributes to the specified object
@param attrObject: Object to add curve length attributes to
@type attrObject: str
@param length: Rest length value
@type length: int or float
"""
# ==========
# - Checks -
# ==========
if not cmds.objExists(attrObject):
raise Exception('Attribute object "' + attrObject + '" does not exist!')
# ===========================
# - Add Distance Attributes -
# ===========================
if not cmds.attributeQuery('length', n=attrObject, ex=True):
cmds.addAttr(attrObject, ln='length', min=0, dv=dist, k=True)
if not cmds.attributeQuery('restLength', n=attrObject, ex=True):
cmds.addAttr(attrObject, ln='restLength', min=0, dv=dist, k=True)
# =================
# - Return Result -
# =================
return attrObject + '.length'
开发者ID:bennymuller,项目名称:glTools,代码行数:29,代码来源:curveLengthDriver.py
注:本文中的maya.cmds.attributeQuery函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论