Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2021-07-01 23:08:11 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-07-01 23:08:11 +0300
commit519c12da4162a42ed0ce2e41db45be21632ab446 (patch)
treeda235d413d732a020f7d6f06d22c5278c66e1fdc
parent4a7951fede101264efa1c085c66b84d47096ca50 (diff)
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
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py6
-rw-r--r--source/blender/editors/transform/transform_snap.c13
-rw-r--r--source/blender/makesrna/intern/rna_scene.c25
3 files changed, 18 insertions, 26 deletions
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);