Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import maya.cmds as mc
- class NodeFn( object ):
- def __init__(self, node):
- if not self.exists:
- mc.error('{0} - does not exist'.format(node))
- @property
- def exists(self):
- return mc.objExists(node)
- @property
- def objType(self):
- if not self.exists:
- return None
- return mc.nodeType(node)
- ####################
- class AtrributeFn( NodeFn, object ):
- def __init__(self, node):
- super().__init__(node)
- @property
- def parent(self):
- return node.split('.')[0]
- @property
- def attr(self):
- return node.split('.')[1]
- @property
- def defaultValue(self):
- return mc.attributeQuery(self.attr, n=self.parent, ld=1)
- @defaultValue.setter
- def defaultValue(self, value):
- mc.addAttr(self, e=1, dv=value)
- node = 'locator1.tx'
- x = AtrributeFn(node)
- print(x.defaultValue)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement