Selection order of objects ?

Is there any way to know selection order of selected objects ?

The order of selected mesh elements is known to a certain degree, but for objects, there’s only selected and active.

You could monitor the changes over time to in a modal operator or an app handler I guess.

Ok, thank you, I tried to make distribute/align script along curve, but dont know the order of selected objects.

The selection order seems to be related to when an object was added to the scene. With the last added object appearing first in the list (bpy.context.selected_objects)LIFO. Selection order in the viewport does not seem to matter.

Here is what I imagine the bpy.context.selected_objects internal code looks like.


result = []
for ob in scene.objects:
    if ob.select == True:
        result.insert(0,ob)
return result

Thank you also. Its useless to align or distribute 20 objects without knowing the order :slight_smile:
Might be better idea to measure distance of objects to start point of curve. Nearest is first and so on.