@bentraje said in Make objects to be at the end of the hierarchy list?:
As you might understand, priorities can be modified with the priorities category and number. However, I want to deal it with the hierarchy. Since its easier to manage.
I guess I'm looking for a node that says
"This object should be at the [-1] or [-2] of the list of the children in the heirarchy".
Yeah, I'm familiar with the hierarchy/execution sequence issues. Normally I just drag and drop stuff in place, since it's something I do only once, but I admit there are issues with D&D when sub-branches are folded out and sometimes dragged items land on the wrong depth level.
What I'm not sure about is your functionality, as you seem to have a specific sequence in mind. The easiest way to sort children in an arbitrary manner would be to just select one, and then have a mini script that Remove()s it and InsertAsLast() the removed node. This way you would retain full control over the sort. If you select more than one, you could do the same (just deselect the node so it won't get moved infinite times when you parse the children list) but the selected nodes would stay in the original sequence - so A B C D E F in your example would always become C D E F A B and never C D E F B A. Don't know how you would determine the sub-sequence otherwise. Perhaps by evaluating the selection sequence itself.
Here's the trivial case where the sequence is determined by the original sequence and the parent is set as the first selected object's parent. This can be easily extended.
import c4d
from c4d import gui
def main():
selectlist = doc.GetSelection()
doc.StartUndo()
if len(selectlist) == 0 :
print "Nothing selected"
return
parent = selectlist[0].GetUp()
if parent == None :
print "No parent"
return
for obj in selectlist:
doc.AddUndo(c4d.UNDOTYPE_HIERARCHY_PSR, obj)
obj.Remove()
obj.InsertUnderLast(parent)
c4d.EventAdd()
doc.EndUndo()
if __name__=='__main__':
main()
But maybe I'm thinking wrong and the main thing here is the filter?