Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_dragdrop.c
| Show First 20 Lines • Show All 1,098 Lines • ▼ Show 20 Lines | static Collection *collection_parent_from_ID(ID *id) | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| static bool collection_drop_init(bContext *C, | static bool collection_drop_init(bContext *C, | ||||
| wmDrag *drag, | wmDrag *drag, | ||||
| const wmEvent *event, | const wmEvent *event, | ||||
| CollectionDrop *data) | CollectionDrop *data) | ||||
| { | { | ||||
| SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); | |||||
| /* Get collection to drop into. */ | /* Get collection to drop into. */ | ||||
| TreeElementInsertType insert_type; | TreeElementInsertType insert_type; | ||||
| TreeElement *te = outliner_drop_insert_collection_find(C, event, &insert_type); | TreeElement *te = outliner_drop_insert_collection_find(C, event, &insert_type); | ||||
| if (!te) { | if (!te) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| Collection *to_collection = outliner_collection_from_tree_element(te); | Collection *to_collection = outliner_collection_from_tree_element(te); | ||||
| if (ID_IS_LINKED(to_collection)) { | if (ID_IS_LINKED(to_collection)) { | ||||
| Show All 17 Lines | /* Get collection to drop into. */ | ||||
| ID *id = drag_id->id; | ID *id = drag_id->id; | ||||
| if (!(id && ELEM(GS(id->name), ID_GR, ID_OB))) { | if (!(id && ELEM(GS(id->name), ID_GR, ID_OB))) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Get collection to drag out of. */ | /* Get collection to drag out of. */ | ||||
| ID *parent = drag_id->from_parent; | ID *parent = drag_id->from_parent; | ||||
| Collection *from_collection = collection_parent_from_ID(parent); | Collection *from_collection = collection_parent_from_ID(parent); | ||||
| if (event->ctrl || space_outliner->outlinevis == SO_SCENES) { | if (event->ctrl) { | ||||
| from_collection = NULL; | from_collection = NULL; | ||||
| } | } | ||||
| /* Get collections. */ | /* Get collections. */ | ||||
| if (GS(id->name) == ID_GR) { | if (GS(id->name) == ID_GR) { | ||||
| if (id == &to_collection->id) { | if (id == &to_collection->id) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 364 Lines • Show Last 20 Lines | |||||