Add RNA accessor for 'extra user' ID tag,

Not expected to be used directly by users, but very handy to have around
for investigations and debugging.
This commit is contained in:
Bastien Montagne 2022-05-02 15:53:29 +02:00
parent 3d5f5c2d9a
commit 263f56ba49
1 changed files with 20 additions and 0 deletions

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