[Bf-blender-cvs] [54ffc4e19dc] master: Grease Pencil naming: Use clear names for depth ordering

William Reynish noreply at git.blender.org
Mon Feb 25 21:59:39 CET 2019


Commit: 54ffc4e19dc40cdbd9d8142048ac7082e8019f59
Author: William Reynish
Date:   Mon Feb 25 21:59:35 2019 +0100
Branches: master
https://developer.blender.org/rB54ffc4e19dc40cdbd9d8142048ac7082e8019f59

Grease Pencil naming: Use clear names for depth ordering

- Add a new panel to differentiate between viewport display and stroke options
- Use clearer naming for depth ordering and stroke thickness properties

Reviewers: antoniov
Differential Revision: https://developer.blender.org/D4405

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index a910cbe823f..8b4b927ffde 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -332,8 +332,8 @@ class DATA_PT_gpencil_vertexpanel(DataButtonsPanel, Panel):
             layout.prop(context.tool_settings, "vertex_group_weight", text="Weight")
 
 
-class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
-    bl_label = "Viewport Display"
+class DATA_PT_gpencil_strokes(DataButtonsPanel, Panel):
+    bl_label = "Strokes"
     bl_options = {'DEFAULT_CLOSED'}
 
     def draw(self, context):
@@ -344,27 +344,41 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
         ob = context.object
 
         gpd = context.gpencil_data
-        gpl = context.active_gpencil_layer
 
-        layout.prop(gpd, "xray_mode", text="Depth Ordering")
-        if gpd.xray_mode == '3DSPACE':
-            layout.prop(gpd, "draw_mode", text="Mode")
-
-        layout.prop(ob, "empty_display_size", text="Marker Size")
+        layout.prop(gpd, "object_depth_order")
+        if gpd.object_depth_order == '3DSPACE':
+            layout.prop(gpd, "stroke_depth_order")
 
         col = layout.column(align=True)
-        col.prop(gpd, "show_constant_thickness")
+        col.prop(gpd, "stroke_thickness_space")
         sub = col.column()
-        sub.active = not gpd.show_constant_thickness
+        sub.active = gpd.stroke_thickness_space == 'WORLDSPACE'
         sub.prop(gpd, "pixel_factor", text="Thickness Scale")
 
+        layout.prop(gpd, "use_force_fill_recalc", text="Force Fill Update")
+        layout.prop(gpd, "use_adaptive_uv", text="Adaptive UVs")
+
+
+class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
+    bl_label = "Viewport Display"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+        layout.use_property_decorate = False
+
+        ob = context.object
+
+        gpd = context.gpencil_data
+        gpl = context.active_gpencil_layer
+
+        layout.prop(ob, "empty_display_size", text="Marker Size")
+
         layout.prop(gpd, "edit_line_color", text="Edit Line Color")
         if gpl:
             layout.prop(gpd, "show_stroke_direction", text="Show Stroke Directions")
 
-        layout.prop(gpd, "use_force_fill_recalc", text="Force Fill Update")
-        layout.prop(gpd, "use_adaptive_uv", text="Adaptive UVs")
-
 
 class DATA_PT_gpencil_canvas(DataButtonsPanel, Panel):
     bl_label = "Canvas"
