From 4402c2324b81efad8d09a016a7e6838395711158 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 20 Apr 2021 00:13:26 +1000 Subject: Cleanup: use 'wmOperator.ptr' in draw functions Draw functions used RNA_pointer_create to create the pointer, however this already exists in the operator. --- .../blender/editors/gpencil/gpencil_interpolate.c | 26 +++++------- source/blender/editors/io/io_alembic.c | 23 ++++------ source/blender/editors/io/io_collada.c | 16 ++----- source/blender/editors/io/io_gpencil_export.c | 18 ++------ source/blender/editors/io/io_gpencil_import.c | 8 +--- source/blender/editors/mesh/editmesh_bevel.c | 49 ++++++++++------------ source/blender/editors/mesh/editmesh_intersect.c | 34 ++++++--------- source/blender/editors/mesh/editmesh_tools.c | 31 ++++++-------- source/blender/editors/object/object_add.c | 21 ++++------ source/blender/editors/screen/screendump.c | 6 +-- source/blender/editors/space_image/image_ops.c | 25 +++++------ .../editors/space_sequencer/sequencer_add.c | 5 +-- .../editors/space_sequencer/sequencer_edit.c | 18 ++++---- 13 files changed, 106 insertions(+), 174 deletions(-) (limited to 'source') diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 7ca53779522..0062e363cdf 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -1434,36 +1434,32 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op) static void gpencil_interpolate_seq_ui(bContext *C, wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); uiLayout *col, *row; - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); const eGP_Interpolate_Type type = RNA_enum_get(op->ptr, "type"); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); row = uiLayoutRow(layout, true); - uiItemR(row, &ptr, "step", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "step", 0, NULL, ICON_NONE); row = uiLayoutRow(layout, true); - uiItemR(row, &ptr, "layers", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "layers", 0, NULL, ICON_NONE); if (CTX_data_mode_enum(C) == CTX_MODE_EDIT_GPENCIL) { row = uiLayoutRow(layout, true); - uiItemR(row, &ptr, "interpolate_selected_only", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "interpolate_selected_only", 0, NULL, ICON_NONE); } row = uiLayoutRow(layout, true); - uiItemR(row, &ptr, "flip", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "flip", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, true); - uiItemR(col, &ptr, "smooth_factor", 0, NULL, ICON_NONE); - uiItemR(col, &ptr, "smooth_steps", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "smooth_factor", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "smooth_steps", 0, NULL, ICON_NONE); row = uiLayoutRow(layout, true); - uiItemR(row, &ptr, "type", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "type", 0, NULL, ICON_NONE); if (type == GP_IPO_CURVEMAP) { /* Get an RNA pointer to ToolSettings to give to the custom curve. */ @@ -1477,16 +1473,16 @@ static void gpencil_interpolate_seq_ui(bContext *C, wmOperator *op) } else if (type != GP_IPO_LINEAR) { row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "easing", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "easing", 0, NULL, ICON_NONE); if (type == GP_IPO_BACK) { row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "back", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "back", 0, NULL, ICON_NONE); } else if (type == GP_IPO_ELASTIC) { row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "amplitude", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "amplitude", 0, NULL, ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "period", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "period", 0, NULL, ICON_NONE); } } } diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c index 1f1165a464b..592467c2a85 100644 --- a/source/blender/editors/io/io_alembic.c +++ b/source/blender/editors/io/io_alembic.c @@ -240,22 +240,17 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr) static void wm_alembic_export_draw(bContext *C, wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - /* Conveniently set start and end frame to match the scene's frame range. */ Scene *scene = CTX_data_scene(C); - if (scene != NULL && RNA_boolean_get(&ptr, "init_scene_frame_range")) { - RNA_int_set(&ptr, "start", SFRA); - RNA_int_set(&ptr, "end", EFRA); + if (scene != NULL && RNA_boolean_get(op->ptr, "init_scene_frame_range")) { + RNA_int_set(op->ptr, "start", SFRA); + RNA_int_set(op->ptr, "end", EFRA); - RNA_boolean_set(&ptr, "init_scene_frame_range", false); + RNA_boolean_set(op->ptr, "init_scene_frame_range", false); } - ui_alembic_export_settings(op->layout, &ptr); + ui_alembic_export_settings(op->layout, op->ptr); } static bool wm_alembic_export_check(bContext *UNUSED(C), wmOperator *op) @@ -594,13 +589,9 @@ static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr) uiItemR(col, imfptr, "validate_meshes", 0, NULL, ICON_NONE); } -static void wm_alembic_import_draw(bContext *C, wmOperator *op) +static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - ui_alembic_import_settings(op->layout, &ptr); + ui_alembic_import_settings(op->layout, op->ptr); } /* op->invoke, opens fileselect if path property not set, otherwise executes */ diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index c8e3e1814fc..859c12d7e52 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -400,13 +400,9 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) } } -static void wm_collada_export_draw(bContext *C, wmOperator *op) +static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiCollada_exportSettings(op->layout, &ptr); + uiCollada_exportSettings(op->layout, op->ptr); } static bool wm_collada_export_check(bContext *UNUSED(C), wmOperator *op) @@ -798,13 +794,9 @@ static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr) uiItemR(box, imfptr, "keep_bind_info", 0, NULL, ICON_NONE); } -static void wm_collada_import_draw(bContext *C, wmOperator *op) +static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiCollada_importSettings(op->layout, &ptr); + uiCollada_importSettings(op->layout, op->ptr); } void WM_OT_collada_import(wmOperatorType *ot) diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c index 7b4b59902f9..b49be324372 100644 --- a/source/blender/editors/io/io_gpencil_export.c +++ b/source/blender/editors/io/io_gpencil_export.c @@ -215,14 +215,9 @@ static void ui_gpencil_export_svg_settings(uiLayout *layout, PointerRNA *imfptr) uiItemR(col, imfptr, "use_clip_camera", 0, NULL, ICON_NONE); } -static void wm_gpencil_export_svg_draw(bContext *C, wmOperator *op) +static void wm_gpencil_export_svg_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - - ui_gpencil_export_svg_settings(op->layout, &ptr); + ui_gpencil_export_svg_settings(op->layout, op->ptr); } static bool wm_gpencil_export_svg_poll(bContext *C) @@ -378,14 +373,9 @@ static void ui_gpencil_export_pdf_settings(uiLayout *layout, PointerRNA *imfptr) uiItemR(sub, imfptr, "use_normalized_thickness", 0, NULL, ICON_NONE); } -static void wm_gpencil_export_pdf_draw(bContext *C, wmOperator *op) +static void wm_gpencil_export_pdf_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - - ui_gpencil_export_pdf_settings(op->layout, &ptr); + ui_gpencil_export_pdf_settings(op->layout, op->ptr); } static bool wm_gpencil_export_pdf_poll(bContext *C) diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c index e4fabc0c5de..a9911f1cef2 100644 --- a/source/blender/editors/io/io_gpencil_import.c +++ b/source/blender/editors/io/io_gpencil_import.c @@ -136,13 +136,9 @@ static void ui_gpencil_import_svg_settings(uiLayout *layout, PointerRNA *imfptr) uiItemR(col, imfptr, "scale", 0, NULL, ICON_NONE); } -static void wm_gpencil_import_svg_draw(bContext *C, wmOperator *op) +static void wm_gpencil_import_svg_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - - ui_gpencil_import_svg_settings(op->layout, &ptr); + ui_gpencil_import_svg_settings(op->layout, op->ptr); } static bool wm_gpencil_import_svg_poll(bContext *C) diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 51190268c4c..43492cd57af 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -911,76 +911,73 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event) static void edbm_bevel_ui(bContext *C, wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); uiLayout *col, *row; - PointerRNA ptr, toolsettings_ptr; + PointerRNA toolsettings_ptr; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - - int profile_type = RNA_enum_get(&ptr, "profile_type"); - int offset_type = RNA_enum_get(&ptr, "offset_type"); - bool affect_type = RNA_enum_get(&ptr, "affect"); + int profile_type = RNA_enum_get(op->ptr, "profile_type"); + int offset_type = RNA_enum_get(op->ptr, "offset_type"); + bool affect_type = RNA_enum_get(op->ptr, "affect"); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiItemS(layout); - uiItemR(layout, &ptr, "offset_type", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "offset_type", 0, NULL, ICON_NONE); if (offset_type == BEVEL_AMT_PERCENT) { - uiItemR(layout, &ptr, "offset_pct", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "offset_pct", 0, NULL, ICON_NONE); } else { - uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "offset", 0, NULL, ICON_NONE); } - uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "segments", 0, NULL, ICON_NONE); if (ELEM(profile_type, BEVEL_PROFILE_SUPERELLIPSE, BEVEL_PROFILE_CUSTOM)) { uiItemR(layout, - &ptr, + op->ptr, "profile", UI_ITEM_R_SLIDER, (profile_type == BEVEL_PROFILE_SUPERELLIPSE) ? IFACE_("Shape") : IFACE_("Miter Shape"), ICON_NONE); } - uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "material", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, true); - uiItemR(col, &ptr, "harden_normals", 0, NULL, ICON_NONE); - uiItemR(col, &ptr, "clamp_overlap", 0, NULL, ICON_NONE); - uiItemR(col, &ptr, "loop_slide", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "harden_normals", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "clamp_overlap", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "loop_slide", 0, NULL, ICON_NONE); col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark")); uiLayoutSetActive(col, affect_type == BEVEL_AFFECT_EDGES); - uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seams"), ICON_NONE); - uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE); + uiItemR(col, op->ptr, "mark_seam", 0, IFACE_("Seams"), ICON_NONE); + uiItemR(col, op->ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE); uiItemS(layout); col = uiLayoutColumn(layout, false); uiLayoutSetActive(col, affect_type == BEVEL_AFFECT_EDGES); - uiItemR(col, &ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE); - uiItemR(col, &ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE); - if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) { - uiItemR(col, &ptr, "spread", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE); + uiItemR(col, op->ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE); + if (RNA_enum_get(op->ptr, "miter_inner") == BEVEL_MITER_ARC) { + uiItemR(col, op->ptr, "spread", 0, NULL, ICON_NONE); } uiItemS(layout); col = uiLayoutColumn(layout, false); uiLayoutSetActive(col, affect_type == BEVEL_AFFECT_EDGES); - uiItemR(col, &ptr, "vmesh_method", 0, IFACE_("Intersection Type"), ICON_NONE); + uiItemR(col, op->ptr, "vmesh_method", 0, IFACE_("Intersection Type"), ICON_NONE); - uiItemR(layout, &ptr, "face_strength_mode", 0, IFACE_("Face Strength"), ICON_NONE); + uiItemR(layout, op->ptr, "face_strength_mode", 0, IFACE_("Face Strength"), ICON_NONE); uiItemS(layout); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); if (profile_type == BEVEL_PROFILE_CUSTOM) { /* Get an RNA pointer to ToolSettings to give to the curve profile template code. */ Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c index 141f120396a..d1f228e951a 100644 --- a/source/blender/editors/mesh/editmesh_intersect.c +++ b/source/blender/editors/mesh/editmesh_intersect.c @@ -251,32 +251,28 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void edbm_intersect_ui(bContext *C, wmOperator *op) +static void edbm_intersect_ui(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); uiLayout *row; - PointerRNA ptr; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - - bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT; + bool use_exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT; uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiItemS(layout); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "separate_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "separate_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiItemS(layout); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiItemS(layout); if (!use_exact) { - uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "threshold", 0, NULL, ICON_NONE); } } @@ -418,32 +414,28 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void edbm_intersect_boolean_ui(bContext *C, wmOperator *op) +static void edbm_intersect_boolean_ui(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; uiLayout *row; - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT; + bool use_exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT; uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "operation", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "operation", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiItemS(layout); row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, op->ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiItemS(layout); - uiItemR(layout, &ptr, "use_swap", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "use_self", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "use_swap", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "use_self", 0, NULL, ICON_NONE); if (!use_exact) { - uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "threshold", 0, NULL, ICON_NONE); } } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 33e4691bfb5..bb332a4094c 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3694,21 +3694,18 @@ static const EnumPropertyItem *shape_itemf(bContext *C, static void edbm_blend_from_shape_ui(bContext *C, wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; Object *obedit = CTX_data_edit_object(C); Mesh *me = obedit->data; PointerRNA ptr_key; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); RNA_id_pointer_create((ID *)me->key, &ptr_key); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", NULL, ICON_SHAPEKEY_DATA); - uiItemR(layout, &ptr, "blend", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "add", 0, NULL, ICON_NONE); + uiItemPointerR(layout, op->ptr, "shape", &ptr_key, "key_blocks", NULL, ICON_SHAPEKEY_DATA); + uiItemR(layout, op->ptr, "blend", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "add", 0, NULL, ICON_NONE); } void MESH_OT_blend_from_shape(wmOperatorType *ot) @@ -5612,29 +5609,25 @@ static bool edbm_decimate_check(bContext *UNUSED(C), wmOperator *UNUSED(op)) return true; } -static void edbm_decimate_ui(bContext *C, wmOperator *op) +static void edbm_decimate_ui(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout, *row, *col, *sub; - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); uiLayoutSetPropSep(layout, true); - uiItemR(layout, &ptr, "ratio", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "ratio", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "use_vertex_group", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "use_vertex_group", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_vertex_group")); - uiItemR(col, &ptr, "vertex_group_factor", 0, NULL, ICON_NONE); - uiItemR(col, &ptr, "invert_vertex_group", 0, NULL, ICON_NONE); + uiLayoutSetActive(col, RNA_boolean_get(op->ptr, "use_vertex_group")); + uiItemR(col, op->ptr, "vertex_group_factor", 0, NULL, ICON_NONE); + uiItemR(col, op->ptr, "invert_vertex_group", 0, NULL, ICON_NONE); row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry")); - uiItemR(row, &ptr, "use_symmetry", 0, "", ICON_NONE); + uiItemR(row, op->ptr, "use_symmetry", 0, "", ICON_NONE); sub = uiLayoutRow(row, true); - uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry")); - uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiLayoutSetActive(sub, RNA_boolean_get(op->ptr, "use_symmetry")); + uiItemR(sub, op->ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE); } void MESH_OT_decimate(wmOperatorType *ot) diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index bcddf3d585c..a0de1e0fa84 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -3110,24 +3110,21 @@ static int object_convert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void object_convert_ui(bContext *C, wmOperator *op) +static void object_convert_ui(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); - PointerRNA ptr; uiLayoutSetPropSep(layout, true); - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "keep_original", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "target", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "keep_original", 0, NULL, ICON_NONE); - if (RNA_enum_get(&ptr, "target") == OB_GPENCIL) { - uiItemR(layout, &ptr, "thickness", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "angle", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "seams", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "faces", 0, NULL, ICON_NONE); + if (RNA_enum_get(op->ptr, "target") == OB_GPENCIL) { + uiItemR(layout, op->ptr, "thickness", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "angle", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "offset", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "seams", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "faces", 0, NULL, ICON_NONE); } } diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 3df63d423e2..6df96b1e30f 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -199,10 +199,9 @@ static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), return !(STREQ(prop_id, "filepath")); } -static void screenshot_draw(bContext *C, wmOperator *op) +static void screenshot_draw(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); ScreenshotData *scd = op->customdata; uiLayoutSetPropSep(layout, true); @@ -214,9 +213,8 @@ static void screenshot_draw(bContext *C, wmOperator *op) uiTemplateImageSettings(layout, &ptr, false); /* main draw call */ - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); uiDefAutoButsRNA( - layout, &ptr, screenshot_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); + layout, op->ptr, screenshot_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); } static bool screenshot_poll(bContext *C) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 83dd5098a30..48e1397601f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1479,16 +1479,15 @@ static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr), return !(STR_ELEM(prop_id, "filepath", "directory", "filename")); } -static void image_open_draw(bContext *C, wmOperator *op) +static void image_open_draw(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); ImageOpenData *iod = op->customdata; ImageFormatData *imf = &iod->im_format; PointerRNA imf_ptr, ptr; /* main draw call */ - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); uiDefAutoButsRNA( layout, &ptr, image_open_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); @@ -2001,10 +2000,9 @@ static bool image_save_as_draw_check_prop(PointerRNA *ptr, ((STREQ(prop_id, "relative_path")) && RNA_boolean_get(ptr, "copy"))); } -static void image_save_as_draw(bContext *C, wmOperator *op) +static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); ImageSaveData *isd = op->customdata; PointerRNA imf_ptr, ptr; const bool is_multiview = RNA_boolean_get(op->ptr, "show_multiview"); @@ -2014,7 +2012,7 @@ static void image_save_as_draw(bContext *C, wmOperator *op) uiTemplateImageSettings(layout, &imf_ptr, false); /* main draw call */ - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); uiDefAutoButsRNA( layout, &ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); @@ -2614,18 +2612,17 @@ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e return WM_operator_props_dialog_popup(C, op, 300); } -static void image_new_draw(bContext *C, wmOperator *op) +static void image_new_draw(bContext *UNUSED(C), wmOperator *op) { uiLayout *col; uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); PointerRNA ptr; #if 0 Scene *scene = CTX_data_scene(C); const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; #endif - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); /* copy of WM_operator_props_dialog_popup() layout */ @@ -3991,14 +3988,13 @@ static int tile_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev return WM_operator_props_dialog_popup(C, op, 300); } -static void tile_add_draw(bContext *C, wmOperator *op) +static void tile_add_draw(bContext *UNUSED(C), wmOperator *op) { uiLayout *col; uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); PointerRNA ptr; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); @@ -4128,11 +4124,10 @@ static int tile_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e return WM_operator_props_dialog_popup(C, op, 300); } -static void tile_fill_draw(bContext *C, wmOperator *op) +static void tile_fill_draw(bContext *UNUSED(C), wmOperator *op) { - wmWindowManager *wm = CTX_wm_manager(C); PointerRNA ptr; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); draw_fill_tile(&ptr, op->layout); } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 0b0c43d3417..2df8dce0b3c 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -729,16 +729,15 @@ static int sequencer_add_movie_strip_invoke(bContext *C, return OPERATOR_RUNNING_MODAL; } -static void sequencer_add_draw(bContext *C, wmOperator *op) +static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); SequencerAddData *sad = op->customdata; ImageFormatData *imf = &sad->im_format; PointerRNA imf_ptr, ptr; /* Main draw call. */ - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); + RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); uiDefAutoButsRNA( layout, &ptr, sequencer_add_draw_check_fn, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5d616969a4f..52cfeeecb5c 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1485,26 +1485,22 @@ static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *ev return sequencer_split_exec(C, op); } -static void sequencer_split_ui(bContext *C, wmOperator *op) +static void sequencer_split_ui(bContext *UNUSED(C), wmOperator *op) { uiLayout *layout = op->layout; - wmWindowManager *wm = CTX_wm_manager(C); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - PointerRNA ptr; - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiLayout *row = uiLayoutRow(layout, false); - uiItemR(row, &ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiItemR(layout, &ptr, "frame", 0, NULL, ICON_NONE); - uiItemR(layout, &ptr, "side", 0, NULL, ICON_NONE); + uiItemR(row, op->ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "frame", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "side", 0, NULL, ICON_NONE); uiItemS(layout); - uiItemR(layout, &ptr, "use_cursor_position", 0, NULL, ICON_NONE); - if (RNA_boolean_get(&ptr, "use_cursor_position")) { - uiItemR(layout, &ptr, "channel", 0, NULL, ICON_NONE); + uiItemR(layout, op->ptr, "use_cursor_position", 0, NULL, ICON_NONE); + if (RNA_boolean_get(op->ptr, "use_cursor_position")) { + uiItemR(layout, op->ptr, "channel", 0, NULL, ICON_NONE); } } -- cgit v1.2.3