[Bf-blender-cvs] [a0c9095620a] master: UI: Put camera composition guides in standard sub-panel

William Reynish noreply at git.blender.org
Thu Mar 21 15:01:09 CET 2019


Commit: a0c9095620a2546e034e10b44b33d69dad2317c8
Author: William Reynish
Date:   Thu Mar 21 15:01:07 2019 +0100
Branches: master
https://developer.blender.org/rBa0c9095620a2546e034e10b44b33d69dad2317c8

UI: Put camera composition guides in standard sub-panel

Before we were using a very inconsistent toggle-menu for this. Just use standard UI here instead.

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

M	release/scripts/startup/bl_ui/properties_data_camera.py
M	source/blender/makesrna/intern/rna_camera.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 3a938ccd47e..1aea73a48eb 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -367,10 +367,6 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
 
         cam = context.camera
 
-        split = layout.split()
-        split.label()
-        split.prop_menu_enum(cam, "show_guide")
-
         col = layout.column(align=True)
 
         col.separator()
@@ -379,10 +375,35 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
 
         col.separator()
 
-        col.prop(cam, "show_limits", text="Limits")
-        col.prop(cam, "show_mist", text="Mist")
-        col.prop(cam, "show_sensor", text="Sensor")
-        col.prop(cam, "show_name", text="Name")
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=False, even_rows=False, align=False)
+
+        flow.prop(cam, "show_limits", text="Limits")
+        flow.prop(cam, "show_mist", text="Mist")
+        flow.prop(cam, "show_sensor", text="Sensor")
+        flow.prop(cam, "show_name", text="Name")
+
+class DATA_PT_camera_display_composition_guides(CameraButtonsPanel, Panel):
+    bl_label = "Composition Guides"
+    bl_parent_id = "DATA_PT_camera_display"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        cam = context.camera
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=False, even_rows=False, align=False)
+
+        flow.prop(cam, "composition_center")
+        flow.prop(cam, "composition_center_diagonal")
+        flow.prop(cam, "composition_thirds")
+        flow.prop(cam, "composition_golden")
+        flow.prop(cam, "composition_golden_tria_a")
+        flow.prop(cam, "composition_golden_tria_b")
+        flow.prop(cam, "composition_harmony_tri_a")
+        flow.prop(cam, "composition_harmony_tri_b")
 
 
 class DATA_PT_camera_display_passepartout(CameraButtonsPanel, Panel):
@@ -503,6 +524,7 @@ classes = (
     DATA_PT_camera_safe_areas_center_cut,
     DATA_PT_camera_background_image,
     DATA_PT_camera_display,
+    DATA_PT_camera_display_composition_guides,
     DATA_PT_camera_display_passepartout,
     DATA_PT_custom_props_camera,
 )
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 0912c9bdc6e..fba0d4b7a54 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -372,17 +372,6 @@ void RNA_def_camera(BlenderRNA *brna)
 		{CAM_PANO, "PANO", 0, "Panoramic", ""},
 		{0, NULL, 0, NULL, NULL},
 	};
-	static const EnumPropertyItem prop_display_type_extra_items[] = {
-		{CAM_DTX_CENTER, "CENTER", 0, "Center", ""},
-		{CAM_DTX_CENTER_DIAG, "CENTER_DIAGONAL", 0, "Center Diagonal", ""},
-		{CAM_DTX_THIRDS, "THIRDS", 0, "Thirds", ""},
-		{CAM_DTX_GOLDEN, "GOLDEN", 0, "Golden", ""},
-		{CAM_DTX_GOLDEN_TRI_A, "GOLDEN_TRIANGLE_A", 0, "Golden Triangle A", ""},
-		{CAM_DTX_GOLDEN_TRI_B, "GOLDEN_TRIANGLE_B", 0, "Golden Triangle B", ""},
-		{CAM_DTX_HARMONY_TRI_A, "HARMONY_TRIANGLE_A", 0, "Harmonious Triangle A", ""},
-		{CAM_DTX_HARMONY_TRI_B, "HARMONY_TRIANGLE_B", 0, "Harmonious Triangle B", ""},
-		{0, NULL, 0, NULL, NULL},
-	};
 	static const EnumPropertyItem prop_lens_unit_items[] = {
 		{0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"},
 		{CAM_ANGLETOGGLE, "FOV", 0, "Field of View", "Specify the lens as the field of view's angle"},
@@ -405,13 +394,6 @@ void RNA_def_camera(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Type", "Camera types");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
 
-	prop = RNA_def_property(srna, "show_guide", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_sdna(prop, NULL, "dtx");
-	RNA_def_property_enum_items(prop, prop_display_type_extra_items);
-	RNA_def_property_flag(prop, PROP_ENUM_FLAG);
-	RNA_def_property_ui_text(prop, "Composition Guides",  "Display overlay");
-	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
 	prop = RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
 	RNA_def_property_enum_items(prop, sensor_fit_items);
@@ -578,6 +560,47 @@ void RNA_def_camera(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, prop_lens_unit_items);
 	RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface");
 
+	/* dtx */
+	prop = RNA_def_property(srna, "composition_center", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER);
+	RNA_def_property_ui_text(prop, "Center", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_center_diagonal", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER_DIAG);
+	RNA_def_property_ui_text(prop, "Center Diagonal", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_thirds", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_THIRDS);
+	RNA_def_property_ui_text(prop, "Thirds", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_golden", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN);
+	RNA_def_property_ui_text(prop, "Center", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_golden_tria_a", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_A);
+	RNA_def_property_ui_text(prop, "Golden Triangle A", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_golden_tria_b", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_B);
+	RNA_def_property_ui_text(prop, "Golden Triangle B", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_harmony_tri_a", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_A);
+	RNA_def_property_ui_text(prop, "Harmonious Triangle A", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+	prop = RNA_def_property(srna, "composition_harmony_tri_b", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_B);
+	RNA_def_property_ui_text(prop, "Harmonious Triangle B", "Display the clipping range and focus point on the camera");
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
 	/* pointers */
 	prop = RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");



More information about the Bf-blender-cvs mailing list