Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_dragdrop.c
| Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | static TreeElement *outliner_drop_insert_find(bContext *C, | ||||
| const wmEvent *event, | const wmEvent *event, | ||||
| TreeElementInsertType *r_insert_type) | TreeElementInsertType *r_insert_type) | ||||
| { | { | ||||
| SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); | SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| TreeElement *te_hovered; | TreeElement *te_hovered; | ||||
| float view_mval[2]; | float view_mval[2]; | ||||
| /* Emtpy tree, e.g. while filtered. */ | |||||
| if (BLI_listbase_is_empty(&space_outliner->tree)) { | |||||
| return NULL; | |||||
| } | |||||
| UI_view2d_region_to_view( | UI_view2d_region_to_view( | ||||
| ®ion->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]); | ®ion->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]); | ||||
| te_hovered = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]); | te_hovered = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]); | ||||
| if (te_hovered) { | if (te_hovered) { | ||||
| /* Mouse hovers an element (ignoring x-axis), | /* Mouse hovers an element (ignoring x-axis), | ||||
| * now find out how to insert the dragged item exactly. */ | * now find out how to insert the dragged item exactly. */ | ||||
| const float margin = UI_UNIT_Y * (1.0f / 4); | const float margin = UI_UNIT_Y * (1.0f / 4); | ||||
| ▲ Show 20 Lines • Show All 1,358 Lines • Show Last 20 Lines | |||||