[Bf-blender-cvs] [920a58d9b6d] wm-drag-drop-rewrite: Merge branch 'master' into wm-drag-drop-rewrite

Julian Eisel noreply at git.blender.org
Fri Jun 5 13:10:20 CEST 2020


Commit: 920a58d9b6d667894cf166cbbd25e4c2fbd238ea
Author: Julian Eisel
Date:   Fri Jun 5 13:09:31 2020 +0200
Branches: wm-drag-drop-rewrite
https://developer.blender.org/rB920a58d9b6d667894cf166cbbd25e4c2fbd238ea

Merge branch 'master' into wm-drag-drop-rewrite

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



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

diff --cc release/scripts/presets/keyconfig/keymap_data/blender_default.py
index b78466adfdb,08e81d89c4f..45496c54293
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@@ -763,9 -774,11 +774,11 @@@ def km_outliner(params)
           {"properties": [("all", True)]}),
          ("outliner.item_openclose", {"type": 'EVT_TWEAK_L', "value": 'ANY'},
           {"properties": [("all", False)]}),
+         # Fall through to generic context menu if the item(s) selected have no type specific actions.
          ("outliner.operation", {"type": 'RIGHTMOUSE', "value": 'PRESS'}, None),
+         op_menu("OUTLINER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
 -        ("outliner.item_drag_drop", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
 -        ("outliner.item_drag_drop", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True}, None),
 +        ("outliner.drag_init", {"type": 'EVT_TWEAK_L', "value": 'ANY'}, None),
 +        ("outliner.drag_init", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True}, None),
          ("outliner.show_hierarchy", {"type": 'HOME', "value": 'PRESS'}, None),
          ("outliner.show_active", {"type": 'PERIOD', "value": 'PRESS'}, None),
          ("outliner.show_active", {"type": 'NUMPAD_PERIOD', "value": 'PRESS'}, None),
diff --cc release/scripts/startup/bl_operators/wm.py
index b6ba5a385ed,4c4736cd669..486b48372ac
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@@ -2646,5 -2661,5 +2688,6 @@@ classes = 
      BatchRenameAction,
      WM_OT_batch_rename,
      WM_MT_splash,
+     WM_MT_splash_about,
 +    WM_OT_drop_files,
  )
diff --cc source/blender/blenkernel/BKE_screen.h
index b394d822164,fc7146b8cf4..ccb5e0b69b6
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@@ -111,18 -110,15 +112,21 @@@ typedef struct SpaceType 
    int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
  
    /* Used when we want to replace an ID by another (or NULL). */
-   void (*id_remap)(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id);
+   void (*id_remap)(struct ScrArea *area,
+                    struct SpaceLink *sl,
+                    struct ID *old_id,
+                    struct ID *new_id);
  
-   int (*space_subtype_get)(struct ScrArea *sa);
-   void (*space_subtype_set)(struct ScrArea *sa, int value);
+   int (*space_subtype_get)(struct ScrArea *area);
+   void (*space_subtype_set)(struct ScrArea *area, int value);
    void (*space_subtype_item_extend)(struct bContext *C, EnumPropertyItem **item, int *totitem);
  
 +  /* get drop target for data */
 +  void (*drop_target_find)(struct bContext *C,
 +                           struct wmDropTargetFinder *finder,
 +                           struct wmDragData *drag_data,
 +                           const struct wmEvent *event);
 +
    /* region type definitions */
    ListBase regiontypes;
  
diff --cc source/blender/editors/space_clip/space_clip.c
index dad361db7e3,a68e06951f7..0dccd45578e
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@@ -592,7 -601,45 +592,7 @@@ static int clip_context(const bContext 
    return false;
  }
  
- static void clip_refresh(const bContext *C, ScrArea *sa)
 -/* dropboxes */
 -static bool clip_drop_poll(bContext *UNUSED(C),
 -                           wmDrag *drag,
 -                           const wmEvent *UNUSED(event),
 -                           const char **UNUSED(r_tooltip))
 -{
 -  if (drag->type == WM_DRAG_PATH) {
 -    /* rule might not work? */
 -    if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) {
 -      return true;
 -    }
 -  }
 -
 -  return false;
 -}
 -
 -static void clip_drop_copy(wmDrag *drag, wmDropBox *drop)
 -{
 -  PointerRNA itemptr;
 -  char dir[FILE_MAX], file[FILE_MAX];
 -
 -  BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file));
 -
 -  RNA_string_set(drop->ptr, "directory", dir);
 -
 -  RNA_collection_clear(drop->ptr, "files");
 -  RNA_collection_add(drop->ptr, "files", &itemptr);
 -  RNA_string_set(&itemptr, "name", file);
 -}
 -
 -/* area+region dropbox definition */
 -static void clip_dropboxes(void)
 -{
 -  ListBase *lb = WM_dropboxmap_find("Clip", SPACE_CLIP, 0);
 -
 -  WM_dropbox_add(lb, "CLIP_OT_open", clip_drop_poll, clip_drop_copy);
 -}
 -
