diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-02 22:13:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-02 22:13:26 +0300 |
commit | ba4a2a4c8b827201b18e97d9dd025ef93a4db754 (patch) | |
tree | a71d6b72aaf0616ebda671bf4b011880b49bb280 /source/blender/modifiers/intern/MOD_surfacedeform.c | |
parent | ff7d74235023d0c927c0ad3f4d72d1c5dd41b240 (diff) |
UI: Use instanced panel custom data instead of list index
For modifier shortcuts we added a "custom_data" field to panels.
This commit uses the same system for accessing the list data that
corresponds to each panel. This way the context is only used once
and the modifier for each panel can be accessed more easily later.
This ends up being mostly a cleanup commit with a few small changes
in interface_panel.c. The large changes in the UI functions are due
to the fact that the panel custom data is now passed around as a
single pointer instead of being created again for every panel.
The list_index variable in Panel.runtime is removed as it's now
unnecessary.
Differential Revision: https://developer.blender.org/D8559
Diffstat (limited to 'source/blender/modifiers/intern/MOD_surfacedeform.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_surfacedeform.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 962e93be215..6fc2bd29add 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -1397,29 +1397,28 @@ static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, bool UNUSED !(smd->verts != NULL && !(smd->flags & MOD_SDEF_BIND)); } -static void panel_draw(const bContext *C, Panel *panel) +static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *col; uiLayout *layout = panel->layout; - PointerRNA ptr; PointerRNA ob_ptr; - modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr); - PointerRNA target_ptr = RNA_pointer_get(&ptr, "target"); + PointerRNA target_ptr = RNA_pointer_get(ptr, "target"); - bool is_bound = RNA_boolean_get(&ptr, "is_bound"); + bool is_bound = RNA_boolean_get(ptr, "is_bound"); uiLayoutSetPropSep(layout, true); col = uiLayoutColumn(layout, false); uiLayoutSetActive(col, !is_bound); - uiItemR(col, &ptr, "target", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "target", 0, NULL, ICON_NONE); - uiItemR(col, &ptr, "falloff", 0, NULL, ICON_NONE); - uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "falloff", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "strength", 0, NULL, ICON_NONE); - modifier_vgroup_ui(layout, &ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); + modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", NULL); uiItemS(layout); @@ -1431,7 +1430,7 @@ static void panel_draw(const bContext *C, Panel *panel) uiLayoutSetActive(col, !RNA_pointer_is_null(&target_ptr)); uiItemO(col, IFACE_("Bind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind"); } - modifier_panel_end(layout, &ptr); + modifier_panel_end(layout, ptr); } static void panelRegister(ARegionType *region_type) |