skybrush-io / studio-blender

Skybrush Studio for Blender - a Blender addon for designing and validating drone shows
https://skybrush.io
GNU General Public License v3.0
43 stars 30 forks source link

feat: sorted formation objects #26

Open thomas-advantitge opened 3 months ago

thomas-advantitge commented 3 months ago

This helps to have a configurable order when using objects with vertex groups in order to use formation_index more easily.

ntamas commented 3 months ago

This PR would also affect the behaviour of get_selected_objects_from_collection() because that uses get_selected_objects() internally. Furthermore, it would contradict the documentation of get_selected_objects_from_collection() because the documentation states that get_selected_objects_from_collection() returns the objects in the same order as they appear in context.selected_objects, which is not true anymore after this modification.

Can I suggest adding a sort: bool = False keyword argment to get_selected_objects() instead? You could then do the sort only when sort = True, and call get_selected_objects() with sort = True if needed. Sorry for being picky, I just don't see clearly what additional implications it would have to pre-sort the objects automatically and I don't want to break any existing behaviour.