macOS/File Browser: Support external operations #107267
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#107267
Loading…
Reference in New Issue
No description provided.
Delete Branch "ankitm/blender:ankitm/finderreveal"
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?
Building upon blender/blender#104531,
This PR adds support for the following external operations:
of file.
Some UI text and variable rename cleanup has also been done after
review comments in #104531 .
open is not done using service since it shows a popup "blender wants to use the
restricted service "open" confirm/cancel" on every use. So not friendly
enough. sharedWorkspace is used instead
Though I'm not super keen on the location.. delete and rename also show up in context menu in Finder.
I'd only want to add reveal in finder and that too
@ -1790,0 +1780,4 @@
ICON_NONE,
#ifdef __APPLE__
"Reveal in Finder",
"Reveal location in Finder"
How about
"Display this file in a new Finder window"
?The existing descriptions here aren't great either, noted that in #104531.
@ -1790,0 +1791,4 @@
ICON_NONE,
#ifdef __APPLE__
"Reveal in Finder",
"Reveal location in Finder"
"Display this directory in a new Finder window"
? (Is it the selected directory or the current directory?)@ -1793,0 +1816,4 @@
ICON_NONE,
#ifdef __APPLE__
"Get Info",
"Open the Get Info window for this item"
Use "file" instead of "item".
Test comment
This is awesome.
There seems to be one omission here though. As far as I knew the existing code on Mac for "Open" used "WM_OT_path_open", which is python
subprocess.check_call(["open", filepath])
. If given a document filepath it should open up the associated program with that file loaded. That is definitely how it works on Windows and on Linux (demonstrated by Pablo in Blender Today). But looking at your changes here it looks like "open" and "folder open" are doing the same thing, just opening up a Finder window that contains the file with both described the same as "Reveal location in Finder".Of course I could be wrong about the behavior of
subprocess.check_call(["open", filepath])
as I don't have a mac but fairly certain we were using that to open up your web browser from an html file. Does it show the warning you posted for other uses of "WM_OT_path_open"? For example right-clicking on an input that contains a filepath and there should be "open" that has a description of "Open File Externally"One thing I'd recommend is trying to unify these as much as possible between platforms. So if an operation is similar we should try to name and describe them similarly. Even though I do prefer to use language expected on each platform.
For example we might consider changing
FILE_EXTERNAL_OPERATION_FOLDER_CMD
("CMD") toFILE_EXTERNAL_OPERATION_FOLDER_TERMINAL
("TERMINAL") as that fits both well and a bit more generic. SimilarlyFILE_EXTERNAL_OPERATION_PROPERTIES
("PROPERTIES") might be better asFILE_EXTERNAL_OPERATION_INFO
("INFO"). A more generic descriptor forFILE_EXTERNAL_OPERATION_RUNAS
("RUNAS") might beFILE_EXTERNAL_OPERATION_SUDO
("SUDO")?Then perhaps standardize on such words as "folder" (instead of directory) and keep as much as possible the same, but still varying by platform when needed.
To open the file using WM_OT_path_open, Context would need to be passed to storage_apple.mm. The confirmation popup doesn't show up.
To open the file using service, it's cleaner in code but the popup shows up.
I'll check again
Agree with the renames of enums and descriptions, will change that. FILE_EXTERNAL_OPERATION_RUNAS is not a thing on mac at all.. so will not do that.
macOS/File Browser: Support external operationsto WIP: macOS/File Browser: Support external operationsMostly fine, although I can’t say much about the Obj-C code. Just some polishing for user messages needed.
@ -118,2 +118,4 @@
* \{ */
/**
* All operations may not be supported on all platforms.
“Not all operations may be supported on all platforms.”
@ -1790,0 +1779,4 @@
"OPEN",
ICON_NONE,
"Open",
"Open the file in its default application"},
“Open this file…” (like the other descriptions).
@ -1790,0 +1788,4 @@
"Reveal this file in a new Finder window"
#else
"Reveal in File Explorer",
"Open this file in system file browser"
“in a system file browser“
@ -1790,0 +1791,4 @@
"Open this file in system file browser"
#endif
},
{FILE_EXTERNAL_OPERATION_EDIT, "EDIT", ICON_NONE, "Edit", "Edit the file"},
“…this file…”
I'm not understanding the change of
FILE_EXTERNAL_OPERATION_FOLDER_OPEN
toFILE_EXTERNAL_OPERATION_FILE_REVEAL
Some of these operations are on documents and some are on folder paths. If the subject is a folder though then there is no file to be "revealed", and we are simply "opening" the "folder".
I can understand perhaps wanting to add a new operation though, where the subject is a file and the operation opens its containing folder and then ensures that the file is in view and/or highlighted in some way. But I don't see having an
FILE_EXTERNAL_OPERATION_FILE_REVEAL
operation on a directory path, with enum value "FOLDER_OPEN" that doesn't match and a description that includes "Open this file" (neither verb nor subject matching).On windows, the file path is also passed down instead of just root. So it can be used to match OS behaviour
My bad missed it
Still not following. I am in File Browser and I right-click on a folder. There is no "file" to "reveal", just a "folder" to "open".
WIP: macOS/File Browser: Support external operationsto macOS/File Browser: Support external operationsI am very pleased to see the list of operations expanded more than I expected, but I didn't test for that. So I am hoping you can add a case for
FILE_EXTERNAL_OPERATION_FILE_REVEAL
at the very end of the switch inwindows_operation_string
and just have it return "".And then just add a check for empty operation in
BLI_windows_external_operation_supported
, by just starting that function with:That should be enough for this to work correctly on Windows.
In the file_external_operation enum for
FILE_EXTERNAL_OPERATION_FOLDER_OPEN
for not Apple the name should be "Open in File Explorer" as we don't use "reveal" anywhere for that type of operation.In
file_os_operations_menu_item
you have replacedFILE_EXTERNAL_OPERATION_FOLDER_OPEN
withFILE_EXTERNAL_OPERATION_FILE_REVEAL
but we need the former on Windows. Otherwise we don't get the option to open the containing folder for a document.I have some concern about uses of "File Explorer" for non-Apple cases. I love that you use "Finder" for Apple, but at least FILE_EXTERNAL_OPERATION_FOLDER_OPEN should work for Linux and that might be confusing. We could add an else for Windows for the specific phrase or use something more generic.
Checkout
From your project repository, check out a new branch and test the changes.