Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/space_view3d.c
| Show First 20 Lines • Show All 603 Lines • ▼ Show 20 Lines | |||||
| static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | static bool view3d_world_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | ||||
| { | { | ||||
| return view3d_drop_id_in_main_region_poll(C, drag, event, ID_WO); | return view3d_drop_id_in_main_region_poll(C, drag, event, ID_WO); | ||||
| } | } | ||||
| static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | static bool view3d_object_data_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | ||||
| { | { | ||||
| ID_Type id_type = view3d_drop_id_in_main_region_poll_get_id_type(C, drag, event); | ID_Type id_type = view3d_drop_id_in_main_region_poll_get_id_type(C, drag, event); | ||||
| if (id_type && OB_DATA_SUPPORT_ID(id_type)) { | if (id_type && OB_DATA_SUPPORT_ID(id_type) && (id_type != ID_GD)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| static bool view3d_gpencil_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | |||||
| { | |||||
| return view3d_drop_id_in_main_region_poll(C, drag, event, ID_GD); | |||||
| } | |||||
| static char *view3d_object_data_drop_tooltip(bContext *UNUSED(C), | static char *view3d_object_data_drop_tooltip(bContext *UNUSED(C), | ||||
| wmDrag *UNUSED(drag), | wmDrag *UNUSED(drag), | ||||
| const int UNUSED(xy[2]), | const int UNUSED(xy[2]), | ||||
| wmDropBox *UNUSED(drop)) | wmDropBox *UNUSED(drop)) | ||||
| { | { | ||||
| return BLI_strdup(TIP_("Create object instance from object-data")); | return BLI_strdup(TIP_("Create object instance from object-data")); | ||||
| } | } | ||||
| static char *view3d_gpencil_data_drop_tooltip(bContext *UNUSED(C), | |||||
| wmDrag *UNUSED(drag), | |||||
| const int UNUSED(xy[2]), | |||||
| wmDropBox *UNUSED(drop)) | |||||
| { | |||||
| return BLI_strdup(TIP_("Add strokes to active object")); | |||||
| } | |||||
| static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | static bool view3d_ima_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) | ||||
| { | { | ||||
| if (ED_region_overlap_isect_any_xy(CTX_wm_area(C), event->xy)) { | if (ED_region_overlap_isect_any_xy(CTX_wm_area(C), event->xy)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| 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)); | ||||
| ▲ Show 20 Lines • Show All 306 Lines • ▼ Show 20 Lines | WM_dropbox_add(lb, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| view3d_object_data_drop_tooltip); | view3d_object_data_drop_tooltip); | ||||
| WM_dropbox_add(lb, | WM_dropbox_add(lb, | ||||
| "VIEW3D_OT_drop_world", | "VIEW3D_OT_drop_world", | ||||
| view3d_world_drop_poll, | view3d_world_drop_poll, | ||||
| view3d_id_drop_copy, | view3d_id_drop_copy, | ||||
| WM_drag_free_imported_drag_ID, | WM_drag_free_imported_drag_ID, | ||||
| NULL); | NULL); | ||||
| /* TODO(@antoniov): Change to use a temp copy using BLO_library_temp_load_id (). */ | |||||
| WM_dropbox_add(lb, | |||||
| "GPENCIL_OT_asset_import", | |||||
| view3d_gpencil_drop_poll, | |||||
| view3d_id_drop_copy_with_type, | |||||
| WM_drag_free_imported_drag_ID, | |||||
| view3d_gpencil_data_drop_tooltip); | |||||
| } | } | ||||
| static void view3d_widgets(void) | static void view3d_widgets(void) | ||||
| { | { | ||||
| wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure( | wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure( | ||||
| &(const struct wmGizmoMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW}); | &(const struct wmGizmoMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW}); | ||||
| WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_xform_gizmo_context); | WM_gizmogrouptype_append_and_link(gzmap_type, VIEW3D_GGT_xform_gizmo_context); | ||||
| ▲ Show 20 Lines • Show All 1,103 Lines • Show Last 20 Lines | |||||