Conversation
Opening a model from Snapmaker Space downloads and loads it correctly, and then post_init() throws it away. The model appears on the plate for a moment, the plate clears and the title becomes "Untitled". macOS does not pass the URL in argv. LaunchServices starts the app first and delivers the URL afterwards through MacOpenURL, so init_params->input_files is empty and switch_to_3d is never set. post_init() therefore takes its ordinary startup path, sends the user to the home page and calls trigger_restore_project, which starts a blank project over the model MacOpenURL is loading. Windows is unaffected because the URL does arrive in argv, switch_to_3d is true, and that whole block is skipped. Set a flag in MacOpenURL and check it where switch_to_3d cannot reach, which gives the URL path on macOS the same treatment it already gets elsewhere. Fixes OrcaSlicer#851
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #851.
Opening a model from Snapmaker Space on macOS downloads and loads it correctly, and then the app discards it. The model is visible on the plate for a moment, the plate clears, and the title changes to "Untitled".
Cause
macOS does not pass the URL in
argv. LaunchServices launches the app first and delivers the URL afterwards throughGUI_App::MacOpenURL, soinit_params->input_filesis empty by the timepost_init()inspects it andswitch_to_3dis never set.post_init()therefore continues into its ordinary startup path, which selects the home page and callsplater_->trigger_restore_project(1). That finds no backup to restore and starts a blank project, over the modelMacOpenURLhas just finished loading.Windows is unaffected: the URL arrives in
argv,switch_to_3dbecomestrue, and the whole block is skipped.The change
MacOpenURLsetsm_url_open_pending, andpost_init()checks it at the pointswitch_to_3dcannot reach. That gives the macOS URL path the same treatment the argv path already gets.MacOpenURLis macOS-only, so Windows and Linux are unchanged by construction. Theinfolog line makes it possible to confirm the path from a user's log without reproducing anything.Verification
Built and tested on macOS 26.6.2, Apple Silicon.
url open pendingline present and noReset Projectsnapshot afterload project done.trigger_restore_projectas before.Not yet exercised on my side, and worth a look in review: restoring an unsaved project after a crash, and double-clicking a
.3mfin Finder. Neither goes throughMacOpenURL, so neither should see the flag set, but I would rather say so than imply I tested them.The two public models used are linked in #851 for anyone wanting to reproduce. Note that it only reproduces on a cold launch: if Snapmaker Orca is already running and has finished starting up, it works fine, which is why this has been hard to recur.
Note on crash recovery
trigger_restore_projectis also what offers to restore an unsaved project after a crash. That prompt is skipped only when a URL open is in flight, which seems right: the user asked for a specific model. It is unaffected on every other launch path. Happy to gate it differently if you would prefer the prompt still appear.