Viewport: Add adjustable safe areas, 3d-view & VSE
authorCampbell Barton <ideasman42@gmail.com>
Mon, 19 Jan 2015 05:30:35 +0000 (16:30 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 19 Jan 2015 05:47:57 +0000 (16:47 +1100)
Also adds safe-area presets.

D325 by Diego Gangl with own edits.

24 files changed:
intern/cycles/blender/addon/ui.py
release/scripts/presets/safe_areas/14_colon_9_in_16_colon_9.py [new file with mode: 0644]
release/scripts/presets/safe_areas/16_colon_9.py [new file with mode: 0644]
release/scripts/presets/safe_areas/4_colon_3_in_16_colon_9.py [new file with mode: 0644]
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_ui/properties_data_camera.py
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/versioning_270.c
source/blender/blenloader/intern/versioning_legacy.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_camera_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c

index 8fd09c3bc19475bfc34f5800edfa1ea97002b813..da303ce5690e3e6e6fb2f77f3101e0517f0dc1b0 100644 (file)
@@ -1417,6 +1417,7 @@ def get_panels():
         "DATA_PT_vertex_colors",
         "DATA_PT_camera",
         "DATA_PT_camera_display",
+        "DATA_PT_camera_safe_areas",
         "DATA_PT_lens",
         "DATA_PT_speaker",
         "DATA_PT_distance",
diff --git a/release/scripts/presets/safe_areas/14_colon_9_in_16_colon_9.py b/release/scripts/presets/safe_areas/14_colon_9_in_16_colon_9.py
new file mode 100644 (file)
index 0000000..e486b41
--- /dev/null
@@ -0,0 +1,7 @@
+import bpy
+safe_areas = bpy.context.scene.safe_areas
+
+safe_areas.title = (0.035, 0.035)
+safe_areas.action = (0.1, 0.05)
+safe_areas.title_center = (0.15, 0.05)
+safe_areas.action_center = (0.1, 0.05)
diff --git a/release/scripts/presets/safe_areas/16_colon_9.py b/release/scripts/presets/safe_areas/16_colon_9.py
new file mode 100644 (file)
index 0000000..221b8db
--- /dev/null
@@ -0,0 +1,7 @@
+import bpy
+safe_areas = bpy.context.scene.safe_areas
+
+safe_areas.title = (0.035, 0.035)
+safe_areas.action = (0.1, 0.05)
+safe_areas.title_center = (0.0, 0.0)
+safe_areas.action_center = (0.0, 0.0)
diff --git a/release/scripts/presets/safe_areas/4_colon_3_in_16_colon_9.py b/release/scripts/presets/safe_areas/4_colon_3_in_16_colon_9.py
new file mode 100644 (file)
index 0000000..c10bc6c
--- /dev/null
@@ -0,0 +1,7 @@
+import bpy
+safe_areas = bpy.context.scene.safe_areas
+
+safe_areas.title = (0.035, 0.035)
+safe_areas.action = (0.1, 0.05)
+safe_areas.title_center = (0.175, 0.05)
+safe_areas.action_center = (0.15, 0.05)
index f89792bea6ed46d3cb5946c86d3890ee841b818a..5e3485a27a4908d3d0b9e0051860d65765ee046e 100644 (file)
@@ -277,6 +277,26 @@ class AddPresetCamera(AddPresetBase, Operator):
         return preset_values
 
 
+class AddPresetSafeAreas(AddPresetBase, Operator):
+    """Add or remove a Safe Areas Preset"""
+    bl_idname = "safe_areas.preset_add"
+    bl_label = "Add Safe Area Preset"
+    preset_menu = "SAFE_AREAS_MT_presets"
+
+    preset_defines = [
+        "safe_areas = bpy.context.scene.safe_areas"
+    ]
+
+    preset_values = [
+        "safe_areas.title",
+        "safe_areas.action",
+        "safe_areas.title_center",
+        "safe_areas.action_center",
+    ]
+
+    preset_subdir = "safe_areas"
+
+
 class AddPresetSSS(AddPresetBase, Operator):
     """Add or remove a Subsurface Scattering Preset"""
     bl_idname = "material.sss_preset_add"
index fee3e589074358869e9aaa6e9e8b96eeb69f166f..9c94c9cf7d576ace47facaae290716aa6d14071f 100644 (file)
@@ -41,6 +41,14 @@ class CAMERA_MT_presets(Menu):
     draw = Menu.draw_preset
 
 
+class SAFE_AREAS_MT_presets(Menu):
+    bl_label = "Camera Presets"
+    preset_subdir = "safe_areas"
+    preset_operator = "script.execute_preset"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    draw = Menu.draw_preset
+
+
 class DATA_PT_context_camera(CameraButtonsPanel, Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
@@ -195,7 +203,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
         col = split.column()
         col.prop(cam, "show_limits", text="Limits")
         col.prop(cam, "show_mist", text="Mist")
-        col.prop(cam, "show_title_safe", text="Safe Areas")
+
         col.prop(cam, "show_sensor", text="Sensor")
         col.prop(cam, "show_name", text="Name")
 
@@ -210,10 +218,57 @@ class DATA_PT_camera_display(CameraButtonsPanel, Panel):
         sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True)
 
 
+class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel):
+    bl_label = "Safe Areas"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+    def draw_header(self, context):
+        cam = context.camera
+
+        self.layout.prop(cam, "show_safe_areas", text="")
+
+    def draw(self, context):
+        layout = self.layout
+        cam = context.camera
+
+        draw_display_safe_settings(layout, cam)
+
+
 class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     _context_path = "object.data"
     _property_type = bpy.types.Camera
 
