Outliner: New Grease Pencil filter

Actually is impossible to filter the Grease Pencil object type in the Outliner because only Meshes, Cameras and Lights are supported. This patch adds the Grease Pencil filter that allows artists to select only this type of objects. This filter is very handy for storyboarding.

Pull Request #104473
This commit is contained in:
Antonio Vazquez 2023-02-27 13:07:14 +01:00 • committed by Antonio Vazquez
parent 8aedc03aa2
commit b558fff5b8
4 changed files with 18 additions and 1 deletions

View file

@ -484,6 +484,10 @@ 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:
row = sub.row()
row.label(icon='STROKE')
row.prop(space, "use_filter_object_grease_pencil", text="Grease Pencil")
row = sub.row()
row.label(icon='EMPTY_DATA')
row.prop(space, "use_filter_object_empty", text="Empties")

View file

@ -1438,6 +1438,11 @@ static bool outliner_element_visible_get(const Scene *scene,
return false;
}
break;
case OB_GPENCIL:
if (exclude_filter & SO_FILTER_NO_OB_GPENCIL) {
return false;
}
break;
default:
if (exclude_filter & SO_FILTER_NO_OB_OTHERS) {
return false;

View file

@ -340,11 +340,14 @@ typedef enum eSpaceOutliner_Filter {
SO_FILTER_NO_VIEW_LAYERS = (1 << 18),
SO_FILTER_ID_TYPE = (1 << 19),
SO_FILTER_NO_OB_GPENCIL = (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_OTHERS)
SO_FILTER_NO_OB_LAMP | SO_FILTER_NO_OB_CAMERA | SO_FILTER_NO_OB_GPENCIL | \
SO_FILTER_NO_OB_OTHERS)
#define SO_FILTER_OB_STATE \
(SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_SELECTED | SO_FILTER_OB_STATE_ACTIVE | \

View file

@ -3908,6 +3908,11 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Cameras", "Show camera objects");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
prop = RNA_def_property(srna, "use_filter_object_grease_pencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_GPENCIL);
RNA_def_property_ui_text(prop, "Show Grease Pencil", "Show grease pencil objects");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
prop = RNA_def_property(srna, "use_filter_object_others", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_OTHERS);
RNA_def_property_ui_text(