diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-09-09 14:52:37 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-09-09 15:12:55 +0300 |
commit | 9dcae4eb17d7b5a90fda43d0abab1636acf42851 (patch) | |
tree | 60dc9706c2bab6e363096baf865b585a46a4d31f /source/blender/editors/interface/interface_templates.c | |
parent | 98eb89be5dd08f3b38f34e7881bae37c3b13e8bb (diff) |
Refactor getting constraints
This is the refactoring part of D8805 (should be no functional changes).
- exposes pose-related part of former 'get_constraints()' from
interface_templates.c to new ED_object_pose_constraint_list
- rename ED_object_constraint_list_from_context -->
ED_object_constraint_active_list
Also clarify comments on both of these.
ref T80464
ref https://developer.blender.org/D8805
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 671a7865c6a..08d3ad0f23c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1972,27 +1972,6 @@ static bool constraint_panel_is_bone(Panel *panel) } /** - * Get the constraints for the active pose bone or the active / pinned object. - */ -static ListBase *get_constraints(const bContext *C, bool use_bone_constraints) -{ - ListBase *constraints = {NULL}; - if (use_bone_constraints) { - bPoseChannel *pose_bone = CTX_data_pointer_get(C, "pose_bone").data; - if (pose_bone != NULL) { - constraints = &pose_bone->constraints; - } - } - else { - Object *ob = ED_object_active_context(C); - if (ob != NULL) { - constraints = &ob->constraints; - } - } - return constraints; -} - -/** * Move a constraint to the index it's moved to after a drag and drop. */ static void constraint_reorder(bContext *C, Panel *panel, int new_index) @@ -2066,7 +2045,13 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_ ARegion *region = CTX_wm_region(C); Object *ob = ED_object_active_context(C); - ListBase *constraints = get_constraints(C, use_bone_constraints); + ListBase *constraints = {NULL}; + if (use_bone_constraints) { + constraints = ED_object_pose_constraint_list(C); + } + else { + constraints = ED_object_constraint_active_list(ob); + } /* Switch between the bone panel ID function and the object panel ID function. */ uiListPanelIDFromDataFunc panel_id_func = use_bone_constraints ? bone_constraint_panel_id : |