+
+def draw_display_safe_settings(layout, settings):
+
+    safe_data = bpy.context.scene.safe_areas
+    show_safe_areas = settings.show_safe_areas
+    show_safe_center = settings.show_safe_center
+
+    split = layout.split()
+
+    col = split.column()
+    row = col.row(align=True)
+    row.menu("SAFE_AREAS_MT_presets", text=bpy.types.SAFE_AREAS_MT_presets.bl_label)
+    row.operator("safe_areas.preset_add", text="", icon='ZOOMIN')
+    row.operator("safe_areas.preset_add", text="", icon='ZOOMOUT').remove_active = True
+
+    col = split.column()
+    col.prop(settings, "show_safe_center", text="Center-Cut Safe Areas")
+
+    split = layout.split()
+    col = split.column()
+    col.active = show_safe_areas
+    col.prop(safe_data, "title", slider=True)
+    col.prop(safe_data, "action", slider=True)
+
+    col = split.column()
+    col.active = show_safe_areas and show_safe_center
+    col.prop(safe_data, "title_center", slider=True)
+    col.prop(safe_data, "action_center", slider=True)
+
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
index 66b3cbe73d9429e692c3784f625863695bd2f33c..bf63b8479960b6cb22d2491f6b4d68bc0165370d 100644 (file)
@@ -22,6 +22,7 @@ from bpy.types import Header, Menu, Panel
 from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel, GreasePencilToolsPanel
 from bpy.app.translations import pgettext_iface as iface_
 
+from bl_ui.properties_data_camera import draw_display_safe_settings
 
 def act_strip(context):
     try:
@@ -205,7 +206,7 @@ class SEQUENCER_MT_view(Menu):
 
         if is_preview:
             if st.display_mode == 'IMAGE':
-                layout.prop(st, "show_safe_margin")
+                layout.prop(st, "show_safe_areas")
             elif st.display_mode == 'WAVEFORM':
                 layout.prop(st, "show_separate_color")
 
@@ -973,12 +974,38 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
         col = layout.column()
         if st.display_mode == 'IMAGE':
             col.prop(st, "draw_overexposed")
-            col.prop(st, "show_safe_margin")
+            col.separator()
+
         elif st.display_mode == 'WAVEFORM':
             col.prop(st, "show_separate_color")
+
+        col = layout.column()
+        col.separator()
         col.prop(st, "proxy_render_size")
 
 
+class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel):
+    bl_label = "Safe Areas"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        st = context.space_data
+        is_preview = st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}
+        return is_preview and (st.display_mode == 'IMAGE')
+
+    def draw_header(self, context):
+        st = context.space_data
+
+        self.layout.prop(st, "show_safe_areas", text="")
+
+    def draw(self, context):
+        layout = self.layout
+        st = context.space_data
+
+        draw_display_safe_settings(layout, st)
+
+
 class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
     bl_label = "Modifiers"
 
