Fix creating operator properties without an owner_id

Any dynamic enum access would not use the callback.
Always set the owner_id to avoid this causing problems.

Oversight in 919558854d
This commit is contained in:
Campbell Barton 2021-04-19 23:43:55 +10:00
parent 33f218fa3f
commit 8245805ce3
13 changed files with 62 additions and 40 deletions

View File

@ -1434,10 +1434,11 @@ 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(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
const eGP_Interpolate_Type type = RNA_enum_get(op->ptr, "type");

View File

@ -240,9 +240,10 @@ 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(NULL, op->type->srna, op->properties, &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);
@ -593,11 +594,12 @@ 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 *UNUSED(C), wmOperator *op)
static void wm_alembic_import_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
ui_alembic_import_settings(op->layout, &ptr);
}

View File

@ -400,11 +400,12 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
}
}
static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
static void wm_collada_export_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiCollada_exportSettings(op->layout, &ptr);
}
@ -797,11 +798,12 @@ 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 *UNUSED(C), wmOperator *op)
static void wm_collada_import_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiCollada_importSettings(op->layout, &ptr);
}

View File

@ -215,11 +215,12 @@ 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 *UNUSED(C), wmOperator *op)
static void wm_gpencil_export_svg_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
ui_gpencil_export_svg_settings(op->layout, &ptr);
}
@ -377,11 +378,12 @@ 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 *UNUSED(C), wmOperator *op)
static void wm_gpencil_export_pdf_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
ui_gpencil_export_pdf_settings(op->layout, &ptr);
}

View File

@ -136,10 +136,11 @@ 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 *UNUSED(C), wmOperator *op)
static void wm_gpencil_import_svg_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
ui_gpencil_import_svg_settings(op->layout, &ptr);
}

View File

@ -911,10 +911,11 @@ 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;
RNA_pointer_create(NULL, op->type->srna, op->properties, &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");

View File

@ -251,13 +251,14 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static void edbm_intersect_ui(bContext *UNUSED(C), wmOperator *op)
static void edbm_intersect_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
wmWindowManager *wm = CTX_wm_manager(C);
uiLayout *row;
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT;
@ -417,13 +418,14 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static void edbm_intersect_boolean_ui(bContext *UNUSED(C), wmOperator *op)
static void edbm_intersect_boolean_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
uiLayout *row;
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT;

View File

@ -3694,12 +3694,13 @@ 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(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
RNA_id_pointer_create((ID *)me->key, &ptr_key);
uiLayoutSetPropSep(layout, true);
@ -5611,12 +5612,13 @@ static bool edbm_decimate_check(bContext *UNUSED(C), wmOperator *UNUSED(op))
return true;
}
static void edbm_decimate_ui(bContext *UNUSED(C), wmOperator *op)
static void edbm_decimate_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout, *row, *col, *sub;
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true);

View File

@ -3110,14 +3110,15 @@ static int object_convert_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static void object_convert_ui(bContext *UNUSED(C), wmOperator *op)
static void object_convert_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
uiLayoutSetPropSep(layout, true);
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
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);

View File

@ -199,9 +199,10 @@ static bool screenshot_draw_check_prop(PointerRNA *UNUSED(ptr),
return !(STREQ(prop_id, "filepath"));
}
static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
static void screenshot_draw(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
wmWindowManager *wm = CTX_wm_manager(C);
ScreenshotData *scd = op->customdata;
uiLayoutSetPropSep(layout, true);
@ -213,7 +214,7 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
uiTemplateImageSettings(layout, &ptr, false);
/* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
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);
}

View File

@ -1479,15 +1479,16 @@ static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr),
return !(STR_ELEM(prop_id, "filepath", "directory", "filename"));
}
static void image_open_draw(bContext *UNUSED(C), wmOperator *op)
static void image_open_draw(bContext *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(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(
layout, &ptr, image_open_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
@ -2000,9 +2001,10 @@ 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 *UNUSED(C), wmOperator *op)
static void image_save_as_draw(bContext *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");
@ -2012,7 +2014,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
uiTemplateImageSettings(layout, &imf_ptr, false);
/* main draw call */
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(
layout, &ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
@ -2612,17 +2614,18 @@ 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 *UNUSED(C), wmOperator *op)
static void image_new_draw(bContext *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(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
/* copy of WM_operator_props_dialog_popup() layout */
@ -3988,13 +3991,14 @@ 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 *UNUSED(C), wmOperator *op)
static void tile_add_draw(bContext *C, wmOperator *op)
{
uiLayout *col;
uiLayout *layout = op->layout;
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@ -4124,10 +4128,11 @@ 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 *UNUSED(C), wmOperator *op)
static void tile_fill_draw(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
draw_fill_tile(&ptr, op->layout);
}

View File

@ -729,15 +729,16 @@ static int sequencer_add_movie_strip_invoke(bContext *C,
return OPERATOR_RUNNING_MODAL;
}
static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op)
static void sequencer_add_draw(bContext *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(NULL, op->type->srna, op->properties, &ptr);
RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
uiDefAutoButsRNA(
layout, &ptr, sequencer_add_draw_check_fn, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);

View File

@ -1485,14 +1485,15 @@ static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return sequencer_split_exec(C, op);
}
static void sequencer_split_ui(bContext *UNUSED(C), wmOperator *op)
static void sequencer_split_ui(bContext *C, wmOperator *op)
{
uiLayout *layout = op->layout;
wmWindowManager *wm = CTX_wm_manager(C);
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &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);