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
This commit is contained in:
Richard Antalik 2021-07-01 22:08:11 +02:00
parent 4a7951fede
commit 519c12da41
3 changed files with 18 additions and 26 deletions

View File

@ -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,

View File

@ -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);
}

View File

@ -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);