Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_constraint.c
| Show First 20 Lines • Show All 1,415 Lines • ▼ Show 20 Lines | void ED_object_constraint_dependency_tag_update(Main *bmain, Object *ob, bConstraint *con) | ||||
| ED_object_constraint_tag_update(bmain, ob, con); | ED_object_constraint_tag_update(bmain, ob, con); | ||||
| if (ob->pose) { | if (ob->pose) { | ||||
| object_pose_tag_update(bmain, ob); | object_pose_tag_update(bmain, ob); | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| } | } | ||||
| bool ED_object_constraint_move_to_index(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; | |||||
| } | |||||
| /** \} */ | /** \} */ | ||||
| /* ------------------------------------------------------------------- */ | /* ------------------------------------------------------------------- */ | ||||
| /** \name Delete Constraint Operator | /** \name Delete Constraint Operator | ||||
| * \{ */ | * \{ */ | ||||
| static int constraint_delete_exec(bContext *C, wmOperator *op) | static int constraint_delete_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | static int constraint_move_to_index_exec(bContext *C, wmOperator *op) | ||||
| bConstraint *con = edit_constraint_property_get(op, ob, 0); | bConstraint *con = edit_constraint_property_get(op, ob, 0); | ||||
| int new_index = RNA_int_get(op->ptr, "index"); | int new_index = RNA_int_get(op->ptr, "index"); | ||||
| if (new_index < 0) { | if (new_index < 0) { | ||||
| new_index = 0; | new_index = 0; | ||||
| } | } | ||||
| if (con) { | if (con) { | ||||
| ListBase *conlist = ED_object_constraint_list_from_constraint(ob, con, NULL); | ED_object_constraint_move_to_index(ob, con, new_index); | ||||
| int current_index = BLI_findindex(conlist, con); | |||||
| BLI_assert(current_index >= 0); | |||||
| BLI_listbase_link_move(conlist, con, new_index - current_index); | |||||
| WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); | WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 826 Lines • Show Last 20 Lines | |||||