[Bf-blender-cvs] [519c12da416] master: VSE: Snapping feedback

Richard Antalik noreply at git.blender.org
Thu Jul 1 22:15:36 CEST 2021


Commit: 519c12da4162a42ed0ce2e41db45be21632ab446
Author: Richard Antalik
Date:   Thu Jul 1 22:08:11 2021 +0200
Branches: master
https://developer.blender.org/rB519c12da4162a42ed0ce2e41db45be21632ab446

VSE: Snapping feedback

Address initial feedback:
 - Use checkboxes instead of radio buttons
 - Hide snapping distance control from UI
 - Tweak snapping line color - use selected strip color, 50% transparency. Similar to other editors
 - Draw 2px thick line, since strip outline is also 2px thick

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11759

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

M	release/scripts/startup/bl_ui/space_sequencer.py
M	source/blender/editors/transform/transform_snap.c
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index ab05461f185..99384ac713d 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -2286,15 +2286,13 @@ class SEQUENCER_PT_snapping(Panel):
         layout.use_property_decorate = False
 
         col = layout.column(heading="Snap to", align=True)
-        col.prop(sequencer_tool_settings, "snap_seq_element", expand=True)
+        col.prop(sequencer_tool_settings, "snap_to_current_frame" )
+        col.prop(sequencer_tool_settings, "snap_to_hold_offset")
 
         col = layout.column(heading="Ignore", align=True)
         col.prop(sequencer_tool_settings, "snap_ignore_muted", text="Muted Strips")
         col.prop(sequencer_tool_settings, "snap_ignore_sound",text="Sound Strips")
 
-        col = layout.column()
-        col.prop(sequencer_tool_settings, "snap_distance", slider=True, text="Distance")
-
 
 classes = (
     SEQUENCER_MT_change,
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 9a33dc1218d..05dcc612aae 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -303,10 +303,15 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
       uint pos = GPU_vertformat_attr_add(
           immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
       immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-      immBegin(GPU_PRIM_LINES, 2);
-      immVertex2f(pos, t->tsnap.snapPoint[0], region->v2d.cur.ymin);
-      immVertex2f(pos, t->tsnap.snapPoint[0], region->v2d.cur.ymax);
-      immEnd();
+      UI_GetThemeColor3ubv(TH_SEQ_ACTIVE, col);
+      col[3] = 128;
+      immUniformColor4ubv(col);
+      float pixelx = BLI_rctf_size_x(&region->v2d.cur) / BLI_rcti_size_x(&region->v2d.mask);
+      immRectf(pos,
+               t->tsnap.snapPoint[0] - pixelx,
+               region->v2d.cur.ymax,
+               t->tsnap.snapPoint[0] + pixelx,
+               region->v2d.cur.ymin);
       immUnbindProgram();
       GPU_blend(GPU_BLEND_NONE);
     }
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 503c4a1a1f8..0ce4271c3c2 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -190,16 +190,6 @@ const EnumPropertyItem rna_enum_snap_node_element_items[] = {
     {0, NULL, 0, NULL, NULL},
 };
 
-const EnumPropertyItem rna_enum_snap_seq_element_items[] = {
-    {SEQ_SNAP_TO_CURRENT_FRAME,
-     "CURRENT_FRAME",
-     ICON_NONE,
-     "Current Frame",
-     "Snap to current frame"},
-    {SEQ_SNAP_TO_STRIP_HOLD, "STRIP_HOLD", ICON_NONE, "Hold Offset", "Snap to strip hold offset"},
-    {0, NULL, 0, NULL, NULL},
-};
-
 #ifndef RNA_RUNTIME
 static const EnumPropertyItem snap_uv_element_items[] = {
     {SCE_SNAP_MODE_INCREMENT,
@@ -3527,23 +3517,22 @@ static void rna_def_sequencer_tool_settings(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Fit Method", "Scale fit method");
 
   /* Transform snapping. */
+  prop = RNA_def_property(srna, "snap_to_current_frame", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "snap_mode", SEQ_SNAP_TO_CURRENT_FRAME);
+  RNA_def_property_ui_text(prop, "Current Frame", "Snap to current frame");
+  RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
-  /* Sequencer editor uses own set of snap modes */
-  prop = RNA_def_property(srna, "snap_seq_element", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode");
-  RNA_def_property_enum_items(prop, rna_enum_snap_seq_element_items);
-  RNA_def_property_ui_text(prop, "Snap To", "Type of element to snap to");
-  RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+  prop = RNA_def_property(srna, "snap_to_hold_offset", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "snap_mode", SEQ_SNAP_TO_STRIP_HOLD);
+  RNA_def_property_ui_text(prop, "Hold Offset", "Snap to strip hold offsets");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
   prop = RNA_def_property(srna, "snap_ignore_muted", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SEQ_SNAP_IGNORE_MUTED);
-  RNA_def_property_boolean_default(prop, true);
   RNA_def_property_ui_text(prop, "Ignore Muted Strips", "Don't snap to hidden strips");
 
   prop = RNA_def_property(srna, "snap_ignore_sound", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SEQ_SNAP_IGNORE_SOUND);
-  RNA_def_property_boolean_default(prop, true);
   RNA_def_property_ui_text(prop, "Ignore Sound Strips", "Don't snap to sound strips");
 
   prop = RNA_def_property(srna, "snap_distance", PROP_INT, PROP_PIXEL);



More information about the Bf-blender-cvs mailing list