[Bf-blender-cvs] [77794b1a7b9] master: VSE: Add precise drag and drop and strip previews

Sebastian Parborg noreply at git.blender.org
Thu Apr 28 12:56:03 CEST 2022


Commit: 77794b1a7b99bd689d1d9872c61d7990fbad2ce4
Author: Sebastian Parborg
Date:   Thu Apr 28 12:50:22 2022 +0200
Branches: master
https://developer.blender.org/rB77794b1a7b99bd689d1d9872c61d7990fbad2ce4

VSE: Add precise drag and drop and strip previews

This patch adds the drag and drop strip previews in the VSE.
It also adds two new functions to the drag and drop API.

1. "draw_in_view" for callbacks that wants to draw elements in local viewport coordinates
2. "on_drag_start" that can be used for prefetching data only once at the start of the drag.

Reviewed By: Julian, Campbell

Differential Revision: http://developer.blender.org/D14560

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

M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_dropboxes.cc
M	source/blender/editors/interface/interface_ops.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/editors/space_console/space_console.c
M	source/blender/editors/space_file/space_file.c
M	source/blender/editors/space_image/space_image.c
M	source/blender/editors/space_node/space_node.cc
M	source/blender/editors/space_sequencer/CMakeLists.txt
M	source/blender/editors/space_sequencer/sequencer_add.c
A	source/blender/editors/space_sequencer/sequencer_drag_drop.c
M	source/blender/editors/space_sequencer/sequencer_intern.h
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/editors/space_text/space_text.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_convert.h
M	source/blender/editors/transform/transform_convert_sequencer.c
M	source/blender/editors/transform/transform_orientations.h
M	source/blender/editors/transform/transform_snap_sequencer.c
M	source/blender/sequencer/SEQ_transform.h
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_dragdrop.c
M	source/blender/windowmanager/intern/wm_draw.c

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

diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 66c17ff8115..82cc518f029 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -202,6 +202,21 @@ int ED_transform_calc_gizmo_stats(const struct bContext *C,
                                   const struct TransformCalcParams *params,
                                   struct TransformBounds *tbounds);
 
+/**
+ * Iterates over all the strips and finds the closest snapping candidate of either \a frame_1 or \a
+ * frame_2. The closest snapping candidate will be the closest start or end frame of an existing
+ * strip.
+ * \returns True if there was anything to snap to.
+ */
+bool ED_transform_snap_sequencer_to_closest_strip_calc(struct Scene *scene,
+                                                       struct ARegion *region,
+                                                       int frame_1,
+                                                       int frame_2,
+                                                       int *r_snap_distance,
+                                                       float *r_snap_frame);
+
+void ED_draw_sequencer_snap_point(struct bContext *C, float snap_point);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 1b817d06564..9f4d6815287 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -2925,7 +2925,7 @@ void ED_keymap_ui(struct wmKeyConfig *keyconf);
 void ED_dropboxes_ui(void);
 void ED_uilisttypes_ui(void);
 
-void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop);
+void UI_drop_color_copy(struct bContext *C, struct wmDrag *drag, struct wmDropBox *drop);
 bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event);
 
 bool UI_context_copy_to_selected_list(struct bContext *C,
diff --git a/source/blender/editors/interface/interface_dropboxes.cc b/source/blender/editors/interface/interface_dropboxes.cc
index 2e8708827e7..9d3c1372b15 100644
--- a/source/blender/editors/interface/interface_dropboxes.cc
+++ b/source/blender/editors/interface/interface_dropboxes.cc
@@ -67,7 +67,7 @@ static bool ui_drop_name_poll(struct bContext *C, wmDrag *drag, const wmEvent *U
   return UI_but_active_drop_name(C) && (drag->type == WM_DRAG_ID);
 }
 
-static void ui_drop_name_copy(wmDrag *drag, wmDropBox *drop)
+static void ui_drop_name_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   const ID *id = WM_drag_get_local_ID(drag, 0);
   RNA_string_set(drop->ptr, "string", id->name + 2);
@@ -85,7 +85,7 @@ static bool ui_drop_material_poll(bContext *C, wmDrag *drag, const wmEvent *UNUS
   return WM_drag_is_ID_type(drag, ID_MA) && !RNA_pointer_is_null(&mat_slot);
 }
 
-static void ui_drop_material_copy(wmDrag *drag, wmDropBox *drop)
+static void ui_drop_material_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   const ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, ID_MA);
   RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 0f4f0ef48ff..5b97a80d513 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1862,7 +1862,7 @@ bool UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(
   return 0;
 }
 