index eac4f6a56a53aa98fcae45ab362c8376745cba8e..149472db8fa44e60b70a6f9ffc08cdcde711c595 100644 (file)
@@ -39,6 +39,7 @@ extern "C" {
 
 struct AviCodecData;
 struct Base;
+struct DisplaySafeAreas;
 struct EvaluationContext;
 struct bglMats;
 struct Main;
index 13e9b7fb0c47ac692754f1bf816e7c4115e8aba5..577dbd6d323fd1eb5390a7b3d9530d5a6cfdc9e0 100644 (file)
@@ -689,6 +689,12 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
        BLI_strncpy(sce->sequencer_colorspace_settings.name, colorspace_name,
                    sizeof(sce->sequencer_colorspace_settings.name));
 
+       /* Safe Areas */
+       copy_v2_fl2(sce->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
+       copy_v2_fl2(sce->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
+       copy_v2_fl2(sce->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
+       copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
+
        return sce;
 }
 
index e6e43758e11ee96df1195938cda41aff858248a0..bde3f0f25124af235552e6b76f40400f4b919423 100644 (file)
@@ -458,4 +458,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 #undef BRUSH_RAKE
 #undef BRUSH_RANDOM_ROTATION
        }
+
+       /* Customizable Safe Areas */
+       if (!MAIN_VERSION_ATLEAST(main, 273, 2)) {
+               if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
+                       Scene *scene;
+
+                       for (scene = main->scene.first; scene; scene = scene->id.next) {
+                               copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
+                               copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
+                               copy_v2_fl2(scene->safe_areas.title_center, 17.5f / 100.0f, 5.0f / 100.0f);
+                               copy_v2_fl2(scene->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f);
+                       }
+               }
+       }
 }
index 6f2989233978f3fbb4701263c2583c2b6f8db699..a28ca7d187a3f336de4cd55f0c3d7db095128e0b 100644 (file)
@@ -2183,8 +2183,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
                                cam->flag |= CAM_SHOWPASSEPARTOUT;
 
                        /* make sure old cameras have title safe on */
-                       if (!(cam->flag & CAM_SHOWTITLESAFE))
-                               cam->flag |= CAM_SHOWTITLESAFE;
+                       if (!(cam->flag & CAM_SHOW_SAFE_MARGINS))
+                               cam->flag |= CAM_SHOW_SAFE_MARGINS;
 
                        /* set an appropriate camera passepartout alpha */
                        if (!(cam->passepartalpha))
index 8789e837f176a087eb99a59660d3679500c033be..159fda89f59673eea82b9b6984e0cba9c3e3cb04 100644 (file)
@@ -316,6 +316,10 @@ void UI_draw_roundbox_shade_x(int mode, float minx, float miny, float maxx, floa
 void UI_draw_roundbox_shade_y(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight);
 void UI_draw_text_underline(int pos_x, int pos_y, int len, int height);
 
+void UI_draw_safe_areas(
+        float x1, float x2, float y1, float y2,
+        const float title_aspect[2], const float action_aspect[2]);
+
 /* state for scrolldrawing */
 #define UI_SCROLL_PRESSED       (1 << 0)
 #define UI_SCROLL_ARROWS        (1 << 1)
index bcd9b9a55471a2962dfbb8459f1412cb6e692451..cca4df308111910ba2880061586894bc43a19ec9 100644 (file)
@@ -450,6 +450,51 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
 #endif
 }
 