@@ -402,6 +416,7 @@ classes = (
     DATA_PT_gpencil_layer_optionpanel,
     DATA_PT_gpencil_parentpanel,
     DATA_PT_gpencil_vertexpanel,
+    DATA_PT_gpencil_strokes,
     DATA_PT_gpencil_display,
     DATA_PT_gpencil_canvas,
     DATA_PT_custom_props_gpencil,
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index b60409225ce..0775af67d84 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -51,16 +51,16 @@ static const EnumPropertyItem parent_type_items[] = {
 };
 
 #ifndef RNA_RUNTIME
-static EnumPropertyItem rna_enum_gpencil_drawmodes_items[] = {
-	{GP_DRAWMODE_2D, "2D", 0, "2D Layers",	"Draw strokes using grease pencil layers to define order"},
-	{GP_DRAWMODE_3D, "3D", 0, "3D Location", "Draw strokes using real 3D position in 3D space"},
+static EnumPropertyItem rna_enum_gpencil_stroke_depth_order_items[] = {
+	{GP_DRAWMODE_2D, "2D", 0, "2D Layers",	"Display strokes using grease pencil layers to define order"},
+	{GP_DRAWMODE_3D, "3D", 0, "3D Location", "Display strokes using real 3D position in 3D space"},
 	{0, NULL, 0, NULL, NULL},
 };
 
-static EnumPropertyItem rna_enum_gpencil_xraymodes_items[] = {
-	{GP_XRAY_FRONT, "FRONT", 0, "Front", "Draw all strokes in front"},
-	{GP_XRAY_3DSPACE, "3DSPACE", 0, "3D Space", "Draw strokes relative to other objects in 3D space"},
-	{GP_XRAY_BACK, "BACK", 0, "Back", "Draw all strokes last"},
+static EnumPropertyItem rna_enum_gpencil_object_depth_order_items[] = {
+	{GP_XRAY_FRONT, "FRONT", 0, "Front", "Display all strokes in front"},
+	{GP_XRAY_3DSPACE, "3DSPACE", 0, "3D Space", "Display strokes relative to other objects in 3D space"},
+	{GP_XRAY_BACK, "BACK", 0, "Back", "Display all strokes last"},
 	{0, NULL, 0, NULL, NULL},
 };
 
@@ -1473,6 +1473,12 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	static float onion_dft1[3] = { 0.145098f, 0.419608f, 0.137255f }; /* green */
 	static float onion_dft2[3] = { 0.125490f, 0.082353f, 0.529412f }; /* blue */
 
+		static const EnumPropertyItem stroke_thickness_items[] = {
+		{0, "WORLDSPACE", 0, "World Space", "Set stroke thickness relative to the world space"},
+		{GP_DATA_STROKE_KEEPTHICKNESS, "SCREENSPACE", 0, "Screen Space", "Set stroke thickness relative to the screen space"},
+		{0, NULL, 0, NULL, NULL},
+	};
+
 	srna = RNA_def_struct(brna, "GreasePencil", "ID");
 	RNA_def_struct_sdna(srna, "bGPdata");
 	RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook");
@@ -1496,19 +1502,18 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 	RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
 	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
 
-	/* draw modes */
-	prop = RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE);
+	/* Depth */
+	prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "draw_mode");
-	RNA_def_property_enum_items(prop, rna_enum_gpencil_drawmodes_items);
-	RNA_def_property_ui_text(prop, "Mode",
+	RNA_def_property_enum_items(prop, rna_enum_gpencil_stroke_depth_order_items);
+	RNA_def_property_ui_text(prop, "Stroke Depth Order",
 		"Defines how the strokes are ordered in 3D space");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
-	/* xray modes */
-	prop = RNA_def_property(srna, "xray_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "object_depth_order", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "xray_mode");
-	RNA_def_property_enum_items(prop, rna_enum_gpencil_xraymodes_items);
-	RNA_def_property_ui_text(prop, "X-Ray", "");
+	RNA_def_property_enum_items(prop, rna_enum_gpencil_object_depth_order_items);
+	RNA_def_property_ui_text(prop, "Object Depth Order", "");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
 	/* Flags */
@@ -1547,9 +1552,10 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 		"and smaller red dot (end) points");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
-	prop = RNA_def_property(srna, "show_constant_thickness", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_KEEPTHICKNESS);
-	RNA_def_property_ui_text(prop, "Keep Thickness", "Maintain the thickness of the stroke when the viewport zoom changes");
+    prop = RNA_def_property(srna, "stroke_thickness_space", PROP_ENUM, PROP_NONE); /* as an enum */
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+	RNA_def_property_enum_items(prop, stroke_thickness_items);
+	RNA_def_property_ui_text(prop, "Stroke Thickness", "Set stroke thickness in screen space or world space");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
 	prop = RNA_def_property(srna, "pixel_factor", PROP_FLOAT, PROP_NONE);



More information about the Bf-blender-cvs mailing list