macOS: Remove user notifications.

User notifications in Blender were always annoying and therefore by default turned off.
- When tweaking compositor/material tree a notification was shown.
- When rendering an animation for each frame a notification was shown.

The reason for this was that it was automatically shown when a background job was
finished and Blender wasn't the top most application.

In stead of migrating user notification to UserNotification.framework it was decided
to remove it for now. If in the future notifications should be added back we should
start with a design to figure out where notifications makes sense.

Reviewed By: sergey, brecht

Maniphest Tasks: T103757

Differential Revision: https://developer.blender.org/D16955
This commit is contained in:
Jeroen Bakker 2023-01-12 08:39:42 +01:00 committed by Jeroen Bakker
parent b9177014b6
commit 3590e263e0
Notes: blender-bot 2023-02-14 09:43:37 +01:00
Referenced by issue #103757, macOS: Replace NSUserNotification API with UserNotifications.frameworks API
1 changed files with 1 additions and 19 deletions

View File

@ -895,22 +895,13 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
return GHOST_kSuccess;
}
static void postNotification()
{
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = @"Blender Progress Notification";
notification.informativeText = @"Calculation is finished.";
notification.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
[notification release];
}
GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
{
if (!m_progressBarVisible)
return GHOST_kFailure;
m_progressBarVisible = false;
/* Reset application icon to remove the progress bar. */
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSImage *dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128, 128)];
@ -921,15 +912,6 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
fraction:1.0];
[dockIcon unlockFocus];
[NSApp setApplicationIconImage:dockIcon];
// We use notifications to inform the user when the progress reached 100%
// Atm. just fire this when the progressbar ends, the behavior is controlled
// in the NotificationCenter If Blender is not frontmost window, a message
// pops up with sound, in any case an entry in notifications
if ([NSUserNotificationCenter respondsToSelector:@selector(defaultUserNotificationCenter)]) {
postNotification();
}
[dockIcon release];
[pool drain];