WM: add function to access last_properties

This commit is contained in:
2018-05-02 17:59:43 +02:00
parent e4774c0b2d
commit f5cb96704b
3 changed files with 19 additions and 6 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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.
*/