We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c224415 commit 7731860Copy full SHA for 7731860
1 file changed
python/mmSolver/utils/node.py
@@ -122,6 +122,25 @@ def get_node_parents(node):
122
return parent_nodes
123
124
125
+def sort_nodes_by_depth(nodes, reverse=False):
126
+ """
127
+ Sort nodes by depth, shallow nodes first.
128
+
129
+ :param nodes: List of Maya DAG node paths.
130
+ :type nodes: [str, ..]
131
132
+ :returns: List of sorted nodes.
133
+ :rtype: [str, ..]
134
135
+ assert isinstance(nodes, (list, set))
136
137
+ def func(a):
138
+ return a.count('|')
139
140
+ nodes = sorted(nodes, key=func, reverse=reverse)
141
+ return nodes
142
143
144
def get_as_selection_list_apione(paths):
145
"""
146
Get a Maya API selection list with the given valid Maya node paths.
0 commit comments