-void UI_drop_color_copy(wmDrag *drag, wmDropBox *drop)
+void UI_drop_color_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   uiDragColorHandle *drag_info = drag->poin;
 
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 408ddfe7241..d7cf09ca89a 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -5771,7 +5771,7 @@ static bool blend_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEven
   return false;
 }
 
-static void blend_file_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void blend_file_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   /* copy drag path to properties */
   RNA_string_set(drop->ptr, "filepath", drag->path);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 444ed421083..91fef23019c 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -597,7 +597,7 @@ static bool clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNU
   return false;
 }
 
-static void clip_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void clip_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   PointerRNA itemptr;
   char dir[FILE_MAX], file[FILE_MAX];
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 8e33f7fa97f..c69b73e377d 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -149,7 +149,7 @@ static bool id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSE
   return WM_drag_get_local_ID(drag, 0) != NULL;
 }
 
-static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   ID *id = WM_drag_get_local_ID(drag, 0);
 
@@ -164,7 +164,7 @@ static bool path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNU
   return (drag->type == WM_DRAG_PATH);
 }
 
-static void path_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   char pathname[FILE_MAX + 2];
   BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 7b3b87f4572..0170361f244 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -844,7 +844,7 @@ static bool filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(
   return false;
 }
 
-static void filepath_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void filepath_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   RNA_string_set(drop->ptr, "filepath", drag->path);
 }
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index bc047a00ae1..568bd064e3e 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -255,7 +255,7 @@ static bool image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
   return false;
 }
 
-static void image_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void image_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   /* copy drag path to properties */
   RNA_string_set(drop->ptr, "filepath", drag->path);
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index 82b850653be..34f357ae5c3 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -636,21 +636,21 @@ static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent
   return WM_drag_is_ID_type(drag, ID_MSK);
 }
 
-static void node_group_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void node_group_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
 
   RNA_string_set(drop->ptr, "name", id->name + 2);
 }
 
-static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void node_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
 
   RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
 }
 
-static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
+static void node_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
 {
   ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
 
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 2d1785523d7..b5355efec7a 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -25,6 +25,7 @@ set(INC
 set(SRC
   sequencer_add.c
   sequencer_buttons.c
+  sequencer_drag_drop.c
   sequencer_draw.c
   sequencer_channels_draw.c
   sequencer_channels_edit.c
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 4672961543f..9298eb83b46 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -125,12 +125,20 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
       ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
 
   RNA_def_boolean(
-      ot->srna, "replace_sel", 1, "Replace Selection", "Replace the current selection");
+      ot->srna, "replace_sel", true, "Replace Selection", "Replace the current selection");
 
   /* Only for python scripts which import strips and place them after. */
   prop = RNA_def_boolean(
-      ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips");
-  RNA_def_property_flag(prop, PROP_HIDDEN);
+      ot->srna, "overlap", false, "Allow Overlap", "Don't correct overlap on new sequence strips");
+  RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
+  prop = RNA_def_boolean(
+      ot->srna,
+      "overlap_shuffle_override",
+      false,
+      "Override Overlap Shuffle Behaviour",
+      "Use the overlap_mode tool settings to determine how to shuffle overlapping strips");
+  RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 
   if (flag & SEQPROP_FIT_METHOD) 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list