body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def deleteAttr(self, attr):
'Delete `attr` from node\n\n Arguments:\n attr (Plug): Attribute to remove\n\n Example:\n >>> node = createNode("transform")\n >>> node["myAttr"] = Double()\n >>> node.deleteAttr("myAttr")\n >>> node.hasAttr("myAttr")\n... | 4,967,128,804,810,269,000 | Delete `attr` from node
Arguments:
attr (Plug): Attribute to remove
Example:
>>> node = createNode("transform")
>>> node["myAttr"] = Double()
>>> node.deleteAttr("myAttr")
>>> node.hasAttr("myAttr")
False | cmdx.py | deleteAttr | fvbehr/cmdx | python | def deleteAttr(self, attr):
'Delete `attr` from node\n\n Arguments:\n attr (Plug): Attribute to remove\n\n Example:\n >>> node = createNode("transform")\n >>> node["myAttr"] = Double()\n >>> node.deleteAttr("myAttr")\n >>> node.hasAttr("myAttr")\n... |
def connections(self, type=None, unit=None, plugs=False):
'Yield plugs of node with a connection to any other plug\n\n Arguments:\n unit (int, optional): Return plug in this unit,\n e.g. Meters or Radians\n type (str, optional): Restrict output to nodes of this type,\n ... | -953,114,406,584,097,200 | Yield plugs of node with a connection to any other plug
Arguments:
unit (int, optional): Return plug in this unit,
e.g. Meters or Radians
type (str, optional): Restrict output to nodes of this type,
e.g. "transform" or "mesh"
plugs (bool, optional): Return plugs, rather than nodes
Example:... | cmdx.py | connections | fvbehr/cmdx | python | def connections(self, type=None, unit=None, plugs=False):
'Yield plugs of node with a connection to any other plug\n\n Arguments:\n unit (int, optional): Return plug in this unit,\n e.g. Meters or Radians\n type (str, optional): Restrict output to nodes of this type,\n ... |
def connection(self, type=None, unit=None, plug=False):
'Singular version of :func:`connections()`'
return next(self.connections(type, unit, plug), None) | -1,656,226,878,386,424,600 | Singular version of :func:`connections()` | cmdx.py | connection | fvbehr/cmdx | python | def connection(self, type=None, unit=None, plug=False):
return next(self.connections(type, unit, plug), None) |
@protected
def path(self):
'Return full path to node\n\n Example:\n >>> parent = createNode("transform", "myParent")\n >>> child = createNode("transform", "myChild", parent=parent)\n >>> child.name()\n u\'myChild\'\n >>> child.path()\n u\'|myP... | -6,994,904,142,941,890,000 | Return full path to node
Example:
>>> parent = createNode("transform", "myParent")
>>> child = createNode("transform", "myChild", parent=parent)
>>> child.name()
u'myChild'
>>> child.path()
u'|myParent|myChild' | cmdx.py | path | fvbehr/cmdx | python | @protected
def path(self):
'Return full path to node\n\n Example:\n >>> parent = createNode("transform", "myParent")\n >>> child = createNode("transform", "myChild", parent=parent)\n >>> child.name()\n u\'myChild\'\n >>> child.path()\n u\'|myP... |
@protected
def dagPath(self):
'Return a om.MDagPath for this node\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> parent = createNode("transform", name="Parent")\n >>> child = createNode("transform", name="Child", parent=parent)\n >>> path = child.dagP... | 4,291,435,113,795,996,700 | Return a om.MDagPath for this node
Example:
>>> _ = cmds.file(new=True, force=True)
>>> parent = createNode("transform", name="Parent")
>>> child = createNode("transform", name="Child", parent=parent)
>>> path = child.dagPath()
>>> str(path)
'Child'
>>> str(path.pop())
'Parent' | cmdx.py | dagPath | fvbehr/cmdx | python | @protected
def dagPath(self):
'Return a om.MDagPath for this node\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> parent = createNode("transform", name="Parent")\n >>> child = createNode("transform", name="Child", parent=parent)\n >>> path = child.dagP... |
@protected
def shortestPath(self):
'Return shortest unique path to node\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> parent = createNode("transform", name="myParent")\n >>> child = createNode("transform", name="myChild", parent=parent)\n >>> child.s... | 5,479,381,250,253,778,000 | Return shortest unique path to node
Example:
>>> _ = cmds.file(new=True, force=True)
>>> parent = createNode("transform", name="myParent")
>>> child = createNode("transform", name="myChild", parent=parent)
>>> child.shortestPath()
u'myChild'
>>> child = createNode("transform", name="myChild")
... | cmdx.py | shortestPath | fvbehr/cmdx | python | @protected
def shortestPath(self):
'Return shortest unique path to node\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> parent = createNode("transform", name="myParent")\n >>> child = createNode("transform", name="myChild", parent=parent)\n >>> child.s... |
@property
def level(self):
'Return the number of parents this DAG node has\n\n Example:\n >>> parent = createNode("transform")\n >>> child = createNode("transform", parent=parent)\n >>> child.level\n 1\n >>> parent.level\n 0\n\n '
r... | 4,354,758,280,728,383,000 | Return the number of parents this DAG node has
Example:
>>> parent = createNode("transform")
>>> child = createNode("transform", parent=parent)
>>> child.level
1
>>> parent.level
0 | cmdx.py | level | fvbehr/cmdx | python | @property
def level(self):
'Return the number of parents this DAG node has\n\n Example:\n >>> parent = createNode("transform")\n >>> child = createNode("transform", parent=parent)\n >>> child.level\n 1\n >>> parent.level\n 0\n\n '
r... |
@property
def boundingBox(self):
'Return a cmdx.BoundingBox of this DAG node'
return BoundingBox(self._fn.boundingBox) | 5,388,794,584,110,900,000 | Return a cmdx.BoundingBox of this DAG node | cmdx.py | boundingBox | fvbehr/cmdx | python | @property
def boundingBox(self):
return BoundingBox(self._fn.boundingBox) |
def hide(self):
'Set visibility to False'
self['visibility'] = False | -7,527,321,505,382,108,000 | Set visibility to False | cmdx.py | hide | fvbehr/cmdx | python | def hide(self):
self['visibility'] = False |
def show(self):
'Set visibility to True'
self['visibility'] = True | -7,172,749,785,531,764,000 | Set visibility to True | cmdx.py | show | fvbehr/cmdx | python | def show(self):
self['visibility'] = True |
def addChild(self, child, index=Last):
'Add `child` to self\n\n Arguments:\n child (Node): Child to add\n index (int, optional): Physical location in hierarchy,\n defaults to cmdx.Last\n\n Example:\n >>> parent = createNode("transform")\n >>> ... | -4,976,683,699,214,987,000 | Add `child` to self
Arguments:
child (Node): Child to add
index (int, optional): Physical location in hierarchy,
defaults to cmdx.Last
Example:
>>> parent = createNode("transform")
>>> child = createNode("transform")
>>> parent.addChild(child) | cmdx.py | addChild | fvbehr/cmdx | python | def addChild(self, child, index=Last):
'Add `child` to self\n\n Arguments:\n child (Node): Child to add\n index (int, optional): Physical location in hierarchy,\n defaults to cmdx.Last\n\n Example:\n >>> parent = createNode("transform")\n >>> ... |
def assembly(self):
'Return the top-level parent of node\n\n Example:\n >>> parent1 = createNode("transform")\n >>> parent2 = createNode("transform")\n >>> child = createNode("transform", parent=parent1)\n >>> grandchild = createNode("transform", parent=child)\n ... | -5,640,171,306,117,309,000 | Return the top-level parent of node
Example:
>>> parent1 = createNode("transform")
>>> parent2 = createNode("transform")
>>> child = createNode("transform", parent=parent1)
>>> grandchild = createNode("transform", parent=child)
>>> child.assembly() == parent1
True
>>> parent2.assembly() == ... | cmdx.py | assembly | fvbehr/cmdx | python | def assembly(self):
'Return the top-level parent of node\n\n Example:\n >>> parent1 = createNode("transform")\n >>> parent2 = createNode("transform")\n >>> child = createNode("transform", parent=parent1)\n >>> grandchild = createNode("transform", parent=child)\n ... |
def transform(self, space=sObject, time=None):
'Return TransformationMatrix'
plug = (self['worldMatrix'][0] if (space == sWorld) else self['matrix'])
return TransformationMatrix(plug.asMatrix(time)) | -7,353,854,567,979,109,000 | Return TransformationMatrix | cmdx.py | transform | fvbehr/cmdx | python | def transform(self, space=sObject, time=None):
plug = (self['worldMatrix'][0] if (space == sWorld) else self['matrix'])
return TransformationMatrix(plug.asMatrix(time)) |
def mapFrom(self, other, time=None):
'Return TransformationMatrix of `other` relative self\n\n Example:\n >>> a = createNode("transform")\n >>> b = createNode("transform")\n >>> a["translate"] = (0, 5, 0)\n >>> b["translate"] = (0, -5, 0)\n >>> delta = a... | -8,735,090,727,095,845,000 | Return TransformationMatrix of `other` relative self
Example:
>>> a = createNode("transform")
>>> b = createNode("transform")
>>> a["translate"] = (0, 5, 0)
>>> b["translate"] = (0, -5, 0)
>>> delta = a.mapFrom(b)
>>> delta.translation()[1]
10.0
>>> a = createNode("transform")
>>> b... | cmdx.py | mapFrom | fvbehr/cmdx | python | def mapFrom(self, other, time=None):
'Return TransformationMatrix of `other` relative self\n\n Example:\n >>> a = createNode("transform")\n >>> b = createNode("transform")\n >>> a["translate"] = (0, 5, 0)\n >>> b["translate"] = (0, -5, 0)\n >>> delta = a... |
def mapTo(self, other, time=None):
'Return TransformationMatrix of self relative `other`\n\n See :func:`mapFrom` for examples.\n\n '
return other.mapFrom(self, time) | -7,217,237,857,843,995,000 | Return TransformationMatrix of self relative `other`
See :func:`mapFrom` for examples. | cmdx.py | mapTo | fvbehr/cmdx | python | def mapTo(self, other, time=None):
'Return TransformationMatrix of self relative `other`\n\n See :func:`mapFrom` for examples.\n\n '
return other.mapFrom(self, time) |
def parent(self, type=None):
'Return parent of node\n\n Arguments:\n type (str, optional): Return parent, only if it matches this type\n\n Example:\n >>> parent = createNode("transform")\n >>> child = createNode("transform", parent=parent)\n >>> child.parent... | 1,257,059,951,428,212,500 | Return parent of node
Arguments:
type (str, optional): Return parent, only if it matches this type
Example:
>>> parent = createNode("transform")
>>> child = createNode("transform", parent=parent)
>>> child.parent() == parent
True
>>> not child.parent(type="camera")
True
>>> parent.pare... | cmdx.py | parent | fvbehr/cmdx | python | def parent(self, type=None):
'Return parent of node\n\n Arguments:\n type (str, optional): Return parent, only if it matches this type\n\n Example:\n >>> parent = createNode("transform")\n >>> child = createNode("transform", parent=parent)\n >>> child.parent... |
def children(self, type=None, filter=om.MFn.kTransform, query=None, contains=None):
'Return children of node\n\n All returned children are transform nodes, as specified by the\n `filter` argument. For shapes, use the :func:`shapes` method.\n The `contains` argument only returns transform nodes ... | -6,300,038,422,551,337,000 | Return children of node
All returned children are transform nodes, as specified by the
`filter` argument. For shapes, use the :func:`shapes` method.
The `contains` argument only returns transform nodes containing
a shape of the type provided.
Arguments:
type (str, optional): Return only children that match this t... | cmdx.py | children | fvbehr/cmdx | python | def children(self, type=None, filter=om.MFn.kTransform, query=None, contains=None):
'Return children of node\n\n All returned children are transform nodes, as specified by the\n `filter` argument. For shapes, use the :func:`shapes` method.\n The `contains` argument only returns transform nodes ... |
def descendent(self, type=om.MFn.kInvalid):
'Singular version of :func:`descendents()`\n\n A recursive, depth-first search.\n\n .. code-block:: python\n\n a\n |\n b---d\n | |\n c e\n\n Example:\n >>> _ = cmds.file(new=True, f... | -2,679,626,154,566,718,000 | Singular version of :func:`descendents()`
A recursive, depth-first search.
.. code-block:: python
a
|
b---d
| |
c e
Example:
>>> _ = cmds.file(new=True, force=True)
>>> a = createNode("transform", "a")
>>> b = createNode("transform", "b", parent=a)
>>> c = createNode("transfo... | cmdx.py | descendent | fvbehr/cmdx | python | def descendent(self, type=om.MFn.kInvalid):
'Singular version of :func:`descendents()`\n\n A recursive, depth-first search.\n\n .. code-block:: python\n\n a\n |\n b---d\n | |\n c e\n\n Example:\n >>> _ = cmds.file(new=True, f... |
def duplicate(self):
'Return a duplicate of self'
return self.__class__(self._fn.duplicate()) | -4,786,223,266,813,627,000 | Return a duplicate of self | cmdx.py | duplicate | fvbehr/cmdx | python | def duplicate(self):
return self.__class__(self._fn.duplicate()) |
def clone(self, name=None, parent=None, worldspace=False):
'Return a clone of self\n\n A "clone" assignes the .outMesh attribute of a mesh node\n to the `.inMesh` of the resulting clone.\n\n Supports:\n - mesh\n\n Arguments:\n name (str, optional): Name of newly cre... | 6,024,038,159,471,500,000 | Return a clone of self
A "clone" assignes the .outMesh attribute of a mesh node
to the `.inMesh` of the resulting clone.
Supports:
- mesh
Arguments:
name (str, optional): Name of newly created clone
parent (DagNode, optional): Parent to newly cloned node
worldspace (bool, optional): Translate output ... | cmdx.py | clone | fvbehr/cmdx | python | def clone(self, name=None, parent=None, worldspace=False):
'Return a clone of self\n\n A "clone" assignes the .outMesh attribute of a mesh node\n to the `.inMesh` of the resulting clone.\n\n Supports:\n - mesh\n\n Arguments:\n name (str, optional): Name of newly cre... |
def add(self, member):
'Add single `member` to set\n\n Arguments:\n member (cmdx.Node): Node to add\n\n '
return self.update([member]) | -1,154,492,052,028,597,800 | Add single `member` to set
Arguments:
member (cmdx.Node): Node to add | cmdx.py | add | fvbehr/cmdx | python | def add(self, member):
'Add single `member` to set\n\n Arguments:\n member (cmdx.Node): Node to add\n\n '
return self.update([member]) |
def update(self, members):
'Add several `members` to set\n\n Arguments:\n members (list): Series of cmdx.Node instances\n\n '
cmds.sets(list(map(str, members)), forceElement=self.path()) | 6,528,813,593,263,597,000 | Add several `members` to set
Arguments:
members (list): Series of cmdx.Node instances | cmdx.py | update | fvbehr/cmdx | python | def update(self, members):
'Add several `members` to set\n\n Arguments:\n members (list): Series of cmdx.Node instances\n\n '
cmds.sets(list(map(str, members)), forceElement=self.path()) |
def clear(self):
'Remove all members from set'
mobj = _encode1(self.name(namespace=True))
fn = om1.MFnSet(mobj)
fn.clear() | -4,805,899,163,082,157,000 | Remove all members from set | cmdx.py | clear | fvbehr/cmdx | python | def clear(self):
mobj = _encode1(self.name(namespace=True))
fn = om1.MFnSet(mobj)
fn.clear() |
def sort(self, key=(lambda o: (o.typeName, o.path()))):
'Sort members of set by `key`\n\n Arguments:\n key (lambda): See built-in `sorted(key)` for reference\n\n '
members = sorted(self.members(), key=key)
self.clear()
self.update(members) | 7,600,609,802,508,725,000 | Sort members of set by `key`
Arguments:
key (lambda): See built-in `sorted(key)` for reference | cmdx.py | sort | fvbehr/cmdx | python | def sort(self, key=(lambda o: (o.typeName, o.path()))):
'Sort members of set by `key`\n\n Arguments:\n key (lambda): See built-in `sorted(key)` for reference\n\n '
members = sorted(self.members(), key=key)
self.clear()
self.update(members) |
def descendent(self, type=None):
'Return the first descendent'
return next(self.descendents(type), None) | 2,758,731,034,804,471,000 | Return the first descendent | cmdx.py | descendent | fvbehr/cmdx | python | def descendent(self, type=None):
return next(self.descendents(type), None) |
def descendents(self, type=None):
'Return hierarchy of objects in set'
for member in self.members(type=type):
(yield member)
try:
for child in member.descendents(type=type):
(yield child)
except AttributeError:
continue | 2,284,004,089,486,410,800 | Return hierarchy of objects in set | cmdx.py | descendents | fvbehr/cmdx | python | def descendents(self, type=None):
for member in self.members(type=type):
(yield member)
try:
for child in member.descendents(type=type):
(yield child)
except AttributeError:
continue |
def flatten(self, type=None):
'Return members, converting nested object sets into its members\n\n Example:\n >>> from maya import cmds\n >>> _ = cmds.file(new=True, force=True)\n >>> a = cmds.createNode("transform", name="a")\n >>> b = cmds.createNode("transform", ... | -7,318,383,916,224,831,000 | Return members, converting nested object sets into its members
Example:
>>> from maya import cmds
>>> _ = cmds.file(new=True, force=True)
>>> a = cmds.createNode("transform", name="a")
>>> b = cmds.createNode("transform", name="b")
>>> c = cmds.createNode("transform", name="c")
>>> cmds.select(... | cmdx.py | flatten | fvbehr/cmdx | python | def flatten(self, type=None):
'Return members, converting nested object sets into its members\n\n Example:\n >>> from maya import cmds\n >>> _ = cmds.file(new=True, force=True)\n >>> a = cmds.createNode("transform", name="a")\n >>> b = cmds.createNode("transform", ... |
def member(self, type=None):
'Return the first member'
return next(self.members(type), None) | 2,758,058,022,612,825,600 | Return the first member | cmdx.py | member | fvbehr/cmdx | python | def member(self, type=None):
return next(self.members(type), None) |
def __abs__(self):
'Return absolute value of plug\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = -10\n >>> abs(node["tx"])\n 10.0\n\n '
return abs(self.read()) | 3,696,060,056,975,704,000 | Return absolute value of plug
Example:
>>> node = createNode("transform")
>>> node["tx"] = -10
>>> abs(node["tx"])
10.0 | cmdx.py | __abs__ | fvbehr/cmdx | python | def __abs__(self):
'Return absolute value of plug\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = -10\n >>> abs(node["tx"])\n 10.0\n\n '
return abs(self.read()) |
def __bool__(self):
'if plug:\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = 10\n >>> if node["tx"]:\n ... True\n ...\n True\n\n '
return bool(self.read()) | 5,208,369,855,668,886,000 | if plug:
Example:
>>> node = createNode("transform")
>>> node["tx"] = 10
>>> if node["tx"]:
... True
...
True | cmdx.py | __bool__ | fvbehr/cmdx | python | def __bool__(self):
'if plug:\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = 10\n >>> if node["tx"]:\n ... True\n ...\n True\n\n '
return bool(self.read()) |
def __float__(self):
'Return plug as floating point value\n\n Example:\n >>> node = createNode("transform")\n >>> float(node["visibility"])\n 1.0\n\n '
return float(self.read()) | -1,371,728,202,996,577,800 | Return plug as floating point value
Example:
>>> node = createNode("transform")
>>> float(node["visibility"])
1.0 | cmdx.py | __float__ | fvbehr/cmdx | python | def __float__(self):
'Return plug as floating point value\n\n Example:\n >>> node = createNode("transform")\n >>> float(node["visibility"])\n 1.0\n\n '
return float(self.read()) |
def __int__(self):
'Return plug as int\n\n Example:\n >>> node = createNode("transform")\n >>> int(node["visibility"])\n 1\n\n '
return int(self.read()) | -5,482,114,458,824,505,000 | Return plug as int
Example:
>>> node = createNode("transform")
>>> int(node["visibility"])
1 | cmdx.py | __int__ | fvbehr/cmdx | python | def __int__(self):
'Return plug as int\n\n Example:\n >>> node = createNode("transform")\n >>> int(node["visibility"])\n 1\n\n '
return int(self.read()) |
def __eq__(self, other):
'Compare plug to `other`\n\n Example:\n >>> node = createNode("transform")\n >>> node["visibility"] == True\n True\n >>> node["visibility"] == node["nodeState"]\n False\n >>> node["visibility"] != node["nodeState"]\n ... | -1,027,741,186,896,287,600 | Compare plug to `other`
Example:
>>> node = createNode("transform")
>>> node["visibility"] == True
True
>>> node["visibility"] == node["nodeState"]
False
>>> node["visibility"] != node["nodeState"]
True | cmdx.py | __eq__ | fvbehr/cmdx | python | def __eq__(self, other):
'Compare plug to `other`\n\n Example:\n >>> node = createNode("transform")\n >>> node["visibility"] == True\n True\n >>> node["visibility"] == node["nodeState"]\n False\n >>> node["visibility"] != node["nodeState"]\n ... |
def __neg__(self):
'Negate unary operator\n\n Example:\n >>> node = createNode("transform")\n >>> node["visibility"] = 1\n >>> -node["visibility"]\n -1\n\n '
return (- self.read()) | 1,442,792,006,433,584,400 | Negate unary operator
Example:
>>> node = createNode("transform")
>>> node["visibility"] = 1
>>> -node["visibility"]
-1 | cmdx.py | __neg__ | fvbehr/cmdx | python | def __neg__(self):
'Negate unary operator\n\n Example:\n >>> node = createNode("transform")\n >>> node["visibility"] = 1\n >>> -node["visibility"]\n -1\n\n '
return (- self.read()) |
def __div__(self, other):
'Python 2.x division\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = 5\n >>> node["ty"] = 2\n >>> node["tx"] / node["ty"]\n 2.5\n\n '
if isinstance(other, Plug):
other = other.read()
r... | -695,580,136,023,903,700 | Python 2.x division
Example:
>>> node = createNode("transform")
>>> node["tx"] = 5
>>> node["ty"] = 2
>>> node["tx"] / node["ty"]
2.5 | cmdx.py | __div__ | fvbehr/cmdx | python | def __div__(self, other):
'Python 2.x division\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = 5\n >>> node["ty"] = 2\n >>> node["tx"] / node["ty"]\n 2.5\n\n '
if isinstance(other, Plug):
other = other.read()
r... |
def __truediv__(self, other):
'Float division, e.g. self / other'
if isinstance(other, Plug):
other = other.read()
return (self.read() / other) | -4,273,911,146,258,172,400 | Float division, e.g. self / other | cmdx.py | __truediv__ | fvbehr/cmdx | python | def __truediv__(self, other):
if isinstance(other, Plug):
other = other.read()
return (self.read() / other) |
def __add__(self, other):
'Support legacy add string to plug\n\n Note:\n Adding to short name is faster, e.g. node["t"] + "x",\n than adding to longName, e.g. node["translate"] + "X"\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = 5\n ... | -1,802,765,904,493,526,500 | Support legacy add string to plug
Note:
Adding to short name is faster, e.g. node["t"] + "x",
than adding to longName, e.g. node["translate"] + "X"
Example:
>>> node = createNode("transform")
>>> node["tx"] = 5
>>> node["translate"] + "X"
5.0
>>> node["t"] + "x"
5.0
>>> try:
..... | cmdx.py | __add__ | fvbehr/cmdx | python | def __add__(self, other):
'Support legacy add string to plug\n\n Note:\n Adding to short name is faster, e.g. node["t"] + "x",\n than adding to longName, e.g. node["translate"] + "X"\n\n Example:\n >>> node = createNode("transform")\n >>> node["tx"] = 5\n ... |
def __iadd__(self, other):
'Support += operator, for .append()\n\n Example:\n >>> node = createNode("transform")\n >>> node["myArray"] = Double(array=True)\n >>> node["myArray"].append(1.0)\n >>> node["myArray"].extend([2.0, 3.0])\n >>> node["myArray"] +... | 8,823,742,964,830,426,000 | Support += operator, for .append()
Example:
>>> node = createNode("transform")
>>> node["myArray"] = Double(array=True)
>>> node["myArray"].append(1.0)
>>> node["myArray"].extend([2.0, 3.0])
>>> node["myArray"] += 5.1
>>> node["myArray"] += [1.1, 2.3, 999.0]
>>> node["myArray"][0]
1.0
... | cmdx.py | __iadd__ | fvbehr/cmdx | python | def __iadd__(self, other):
'Support += operator, for .append()\n\n Example:\n >>> node = createNode("transform")\n >>> node["myArray"] = Double(array=True)\n >>> node["myArray"].append(1.0)\n >>> node["myArray"].extend([2.0, 3.0])\n >>> node["myArray"] +... |
def __str__(self):
'Return value as str\n\n Example:\n >>> node = createNode("transform")\n >>> str(node["tx"])\n \'0.0\'\n\n '
return str(self.read()) | 6,129,550,338,742,648,000 | Return value as str
Example:
>>> node = createNode("transform")
>>> str(node["tx"])
'0.0' | cmdx.py | __str__ | fvbehr/cmdx | python | def __str__(self):
'Return value as str\n\n Example:\n >>> node = createNode("transform")\n >>> str(node["tx"])\n \'0.0\'\n\n '
return str(self.read()) |
def __rshift__(self, other):
'Support connecting attributes via A >> B'
self.connect(other) | -2,720,337,759,746,114,600 | Support connecting attributes via A >> B | cmdx.py | __rshift__ | fvbehr/cmdx | python | def __rshift__(self, other):
self.connect(other) |
def __lshift__(self, other):
'Support connecting attributes via A << B'
other.connect(self) | 8,315,847,255,192,761,000 | Support connecting attributes via A << B | cmdx.py | __lshift__ | fvbehr/cmdx | python | def __lshift__(self, other):
other.connect(self) |
def __floordiv__(self, other):
'Disconnect attribute via A // B\n\n Example:\n >>> nodeA = createNode("transform")\n >>> nodeB = createNode("transform")\n >>> nodeA["tx"] >> nodeB["tx"]\n >>> nodeA["tx"] = 5\n >>> nodeB["tx"] == 5\n True\n ... | -4,267,484,824,930,592,000 | Disconnect attribute via A // B
Example:
>>> nodeA = createNode("transform")
>>> nodeB = createNode("transform")
>>> nodeA["tx"] >> nodeB["tx"]
>>> nodeA["tx"] = 5
>>> nodeB["tx"] == 5
True
>>> nodeA["tx"] // nodeB["tx"]
>>> nodeA["tx"] = 0
>>> nodeB["tx"] == 5
True | cmdx.py | __floordiv__ | fvbehr/cmdx | python | def __floordiv__(self, other):
'Disconnect attribute via A // B\n\n Example:\n >>> nodeA = createNode("transform")\n >>> nodeB = createNode("transform")\n >>> nodeA["tx"] >> nodeB["tx"]\n >>> nodeA["tx"] = 5\n >>> nodeB["tx"] == 5\n True\n ... |
def __iter__(self):
'Iterate over value as a tuple\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"] = (0, 1, 2)\n >>> for index, axis in enumerate(node["translate"]):\n ... assert axis == float(index)\n ... assert isinstance(... | 1,250,772,775,994,694,700 | Iterate over value as a tuple
Example:
>>> node = createNode("transform")
>>> node["translate"] = (0, 1, 2)
>>> for index, axis in enumerate(node["translate"]):
... assert axis == float(index)
... assert isinstance(axis, Plug)
...
>>> a = createNode("transform")
>>> a["myArray"] = M... | cmdx.py | __iter__ | fvbehr/cmdx | python | def __iter__(self):
'Iterate over value as a tuple\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"] = (0, 1, 2)\n >>> for index, axis in enumerate(node["translate"]):\n ... assert axis == float(index)\n ... assert isinstance(... |
def __getitem__(self, index):
'Read from child of array or compound plug\n\n Arguments:\n index (int): Logical index of plug (NOT physical, make note)\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("transform", name="mynode")\n ... | 6,862,531,856,520,929,000 | Read from child of array or compound plug
Arguments:
index (int): Logical index of plug (NOT physical, make note)
Example:
>>> _ = cmds.file(new=True, force=True)
>>> node = createNode("transform", name="mynode")
>>> node["translate"][0].read()
0.0
>>> node["visibility"][0]
Traceback (most... | cmdx.py | __getitem__ | fvbehr/cmdx | python | def __getitem__(self, index):
'Read from child of array or compound plug\n\n Arguments:\n index (int): Logical index of plug (NOT physical, make note)\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n >>> node = createNode("transform", name="mynode")\n ... |
def __setitem__(self, index, value):
'Write to child of array or compound plug\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"][0] = 5\n >>> node["tx"]\n 5.0\n\n '
self[index].write(value) | -2,246,581,550,528,541,700 | Write to child of array or compound plug
Example:
>>> node = createNode("transform")
>>> node["translate"][0] = 5
>>> node["tx"]
5.0 | cmdx.py | __setitem__ | fvbehr/cmdx | python | def __setitem__(self, index, value):
'Write to child of array or compound plug\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"][0] = 5\n >>> node["tx"]\n 5.0\n\n '
self[index].write(value) |
def __init__(self, node, mplug, unit=None, key=None, modifier=None):
'A Maya plug\n\n Arguments:\n node (Node): Parent Node of plug\n mplug (maya.api.OpenMaya.MPlug): Internal Maya plug\n unit (int, optional): Unit with which to read plug\n\n '
assert isinstance(no... | 7,909,641,668,024,552,000 | A Maya plug
Arguments:
node (Node): Parent Node of plug
mplug (maya.api.OpenMaya.MPlug): Internal Maya plug
unit (int, optional): Unit with which to read plug | cmdx.py | __init__ | fvbehr/cmdx | python | def __init__(self, node, mplug, unit=None, key=None, modifier=None):
'A Maya plug\n\n Arguments:\n node (Node): Parent Node of plug\n mplug (maya.api.OpenMaya.MPlug): Internal Maya plug\n unit (int, optional): Unit with which to read plug\n\n '
assert isinstance(no... |
def append(self, value):
'Add `value` to end of self, which is an array\n\n Arguments:\n value (object): If value, create a new entry and append it.\n If cmdx.Plug, create a new entry and connect it.\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n ... | -5,210,446,223,402,379,000 | Add `value` to end of self, which is an array
Arguments:
value (object): If value, create a new entry and append it.
If cmdx.Plug, create a new entry and connect it.
Example:
>>> _ = cmds.file(new=True, force=True)
>>> node = createNode("transform", name="appendTest")
>>> node["myArray"] = Dou... | cmdx.py | append | fvbehr/cmdx | python | def append(self, value):
'Add `value` to end of self, which is an array\n\n Arguments:\n value (object): If value, create a new entry and append it.\n If cmdx.Plug, create a new entry and connect it.\n\n Example:\n >>> _ = cmds.file(new=True, force=True)\n ... |
def extend(self, values):
'Append multiple values to the end of an array\n\n Arguments:\n values (tuple): If values, create a new entry and append it.\n If cmdx.Plug\'s, create a new entry and connect it.\n\n Example:\n >>> node = createNode("transform")\n ... | 1,190,274,450,193,964,800 | Append multiple values to the end of an array
Arguments:
values (tuple): If values, create a new entry and append it.
If cmdx.Plug's, create a new entry and connect it.
Example:
>>> node = createNode("transform")
>>> node["myArray"] = Double(array=True)
>>> node["myArray"].extend([1.0, 2.0, 3.... | cmdx.py | extend | fvbehr/cmdx | python | def extend(self, values):
'Append multiple values to the end of an array\n\n Arguments:\n values (tuple): If values, create a new entry and append it.\n If cmdx.Plug\'s, create a new entry and connect it.\n\n Example:\n >>> node = createNode("transform")\n ... |
def asDouble(self, time=None):
'Return plug as double (Python float)\n\n Example:\n >>> node = createNode("transform")\n >>> node["translateX"] = 5.0\n >>> node["translateX"].asDouble()\n 5.0\n\n '
if (time is not None):
return self._mplug.asDoub... | 7,789,230,498,371,087,000 | Return plug as double (Python float)
Example:
>>> node = createNode("transform")
>>> node["translateX"] = 5.0
>>> node["translateX"].asDouble()
5.0 | cmdx.py | asDouble | fvbehr/cmdx | python | def asDouble(self, time=None):
'Return plug as double (Python float)\n\n Example:\n >>> node = createNode("transform")\n >>> node["translateX"] = 5.0\n >>> node["translateX"].asDouble()\n 5.0\n\n '
if (time is not None):
return self._mplug.asDoub... |
def asMatrix(self, time=None):
'Return plug as MatrixType\n\n Example:\n >>> node1 = createNode("transform")\n >>> node2 = createNode("transform", parent=node1)\n >>> node1["translate"] = (0, 5, 0)\n >>> node2["translate"] = (0, 5, 0)\n >>> plug1 = node1... | 6,023,091,757,034,787,000 | Return plug as MatrixType
Example:
>>> node1 = createNode("transform")
>>> node2 = createNode("transform", parent=node1)
>>> node1["translate"] = (0, 5, 0)
>>> node2["translate"] = (0, 5, 0)
>>> plug1 = node1["matrix"]
>>> plug2 = node2["worldMatrix"][0]
>>> mat1 = plug1.asMatrix()
>>> ... | cmdx.py | asMatrix | fvbehr/cmdx | python | def asMatrix(self, time=None):
'Return plug as MatrixType\n\n Example:\n >>> node1 = createNode("transform")\n >>> node2 = createNode("transform", parent=node1)\n >>> node1["translate"] = (0, 5, 0)\n >>> node2["translate"] = (0, 5, 0)\n >>> plug1 = node1... |
def asTransformationMatrix(self, time=None):
'Return plug as TransformationMatrix\n\n Example:\n >>> node = createNode("transform")\n >>> node["translateY"] = 12\n >>> node["rotate"] = 1\n >>> tm = node["matrix"].asTm()\n >>> map(round, tm.rotation())\n ... | -6,577,919,965,052,642,000 | Return plug as TransformationMatrix
Example:
>>> node = createNode("transform")
>>> node["translateY"] = 12
>>> node["rotate"] = 1
>>> tm = node["matrix"].asTm()
>>> map(round, tm.rotation())
[1.0, 1.0, 1.0]
>>> list(tm.translation())
[0.0, 12.0, 0.0] | cmdx.py | asTransformationMatrix | fvbehr/cmdx | python | def asTransformationMatrix(self, time=None):
'Return plug as TransformationMatrix\n\n Example:\n >>> node = createNode("transform")\n >>> node["translateY"] = 12\n >>> node["rotate"] = 1\n >>> tm = node["matrix"].asTm()\n >>> map(round, tm.rotation())\n ... |
@property
def connected(self):
'Return whether or not this attribute is connected (to anything)'
return (self.connection() is not None) | -914,703,285,969,393,700 | Return whether or not this attribute is connected (to anything) | cmdx.py | connected | fvbehr/cmdx | python | @property
def connected(self):
return (self.connection() is not None) |
@locked.setter
def locked(self, value):
'Lock attribute'
elements = (self if (self.isArray or self.isCompound) else [self])
for el in elements:
cmds.setAttr(el.path(), lock=value) | -776,994,980,534,713,500 | Lock attribute | cmdx.py | locked | fvbehr/cmdx | python | @locked.setter
def locked(self, value):
elements = (self if (self.isArray or self.isCompound) else [self])
for el in elements:
cmds.setAttr(el.path(), lock=value) |
@property
def channelBox(self):
'Is the attribute visible in the Channel Box?'
if (self.isArray or self.isCompound):
return all((plug._mplug.isChannelBox for plug in self))
else:
return self._mplug.isChannelBox | -8,505,339,440,170,590,000 | Is the attribute visible in the Channel Box? | cmdx.py | channelBox | fvbehr/cmdx | python | @property
def channelBox(self):
if (self.isArray or self.isCompound):
return all((plug._mplug.isChannelBox for plug in self))
else:
return self._mplug.isChannelBox |
@property
def keyable(self):
'Is the attribute keyable?'
if (self.isArray or self.isCompound):
return all((plug._mplug.isKeyable for plug in self))
else:
return self._mplug.isKeyable | -6,111,402,977,931,448,000 | Is the attribute keyable? | cmdx.py | keyable | fvbehr/cmdx | python | @property
def keyable(self):
if (self.isArray or self.isCompound):
return all((plug._mplug.isKeyable for plug in self))
else:
return self._mplug.isKeyable |
def hide(self):
'Hide attribute from channel box\n\n Note: An attribute cannot be hidden from the channel box\n and keyable at the same time. Therefore, this method\n also makes the attribute non-keyable.\n\n Supports array and compound attributes too.\n\n '
self.keyable = Fal... | 7,086,864,995,649,053,000 | Hide attribute from channel box
Note: An attribute cannot be hidden from the channel box
and keyable at the same time. Therefore, this method
also makes the attribute non-keyable.
Supports array and compound attributes too. | cmdx.py | hide | fvbehr/cmdx | python | def hide(self):
'Hide attribute from channel box\n\n Note: An attribute cannot be hidden from the channel box\n and keyable at the same time. Therefore, this method\n also makes the attribute non-keyable.\n\n Supports array and compound attributes too.\n\n '
self.keyable = Fal... |
@property
def default(self):
'Return default value of plug'
return _plug_to_default(self._mplug) | -2,075,065,239,552,319,000 | Return default value of plug | cmdx.py | default | fvbehr/cmdx | python | @property
def default(self):
return _plug_to_default(self._mplug) |
def reset(self):
'Restore plug to default value'
if self.writable:
self.write(self.default)
else:
raise TypeError(("Cannot reset non-writable attribute '%s'" % self.path())) | 4,564,896,471,130,789,000 | Restore plug to default value | cmdx.py | reset | fvbehr/cmdx | python | def reset(self):
if self.writable:
self.write(self.default)
else:
raise TypeError(("Cannot reset non-writable attribute '%s'" % self.path())) |
@property
def writable(self):
'Can the user write to this attribute?\n\n Convenience for combined call to `plug.connected`\n and `plug.locked`.\n\n Example:\n >> if node["translateX"].writable:\n .. node["translateX"] = 5\n\n '
return (not any([self.connected,... | 8,115,363,899,282,015,000 | Can the user write to this attribute?
Convenience for combined call to `plug.connected`
and `plug.locked`.
Example:
>> if node["translateX"].writable:
.. node["translateX"] = 5 | cmdx.py | writable | fvbehr/cmdx | python | @property
def writable(self):
'Can the user write to this attribute?\n\n Convenience for combined call to `plug.connected`\n and `plug.locked`.\n\n Example:\n >> if node["translateX"].writable:\n .. node["translateX"] = 5\n\n '
return (not any([self.connected,... |
def show(self):
'Show attribute in channel box\n\n Note: An attribute can be both visible in the channel box\n and non-keyable, therefore, unlike :func:`hide()`, this\n method does not alter the keyable state of the attribute.\n\n '
self.channelBox = True | -7,542,682,929,514,979,000 | Show attribute in channel box
Note: An attribute can be both visible in the channel box
and non-keyable, therefore, unlike :func:`hide()`, this
method does not alter the keyable state of the attribute. | cmdx.py | show | fvbehr/cmdx | python | def show(self):
'Show attribute in channel box\n\n Note: An attribute can be both visible in the channel box\n and non-keyable, therefore, unlike :func:`hide()`, this\n method does not alter the keyable state of the attribute.\n\n '
self.channelBox = True |
def type(self):
'Retrieve API type of plug as string\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"].type()\n \'kAttribute3Double\'\n >>> node["translateX"].type()\n \'kDoubleLinearAttribute\'\n\n '
return self._mplug... | -6,392,659,328,201,751,000 | Retrieve API type of plug as string
Example:
>>> node = createNode("transform")
>>> node["translate"].type()
'kAttribute3Double'
>>> node["translateX"].type()
'kDoubleLinearAttribute' | cmdx.py | type | fvbehr/cmdx | python | def type(self):
'Retrieve API type of plug as string\n\n Example:\n >>> node = createNode("transform")\n >>> node["translate"].type()\n \'kAttribute3Double\'\n >>> node["translateX"].type()\n \'kDoubleLinearAttribute\'\n\n '
return self._mplug... |
def read(self, unit=None, time=None):
'Read attribute value\n\n Arguments:\n unit (int, optional): Unit with which to read plug\n time (float, optional): Time at which to read plug\n\n Example:\n >>> node = createNode("transform")\n >>> node["ty"] = 100.0\n ... | 1,548,194,270,824,116,700 | Read attribute value
Arguments:
unit (int, optional): Unit with which to read plug
time (float, optional): Time at which to read plug
Example:
>>> node = createNode("transform")
>>> node["ty"] = 100.0
>>> node["ty"].read()
100.0
>>> node["ty"].read(unit=Meters)
1.0 | cmdx.py | read | fvbehr/cmdx | python | def read(self, unit=None, time=None):
'Read attribute value\n\n Arguments:\n unit (int, optional): Unit with which to read plug\n time (float, optional): Time at which to read plug\n\n Example:\n >>> node = createNode("transform")\n >>> node["ty"] = 100.0\n ... |
def disconnect(self, other=None, source=True, destination=True):
'Disconnect self from `other`\n\n Arguments:\n other (Plug, optional): If none is provided, disconnect everything\n\n Example:\n >>> node1 = createNode("transform")\n >>> node2 = createNode("transform")\n... | 840,204,997,532,550,300 | Disconnect self from `other`
Arguments:
other (Plug, optional): If none is provided, disconnect everything
Example:
>>> node1 = createNode("transform")
>>> node2 = createNode("transform")
>>> node2["tx"].connection() is None
True
>>> node2["ty"].connection() is None
True
>>>
>>> no... | cmdx.py | disconnect | fvbehr/cmdx | python | def disconnect(self, other=None, source=True, destination=True):
'Disconnect self from `other`\n\n Arguments:\n other (Plug, optional): If none is provided, disconnect everything\n\n Example:\n >>> node1 = createNode("transform")\n >>> node2 = createNode("transform")\n... |
def connections(self, type=None, source=True, destination=True, plugs=False, unit=None):
'Yield plugs connected to self\n\n Arguments:\n type (int, optional): Only return nodes of this type\n source (bool, optional): Return source plugs,\n default is True\n des... | -4,690,551,879,807,121,000 | Yield plugs connected to self
Arguments:
type (int, optional): Only return nodes of this type
source (bool, optional): Return source plugs,
default is True
destination (bool, optional): Return destination plugs,
default is True
plugs (bool, optional): Return connected plugs instead of n... | cmdx.py | connections | fvbehr/cmdx | python | def connections(self, type=None, source=True, destination=True, plugs=False, unit=None):
'Yield plugs connected to self\n\n Arguments:\n type (int, optional): Only return nodes of this type\n source (bool, optional): Return source plugs,\n default is True\n des... |
def connection(self, type=None, source=True, destination=True, plug=False, unit=None):
'Return first connection from :func:`connections()`'
return next(self.connections(type=type, source=source, destination=destination, plugs=plug, unit=unit), None) | -2,606,376,444,302,805,500 | Return first connection from :func:`connections()` | cmdx.py | connection | fvbehr/cmdx | python | def connection(self, type=None, source=True, destination=True, plug=False, unit=None):
return next(self.connections(type=type, source=source, destination=destination, plugs=plug, unit=unit), None) |
def rotateBy(self, rot, space=None):
'Handle arguments conveniently\n\n - Allow for optional `space` argument\n - Automatically convert tuple to Vector\n\n Arguments:\n rot (Vector, Quaternion): Rotation to add\n\n '
space = (space or sTransform)
if isinstance(rot, (tu... | -7,356,503,586,325,908,000 | Handle arguments conveniently
- Allow for optional `space` argument
- Automatically convert tuple to Vector
Arguments:
rot (Vector, Quaternion): Rotation to add | cmdx.py | rotateBy | fvbehr/cmdx | python | def rotateBy(self, rot, space=None):
'Handle arguments conveniently\n\n - Allow for optional `space` argument\n - Automatically convert tuple to Vector\n\n Arguments:\n rot (Vector, Quaternion): Rotation to add\n\n '
space = (space or sTransform)
if isinstance(rot, (tu... |
def quaternion(self):
'Return transformation matrix as a Quaternion'
return Quaternion(self.rotation(asQuaternion=True)) | -1,817,595,353,253,382,100 | Return transformation matrix as a Quaternion | cmdx.py | quaternion | fvbehr/cmdx | python | def quaternion(self):
return Quaternion(self.rotation(asQuaternion=True)) |
def rotatePivot(self, space=None):
'This method does not typically support optional arguments'
space = (space or sTransform)
return super(TransformationMatrix, self).rotatePivot(space) | -4,865,172,239,268,790,000 | This method does not typically support optional arguments | cmdx.py | rotatePivot | fvbehr/cmdx | python | def rotatePivot(self, space=None):
space = (space or sTransform)
return super(TransformationMatrix, self).rotatePivot(space) |
def translation(self, space=None):
'This method does not typically support optional arguments'
space = (space or sTransform)
return super(TransformationMatrix, self).translation(space) | 5,144,207,445,142,521,000 | This method does not typically support optional arguments | cmdx.py | translation | fvbehr/cmdx | python | def translation(self, space=None):
space = (space or sTransform)
return super(TransformationMatrix, self).translation(space) |
def scaleBy(self, space=None):
'This method does not typically support optional arguments'
space = (space or sTransform)
return Vector(super(TransformationMatrix, self).scale(space)) | -8,167,572,264,519,743,000 | This method does not typically support optional arguments | cmdx.py | scaleBy | fvbehr/cmdx | python | def scaleBy(self, space=None):
space = (space or sTransform)
return Vector(super(TransformationMatrix, self).scale(space)) |
def setScale(self, seq, space=None):
'This method does not typically support optional arguments'
if isinstance(seq, Plug):
seq = seq.as_vector()
if isinstance(seq, (tuple, list)):
seq = Vector(*seq)
space = (space or sTransform)
return super(TransformationMatrix, self).setScale(seq, ... | 3,128,911,056,447,938,600 | This method does not typically support optional arguments | cmdx.py | setScale | fvbehr/cmdx | python | def setScale(self, seq, space=None):
if isinstance(seq, Plug):
seq = seq.as_vector()
if isinstance(seq, (tuple, list)):
seq = Vector(*seq)
space = (space or sTransform)
return super(TransformationMatrix, self).setScale(seq, space) |
def setRotation(self, rot):
'Interpret three values as an euler rotation'
if isinstance(rot, Plug):
rot = rot.as_vector()
if isinstance(rot, (tuple, list)):
try:
rot = Vector(rot)
except ValueError:
traceback.print_exc()
raise ValueError("I tried a... | -1,908,348,611,452,193,500 | Interpret three values as an euler rotation | cmdx.py | setRotation | fvbehr/cmdx | python | def setRotation(self, rot):
if isinstance(rot, Plug):
rot = rot.as_vector()
if isinstance(rot, (tuple, list)):
try:
rot = Vector(rot)
except ValueError:
traceback.print_exc()
raise ValueError("I tried automatically converting your tuple to a Vecto... |
def __call__(self, *item):
"Native API 2.0 MMatrix does not support indexing\n\n API 1.0 however *does*, except only for elements\n and not rows. Screw both of those, indexing isn't hard.\n\n Arguments:\n item (int, tuple): 1 integer for row, 2 for element\n\n Identity/default... | 8,799,916,385,701,850,000 | Native API 2.0 MMatrix does not support indexing
API 1.0 however *does*, except only for elements
and not rows. Screw both of those, indexing isn't hard.
Arguments:
item (int, tuple): 1 integer for row, 2 for element
Identity/default matrix:
[[1.0, 0.0, 0.0, 0.0]]
[[0.0, 1.0, 0.0, 0.0]]
[[0.0, 0.0, 1... | cmdx.py | __call__ | fvbehr/cmdx | python | def __call__(self, *item):
"Native API 2.0 MMatrix does not support indexing\n\n API 1.0 however *does*, except only for elements\n and not rows. Screw both of those, indexing isn't hard.\n\n Arguments:\n item (int, tuple): 1 integer for row, 2 for element\n\n Identity/default... |
@record_history
def disconnect(self, a, b=None, source=True, destination=True):
'Disconnect `a` from `b`\n\n Arguments:\n a (Plug): Starting point of a connection\n b (Plug, optional): End point of a connection, defaults to all\n source (bool, optional): Disconnect b, if it i... | 142,448,763,885,116,640 | Disconnect `a` from `b`
Arguments:
a (Plug): Starting point of a connection
b (Plug, optional): End point of a connection, defaults to all
source (bool, optional): Disconnect b, if it is a source
source (bool, optional): Disconnect b, if it is a destination
Normally, Maya only performs a disconnect if... | cmdx.py | disconnect | fvbehr/cmdx | python | @record_history
def disconnect(self, a, b=None, source=True, destination=True):
'Disconnect `a` from `b`\n\n Arguments:\n a (Plug): Starting point of a connection\n b (Plug, optional): End point of a connection, defaults to all\n source (bool, optional): Disconnect b, if it i... |
def __init__(self, time=None):
'Context for evaluating the Maya DG\n\n Extension of MDGContext to also accept time as a float. In Maya 2018\n and above DGContext can also be used as a context manager.\n\n Arguments:\n time (float, om.MTime, optional): Time at which to evaluate contex... | 124,309,355,993,588,350 | Context for evaluating the Maya DG
Extension of MDGContext to also accept time as a float. In Maya 2018
and above DGContext can also be used as a context manager.
Arguments:
time (float, om.MTime, optional): Time at which to evaluate context | cmdx.py | __init__ | fvbehr/cmdx | python | def __init__(self, time=None):
'Context for evaluating the Maya DG\n\n Extension of MDGContext to also accept time as a float. In Maya 2018\n and above DGContext can also be used as a context manager.\n\n Arguments:\n time (float, om.MTime, optional): Time at which to evaluate contex... |
def __hash__(self):
'Support storing in set()'
return hash(self['name']) | -4,552,424,402,059,984,000 | Support storing in set() | cmdx.py | __hash__ | fvbehr/cmdx | python | def __hash__(self):
return hash(self['name']) |
def __repr__(self):
'Avoid repr depicting the full contents of this dict'
return self['name'] | 2,973,130,170,494,998,000 | Avoid repr depicting the full contents of this dict | cmdx.py | __repr__ | fvbehr/cmdx | python | def __repr__(self):
return self['name'] |
def __new__(cls, *args, **kwargs):
'Support for using name of assignment\n\n Example:\n node["thisName"] = cmdx.Double()\n\n In this example, the attribute isn\'t given a `name`\n Instead, the name is inferred from where it is assigned.\n\n '
if (not args):
return... | 1,672,795,968,862,260,700 | Support for using name of assignment
Example:
node["thisName"] = cmdx.Double()
In this example, the attribute isn't given a `name`
Instead, the name is inferred from where it is assigned. | cmdx.py | __new__ | fvbehr/cmdx | python | def __new__(cls, *args, **kwargs):
'Support for using name of assignment\n\n Example:\n node["thisName"] = cmdx.Double()\n\n In this example, the attribute isn\'t given a `name`\n Instead, the name is inferred from where it is assigned.\n\n '
if (not args):
return... |
def default(self, cls=None):
'Return one of three available values\n\n Resolution order:\n 1. Argument\n 2. Node default (from cls.defaults)\n 3. Attribute default\n\n '
if (self['default'] is not None):
return self['default']
if (cls is not None):
... | 98,349,412,122,129,840 | Return one of three available values
Resolution order:
1. Argument
2. Node default (from cls.defaults)
3. Attribute default | cmdx.py | default | fvbehr/cmdx | python | def default(self, cls=None):
'Return one of three available values\n\n Resolution order:\n 1. Argument\n 2. Node default (from cls.defaults)\n 3. Attribute default\n\n '
if (self['default'] is not None):
return self['default']
if (cls is not None):
... |
def read(self, handle):
'Read from MDataHandle'
output = list()
for child in self['children']:
child_handle = handle.child(child['mobject'])
output.append(child.read(child_handle))
return tuple(output) | -2,664,895,905,616,412,700 | Read from MDataHandle | cmdx.py | read | fvbehr/cmdx | python | def read(self, handle):
output = list()
for child in self['children']:
child_handle = handle.child(child['mobject'])
output.append(child.read(child_handle))
return tuple(output) |
def add(self, name, installer, args, api=2):
'Convenience method for .append(Callback())'
callback = Callback(name, installer, args, api)
self.append(callback) | -1,907,981,419,934,310,000 | Convenience method for .append(Callback()) | cmdx.py | add | fvbehr/cmdx | python | def add(self, name, installer, args, api=2):
callback = Callback(name, installer, args, api)
self.append(callback) |
def descendents(self, type=None):
'Faster and more efficient dependency graph traversal\n\n Requires Maya 2017+\n\n Example:\n >>> grandparent = createNode("transform")\n >>> parent = createNode("transform", parent=grandparent)\n >>> child = createN... | -5,788,129,182,698,006,000 | Faster and more efficient dependency graph traversal
Requires Maya 2017+
Example:
>>> grandparent = createNode("transform")
>>> parent = createNode("transform", parent=grandparent)
>>> child = createNode("transform", parent=parent)
>>> mesh = createNode("mesh", parent=child)
>>> it = grandparent.d... | cmdx.py | descendents | fvbehr/cmdx | python | def descendents(self, type=None):
'Faster and more efficient dependency graph traversal\n\n Requires Maya 2017+\n\n Example:\n >>> grandparent = createNode("transform")\n >>> parent = createNode("transform", parent=grandparent)\n >>> child = createN... |
def descendents(self, type=None):
'Recursive, depth-first search; compliant with MItDag of 2017+\n\n Example:\n >>> grandparent = createNode("transform")\n >>> parent = createNode("transform", parent=grandparent)\n >>> child = createNode("transform", parent=pa... | 171,838,027,484,087,870 | Recursive, depth-first search; compliant with MItDag of 2017+
Example:
>>> grandparent = createNode("transform")
>>> parent = createNode("transform", parent=grandparent)
>>> child = createNode("transform", parent=parent)
>>> mesh = createNode("mesh", parent=child)
>>> it = grandparent.descendents(t... | cmdx.py | descendents | fvbehr/cmdx | python | def descendents(self, type=None):
'Recursive, depth-first search; compliant with MItDag of 2017+\n\n Example:\n >>> grandparent = createNode("transform")\n >>> parent = createNode("transform", parent=grandparent)\n >>> child = createNode("transform", parent=pa... |
def xmlMarkup(games, team_ab, team_name, team_record):
"Markup the RSS feed using the data obtained.\n\n :param games: list of games that the team played this season\n :type games: list of GameData\n :param team_ab: the team's abbreviated name\n :type team_ab: string\n :param team_name: the team's name\n ... | -8,852,356,321,434,919,000 | Markup the RSS feed using the data obtained.
:param games: list of games that the team played this season
:type games: list of GameData
:param team_ab: the team's abbreviated name
:type team_ab: string
:param team_name: the team's name
:type team_name: string | markup.py | xmlMarkup | ak212/python-hockey-rss | python | def xmlMarkup(games, team_ab, team_name, team_record):
"Markup the RSS feed using the data obtained.\n\n :param games: list of games that the team played this season\n :type games: list of GameData\n :param team_ab: the team's abbreviated name\n :type team_ab: string\n :param team_name: the team's name\n ... |
def StatEntryFromPath(path, pathspec, ext_attrs=True):
'Builds a stat entry object from a given path.\n\n Args:\n path: A path (string value) to stat.\n pathspec: A `PathSpec` corresponding to the `path`.\n ext_attrs: Whether to include extended file attributes in the result.\n\n Returns:\n `StatEntry... | 7,072,671,682,587,733,000 | Builds a stat entry object from a given path.
Args:
path: A path (string value) to stat.
pathspec: A `PathSpec` corresponding to the `path`.
ext_attrs: Whether to include extended file attributes in the result.
Returns:
`StatEntry` object. | grr/client/grr_response_client/client_utils.py | StatEntryFromPath | billstackpole/grr | python | def StatEntryFromPath(path, pathspec, ext_attrs=True):
'Builds a stat entry object from a given path.\n\n Args:\n path: A path (string value) to stat.\n pathspec: A `PathSpec` corresponding to the `path`.\n ext_attrs: Whether to include extended file attributes in the result.\n\n Returns:\n `StatEntry... |
def StatEntryFromStat(stat, pathspec, ext_attrs=True):
'Build a stat entry object from a given stat object.\n\n Args:\n stat: A `Stat` object.\n pathspec: A `PathSpec` from which `stat` was obtained.\n ext_attrs: Whether to include extended file attributes in the result.\n\n Returns:\n `StatEntry` obj... | 2,486,362,639,857,381,400 | Build a stat entry object from a given stat object.
Args:
stat: A `Stat` object.
pathspec: A `PathSpec` from which `stat` was obtained.
ext_attrs: Whether to include extended file attributes in the result.
Returns:
`StatEntry` object. | grr/client/grr_response_client/client_utils.py | StatEntryFromStat | billstackpole/grr | python | def StatEntryFromStat(stat, pathspec, ext_attrs=True):
'Build a stat entry object from a given stat object.\n\n Args:\n stat: A `Stat` object.\n pathspec: A `PathSpec` from which `stat` was obtained.\n ext_attrs: Whether to include extended file attributes in the result.\n\n Returns:\n `StatEntry` obj... |
@functools.partial(api_util.api_hook, tag='jax2tf_convert')
def convert(fun: Callable, *, polymorphic_shapes: Optional[Sequence[Any]]=None, with_gradient=True, enable_xla=True) -> Callable:
'Transforms `fun` to be executed by TensorFlow.\n\n See\n [README](https://github.com/google/jax/blob/master/jax/experimenta... | -6,558,663,470,984,845,000 | Transforms `fun` to be executed by TensorFlow.
See
[README](https://github.com/google/jax/blob/master/jax/experimental/jax2tf/README.md)
for more details about usage and common problems.
Args:
fun: Function to be transformed. Its arguments and return value should be
JAX arrays, or nested standard Python contain... | jax/experimental/jax2tf/jax2tf.py | convert | ho-oto/jax | python | @functools.partial(api_util.api_hook, tag='jax2tf_convert')
def convert(fun: Callable, *, polymorphic_shapes: Optional[Sequence[Any]]=None, with_gradient=True, enable_xla=True) -> Callable:
'Transforms `fun` to be executed by TensorFlow.\n\n See\n [README](https://github.com/google/jax/blob/master/jax/experimenta... |
def _convert_jax_impl(jax_impl: Callable, *, multiple_results=True) -> Callable:
'Convert the JAX implementation of a primitive.\n\n Args:\n jax_impl: typically the impl-rule for a primitive, with signature\n `(*args: JaxVal, **kwargs) -> Sequence[JaxVal]`. This function implements\n a primitive in ... | 397,753,964,971,300,600 | Convert the JAX implementation of a primitive.
Args:
jax_impl: typically the impl-rule for a primitive, with signature
`(*args: JaxVal, **kwargs) -> Sequence[JaxVal]`. This function implements
a primitive in terms of other primitives.
multiple_results: whether `jax_impl` returns a sequence of results.
R... | jax/experimental/jax2tf/jax2tf.py | _convert_jax_impl | ho-oto/jax | python | def _convert_jax_impl(jax_impl: Callable, *, multiple_results=True) -> Callable:
'Convert the JAX implementation of a primitive.\n\n Args:\n jax_impl: typically the impl-rule for a primitive, with signature\n `(*args: JaxVal, **kwargs) -> Sequence[JaxVal]`. This function implements\n a primitive in ... |
def _interpret_jaxpr(jaxpr: core.ClosedJaxpr, *args: TfVal) -> Sequence[TfVal]:
'Evaluates a Jaxpr with tf.Tensor arguments.\n\n The output is a sequence of TfVal (no `core.unit`), suitable for use with TF.\n '
fun: lu.WrappedFun = lu.wrap_init(core.jaxpr_as_fun(jaxpr))
out_with_avals = _interpret_fun(fun... | 5,744,566,795,549,360,000 | Evaluates a Jaxpr with tf.Tensor arguments.
The output is a sequence of TfVal (no `core.unit`), suitable for use with TF. | jax/experimental/jax2tf/jax2tf.py | _interpret_jaxpr | ho-oto/jax | python | def _interpret_jaxpr(jaxpr: core.ClosedJaxpr, *args: TfVal) -> Sequence[TfVal]:
'Evaluates a Jaxpr with tf.Tensor arguments.\n\n The output is a sequence of TfVal (no `core.unit`), suitable for use with TF.\n '
fun: lu.WrappedFun = lu.wrap_init(core.jaxpr_as_fun(jaxpr))
out_with_avals = _interpret_fun(fun... |
def _aval_to_tf_shape(aval: core.AbstractValue) -> Tuple[(Optional[int], ...)]:
'Generate a TF shape, possibly containing None for polymorphic dimensions.'
return tuple(map((lambda d: (None if isinstance(d, shape_poly.DimVar) else d)), aval.shape)) | 8,408,812,577,119,716,000 | Generate a TF shape, possibly containing None for polymorphic dimensions. | jax/experimental/jax2tf/jax2tf.py | _aval_to_tf_shape | ho-oto/jax | python | def _aval_to_tf_shape(aval: core.AbstractValue) -> Tuple[(Optional[int], ...)]:
return tuple(map((lambda d: (None if isinstance(d, shape_poly.DimVar) else d)), aval.shape)) |
def _tfval_shape_dtype(val: TfVal) -> Tuple[(Sequence[Optional[int]], DType)]:
'Called for constants that occur in the program, or for input values to the converted function.\n\n The returned shape may have unknown components, but only when called for\n inputs.\n '
if isinstance(val, (tf.Tensor, tf.Variable)... | 4,432,653,672,224,603,600 | Called for constants that occur in the program, or for input values to the converted function.
The returned shape may have unknown components, but only when called for
inputs. | jax/experimental/jax2tf/jax2tf.py | _tfval_shape_dtype | ho-oto/jax | python | def _tfval_shape_dtype(val: TfVal) -> Tuple[(Sequence[Optional[int]], DType)]:
'Called for constants that occur in the program, or for input values to the converted function.\n\n The returned shape may have unknown components, but only when called for\n inputs.\n '
if isinstance(val, (tf.Tensor, tf.Variable)... |
def _args_to_avals_and_env(args: Sequence[TfVal], polymorphic_shapes: Sequence[Optional[Union[(str, PolyShape)]]]) -> Tuple[(Sequence[core.AbstractValue], _ShapeEnv)]:
'Computes abstract values and a dimension environment for arguments.\n\n Args:\n args: the arguments, TF inputs.\n polymorphic_shapes: the po... | -6,757,952,359,203,451,000 | Computes abstract values and a dimension environment for arguments.
Args:
args: the arguments, TF inputs.
polymorphic_shapes: the polymorphic specifications for the arguments.
Returns: a tuple of a sequence of abtract values corresponding to the
arguments and a dimension environment. | jax/experimental/jax2tf/jax2tf.py | _args_to_avals_and_env | ho-oto/jax | python | def _args_to_avals_and_env(args: Sequence[TfVal], polymorphic_shapes: Sequence[Optional[Union[(str, PolyShape)]]]) -> Tuple[(Sequence[core.AbstractValue], _ShapeEnv)]:
'Computes abstract values and a dimension environment for arguments.\n\n Args:\n args: the arguments, TF inputs.\n polymorphic_shapes: the po... |
def shape_as_value(x):
'Injects the shape of `x` as an array value.\n\n **Experimental: please give feedback, and expect changes!**\n\n This allows the use of a shape expression as array argument to JAX functions.\n A typical example is for implementing a mean operation:\n\n jnp.sum(x) / np.prod(jax2tf.shape... | 7,109,168,487,154,696,000 | Injects the shape of `x` as an array value.
**Experimental: please give feedback, and expect changes!**
This allows the use of a shape expression as array argument to JAX functions.
A typical example is for implementing a mean operation:
jnp.sum(x) / np.prod(jax2tf.shape_as_value(x)) | jax/experimental/jax2tf/jax2tf.py | shape_as_value | ho-oto/jax | python | def shape_as_value(x):
'Injects the shape of `x` as an array value.\n\n **Experimental: please give feedback, and expect changes!**\n\n This allows the use of a shape expression as array argument to JAX functions.\n A typical example is for implementing a mean operation:\n\n jnp.sum(x) / np.prod(jax2tf.shape... |
def _not(x):
'Computes bitwise not with support for booleans.\n\n Numpy and JAX support bitwise not for booleans by applying a logical not!\n This means that applying bitwise_not yields an unexected result:\n jnp.bitwise_not(jnp.array([True, False]))\n >> DeviceArray([False, True], dtype=bool)\n\n if you ... | -711,532,768,277,860,400 | Computes bitwise not with support for booleans.
Numpy and JAX support bitwise not for booleans by applying a logical not!
This means that applying bitwise_not yields an unexected result:
jnp.bitwise_not(jnp.array([True, False]))
>> DeviceArray([False, True], dtype=bool)
if you assume that booleans are simply cas... | jax/experimental/jax2tf/jax2tf.py | _not | ho-oto/jax | python | def _not(x):
'Computes bitwise not with support for booleans.\n\n Numpy and JAX support bitwise not for booleans by applying a logical not!\n This means that applying bitwise_not yields an unexected result:\n jnp.bitwise_not(jnp.array([True, False]))\n >> DeviceArray([False, True], dtype=bool)\n\n if you ... |
def bool_to_int8(f, argnums):
'Computes bool valued functions using int8.'
argnums = tf.nest.flatten(argnums)
def wrapper(*args, **kwargs):
if (not any(((args[i].dtype == tf.bool) for i in argnums))):
return f(*args, **kwargs)
else:
args_cast = [(tf.cast(a, tf.int8) ... | -6,657,190,721,257,098,000 | Computes bool valued functions using int8. | jax/experimental/jax2tf/jax2tf.py | bool_to_int8 | ho-oto/jax | python | def bool_to_int8(f, argnums):
argnums = tf.nest.flatten(argnums)
def wrapper(*args, **kwargs):
if (not any(((args[i].dtype == tf.bool) for i in argnums))):
return f(*args, **kwargs)
else:
args_cast = [(tf.cast(a, tf.int8) if (i in argnums) else a) for (i, a) in enum... |
def _conv_general_dimension_numbers_proto(dimension_numbers):
'Converts a ConvDimensionNumbers to an XLA ConvolutionDimensionNumbers.'
assert isinstance(dimension_numbers, lax.ConvDimensionNumbers)
(lhs_spec, rhs_spec, out_spec) = dimension_numbers
proto = xla_data_pb2.ConvolutionDimensionNumbers()
... | 5,265,963,477,797,816,000 | Converts a ConvDimensionNumbers to an XLA ConvolutionDimensionNumbers. | jax/experimental/jax2tf/jax2tf.py | _conv_general_dimension_numbers_proto | ho-oto/jax | python | def _conv_general_dimension_numbers_proto(dimension_numbers):
assert isinstance(dimension_numbers, lax.ConvDimensionNumbers)
(lhs_spec, rhs_spec, out_spec) = dimension_numbers
proto = xla_data_pb2.ConvolutionDimensionNumbers()
proto.input_batch_dimension = lhs_spec[0]
proto.input_feature_dimens... |
def _precision_config_proto(precision: Optional[Tuple[(PrecisionType, PrecisionType)]]):
'Convert an integer to an XLA.PrecisionConfig.'
if (precision is None):
return None
proto = xla_data_pb2.PrecisionConfig()
proto.operand_precision.append(int(precision[0]))
proto.operand_precision.append... | 3,985,637,154,650,195,500 | Convert an integer to an XLA.PrecisionConfig. | jax/experimental/jax2tf/jax2tf.py | _precision_config_proto | ho-oto/jax | python | def _precision_config_proto(precision: Optional[Tuple[(PrecisionType, PrecisionType)]]):
if (precision is None):
return None
proto = xla_data_pb2.PrecisionConfig()
proto.operand_precision.append(int(precision[0]))
proto.operand_precision.append(int(precision[1]))
return proto |
def _conv_general_dilated(lhs, rhs, *, window_strides, padding, lhs_dilation, rhs_dilation, dimension_numbers: lax.ConvDimensionNumbers, feature_group_count: int, batch_group_count: int, lhs_shape: Sequence[int], rhs_shape: Sequence[int], precision: Optional[Tuple[(PrecisionType, PrecisionType)]], preferred_element_typ... | -7,552,919,039,765,629,000 | Implementation of lax.conv_general_dilated_p using XlaConv. | jax/experimental/jax2tf/jax2tf.py | _conv_general_dilated | ho-oto/jax | python | def _conv_general_dilated(lhs, rhs, *, window_strides, padding, lhs_dilation, rhs_dilation, dimension_numbers: lax.ConvDimensionNumbers, feature_group_count: int, batch_group_count: int, lhs_shape: Sequence[int], rhs_shape: Sequence[int], precision: Optional[Tuple[(PrecisionType, PrecisionType)]], preferred_element_typ... |
def _dot_general(lhs, rhs, *, dimension_numbers, precision: Optional[Tuple[(PrecisionType, PrecisionType)]], preferred_element_type: Optional[DType], _in_avals: Sequence[core.AbstractValue], _out_aval: core.AbstractValue):
'Implementation of lax.dot_general_p in terms of tf.linalg.einsum.'
((lhs_contracting, rh... | -7,824,252,544,626,182,000 | Implementation of lax.dot_general_p in terms of tf.linalg.einsum. | jax/experimental/jax2tf/jax2tf.py | _dot_general | ho-oto/jax | python | def _dot_general(lhs, rhs, *, dimension_numbers, precision: Optional[Tuple[(PrecisionType, PrecisionType)]], preferred_element_type: Optional[DType], _in_avals: Sequence[core.AbstractValue], _out_aval: core.AbstractValue):
((lhs_contracting, rhs_contracting), (lhs_batch, rhs_batch)) = dimension_numbers
(lh... |
def _reduce_window(operand, init_value, *, jaxpr, consts, window_dimensions, window_strides, padding, base_dilation, window_dilation, _in_avals, _out_aval):
'TensorFlow implementation of reduce_window.\n\n Args:\n operand: N dimensional array containing elements of type T\n init_value: starting value of the ... | 5,077,739,957,849,369,000 | TensorFlow implementation of reduce_window.
Args:
operand: N dimensional array containing elements of type T
init_value: starting value of the reduction
jaxpr: the jaxpr corresponding to the reduction function
consts: the constants associated with jaxpr.
window_dimensions: array of integers for window dimens... | jax/experimental/jax2tf/jax2tf.py | _reduce_window | ho-oto/jax | python | def _reduce_window(operand, init_value, *, jaxpr, consts, window_dimensions, window_strides, padding, base_dilation, window_dilation, _in_avals, _out_aval):
'TensorFlow implementation of reduce_window.\n\n Args:\n operand: N dimensional array containing elements of type T\n init_value: starting value of the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.