Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-09-02 22:13:26 +0300
committerHans Goudey <h.goudey@me.com>2020-09-02 22:13:26 +0300
commitba4a2a4c8b827201b18e97d9dd025ef93a4db754 (patch)
treea71d6b72aaf0616ebda671bf4b011880b49bb280 /source/blender/modifiers/intern/MOD_normal_edit.c
parentff7d74235023d0c927c0ad3f4d72d1c5dd41b240 (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_normal_edit.c')
-rw-r--r--source/blender/modifiers/intern/MOD_normal_edit.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c
index f22ece11726..9962d3a55e0 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -702,75 +702,72 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
return normalEditModifier_do((NormalEditModifierData *)md, ctx, ctx->object, mesh);
}
-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);
- int mode = RNA_enum_get(&ptr, "mode");
+ int mode = RNA_enum_get(ptr, "mode");
- uiItemR(layout, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayoutSetPropSep(layout, true);
- uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(col, mode == MOD_NORMALEDIT_MODE_DIRECTIONAL);
- uiItemR(col, &ptr, "use_direction_parallel", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "use_direction_parallel", 0, NULL, ICON_NONE);
- modifier_panel_end(layout, &ptr);
+ modifier_panel_end(layout, ptr);
}
/* This panel could be open by default, but it isn't currently. */
-static void mix_mode_panel_draw(const bContext *C, Panel *panel)
+static void mix_mode_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *row;
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);
uiLayoutSetPropSep(layout, true);
- uiItemR(layout, &ptr, "mix_mode", 0, NULL, ICON_NONE);
- uiItemR(layout, &ptr, "mix_factor", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "mix_mode", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "mix_factor", 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);
row = uiLayoutRow(layout, true);
- uiItemR(row, &ptr, "mix_limit", 0, NULL, ICON_NONE);
+ uiItemR(row, ptr, "mix_limit", 0, NULL, ICON_NONE);
uiItemR(row,
- &ptr,
+ ptr,
"no_polynors_fix",
0,
"",
- (RNA_boolean_get(&ptr, "no_polynors_fix") ? ICON_LOCKED : ICON_UNLOCKED));
+ (RNA_boolean_get(ptr, "no_polynors_fix") ? ICON_LOCKED : ICON_UNLOCKED));
}
-static void offset_panel_draw(const bContext *C, Panel *panel)
+static void offset_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
- PointerRNA ptr;
- modifier_panel_get_property_pointers(C, panel, NULL, &ptr);
+ PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
- int mode = RNA_enum_get(&ptr, "mode");
- PointerRNA target_ptr = RNA_pointer_get(&ptr, "target");
+ int mode = RNA_enum_get(ptr, "mode");
+ PointerRNA target_ptr = RNA_pointer_get(ptr, "target");
bool needs_object_offset = (mode == MOD_NORMALEDIT_MODE_RADIAL &&
RNA_pointer_is_null(&target_ptr)) ||
(mode == MOD_NORMALEDIT_MODE_DIRECTIONAL &&
- RNA_boolean_get(&ptr, "use_direction_parallel"));
+ RNA_boolean_get(ptr, "use_direction_parallel"));
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, needs_object_offset);
- uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
}
static void panelRegister(ARegionType *region_type)