diff options
author | Campbell Barton <campbell@blender.org> | 2022-02-23 08:29:51 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-02-23 08:29:51 +0300 |
commit | 3c0fd287cb28ec354bfbbfaaf593fd78e698fcc9 (patch) | |
tree | 41503fb00c8457397ad33d1445ae2880ff201c74 /source/blender/windowmanager/intern/wm_toolsystem.c | |
parent | 06bc20f61a8289d612ea985e45a372721d66ccb1 (diff) | |
parent | 74611e3555684a22e9a07bd0992a444b571b8083 (diff) |
Merge branch 'blender-v3.1-release'
Diffstat (limited to 'source/blender/windowmanager/intern/wm_toolsystem.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index e911a2801e5..59895292f67 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -806,13 +806,25 @@ void WM_toolsystem_do_msg_notify_tag_refresh(bContext *C, WM_toolsystem_refresh_screen_area(workspace, view_layer, area); } +static IDProperty *idprops_ensure_named_group(IDProperty *group, const char *idname) +{ + IDProperty *prop = IDP_GetPropertyFromGroup(group, idname); + if ((prop == NULL) || (prop->type != IDP_GROUP)) { + IDPropertyTemplate val = {0}; + prop = IDP_New(IDP_GROUP, &val, __func__); + STRNCPY(prop->name, idname); + IDP_ReplaceInGroup_ex(group, prop, NULL); + } + return prop; +} + IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref) { if (tref->properties == NULL) { IDPropertyTemplate val = {0}; - tref->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties"); + tref->properties = IDP_New(IDP_GROUP, &val, __func__); } - return tref->properties; + return idprops_ensure_named_group(tref->properties, tref->idname); } bool WM_toolsystem_ref_properties_get_ex(bToolRef *tref, @@ -832,17 +844,7 @@ void WM_toolsystem_ref_properties_ensure_ex(bToolRef *tref, PointerRNA *r_ptr) { IDProperty *group = WM_toolsystem_ref_properties_ensure_idprops(tref); - IDProperty *prop = IDP_GetPropertyFromGroup(group, idname); - if (prop == NULL) { - IDPropertyTemplate val = {0}; - prop = IDP_New(IDP_GROUP, &val, "wmGenericProperties"); - STRNCPY(prop->name, idname); - IDP_ReplaceInGroup_ex(group, prop, NULL); - } - else { - BLI_assert(prop->type == IDP_GROUP); - } - + IDProperty *prop = idprops_ensure_named_group(group, idname); RNA_pointer_create(NULL, type, prop, r_ptr); } |