Notifications
Clear all

[Closed] Sort by hierarcchy

I need to sort object by hierarchy.
The tricky part is that I don’t have all the object inthe list of object to sort.

For example, I need to sort only the following objects fro a Biped.

L Toe01
L Calf
Spine2
Peivle
Head
L Hand
L Upper Arm

Shoudl I just select the entire hierarchy and sort. Then, remap the object list from the full hierarchy?

2 Replies
fn isChild node parent = 
(
	local child = off
	while not child and node.parent != undefined do child = ((node = node.parent) == parent)
	child
)	
fn sortByHierarchy list = 
(
	fn sortby n1 n2 = if isChild n1 n2 then -1 else if isChild n2 n1 then 1 else 0 
	qsort list sortby
	list
)

Thanks!