Logic Editor : arrow to move up/down properties
AbandonedPublic

Authored by Julian Eisel (Severin) on Mar 7 2015, 4:11 PM.

Details

Summary

I added operator game_property_move_up and game_property_move_down.
same result that in : https://developer.blender.org/T32292 but no rewrite of the properties list just remove and insert in C code.

Diff Detail

Repository
rB Blender
Branch
ge_properties_order

In general this looks fine to me, just added some inline comments for minor things.

Furthermore, I'm not sure if you have seen it, but I recently worked on modifier drag & drop which is generic enough to be used here as well (although it's not ready for that yet).

Maybe it's worth waiting with this and use drag & drop right away?

source/blender/editors/object/object_edit.c
1782

prevprop can be accessed using prop->prev. Also following our codestyle, index-1 should be index - 1, just as a general note ;)

1786–1787

BLI_listbase_swaplinks(...) makes this a one-liner

1824

Same here of course, prop->next

1828–1829

And here: BLI_listbase_swaplinks(...)

Julian Eisel (Severin) requested changes to this revision.Mar 9 2015, 4:22 PM
This revision now requires changes to proceed.Mar 9 2015, 4:22 PM

Use of BLI_listbase_swaplinks and prop->next/prev

I wouldn't say dnd should be the only way to order the stuff, in some cases it might be just faster to single-click on a button than dragging stuff around. So IMO the patch is still valid.

The only thing i'm not totally agree with is having dedicated operators for moving property up and down, it makes more sense to have a single operator with a direction option, so you'll have OBJECT_OT_game_property_move and UP/DOWN will be an enum option of this operator.

Use one function for move down and up.

Would use defines for move directions (PROPERTIES_MOVE_UP & co), makes code cleaner and easier to read. Otherwise looks good to me.

Use of constant for "UP" and "DOWN"

Will commit later. Commandeering so I don't forget it ;)

This revision is now accepted and ready to land.Apr 20 2015, 11:32 AM

Committed rBa8adeeb6fbd3, thanks for the patch :)