New feature: Quicklook for macOS, make a pull request?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- matthiaswm
- Posts: 35
- Joined: Wed Nov 18, 2020 11:41 am
- Location: Düsseldorf, Germany
New feature: Quicklook for macOS, make a pull request?
Hi devs,
I wrote a QuickLook plugin that shows the contents of an FCStd file already in the Finder ("Browser" on MSWindows). In macOS, this is a super convenient function of the OS. Similar apps exist for Windows and Linux, in case someone feels like implementing this for this platforms as well.
Are you interested in this addition? If so, I would make it part of the CMake build, and I assume I make that into a GitHub Pull Request to the current HEAD? If included, it becomes transparent in the build process and installs itself as part of the package. Signiing may be needed when that is implemented.
- Matthias
I wrote a QuickLook plugin that shows the contents of an FCStd file already in the Finder ("Browser" on MSWindows). In macOS, this is a super convenient function of the OS. Similar apps exist for Windows and Linux, in case someone feels like implementing this for this platforms as well.
Are you interested in this addition? If so, I would make it part of the CMake build, and I assume I make that into a GitHub Pull Request to the current HEAD? If included, it becomes transparent in the build process and installs itself as part of the package. Signiing may be needed when that is implemented.
- Matthias
- Attachments
-
- Screenshot 2022-09-10 at 16.49.34.jpg (467.49 KiB) Viewed 1685 times
Re: New feature: Quicklook for macOS, make a pull request?
Yes indeed! Please make a PR and reference this forum thread!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- adrianinsaval
- Veteran
- Posts: 5541
- Joined: Thu Apr 05, 2018 5:15 pm
Re: New feature: Quicklook for macOS, make a pull request?
is it actually rendering the 3d object or just using the embedded thumbnail image?
- matthiaswm
- Posts: 35
- Joined: Wed Nov 18, 2020 11:41 am
- Location: Düsseldorf, Germany
Re: New feature: Quicklook for macOS, make a pull request?
Pull request is in: https://github.com/FreeCAD/FreeCAD/pull/7491 . Looking forward to get feedback.
I will elsewhere try to get some more information how to better build the macOS M1 app bundle. Testing via homebrew was quite time consuming.
It is extracting the embedded thumbnail. For the icon preview, the resolution is good enough, and extracting the png form the zip archive should be fast enough, even for directories with many project files.adrianinsaval wrote: ↑Sun Sep 11, 2022 10:04 pm is it actually rendering the 3d object or just using the embedded thumbnail image?
For the preview function, I feel that launching FreeCAD, even if it is only the command line version, to generate the view is almost as time consuming as just launching the app, so I decided to use a scaled up version of the embedded thumbnail. It's not beautiful, but it does the job of telling the user what's inside the file.
I would like to improve the thumbnail quality at some point though by using oversampling to get better scaling.
Matthias
Re: New feature: Quicklook for macOS, make a pull request?
Sweet Thank you!matthiaswm wrote: ↑Wed Sep 14, 2022 10:28 pm Pull request is in: https://github.com/FreeCAD/FreeCAD/pull/7491 . Looking forward to get feedback.
Indeed. lots of devs use ccache (https://wiki.freecadweb.org/Compiling_(Speeding_up).matthiaswm wrote: ↑Wed Sep 14, 2022 10:28 pm I will elsewhere try to get some more information how to better build the macOS M1 app bundle. Testing via homebrew was quite time consuming.
Do you mind opening a feature request ticket for this so we can keep track of it ?matthiaswm wrote: ↑Wed Sep 14, 2022 10:28 pm I would like to improve the thumbnail quality at some point though by using oversampling to get better scaling.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- matthiaswm
- Posts: 35
- Joined: Wed Nov 18, 2020 11:41 am
- Location: Düsseldorf, Germany
Re: New feature: Quicklook for macOS, make a pull request?
Done: https://github.com/FreeCAD/FreeCAD/issues/7501Kunda1 wrote: ↑Thu Sep 15, 2022 2:22 pmDo you mind opening a feature request ticket for this so we can keep track of it ?matthiaswm wrote: ↑Wed Sep 14, 2022 10:28 pm I would like to improve the thumbnail quality at some point though by using oversampling to get better scaling.
Edit: Formatting
Re: New feature: Quicklook for macOS, make a pull request?
This is something I cannot confirm, here on some older hardware. Launching FreeCAD takes at least 20 Seconds while using the CLI only (i.e. with launching `--console`) takes perhaps half a Second.matthiaswm wrote: ↑Wed Sep 14, 2022 10:28 pm For the preview function, I feel that launching FreeCAD, even if it is only the command line version, to generate the view is almost as time consuming as just launching the app, so I decided to use a scaled up version of the embedded thumbnail.
Have you seen Yorik's Offscreen Render Utils? While I could not get the png export to work (apparently there's a lib missing in the conda bundle, I get Coin error in SbBool SoOffscreenRenderer::writeToFile(const SbString &, const SbName &) const(): simage library not available.) I tried another route: export to obj, which my Finder can display directly (maybe because of an installed XCode, though).
This little snipped, saved as "offscreenrendertest.py", ...
Code: Select all
# found here: https://forum.freecadweb.org/viewtopic.php?t=37384
# https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Arch/OfflineRenderingUtils.py
import FreeCAD
import OfflineRenderingUtils
import importOBJ
doc = FreeCAD.open("...../some.FCStd")
importOBJ.export(doc.Objects, "...../some.obj")
exit()
Code: Select all
time /Applications/FreeCAD.app/Contents/MacOS/FreeCAD --console offscreenrendertest.py
I did not found the time to try your patch yet, but I find it a very welcome contribution, thanks a lot!
- adrianinsaval
- Veteran
- Posts: 5541
- Joined: Thu Apr 05, 2018 5:15 pm
Re: New feature: Quicklook for macOS, make a pull request?
I think 0.539 can be a lot if there are many files in a folder, if producing just an image is more performant then that could be usable.
Re: New feature: Quicklook for macOS, make a pull request?
Absolutely right. For the preview image in the file browser, I also think that using the embedded thumbnail is the way to go.adrianinsaval wrote: ↑Thu Sep 15, 2022 9:34 pm I think 0.539 can be a lot if there are many files in a folder, if producing just an image is more performant then that could be usable.
My suggestion, using FreeCAD's CLI to convert an FCStd into something (3D) macOS can display natively, aims at this "quick look" feature. This is where you can see the big, upscaled, image in the OP's screenshot. This feature is not trigged automatically for all files in a folder, but rather explicitly by the user for a single file. And for that, half a Second is just fine. Especially when you get not only an image, but a fully rotatable 3D view.
- adrianinsaval
- Veteran
- Posts: 5541
- Joined: Thu Apr 05, 2018 5:15 pm
Re: New feature: Quicklook for macOS, make a pull request?
I see, then it makes a lot of sense