macOS/QuickLook: support rich thumbnail #107072
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#107072
Loading…
Reference in New Issue
No description provided.
Delete Branch "ankitm/blender:ankitm/2ql"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Support thumbnail that shows the file contents instead
of the default blend file icon for all files in Finder.
blender-thumbnailer process is kept alive by the system
in the background and is used when needed.
It will NOT be interactive "Preview" that allows richer
interactions like Panning viewport, or rotating 3D objects.
This may need codesign changes in the buildbot.
Community request: https://blender.community/c/rightclickselect/d3cbbc/?sorting=hot
QLgenerator for older versions (not developed by me):
https://blenderartists.org/t/blender-quicklook-plugin/621221
Replaces the thumbnail from
To something to show the contents of the file as done on other platforms.
Finder icon mode and QuickLook:
Space bar on file:
Colors
System Preferences to toggle the behaviour:Thishas been removed. Nothing will change in System Preferences
@brecht @LazyDodo any preliminary comments, please? Cmake process or info.plist location etc. Further changes will only be in ThumbnailProvider.mm file
Can you explain what this does, show a screenshot?
Updated description
Community request: https://blender.community/c/rightclickselect/d3cbbc/?sorting=hot
QLgenerator for older versions (not mine): https://blenderartists.org/t/blender-quicklook-plugin/621221
I'm a bit confused what this does? I assumed this was going to show the thumbnail embedded in the .blend file rather than the blender logo, just like it does on Windows.
before:
after:
You either chose poor examples or i don't understand what's happening there, but a giant white document doesn't seem better than a document with a blender logo to me?
In terms of code organization, I'd prefer this to be more similar to the existing files for the regular Blender.app. So:
Info.plist
to appropriate subdirectory ofrelease/darwin/Blender.app
ThumbnailProvider.mm
intoInfo.plist
Info.plist
for how to insert version numbersThumbnailExtensionMacOS.entitlements.Debug
torelease/darwin/thumbnail_entitlements.plist
lsregister
as part of the build, nothing should be registered automatically on the build machine.Code signing will have to be done on the buildbot. What is not clear to me if it's needed as well to get this to work on your own machine, or it can just not be signed for that case.
tsk.. I forgot to hit save. Since the thumbnail generation code is noop as of now, nothing is created yet. WIP.
I'll use the the same functions to generate PNG and fill it in a buffer and pass it to the system, so output on OSes will be the same too.
It happens in Xcode also, that's where I took the command from.
Same can be achieved with launching Blender.app. I'll add that in a comment.
Yes that is needed locally also or else QL will mark it as invalid generator.
Xcode runs the command too.
I'd rather we do not do this even if Xcode does. Having the system configuration affected every time you run a build just seems wrong to me.
WIP: macOS/QuickLook: support rich thumbnailto macOS/QuickLook: support rich thumbnailWe may change the behaviour of "space bar on file" to make a full screen image later. Would need another appex file and a high res image.
Getting a bigger preview to work may be impractical, and not worth the code complexity to get working. We don't want to make .blend files too big with big previews images, and opening .blend files specifically for previews is not something we should do.
Is there a way to display the preview inside a different icon, without the document shape? It looks a bit weird to me. Maybe the cup .blend just happens to be poorly aligned.
@ -0,0 +45,4 @@
<key>NSExtensionPrincipalClass</key>
<!-- Must be the same as the class implementing the reply method. -->
<string>ThumbnailProvider</string>
<!-- Shows checkbox in System Preferences. -->
Is this required, and common for these kinds of thumbnails generators? I don't see it for any other apps, but maybe I just happen to not have any apps that do this.
Not required and not sure about commonness. But since there's no other way to disable it, I added it.
I could remove the key from plist and let the system decide.
I'd leave it out and let the system decide.
@ -0,0 +6,4 @@
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
Inconsistent indentation.
@ -41,2 +41,3 @@
endif()
else()
if(UNIX AND NOT APPLE)
Code is more clearly mutually exclusive if you use:
@ -57,0 +70,4 @@
"-e _NSExtensionMain"
"-framework QuickLookThumbnailing"
)
if(DEFINED PTHREADS_LIBRARIES)
This is never defined on macOS, not needed.
@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
This file should be in
release/darwin
too.Personally I'm also fine with not having the debugging entitlement at all, I just disable system integrity protection to be able to debug any application.
I'll remove it.. debugging is only print debugging anyway.
Whoa
@ -0,0 +5,4 @@
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
Inconsistent indentation.
@ -0,0 +1,13 @@
#pragma once
snake_case for filenames
@ -0,0 +1,159 @@
snake_case for filenames
@ -0,0 +8,4 @@
#include "BLI_fileops.h"
#include "BLI_filereader.h"
#include "blendthumb.hh"
Add newline before this.
@ -0,0 +80,4 @@
}
};
static NSError *createErrorFromStr(NSString *errorStr)
snake_case
for function namesJava habit from work ..
@ -0,0 +88,4 @@
userInfo:@{NSLocalizedDescriptionKey : errorStr}];
}
static NSImage *generateNSImageForFile(const char *src_blend_path, NSError **error)
snake_case
for function names@ -0,0 +90,4 @@
static NSImage *generateNSImageForFile(const char *src_blend_path, NSError **error)
{
Remove empty line
@ -0,0 +92,4 @@
{
/* Open source file `src_blend`. */
FileReaderRAII src_file_fd = FileReaderRAII(BLI_open(src_blend_path, O_BINARY | O_RDONLY, 0));
This name is confusing to me, it's not RAII for the
FileReader
type below. Would also be better to putBLI_open
inside the class constructor I think.@ -0,0 +123,4 @@
CGImageRef image = CGImageCreateWithPNGDataProvider(
provider, nullptr, true, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);
NSImage *uiimage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
Not sure why this is called
uiimage
, maybe copied from example code?@ -0,0 +125,4 @@
CGDataProviderRelease(provider);
NSImage *uiimage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
CGImageRelease(image);
CGDataProviderRelease(provider);
Don't call
CGDataProviderRelease
twice@ -1355,1 +1365,3 @@
DESTINATION Blender.app/Contents/MacOS/
DESTINATION Blender.app/Contents/Plugins
)
set(BL_CODESIGN_ENTITLEMENTS "${OSX_APP_SOURCEDIR}/../thumbnail_entitlements.plist")
Not using relative path is more clear I think, their relative location has no particular importance:
${CMAKE_SOURCE_DIR}/release/darwin/thumbnail_entitlements.plist
.Don't invent new
BL_
prefix for variable names, suggest to useTHUMBNAIL_ENTITLEMENTS
@ -1356,0 +1365,4 @@
DESTINATION Blender.app/Contents/Plugins
)
set(BL_CODESIGN_ENTITLEMENTS "${OSX_APP_SOURCEDIR}/../thumbnail_entitlements.plist")
install(CODE
Does this now run on every
make install
? That would slow down incremental builds. Is there a way to make it run only when the appex is updated?insignificant
Even my poor machine makes it unnoticeable. We aren't signing the full blender.app.
Image in Blender file browser. First I thought it wasn't scaling properly but that's not the case either.
Numbers, CSV and html work this way too
The square can be made rectangle by adding a "BLEND" banner under it
Ok, USDZ files seem to show similarly as a document so it's consistent, even if a bit strange to me.
I guess this will need buildbot code signing changes, but we can test what it does without them:
@blender-bot package macos
Package build started. Download here when ready.
Thumbnails don't seem to be working with the buildbot package, which is not surprising.
The code looks good to me, but this will need to wait to land until I have time to make the buildbot changes.
There's a large number of things to go wrong. Listed in troubleshooting section in .mm file.
If you have time, it can be made to work locally.
I know too little about macOS development to be useful here, so removing myself from the reviewer list. The feature itself seems good to have.
Checkout
From your project repository, check out a new branch and test the changes.