Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/space_outliner.c
| Context not available. | |||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "UI_interface.h" | |||||
| #include "outliner_intern.h" | #include "outliner_intern.h" | ||||
| Context not available. | |||||
| RNA_string_set(drop->ptr, "material", id->name + 2); | RNA_string_set(drop->ptr, "material", id->name + 2); | ||||
| } | } | ||||
| static int outliner_drag_scroll_poll(bContext *C, wmDrag *UNUSED(drag), const wmEvent *event) | |||||
| { | |||||
| // TODO: check if we are in the right outlinervis thingie-mode (soops->outlinevis) | |||||
| ARegion *ar = CTX_wm_region(C); | |||||
| if ((ar->v2d.winy - event->mval[1]) < 10) { | |||||
| ar->v2d.cur.ymin += 5.0; | |||||
| ar->v2d.cur.ymax += 5.0; | |||||
| ED_region_tag_redraw(ar); | |||||
| // not sure if we should even return success (do we need 'Scroll' to be displayed in the UI)? | |||||
| return 1; | |||||
| } | |||||
| else if (event->mval[1] < 10) { | |||||
| ar->v2d.cur.ymin -= 5.0; | |||||
| ar->v2d.cur.ymax -= 5.0; | |||||
| ED_region_tag_redraw(ar); | |||||
| // not sure if we should even return success (do we need 'Scroll' to be displayed in the UI)? | |||||
| return 1; | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| static int outliner_drag_open_poll(bContext *C, wmDrag *UNUSED(drag), const wmEvent *event) | |||||
| { | |||||
| ARegion *ar = CTX_wm_region(C); | |||||
| SpaceOops *soops = CTX_wm_space_outliner(C); | |||||
| TreeElement *te; | |||||
| float fmval[2]; | |||||
| // need to find out if we're hovering over the 'open/plus' icon | |||||
| // TODO: atm it opens immediately, check how we can implement a timer (so it will only open after a second or so...) | |||||
| UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]); | |||||
| // hrmf, 'dropzone' is actually only icon+name (rest of the row will return NULL) | |||||
| //te = outliner_dropzone_find(soops, fmval, 1); | |||||
| // rolled my own... | |||||
| te = outliner_drag_open_find(soops, fmval); | |||||
| if (te) { | |||||
| TreeStoreElem *tselem = TREESTORE(te); | |||||
| if (tselem->flag & TSE_CLOSED) { | |||||
| tselem->flag &= ~TSE_CLOSED; | |||||
| soops->storeflag |= SO_TREESTORE_REDRAW; | |||||
| ED_region_tag_redraw(ar); | |||||
| // not sure if we should even return success (do we need 'Open' to be displayed in the UI)? | |||||
| return 1; | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| static void outliner_drag_dummy(wmDrag *UNUSED(drag), wmDropBox *UNUSED(drop)) | |||||
| { | |||||
| } | |||||
| /* region dropbox definition */ | /* region dropbox definition */ | ||||
| static void outliner_dropboxes(void) | static void outliner_dropboxes(void) | ||||
| { | { | ||||
| ListBase *lb = WM_dropboxmap_find("Outliner", SPACE_OUTLINER, RGN_TYPE_WINDOW); | ListBase *lb = WM_dropboxmap_find("Outliner", SPACE_OUTLINER, RGN_TYPE_WINDOW); | ||||
| /* hack to get scrolling working (not a real dropbox -- functionalitiy in poll) */ | |||||
| WM_dropbox_add(lb, "OUTLINER_OT_drag_scroll", outliner_drag_scroll_poll, outliner_drag_dummy); | |||||
| /* hack to get opening working (not a real dropbox -- functionalitiy in poll) */ | |||||
| WM_dropbox_add(lb, "OUTLINER_OT_drag_open", outliner_drag_open_poll, outliner_drag_dummy); | |||||
| /* regular drag n drop */ | |||||
| WM_dropbox_add(lb, "OUTLINER_OT_parent_drop", outliner_parent_drop_poll, outliner_parent_drop_copy); | WM_dropbox_add(lb, "OUTLINER_OT_parent_drop", outliner_parent_drop_poll, outliner_parent_drop_copy); | ||||
| WM_dropbox_add(lb, "OUTLINER_OT_parent_clear", outliner_parent_clear_poll, outliner_parent_clear_copy); | WM_dropbox_add(lb, "OUTLINER_OT_parent_clear", outliner_parent_clear_poll, outliner_parent_clear_copy); | ||||
| WM_dropbox_add(lb, "OUTLINER_OT_scene_drop", outliner_scene_drop_poll, outliner_scene_drop_copy); | WM_dropbox_add(lb, "OUTLINER_OT_scene_drop", outliner_scene_drop_poll, outliner_scene_drop_copy); | ||||
| Context not available. | |||||