+/**
+ * Draw title and text safe areas.
+ *
+ * The first 4 parameters are the offsets for the view, not the zones.
+ */
+void UI_draw_safe_areas(
+        float x1, float x2, float y1, float y2,
+        const float title_aspect[2], const float action_aspect[2])
+{
+       const float size_x_half = (x2 - x1) * 0.5f;
+       const float size_y_half = (y2 - y1) * 0.5f;
+
+       const float *safe_areas[] = {title_aspect, action_aspect};
+       int i, safe_len = ARRAY_SIZE(safe_areas);
+       bool is_first = true;
+
+       for (i = 0; i < safe_len; i++) {
+               if (safe_areas[i][0] || safe_areas[i][1]) {
+                       float margin_x, margin_y;
+                       float minx, miny, maxx, maxy;
+
+                       if (is_first) {
+                               UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25f, 0);
+                               is_first = false;
+                       }
+
+                       margin_x = safe_areas[i][0] * size_x_half;
+                       margin_y = safe_areas[i][1] * size_y_half;
+
+                       minx = x1 + margin_x;
+                       miny = y1 + margin_y;
+                       maxx = x2 - margin_x;
+                       maxy = y2 - margin_y;
+
+                       glBegin(GL_LINE_LOOP);
+                       glVertex2f(maxx, miny);
+                       glVertex2f(maxx, maxy);
+                       glVertex2f(minx, maxy);
+                       glVertex2f(minx, miny);
+                       glEnd();
+               }
+       }
+}
+
+
 static void draw_scope_end(const rctf *rect, GLint *scissor)
 {
        /* restore scissortest */
index afb650f8cfd1f0192d8268f51ded75de355a60cf..3233c4192b9f5435f8dfdd0f3d5e9d35b19c83d9 100644 (file)
@@ -1292,24 +1292,18 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
                glEnd();
 
                /* safety border */
-               if ((sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) {
-                       float fac = 0.1;
-
-                       float a = fac * (x2 - x1);
-                       x1 += a;
-                       x2 -= a;
-
-                       a = fac * (y2 - y1);
-                       y1 += a;
-                       y2 -= a;
-
-                       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
-                       UI_draw_roundbox_corner_set(UI_CNR_ALL);
-                       UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
-
-                       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
+               if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) {
+                       UI_draw_safe_areas(
+                               x1, x2, y1, y2,
+                               scene->safe_areas.title,
+                               scene->safe_areas.action);
+
+                       if (sseq->flag & SEQ_SHOW_SAFE_CENTER) {
+                               UI_draw_safe_areas(
+                                       x1, x2, y1, y2,
+                                       scene->safe_areas.title_center,
+                                       scene->safe_areas.action_center);
+                       }
                }
 
                setlinestyle(0);
index 6231f02907acabd08bda197f522af028a04b5a5d..4d97056c4c516ba6f7e554f7f6e3a8928953ffd8 100644 (file)
@@ -599,6 +599,7 @@ static void sequencer_preview_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED
                                case ND_MARKERS:
                                case ND_SEQUENCER:
                                case ND_RENDER_OPTIONS:
+                               case ND_DRAW_RENDER_VIEWPORT:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
index d0ba3a9f7931d2238d34459d4f87ad7b8f10b7ec..17cecc3dc1ddc64125fd5ae9722179d3d78d352c 100644 (file)
@@ -817,6 +817,16 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN
                                case ND_WORLD:
                                        /* handled by space_view3d_listener() for v3d access */
                                        break;
+                               case ND_DRAW_RENDER_VIEWPORT:
+                               {
+                                       if (v3d->camera && (scene == wmn->reference)) {
+                                               RegionView3D *rv3d = ar->regiondata;
+                                               if (rv3d->persp == RV3D_CAMOB) {
+                                                       ED_region_tag_redraw(ar);
+                                               }
+                                       }
+                                       break;
+                               }
                        }
                        if (wmn->action == NA_EDITED)
                                ED_region_tag_redraw(ar);
index 65721d52dffe3e1afb1785ebc5c7c0f319f5420c..2405069758588bcb1d06e51adfb75f400f9fc551 100644 (file)
@@ -1066,14 +1066,13 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
 
 static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 {
-       float hmargin, vmargin;
        float x1, x2, y1, y2;
        float x1i, x2i, y1i, y2i;
 
        rctf viewborder;
        Camera *ca = NULL;
        RegionView3D *rv3d = ar->regiondata;
-       
+
        if (v3d->camera == NULL)
                return;
        if (v3d->camera->type == OB_CAMERA)
@@ -1225,17 +1224,20 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
                        drawviewborder_triangle(x1, x2, y1, y2, 1, 'B');
                }
 
-               if (ca->flag & CAM_SHOWTITLESAFE) {
-                       UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0);
-
-                       hmargin = 0.1f  * (x2 - x1);
-                       vmargin = 0.05f * (y2 - y1);
-                       UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
+               if (ca->flag & CAM_SHOW_SAFE_MARGINS) {
+                       UI_draw_safe_areas(
+                               x1, x2, y1, y2,
+                               scene->safe_areas.title,
+                               scene->safe_areas.action);
 
-                       hmargin = 0.035f * (x2 - x1);
-                       vmargin = 0.035f * (y2 - y1);
-                       UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
+                       if (ca->flag & CAM_SHOW_SAFE_CENTER) {
+                               UI_draw_safe_areas(
+                                       x1, x2, y1, y2,
+                                       scene->safe_areas.title_center,
+                                       scene->safe_areas.action_center);
+                       }
                }
+
                if (ca->flag & CAM_SHOWSENSOR) {
                        /* determine sensor fit, and get sensor x/y, for auto fit we
                         * assume and square sensor and only use sensor_x */
index c99494ce00e0abce2a38a70feec32d1fb6c0c152..da7d98d2b22ab0b26c01b5e05ef9ebf45c7644d1 100644 (file)
@@ -56,7 +56,7 @@ typedef struct Camera {
        float lens, ortho_scale, drawsize;
        float sensor_x, sensor_y;
        float shiftx, shifty;
-       
+
        /* yafray: dof params */
        /* qdn: yafray var 'YF_dofdist' now enabled for defocus composite node as well.
         * The name was not changed so that no other files need to be modified */
@@ -96,12 +96,13 @@ enum {
        CAM_SHOWLIMITS          = (1 << 0),
        CAM_SHOWMIST            = (1 << 1),
        CAM_SHOWPASSEPARTOUT    = (1 << 2),
-       CAM_SHOWTITLESAFE       = (1 << 3),
+       CAM_SHOW_SAFE_MARGINS       = (1 << 3),
        CAM_SHOWNAME            = (1 << 4),
        CAM_ANGLETOGGLE         = (1 << 5),
        CAM_DS_EXPAND           = (1 << 6),
        CAM_PANORAMA            = (1 << 7), /* deprecated */
        CAM_SHOWSENSOR          = (1 << 8),
+       CAM_SHOW_SAFE_CENTER    = (1 << 9),
 };
 
 #if (DNA_DEPRECATED_GCC_POISON == 1)
index 49f8b3cd4d03612c741d912f41257c88a3311bdb..9371170a004924752d5b84776036757e6884e691 100644 (file)
@@ -1216,6 +1216,21 @@ typedef struct PhysicsSettings {
        int flag, quick_cache_step, rt;
 } PhysicsSettings;
 
+/* ------------------------------------------- */
+/* Safe Area options used in Camera View & VSE
+ */
+typedef struct DisplaySafeAreas {
+       /* each value represents the (x,y) margins as a multiplier.
+        * 'center' in this context is just the name for a different kind of safe-area */
+
+       float title[2];         /* Title Safe */
+       float action[2];        /* Image/Graphics Safe */
+
+       /* use for alternate aspect ratio */
+       float title_center[2];
+       float action_center[2];
+} DisplaySafeAreas;
+
 /* *************************************************************** */
 /* Scene ID-Block */
 
@@ -1251,6 +1266,7 @@ typedef struct Scene {
        
        struct ToolSettings *toolsettings;              /* default allocated now */
        struct SceneStats *stats;                               /* default allocated now */
+       struct DisplaySafeAreas safe_areas;
 
        /* migrate or replace? depends on some internal things... */
        /* no, is on the right place (ton) */
index 82ab0cce30c5ec8f8267b485feca742269f96d1c..723964364f6c5d5a9474ff263283a5e425e62936 100644 (file)
@@ -528,12 +528,13 @@ typedef enum eSpaceSeq_Flag {
        SEQ_DRAWFRAMES              = (1 << 0),
        SEQ_MARKER_TRANS            = (1 << 1),
        SEQ_DRAW_COLOR_SEPARATED    = (1 << 2),
-       SEQ_DRAW_SAFE_MARGINS       = (1 << 3),
+       SEQ_SHOW_SAFE_MARGINS       = (1 << 3),
        SEQ_SHOW_GPENCIL            = (1 << 4),
        SEQ_NO_DRAW_CFRANUM         = (1 << 5),
        SEQ_USE_ALPHA               = (1 << 6), /* use RGBA display mode for preview */
        SEQ_ALL_WAVEFORMS           = (1 << 7), /* draw all waveforms */
        SEQ_NO_WAVEFORMS            = (1 << 8), /* draw no waveforms */
+       SEQ_SHOW_SAFE_CENTER        = (1 << 9),
 } eSpaceSeq_Flag;
 
 /* sseq->view */
index 6167164a7ac91651c663d3d644b5bb81eae532ca..34c2e5a3f2596b470b30d1cef3043924641fadb7 100644 (file)
@@ -203,6 +203,7 @@ extern StructRNA RNA_DataTransferModifier;
 extern StructRNA RNA_DecimateModifier;
 extern StructRNA RNA_DelaySensor;
 extern StructRNA RNA_DisplaceModifier;
+extern StructRNA RNA_DisplaySafeAreas;
 extern StructRNA RNA_DistortedNoiseTexture;
 extern StructRNA RNA_DomainFluidSettings;
 extern StructRNA RNA_DopeSheet;
index 9f119b33889cb04ad8db413ba5567b8fba0bebda..5704004b4b6c3dfa80a6f46aea7284b6460cf649 100644 (file)
@@ -258,9 +258,14 @@ void RNA_def_camera(BlenderRNA *brna)
                                 "Show a darkened overlay outside the image area in Camera view");
        RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
-       prop = RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWTITLESAFE);
-       RNA_def_property_ui_text(prop, "Show Safe Areas", "Show TV title safe and action safe zones in Camera view");
+       prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_MARGINS);
+       RNA_def_property_ui_text(prop, "Show Safe Areas", "Show TV title safe and action safe areas in Camera view");
+       RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+       prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_CENTER);
+       RNA_def_property_ui_text(prop, "Show Center-cut safe areas", "Show safe areas to fit content in a different aspect ratio");
        RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
        prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
