Abandoned: macOS: support QuickLook preview #107014

Closed
Ankit Meel wants to merge 8 commits from ankitm:ankitm/quicklook into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
5 changed files with 31 additions and 7 deletions
Showing only changes of commit c96a3caba4 - Show all commits

View File

@ -11,8 +11,6 @@
<array>
<string>blend</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>Blender_Legacy_Document_Icon.icns</string>
<key>CFBundleTypeName</key>
<string>Blender File</string>
<key>CFBundleTypeOSTypes</key>

View File

@ -17,13 +17,13 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>3.6.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>3.6.0 2023-04-18</string>
<key>LSMinimumSystemVersion</key>
<string>11.3</string>
<key>NSExtension</key>
@ -34,9 +34,13 @@
<array>
<string>org.blenderfoundation.blender.file</string>
</array>
<key>QLThumbnailMinimumDimension</key>
<integer>0</integer>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.quicklook.thumbnail</string>
<key>NSExtensionPrincipalClass</key>
<string>ThumbnailProvider</string>
<key>com.apple.showsInExtensionsManager</key>
<true/>
</dict>

View File

@ -17,4 +17,24 @@ error 17:53:58.164827+0530 kernel Sandbox: qlmanage(37213) deny(1) user-preferen
error 17:54:00.837220+0530 kernel Sandbox: qlmanage(37213) deny(1) file-write-data /dev/dtracehelper
error 17:54:00.904484+0530 kernel Sandbox: qlmanage(37213) deny(1) file-write-create /Users/ankitkumar/Library/Saved Application State/com.apple.quicklook.qlmanage.savedState
https://eclecticlight.co/2018/04/05/inside-quicklook-previews-with-qlmanage/
https://eclecticlight.co/2018/04/05/inside-quicklook-previews-with-qlmanage/
in info.plist, add NSExtensionPrincipalClass, add QLThumbnailMinimumDimension
Try removing blend file thumbnail specificaion from blender.app info.plist
Expect
lender-thumbnailer __extensionPrincipalClass != nil - /AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/ExtensionFoundation/ExtensionFoundation/Source/NSExtension/NSExtensionSupport/EXConcreteExtensionContextVendor.m:108: Unable to find NSExtensionPrincipalClass (<private>) in extension bundle! Please verify that the extension links the required frameworks and that the value for NSExtensionPrincipalClass is prefixed with '$(PRODUCT_MODULE_NAME).' if the class is implemented in Swift.
fault 00:55:16.449383+0530 blender-thumbnailer [__extensionPrincipalClass conformsToProtocol:@protocol(NSExtensionRequestHandling)] - /AppleInternal/Library/BuildRoots/a0876c02-1788-11ed-b9c4-96898e02b808/Library/Caches/com.apple.xbs/Sources/ExtensionFoundation/ExtensionFoundation/Source/NSExtension/NSExtensionSupport/EXConcreteExtensionContextVendor.m:109: NSExtensionPrincipalClass does not conform to NSExtensionRequestHandling protocol!
Signing blender.app
move blender.app to /Applications or launch it at least once
Don't access files outside sandbox or kernel denies:
default 03:07:03.525360+0530 blender-thumbnailer hello world from blender
error 03:07:03.527837+0530 blender-thumbnailer Couldn't issue file extension for url: <private>
error 03:07:03.531152+0530 kernel Sandbox: com.apple.quickl(476) deny(1) file-read-data /Users/ankitkumar/Pictures/IMG_3158.JPG

View File

@ -5,6 +5,8 @@
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>

View File

@ -67,11 +67,12 @@ static eThumbStatus creator_impl(const char *src_blend_path)
completionHandler:(void (^)(QLThumbnailReply *_Nullable reply,
NSError *_Nullable error))handler
{
@autoreleasepool { // Add the supported content types to the QLSupportedContentTypes array in
// Add the supported content types to the QLSupportedContentTypes array in
// the Info.plist of the
// extension.
NSLog(@"hello world from blender");
// NSLog(@"%s", request.fileURL.path.UTF8String);
NSURL *foo = [[NSURL alloc]
initFileURLWithFileSystemRepresentation:"/Users/ankitkumar/Pictures/IMG_3158.JPG"
isDirectory:NO
@ -79,7 +80,6 @@ static eThumbStatus creator_impl(const char *src_blend_path)
QLThumbnailReply *reply = [QLThumbnailReply replyWithImageFileURL:foo];
handler(reply, nil);
}
}
@end