Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/space_node.c
| Show First 20 Lines • Show All 658 Lines • ▼ Show 20 Lines | |||||
| static void node_main_region_draw(const bContext *C, ARegion *region) | static void node_main_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| node_draw_space(C, region); | node_draw_space(C, region); | ||||
| } | } | ||||
| /* ************* dropboxes ************* */ | /* ************* dropboxes ************* */ | ||||
| static bool node_group_drop_poll(bContext *UNUSED(C), | static bool node_group_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| return WM_drag_is_ID_type(drag, ID_NT); | return WM_drag_is_ID_type(drag, ID_NT); | ||||
| } | } | ||||
| static bool node_object_drop_poll(bContext *UNUSED(C), | static bool node_object_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| return WM_drag_is_ID_type(drag, ID_OB); | return WM_drag_is_ID_type(drag, ID_OB); | ||||
| } | } | ||||
| static bool node_collection_drop_poll(bContext *UNUSED(C), | static bool node_collection_drop_poll(bContext *UNUSED(C), | ||||
| wmDrag *drag, | wmDrag *drag, | ||||
| const wmEvent *UNUSED(event), | const wmEvent *UNUSED(event)) | ||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| return WM_drag_is_ID_type(drag, ID_GR); | return WM_drag_is_ID_type(drag, ID_GR); | ||||
| } | } | ||||
| static bool node_texture_drop_poll(bContext *UNUSED(C), | static bool node_texture_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| return WM_drag_is_ID_type(drag, ID_TE); | return WM_drag_is_ID_type(drag, ID_TE); | ||||
| } | } | ||||
| static bool node_ima_drop_poll(bContext *UNUSED(C), | static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| if (drag->type == WM_DRAG_PATH) { | if (drag->type == WM_DRAG_PATH) { | ||||
| /* rule might not work? */ | /* rule might not work? */ | ||||
| return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); | return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); | ||||
| } | } | ||||
| return WM_drag_is_ID_type(drag, ID_IM); | return WM_drag_is_ID_type(drag, ID_IM); | ||||
| } | } | ||||
| static bool node_mask_drop_poll(bContext *UNUSED(C), | static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | ||||
| wmDrag *drag, | |||||
| const wmEvent *UNUSED(event), | |||||
| const char **UNUSED(r_tooltip)) | |||||
| { | { | ||||
| return WM_drag_is_ID_type(drag, ID_MSK); | 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(wmDrag *drag, wmDropBox *drop) | ||||
| { | { | ||||
| ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); | ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0); | ||||
| Show All 25 Lines | |||||
| static void node_dropboxes(void) | static void node_dropboxes(void) | ||||
| { | { | ||||
| ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW); | ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "NODE_OT_add_object", | "NODE_OT_add_object", | ||||
| node_object_drop_poll, | node_object_drop_poll, | ||||
| node_id_drop_copy, | node_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID); | WM_drag_free_imported_drag_ID, | ||||
| NULL); | |||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "NODE_OT_add_collection", | "NODE_OT_add_collection", | ||||
| node_collection_drop_poll, | node_collection_drop_poll, | ||||
| node_id_drop_copy, | node_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID); | WM_drag_free_imported_drag_ID, | ||||
| NULL); | |||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "NODE_OT_add_texture", | "NODE_OT_add_texture", | ||||
| node_texture_drop_poll, | node_texture_drop_poll, | ||||
| node_id_drop_copy, | node_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID); | WM_drag_free_imported_drag_ID, | ||||
| NULL); | |||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "NODE_OT_add_group", | "NODE_OT_add_group", | ||||
| node_group_drop_poll, | node_group_drop_poll, | ||||
| node_group_drop_copy, | node_group_drop_copy, | ||||
| WM_drag_free_imported_drag_ID); | WM_drag_free_imported_drag_ID, | ||||
| NULL); | |||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "NODE_OT_add_file", | "NODE_OT_add_file", | ||||
| node_ima_drop_poll, | node_ima_drop_poll, | ||||
| node_id_path_drop_copy, | node_id_path_drop_copy, | ||||
| WM_drag_free_imported_drag_ID); | WM_drag_free_imported_drag_ID, | ||||
| NULL); | |||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "NODE_OT_add_mask", | "NODE_OT_add_mask", | ||||
| node_mask_drop_poll, | node_mask_drop_poll, | ||||
| node_id_drop_copy, | node_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID); | WM_drag_free_imported_drag_ID, | ||||
| NULL); | |||||
| } | } | ||||
| /* ************* end drop *********** */ | /* ************* end drop *********** */ | ||||
| /* add handlers, stuff you only do once or on area/region changes */ | /* add handlers, stuff you only do once or on area/region changes */ | ||||
| static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | ||||
| { | { | ||||
| ED_region_header_init(region); | ED_region_header_init(region); | ||||
| ▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines | |||||