diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index a0f864d841d..ba955d65ac5 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -389,13 +389,8 @@ static PointerRNA rna_WindoManager_operator_properties_last(const char *idname) wmOperatorType *ot = WM_operatortype_find(idname, true); if (ot != NULL) { - /* Could make optional. */ - if (ot->last_properties == NULL) { - IDPropertyTemplate val = {0}; - ot->last_properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties"); - } PointerRNA ptr; - RNA_pointer_create(NULL, ot->srna, ot->last_properties, &ptr); + WM_operator_last_properties_ensure(ot, &ptr); return ptr; } return PointerRNA_NULL; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 78498fc35b1..31c30388560 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -340,6 +340,9 @@ void WM_operator_properties_free(struct PointerRNA *ptr); bool WM_operator_check_ui_empty(struct wmOperatorType *ot); bool WM_operator_check_ui_enabled(const struct bContext *C, const char *idname); + +IDProperty *WM_operator_last_properties_ensure_idprops(struct wmOperatorType *ot); +void WM_operator_last_properties_ensure(struct wmOperatorType *ot, struct PointerRNA *ptr); wmOperator *WM_operator_last_redo(const struct bContext *C); ID *WM_operator_drop_load_path(struct bContext *C, struct wmOperator *op, const short idcode); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index e6c7f5e94cb..4e21607d847 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1388,6 +1388,21 @@ wmOperator *WM_operator_last_redo(const bContext *C) return op; } +IDProperty *WM_operator_last_properties_ensure_idprops(wmOperatorType *ot) +{ + if (ot->last_properties == NULL) { + IDPropertyTemplate val = {0}; + ot->last_properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties"); + } + return ot->last_properties; +} + +void WM_operator_last_properties_ensure(wmOperatorType *ot, PointerRNA *ptr) +{ + IDProperty *props = WM_operator_last_properties_ensure_idprops(ot); + RNA_pointer_create(NULL, ot->srna, props, ptr); +} + /** * Use for drag & drop a path or name with operators invoke() function. */