From a5c4218b02697f77e333305340407cf4ed59e207 Mon Sep 17 00:00:00 2001 From: Falk David Date: Fri, 19 Jul 2024 17:29:10 +0200 Subject: [PATCH] Fix: Outliner: Grease Pencil object filter The filter for grease pencil objects wasn't showing up. The code was still checking for the legacy type. Now, we're checking for the right object type and are also looking at the `bpy.data.grease_pencils_v3` list to make the checkbox show up in the UI. --- scripts/startup/bl_ui/space_outliner.py | 2 +- source/blender/editors/space_outliner/outliner_tree.cc | 4 ++-- source/blender/makesdna/DNA_space_types.h | 4 ++-- source/blender/makesrna/intern/rna_space.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/startup/bl_ui/space_outliner.py b/scripts/startup/bl_ui/space_outliner.py index ce270879c03..539c4792bca 100644 --- a/scripts/startup/bl_ui/space_outliner.py +++ b/scripts/startup/bl_ui/space_outliner.py @@ -492,7 +492,7 @@ class OUTLINER_PT_filter(Panel): row = sub.row() row.label(icon='CAMERA_DATA') row.prop(space, "use_filter_object_camera", text="Cameras") - if bpy.data.grease_pencils: + if bpy.data.grease_pencils_v3: row = sub.row() row.label(icon='STROKE') row.prop(space, "use_filter_object_grease_pencil", text="Grease Pencil") diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index afe476d7319..16c58a0a87c 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -907,8 +907,8 @@ static bool outliner_element_visible_get(const Scene *scene, return false; } break; - case OB_GPENCIL_LEGACY: - if (exclude_filter & SO_FILTER_NO_OB_GPENCIL_LEGACY) { + case OB_GREASE_PENCIL: + if (exclude_filter & SO_FILTER_NO_OB_GREASE_PENCIL) { return false; } break; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index f7b884145cc..30061447792 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -368,12 +368,12 @@ typedef enum eSpaceOutliner_Filter { SO_FILTER_ID_TYPE = (1 << 19), - SO_FILTER_NO_OB_GPENCIL_LEGACY = (1 << 20), + SO_FILTER_NO_OB_GREASE_PENCIL = (1 << 20), } eSpaceOutliner_Filter; #define SO_FILTER_OB_TYPE \ (SO_FILTER_NO_OB_MESH | SO_FILTER_NO_OB_ARMATURE | SO_FILTER_NO_OB_EMPTY | \ - SO_FILTER_NO_OB_LAMP | SO_FILTER_NO_OB_CAMERA | SO_FILTER_NO_OB_GPENCIL_LEGACY | \ + SO_FILTER_NO_OB_LAMP | SO_FILTER_NO_OB_CAMERA | SO_FILTER_NO_OB_GREASE_PENCIL | \ SO_FILTER_NO_OB_OTHERS) #define SO_FILTER_OB_STATE \ diff --git a/source/blender/makesrna/intern/rna_space.cc b/source/blender/makesrna/intern/rna_space.cc index e31d702087b..7e0478f0872 100644 --- a/source/blender/makesrna/intern/rna_space.cc +++ b/source/blender/makesrna/intern/rna_space.cc @@ -4038,7 +4038,7 @@ static void rna_def_space_outliner(BlenderRNA *brna) RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, nullptr); prop = RNA_def_property(srna, "use_filter_object_grease_pencil", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, nullptr, "filter", SO_FILTER_NO_OB_GPENCIL_LEGACY); + RNA_def_property_boolean_negative_sdna(prop, nullptr, "filter", SO_FILTER_NO_OB_GREASE_PENCIL); RNA_def_property_ui_text(prop, "Show Grease Pencil", "Show grease pencil objects"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, nullptr);