Page MenuHome

Blender does not react to a file being opened from finder on a different desktop (MacOS)
Closed, ResolvedPublic

Description

System Information
Operating system: Darwin-18.7.0-x86_64-i386-64bit 64 Bits
Graphics card: Intel(R) Iris(TM) Graphics 540 Intel Inc. 4.1 INTEL-12.10.12

Blender Version
Broken: version: 2.80 and 2.81 (sub 11), branch: master, commit date: 2019-09-16 21:02, hash: rB76650402f300
Worked: unknown

Short description of error
On MacOS when you try to open any .blend file from finder, when Blender is already running on a different desktop (workspace, also when it is running fullscreen), nothing happens (except for the menu bar saying blender until you click somewhere else). When opened from the same desktop space, the blend files open as expected.

Exact steps for others to reproduce the error
Have a Blender window open regular or fullscreen.
On a different desktop, from finder click a blend file to try to open it. Blender does not react to this.

Event Timeline

Sebastián Barschkis (sebbas) lowered the priority of this task from 90 to 30.Dec 5 2019, 4:00 PM

@Wouter Stomp (wouterstomp) I cannot reproduce this with the latest master (95ca3f6). Can you please confirm that this is still an issue for you?

The issue still occurs for me with 2.82 alpha 2019-12-03

Philipp Oeser (lichtwerk) raised the priority of this task from 30 to 90.Dec 17 2019, 12:48 PM

Another relevant thing: when using the +W shortcut, it closes the current window, but also quits blender. Most apps on macOS keep the option for keeping the app open but all windows closed, thus giving purpose to +Q.

@Sebastián Barschkis (sebbas) to be clear, here by "desktops" we mean Mission Control spaces.

Jacques Lucke (JacquesLucke) changed the task status from Needs Triage to Needs Information from User.Jan 21 2020, 3:01 PM

Can you make a short screen recording that shows the issue in the latest build, please?

Jacques Lucke (JacquesLucke) changed the task status from Needs Information from User to Needs Developer to Reproduce.Jan 21 2020, 3:46 PM

@Yevgeny Makarov (jenkm) not that you needed to make them fullscreen, just put blender (in normal mode) to desktop 2 with the default file, and open another file from finder in desktop 1. Fullscreen apps are not highly reliable, not even Safari.

The file gives the boom effect of being opened, in the Finder, but neither it opens nor does the app changes desktop.

Oh! exactly, it should also switch to another desktop, an unsuccessful example with an Affinity Photo (also a bug).

Okay, this issue is easy to reproduce, just minimize Blender and try to open the file from Finder.

Caused by the absence of an active window:

GHOST_Window *window = (GHOST_Window *)m_windowManager->getActiveWindow();

if (!window) {
  return NO;
}

It works with changes like this:

diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index e50e478b9fc..410c6c5b6b6 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1370,6 +1370,13 @@ - (void)windowWillClose:(NSNotification *)notification
   NSArray *windowsList;
   char *temp_buff;
   size_t filenameTextSize;
+
+  // Check for blender opened windows and make the frontmost key.
+  windowsList = [NSApp orderedWindows];
+  if ([windowsList count]) {
+    [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
+  }
+
   GHOST_Window *window = (GHOST_Window *)m_windowManager->getActiveWindow();
 
   if (!window) {

CC @Brecht Van Lommel (brecht)

@Yevgeny Makarov (jenkm) a fix like this seems fine, but this function already has this same code a few lines lower. Can we just move that up instead of having it twice?

No, it is also necessary after the confirm box closing, but T68707.