[Bf-blender-cvs] [263f56ba493] blender-v3.2-release: Add RNA accessor for 'extra user' ID tag,

Bastien Montagne noreply at git.blender.org
Mon May 2 16:06:26 CEST 2022


Commit: 263f56ba493ae3c9b87e4df095b158af9805d552
Author: Bastien Montagne
Date:   Mon May 2 15:53:29 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB263f56ba493ae3c9b87e4df095b158af9805d552

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.

===================================================================

M	source/blender/makesrna/intern/rna_ID.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index e2ce1f23a33..b65e08311fe 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -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);



More information about the Bf-blender-cvs mailing list