diff options
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 70404af6433..60838d08cc5 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1421,6 +1421,24 @@ void ED_object_constraint_dependency_tag_update(Main *bmain, Object *ob, bConstr DEG_relations_tag_update(bmain); } +/* TODO (Nathan): Use the reports? */ +bool ED_object_constraint_move_to_index(ReportList *reports, + Object *ob, + bConstraint *con, + const int index) +{ + BLI_assert(con != NULL); + BLI_assert(index >= 0); + + ListBase *conlist = ED_object_constraint_list_from_constraint(ob, con, NULL); + int current_index = BLI_findindex(conlist, con); + BLI_assert(current_index >= 0); + + BLI_listbase_link_move(conlist, con, index - current_index); + + return true; +} + /** \} */ /* ------------------------------------------------------------------- */ @@ -1613,11 +1631,7 @@ static int constraint_move_to_index_exec(bContext *C, wmOperator *op) } if (con) { - ListBase *conlist = ED_object_constraint_list_from_constraint(ob, con, NULL); - int current_index = BLI_findindex(conlist, con); - BLI_assert(current_index >= 0); - - BLI_listbase_link_move(conlist, con, new_index - current_index); + ED_object_constraint_move_to_index(op->reports, ob, con, new_index); WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); |