+ static void clip_refresh(const bContext *C, ScrArea *area)
  {
    wmWindowManager *wm = CTX_wm_manager(C);
    wmWindow *window = CTX_wm_window(C);
diff --cc source/blender/editors/space_sequencer/space_sequencer.c
index cff5a2c43ec,f52cfdd34c0..03871aeb464
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@@ -358,8 -358,101 +358,8 @@@ static void sequencer_listener(wmWindo
    }
  }
  
 -/* ************* dropboxes ************* */
 -
 -static bool image_drop_poll(bContext *C,
 -                            wmDrag *drag,
 -                            const wmEvent *event,
 -                            const char **UNUSED(r_tooltip))
 -{
 -  ARegion *region = CTX_wm_region(C);
 -  Scene *scene = CTX_data_scene(C);
 -  int hand;
 -
 -  if (drag->type == WM_DRAG_PATH) {
 -    if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) { /* Rule might not work? */
 -      if (find_nearest_seq(scene, &region->v2d, &hand, event->mval) == NULL) {
 -        return 1;
 -      }
 -    }
 -  }
 -
 -  return 0;
 -}
 -
 -static bool movie_drop_poll(bContext *C,
 -                            wmDrag *drag,
 -                            const wmEvent *event,
 -                            const char **UNUSED(r_tooltip))
 -{
 -  ARegion *region = CTX_wm_region(C);
 -  Scene *scene = CTX_data_scene(C);
 -  int hand;
 -
 -  if (drag->type == WM_DRAG_PATH) {
 -    if (ELEM(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) { /* Rule might not work? */
 -      if (find_nearest_seq(scene, &region->v2d, &hand, event->mval) == NULL) {
 -        return 1;
 -      }
 -    }
 -  }
 -  return 0;
 -}
 -
 -static bool sound_drop_poll(bContext *C,
 -                            wmDrag *drag,
 -                            const wmEvent *event,
 -                            const char **UNUSED(r_tooltip))
 -{
 -  ARegion *region = CTX_wm_region(C);
 -  Scene *scene = CTX_data_scene(C);
 -  int hand;
 -
 -  if (drag->type == WM_DRAG_PATH) {
 -    if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) { /* Rule might not work? */
 -      if (find_nearest_seq(scene, &region->v2d, &hand, event->mval) == NULL) {
 -        return 1;
 -      }
 -    }
 -  }
 -  return 0;
 -}
 -
 -static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
 -{
 -  /* Copy drag path to properties. */
 -  if (RNA_struct_find_property(drop->ptr, "filepath")) {
 -    RNA_string_set(drop->ptr, "filepath", drag->path);
 -  }
 -
 -  if (RNA_struct_find_property(drop->ptr, "directory")) {
 -    PointerRNA itemptr;
 -    char dir[FILE_MAX], file[FILE_MAX];
 -
 -    BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file));
 -
 -    RNA_string_set(drop->ptr, "directory", dir);
 -
 -    RNA_collection_clear(drop->ptr, "files");
 -    RNA_collection_add(drop->ptr, "files", &itemptr);
 -    RNA_string_set(&itemptr, "name", file);
 -  }
 -}
 -
 -/* This region dropbox definition. */
 -static void sequencer_dropboxes(void)
 -{
 -  ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
 -
 -  WM_dropbox_add(lb, "SEQUENCER_OT_image_strip_add", image_drop_poll, sequencer_drop_copy);
 -  WM_dropbox_add(lb, "SEQUENCER_OT_movie_strip_add", movie_drop_poll, sequencer_drop_copy);
 -  WM_dropbox_add(lb, "SEQUENCER_OT_sound_strip_add", sound_drop_poll, sequencer_drop_copy);
 -}
 -
 -/* ************* end drop *********** */
 -
  /* DO NOT make this static, this hides the symbol and breaks API generation script. */
- extern const char *sequencer_context_dir[]; /* quiet warning. */
+ extern const char *sequencer_context_dir[]; /* Quiet warning. */
  const char *sequencer_context_dir[] = {"edit_mask", NULL};
  
  static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
@@@ -411,14 -505,19 +411,14 @@@ static void sequencer_main_region_init(
    keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
    WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
  
-   /* own keymap */
+   /* Own keymap. */
    keymap = WM_keymap_ensure(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
    WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
 -
 -  /* Add drop boxes. */
 -  lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
 -
 -  WM_event_add_dropbox_handler(&region->handlers, lb);
  }
  
+ /* Strip editing timeline. */
  static void sequencer_main_region_draw(const bContext *C, ARegion *region)
  {
-   /* NLE - strip editing timeline interface */
    draw_timeline_seq(C, region);
  }
  
@@@ -736,64 -835,9 +736,64 @@@ static void sequencer_id_remap(ScrArea 
    }
  }
  
 +static void sequencer_drop_copy(wmDragData *drag_data, PointerRNA *ptr)
 +{
 +  const char *path = WM_drag_query_single_path(drag_data);
 +
 +  if (RNA_struct_find_property(ptr, "filepath")) {
 +    RNA_string_set(ptr, "filepath", path);
 +  }
 +
 +  if (RNA_struct_find_property(ptr, "directory")) {
 +    PointerRNA itemptr;
 +    char dir[FILE_MAX], file[FILE_MAX];
 +
 +    BLI_split_dirfile(path, dir, file, sizeof(dir), sizeof(file));
 +
 +    RNA_string_set(ptr, "directory", dir);
 +
 +    RNA_collection_clear(ptr, "files");
 +    RNA_collection_add(ptr, "files", &itemptr);
 +    RNA_string_set(&itemptr, "name", file);
 +  }
 +}
 +
 +static void sequencer_drop_target_find(bContext *C,
 +                                       wmDropTargetFinder *finder,
 +                                       wmDragData *drag_data,
 +                                       const wmEvent *event)
 +{
 +  ARegion *ar = CTX_wm_region(C);
 +  Scene *scene = CTX_data_scene(C);
 +  int hand;
 +  Sequence *seq = find_nearest_seq(scene, &ar->v2d, &hand, event->

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list