Merge branch 'blender-v4.1-release'

This commit is contained in:
Hans Goudey
2024-03-12 10:54:14 -04:00
4 changed files with 251 additions and 32 deletions

View File

@@ -742,6 +742,16 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
/* avoid freeing when types match in case they are referenced by the UI, see: #37073
* obviously this isn't a complete solution, but helps for common cases. */
prop_exist = IDP_GetPropertyFromGroup(group, prop->name);
if (prop_exist && prop_exist->ui_data) {
/* Take ownership of the existing property's UI data. */
const eIDPropertyUIDataType src_type = IDP_ui_data_type(prop_exist);
IDPropertyUIData *ui_data = prop_exist->ui_data;
prop_exist->ui_data = nullptr;
prop->ui_data = IDP_TryConvertUIData(ui_data, src_type, IDP_ui_data_type(prop));
}
if ((prop_exist != nullptr) && (prop_exist->type == prop->type) &&
(prop_exist->subtype == prop->subtype))
{
@@ -750,12 +760,8 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
prop->next = prop_exist->next;
prop->flag = prop_exist->flag;
/* Don't free and reset the existing property's UI data, since this only assigns a value. */
IDPropertyUIData *ui_data = prop_exist->ui_data;
prop_exist->ui_data = nullptr;
IDP_FreePropertyContent(prop_exist);
*prop_exist = *prop;
prop_exist->ui_data = ui_data;
MEM_freeN(prop);
}
else {