本文整理匯總了Python中pymel.core.listAttr方法的典型用法代碼示例。如果您正苦於以下問題:Python core.listAttr方法的具體用法?Python core.listAttr怎麽用?Python core.listAttr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymel.core
的用法示例。
在下文中一共展示了core.listAttr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: import_network
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import listAttr [as 別名]
def import_network(_network):
if not _network.hasAttr('_class'):
log.error('[importFromNetwork] Network dont have mandatory attribute _class')
raise AttributeError
cls = _network.getAttr('_class').split('.')[-1]
obj = core.create_class_instance(cls)
if obj is None:
return None
obj._network = _network
for key in pymel.listAttr(_network, userDefined=True):
if '_' != key[0]: # Variables starting with '_' are private
#logging.debug('Importing attribute {0} from {1}'.format(key, _network.name()))
val = _getNetworkAttr(_network.attr(key))
#if hasattr(obj, key):
setattr(obj, key, val)
#else:
# #logging.debug("Can't set attribute {0} to {1}, attribute does not exists".format(key, obj))
# Update network _uid to the current python variable context
# if _network.hasAttr('_uid'):
# _network._uid.set(id(obj))
return obj
示例2: reset_all_keyable_attributes
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import listAttr [as 別名]
def reset_all_keyable_attributes(dagnodes, *args): # @unusedVariable
"""Resets to default values all keyable attributes on the given node
Args:
dagnodes (list): Maya transform nodes to reset
*args: State of the menu item (if existing) send by mgear's dagmenu
"""
for node in dagnodes:
keyable_attrs = cmds.listAttr(node, keyable=True)
reset_selected_channels_value([node], keyable_attrs)
##################################################
# Transfer space
##################################################
示例3: listAttrForMirror
# 需要導入模塊: from pymel import core [as 別名]
# 或者: from pymel.core import listAttr [as 別名]
def listAttrForMirror(node):
"""List attributes to invert the value for mirror posing
Args:
node (PyNode): The Node with the attributes to invert
Returns:
list: Attributes to invert
"""
# TODO: should "ro" be here?
res = ["tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz"]
res.extend(pm.listAttr(node, userDefined=True, shortNames=True))
res = list(filter(lambda x: not x.startswith("inv"), res))
return res