Fix T87864: Context is None for draw method

Use WM_operator_properties_create_ptr so the owner_id is
set to the window manger which is now required.

Regression in 919558854d.
This commit is contained in:
Campbell Barton 2021-04-28 15:58:30 +10:00
parent 7e678c3096
commit 36863cf129
Notes: blender-bot 2023-02-14 08:47:25 +01:00
Referenced by issue #87864, Context is None with operator draw method
1 changed files with 10 additions and 2 deletions

View File

@ -604,14 +604,22 @@ static PointerRNA rna_Operator_options_get(PointerRNA *ptr)
static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
{
wmOperator *op = (wmOperator *)ptr->data;
return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
PointerRNA result;
WM_operator_properties_create_ptr(&result, op->type);
result.data = op->properties;
return result;
}
static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
{
wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro *)ptr->data;
wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true);
return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
PointerRNA result;
WM_operator_properties_create_ptr(&result, ot);
result.data = otmacro->properties;
return result;
}
static const EnumPropertyItem *rna_Event_value_itemf(bContext *UNUSED(C),