diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-02 18:59:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-03 08:09:22 +0300 |
commit | f5cb96704bcdbd94cc7dacfef51c8028c28f4c4d (patch) | |
tree | 26cdbbf3e7bacfefd5fa4e0151436f3d75436cea /source/blender/windowmanager | |
parent | e4774c0b2d02d3231c1bdc0097d879b77daa5651 (diff) |
WM: add function to access last_properties
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 15 |
2 files changed, 18 insertions, 0 deletions
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. */ |