From d4ce5d6fc9e12a08094b01cf02189bafb38f8e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 5 Jan 2024 14:38:53 +0100 Subject: [PATCH] Anim: add RNA getter for `bone_collection.is_visible_effectively` Add an RNA getter for `bone_collection.is_visible_effectively`. This value could already be derived from other flags, but now that logic sits in C++ and doesn't require duplicated logic in Python any more. --- source/blender/makesrna/intern/rna_armature.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/blender/makesrna/intern/rna_armature.cc b/source/blender/makesrna/intern/rna_armature.cc index 4a3046195d4..72c3823d4d6 100644 --- a/source/blender/makesrna/intern/rna_armature.cc +++ b/source/blender/makesrna/intern/rna_armature.cc @@ -384,6 +384,12 @@ static void rna_BoneCollection_is_visible_set(PointerRNA *ptr, const bool is_vis WM_main_add_notifier(NC_OBJECT | ND_POSE, &arm->id); } +static bool rna_BoneCollection_is_visible_effectively_get(PointerRNA *ptr) +{ + const BoneCollection *bcoll = (BoneCollection *)ptr->data; + return bcoll->is_visible_effectively(); +} + static char *rna_BoneCollection_path(const PointerRNA *ptr) { const BoneCollection *bcoll = (const BoneCollection *)ptr->data; @@ -2265,6 +2271,15 @@ static void rna_def_bonecollection(BlenderRNA *brna) "visible; always True for root bone collections"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_visible_effectively", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_BoneCollection_is_visible_effectively_get", nullptr); + RNA_def_property_ui_text( + prop, + "Effective Visibility", + "Whether this bone collection is effectively visible in the viewport. This is True when " + "this bone collection and all of its ancestors are visible"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_local_override", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, nullptr, "flags", BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL); RNA_def_property_ui_text(