Merge branch 'blender-v3.2-release'

This commit is contained in:
Bastien Montagne
2022-05-02 16:06:42 +02:00
3 changed files with 29 additions and 4 deletions

View File

@@ -120,7 +120,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i
Key *key = ((flag & LIB_ID_FREE_NO_MAIN) == 0) ? BKE_key_from_id(id) : NULL;
if ((flag & LIB_ID_FREE_NO_USER_REFCOUNT) == 0) {
BKE_libblock_relink_ex(bmain, id, NULL, NULL, 0);
BKE_libblock_relink_ex(bmain, id, NULL, NULL, ID_REMAP_SKIP_USER_CLEAR);
}
if ((flag & LIB_ID_FREE_NO_MAIN) == 0 && key != NULL) {
@@ -264,7 +264,12 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS));
/* Since we removed ID from Main,
* we also need to unlink its own other IDs usages ourself. */
BKE_libblock_relink_ex(bmain, id, NULL, NULL, ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS);
BKE_libblock_relink_ex(
bmain,
id,
NULL,
NULL,
(ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS | ID_REMAP_SKIP_USER_CLEAR));
}
}

View File

@@ -409,7 +409,7 @@ static void libblock_remap_data_update_tags(ID *old_id, ID *new_id, void *user_d
/* XXX We may not want to always 'transfer' fake-user from old to new id...
* Think for now it's desired behavior though,
* we can always add an option (flag) to control this later if needed. */
if (old_id && (old_id->flag & LIB_FAKEUSER)) {
if (old_id != NULL && (old_id->flag & LIB_FAKEUSER) && new_id != NULL) {
id_fake_user_clear(old_id);
id_fake_user_set(new_id);
}
@@ -417,7 +417,7 @@ static void libblock_remap_data_update_tags(ID *old_id, ID *new_id, void *user_d
id_us_clear_real(old_id);
}
if (new_id && (new_id->tag & LIB_TAG_INDIRECT) &&
if (new_id != NULL && (new_id->tag & LIB_TAG_INDIRECT) &&
(new_id->runtime.remap.status & ID_REMAP_IS_LINKED_DIRECT)) {
new_id->tag &= ~LIB_TAG_INDIRECT;
new_id->flag &= ~LIB_INDIRECT_WEAK_LINK;

View File

@@ -586,6 +586,18 @@ void rna_ID_fake_user_set(PointerRNA *ptr, bool value)
}
}
void rna_ID_extra_user_set(PointerRNA *ptr, bool value)
{
ID *id = (ID *)ptr->data;
if (value) {
id_us_ensure_real(id);
}
else {
id_us_clear_real(id);
}
}
IDProperty **rna_PropertyGroup_idprops(PointerRNA *ptr)
{
return (IDProperty **)&ptr->data;
@@ -1959,6 +1971,14 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
prop = RNA_def_property(srna, "use_extra_user", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_EXTRAUSER);
RNA_def_property_ui_text(
prop,
"Extra User",
"Indicates wether an extra user is set or not (mainly for internal/debug usages)");
RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_extra_user_set");
prop = RNA_def_property(srna, "is_embedded_data", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_EMBEDDED_DATA);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);