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/gpencil_modifiers/intern/MOD_gpencilsimplify.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/gpencil_modifiers/intern/MOD_gpencilsimplify.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c index 1e75c5926cd..ace9f4f91d6 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c @@ -142,38 +142,37 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER); } -static void panel_draw(const bContext *C, Panel *panel) +static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA ptr; - gpencil_modifier_panel_get_property_pointers(C, panel, NULL, &ptr); + PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL); - int mode = RNA_enum_get(&ptr, "mode"); + int mode = RNA_enum_get(ptr, "mode"); uiLayoutSetPropSep(layout, true); - uiItemR(layout, &ptr, "mode", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); if (mode == GP_SIMPLIFY_FIXED) { - uiItemR(layout, &ptr, "step", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "step", 0, NULL, ICON_NONE); } else if (mode == GP_SIMPLIFY_ADAPTIVE) { - uiItemR(layout, &ptr, "factor", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "factor", 0, NULL, ICON_NONE); } else if (mode == GP_SIMPLIFY_SAMPLE) { - uiItemR(layout, &ptr, "length", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "length", 0, NULL, ICON_NONE); } else if (mode == GP_SIMPLIFY_MERGE) { - uiItemR(layout, &ptr, "distance", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "distance", 0, NULL, ICON_NONE); } - gpencil_modifier_panel_end(layout, &ptr); + gpencil_modifier_panel_end(layout, ptr); } -static void mask_panel_draw(const bContext *C, Panel *panel) +static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel) { - gpencil_modifier_masking_panel_draw(C, panel, true, false); + gpencil_modifier_masking_panel_draw(panel, true, false); } static void panelRegister(ARegionType *region_type) |