index d9587b8d9839b871c3a48d74431b6bfe1d542aa4..57d50958e2ce4a7a4983d3dfaf3cd2db9fdd8e6b 100644 (file)
@@ -5390,6 +5390,55 @@ static void rna_def_selected_uv_element(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Face Index", "");
 }
 
+static void rna_def_display_safe_areas(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static float default_title[2] = {0.035f, 0.035f};
+       static float default_action[2] = {0.1f, 0.05f};
+
+       static float default_title_center[2] = {0.175f, 0.05f};
+       static float default_action_center[2] = {0.15f, 0.05f};
+
+       srna = RNA_def_struct(brna, "DisplaySafeAreas", NULL);
+       RNA_def_struct_ui_text(srna, "Safe Areas", "Safe Areas used in 3D view and the VSE");
+       RNA_def_struct_sdna(srna, "DisplaySafeAreas");
+
+       /* SAFE AREAS */
+       prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_float_sdna(prop, NULL, "title");
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_float_array_default(prop, default_title);
+       RNA_def_property_ui_text(prop, "Title Safe margins", "Safe area for text and graphics");
+       RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+       prop = RNA_def_property(srna, "action", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_float_sdna(prop, NULL, "action");
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_float_array_default(prop, default_action);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Action Safe Margins", "Safe area for general elements");
+       RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+
+       prop = RNA_def_property(srna, "title_center", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_float_sdna(prop, NULL, "title_center");
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_float_array_default(prop, default_title_center);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Center Title Safe Margins", "Safe area for text and graphics in a different aspect ratio");
+       RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+       prop = RNA_def_property(srna, "action_center", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_float_sdna(prop, NULL, "action_center");
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_float_array_default(prop, default_action_center);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Center Action Safe Margins", "Safe area for general elements in a different aspect ratio");
+       RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+}
 
 
 void RNA_def_scene(BlenderRNA *brna)
@@ -5685,6 +5734,13 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "RenderSettings");
        RNA_def_property_ui_text(prop, "Render Data", "");
        
+       /* Safe Areas */
+       prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "safe_areas");
+       RNA_def_property_flag(prop, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "DisplaySafeAreas");
+       RNA_def_property_ui_text(prop, "Safe Areas", "");
+
        /* Markers */
        prop = RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
@@ -5799,6 +5855,7 @@ void RNA_def_scene(BlenderRNA *brna)
        rna_def_scene_game_data(brna);
        rna_def_transform_orientation(brna);
        rna_def_selected_uv_element(brna);
+       rna_def_display_safe_areas(brna);
        RNA_define_animate_sdna(true);
        /* *** Animated *** */
        rna_def_scene_render_data(brna);
index d1d39d659134dd2fb69c4232b60ca7c74781351f..58476c43b73fc01079d183513ad9ff6a18cb1470 100644 (file)
@@ -2570,11 +2570,16 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
 
-       prop = RNA_def_property(srna, "show_safe_margin", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_SAFE_MARGINS);
-       RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
+       prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_MARGINS);
+       RNA_def_property_ui_text(prop, "Safe Areas", "Show TV title safe and action safe areas in preview");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-       
+
+       prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_CENTER);
+       RNA_def_property_ui_text(prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
        prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
        RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");