Skip to content

Commit

Permalink
Fixed name/n argument bug on DependNode.makeName()
Browse files Browse the repository at this point in the history
  • Loading branch information
kimonmatara committed Jun 23, 2022
1 parent 3bfa91a commit 2f385b2
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for attribute (including subtype), component and data types with true inheritanc

* Improvements to name management and plug setting

See :doc:`here <whats_new>` for the full list.
* And `more <https://kimonmatara.github.io/paya/whats_new.html>`_!


Example: Rigging a Radial Repulsor
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ <h1>Paya: PyMEL for Riggers<a class="headerlink" href="#paya-pymel-for-riggers"
accounting for <code class="docutils literal notranslate"><span class="pre">jointOrient</span></code>, <code class="docutils literal notranslate"><span class="pre">rotateAxis</span></code>, <code class="docutils literal notranslate"><span class="pre">inverseScale</span></code> and pivots; rotate vectors by axis-angle; and
more</p></li>
<li><p>Improvements to name management and plug setting</p></li>
<li><p>And <a class="reference external" href="https://kimonmatara.github.io/paya/whats_new.html">more</a>!</p></li>
</ul>
<p>See <a class="reference internal" href="whats_new.html"><span class="doc">here</span></a> for the full list.</p>
</div>
<section id="example-rigging-a-radial-repulsor">
<h2>Example: Rigging a Radial Repulsor<a class="headerlink" href="#example-rigging-a-radial-repulsor" title="Permalink to this headline"></a></h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

Binary file modified nodetypes/__pycache__/dependNode.cpython-37.pyc
Binary file not shown.
Binary file modified nodetypes/__pycache__/transform.cpython-37.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion nodetypes/dependNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def makeName(*elems, name=None):
else:
kwargs['nodeType'] = instype.__melnode__

return _nm.make(*elems, **kwargs)
return _nm.make(name, *elems, **kwargs)

return makeName

Expand Down
52 changes: 50 additions & 2 deletions nodetypes/transform.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import maya.cmds as m
import paya.config as config
import pymel.util as _pu
from paya.util import short
import paya.runtime as r

Expand Down Expand Up @@ -26,7 +28,11 @@ def create(
"""
Creates transform nodes.
:param dagPath/dp: an explicit DAG path; defaults to None
:param dagPath/dp: an explicit DAG path; if provided, the minimum
number of nodes required to match this DAG path will be
generated; ``displayLocalAxis``, ``rotateOrder`` and
``worldMatrix`` will only be applied to the last (innermost)
group; defaults to None
:type dagPath/dp: None, str
:param name/n: one or more name elements; ignored if ``dagPath`` is
provided; defaults to None
Expand Down Expand Up @@ -204,4 +210,46 @@ def getRotateAxisMatrix(self, plug=False):

return attr

return self.attr('rotateAxis').get().asRotateMatrix()
return self.attr('rotateAxis').get().asRotateMatrix()

#--------------------------------------------------------| Offset groups

def createOffsetGroups(self, *suffixes):
"""
:param \*suffixes: one or more offset group suffixes; defaults to
'offset'
:type \*suffixes: list, tuple, str
:return: One or more transformationally-matched offset groups for this
transform, in order of innermost to outermost.
:type: list of :class:`~paya.nodetypes.transform.Transform`
"""
suffixes = _pu.expandArgs(*suffixes)

if not suffixes:
suffixes = ['offset']

bn = self.basename(sts=True, sns=True)

mtx = self.getMatrix(worldSpace=True)
ro = self.attr('rotateOrder').get()

lastChild = self

out = []

with config(inheritNames=False):
for suffix in suffixes:
name = r.nodes.Transform.makeName(bn, suffix)

parent = lastChild.getParent()
kwargs = {}

if parent is not None:
kwargs['parent'] = parent

group = r.group(empty=True, n=name, **kwargs)
group.setMatrix(mtx, worldSpace=True)
lastChild.setParent(group)
out.append(group)

return out

0 comments on commit 2f385b2

Please sign in to comment.