Cocoa/DND : added bitmap data type handling in drag'n'drop operations
[blender-staging.git] / intern / ghost / intern / GHOST_WindowCocoa.mm
index 1223f866a9bb041553a78c63883670abaa8a0455..1a8b54be0fa1cd2956aed0723a6f68368244308a 100644 (file)
@@ -203,11 +203,16 @@ extern "C" {
 {
        NSPoint mouseLocation = [sender draggingLocation];
        NSPasteboard *draggingPBoard = [sender draggingPasteboard];
 {
        NSPoint mouseLocation = [sender draggingLocation];
        NSPasteboard *draggingPBoard = [sender draggingPasteboard];
+       NSImage *droppedImg;
        id data;
        
        switch (m_draggedObjectType) {
                case GHOST_kDragnDropTypeBitmap:
        id data;
        
        switch (m_draggedObjectType) {
                case GHOST_kDragnDropTypeBitmap:
-                       data = [draggingPBoard dataForType:NSTIFFPboardType];
+                       if([NSImage canInitWithPasteboard:draggingPBoard]) {
+                               droppedImg = [[NSImage alloc]initWithPasteboard:draggingPBoard];
+                               data = droppedImg; //[draggingPBoard dataForType:NSTIFFPboardType];
+                       }
+                       else return NO;
                        break;
                case GHOST_kDragnDropTypeFilenames:
                        data = [draggingPBoard propertyListForType:NSFilenamesPboardType];
                        break;
                case GHOST_kDragnDropTypeFilenames:
                        data = [draggingPBoard propertyListForType:NSFilenamesPboardType];