diff --git a/scripts/startup/bl_ui/properties_data_grease_pencil.py b/scripts/startup/bl_ui/properties_data_grease_pencil.py index 0832603dc22..9f374a7d6dc 100644 --- a/scripts/startup/bl_ui/properties_data_grease_pencil.py +++ b/scripts/startup/bl_ui/properties_data_grease_pencil.py @@ -230,6 +230,19 @@ class DATA_PT_grease_pencil_layer_relations(LayerDataButtonsPanel, Panel): col.prop_search(layer, "viewlayer_render", context.scene, "view_layers", text="View Layer") +class DATA_PT_grease_pencil_settings(DataButtonsPanel, Panel): + bl_label = "Settings" + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + layout.use_property_decorate = False + + grease_pencil = context.grease_pencil + col = layout.column(align=True) + col.prop(grease_pencil, "stroke_depth_order", text="Stroke Depth Order") + + class DATA_PT_grease_pencil_custom_props(DataButtonsPanel, PropertyPanel, Panel): _context_path = "object.data" _property_type = bpy.types.GreasePencilv3 @@ -243,6 +256,7 @@ classes = ( DATA_PT_grease_pencil_layer_masks, DATA_PT_grease_pencil_layer_transform, DATA_PT_grease_pencil_layer_relations, + DATA_PT_grease_pencil_settings, DATA_PT_grease_pencil_custom_props, GREASE_PENCIL_MT_grease_pencil_add_layer_extra, ) diff --git a/source/blender/makesrna/intern/rna_grease_pencil.cc b/source/blender/makesrna/intern/rna_grease_pencil.cc index fa92581261e..bf0d580c7fb 100644 --- a/source/blender/makesrna/intern/rna_grease_pencil.cc +++ b/source/blender/makesrna/intern/rna_grease_pencil.cc @@ -549,6 +549,16 @@ static void rna_def_grease_pencil_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem prop_stroke_depth_order_items[] = { + {0, "2D", 0, "2D Layers", "Display strokes using grease pencil layers to define order"}, + {GREASE_PENCIL_STROKE_ORDER_3D, + "3D", + 0, + "3D Location", + "Display strokes using real 3D position in 3D space"}, + {0, nullptr, 0, nullptr, nullptr}, + }; + srna = RNA_def_struct(brna, "GreasePencilv3", "ID"); RNA_def_struct_sdna(srna, "GreasePencil"); RNA_def_struct_ui_text(srna, "Grease Pencil", "Grease Pencil data-block"); @@ -612,6 +622,16 @@ static void rna_def_grease_pencil_data(BlenderRNA *brna) "Auto-Lock Layers", "Automatically lock all layers except the active one to avoid accidental changes"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_autolock"); + + /* Uses a single flag, because the depth order can only be 2D or 3D. */ + prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag"); + RNA_def_property_enum_items(prop, prop_stroke_depth_order_items); + RNA_def_property_ui_text( + prop, + "Stroke Depth Order", + "Defines how the strokes are ordered in 3D space (for objects not displayed 'In Front')"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update"); } void RNA_def_grease_pencil(BlenderRNA *brna)