mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-04 02:38:05 -05:00
* fix(plugins): show missing-plugin notices on preset switch; printer plugin manifest Missing-plugin notices were rebuilt only when a plate was validated, so switching to a preset that needs an absent plugin showed nothing on an empty plate, and new_project() removed the notices for good (their shown-signature stayed set). They are now refreshed on every preset change, when a plugin loads, unloads, is disabled, deleted or unsubscribed, and after a new project, and pushed again whenever they are no longer on screen. Printer presets get their own manifest key, printer_plugins: the full print config applies the printer preset after the process preset, so a shared "plugins" key would replace the process manifest, and printer presets dropped "plugins" on load. Plugins referenced by the printer preset (e.g. a Python printer agent) are reported but never block slicing, since they do not change the sliced result. Saving a preset on a machine that lacks one of its plugins keeps that plugin's manifest entry, so other machines are still offered it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(plugins): resource printer asset plugins for portable bed models and textures A printer preset's bed_custom_model / bed_custom_texture hold the author's absolute local paths, so the custom bed is lost on every other machine and for every bundle subscriber (#15217). A resource printer asset plugin is a pack of bed models (.stl) and textures (.png/.svg) installed like a resource texture pack; the preset then stores a portable reference, orcacloud-asset/<plugin id>/<file>, that each machine resolves to its own installed copy. - New capability type ResourcePrinterAsset ("resource-printer-asset", orca.resource_printer_asset) with get_asset_dir(), validated at load like ResourceTexture: inside the plugin folder, regular files only, .stl/.png/.svg, at most 16, sorted so every file system keeps the same. - PluginPrinterAssets tracks loaded packs and resolves references; Plater::set_bed_shape draws the vendor bed while a pack is missing. - Bed Shape dialog: "From asset pack..." next to each Load button. - The hidden plugin-backed option printer_asset_plugins names the packs the bed files come from, so the printer manifest lists them and the missing-plugin notices offer to install or activate a missing pack (non-blocking). A before-save hook re-derives it on every printer preset save, and transfers between presets carry the manifest along. - References are OS-neutral: no colon or backslash, and Windows device names are rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Remove the missing-plugin notice changes from this PR They moved to a separate PR (#16897) so this branch only carries the printer preset plugin manifest and the slicing block rule. Removed here: the notice refresh hooks in GUI_App and PluginsDialog, Plater::refresh_missing_plugin_notifications, the preset-switch and new-project refresh calls, and NotificationManager::has_notification_of_type. The has_blocking_plugins() changes in Plater.cpp stay. * Close the unresolved_plugin_capabilities test case The merge with main dropped the closing brace of the new test. * Use one manifest-key rule and cover printer plugins in tests ConfigBase::plugin_manifest_key() is now the only definition of which key holds a config's plugin manifest; PluginResolver used its own copy keyed by preset type. The resolver calls the config's method instead. Tests: a printer config keeps its printer_plugins entry for a capability not loaded here, and a missing printer-preset plugin is reported without blocking slicing. Comments that named the "plugins" option for every preset now say plugin manifest. * fix(plugins): build the missing-plugin search link without a running app A missing local plugin gets a "Find on OrcaCloud" link, whose base URL came from GUI::wxGetApp().getAgent(). With no app (unit tests, headless callers) that dereferenced null and crashed refresh_missing_plugins. Keep the default cloud URL when there is no app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: check the printer manifest key through ConfigBase::plugin_manifest_key PluginResolver no longer has its own preset-type helper; the config's method is the single rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Include wx/app.h for wxTheApp in PluginResolver clang-tidy's misc-include-cleaner wants the header that declares wxTheApp included directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Replace the Resource Printer Asset Plugin Type With a Generic Resource Pack A resource pack ships one folder of files, and each file declares the kinds it serves (bed_model, bed_texture, displacement_texture) in Python through get_resource_kinds(). Consumers list only the files of their kind, so one PNG can be both a bed texture and a displacement texture. PluginResourcePacks replaces PluginPrinterAssets and also serves the existing resource-texture type as displacement_texture files, which retires PluginResourceTextures. The resource-texture capability, its Python API, type id, 64-file cap and extension list are unchanged. Printer asset references stay kind-less; resolve() takes the kind of the field being resolved, and only resource-pack entries resolve references. The texture picker groups pack sections by pack_key so a ResourceTexture and a ResourcePack with the same name stay separate. Not built or run locally. * Include the headers clang-tidy asks for in the resource pack code misc-include-cleaner wants PythonPluginInterface.hpp (PluginCapabilityType) in TextureLibrary.cpp, <string_view> in PluginResourcePacks.cpp, ResourcePackKinds.hpp (ResourceKindMap) in the resource pack trampoline, and <cstdint> in the resource pack test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the Resource Printer Asset Capability and Infer File Kinds From the Extension Orca Cloud builds resource pack wheels from uploaded files, stores no per-file metadata, and names its types resource-textures and resource-printer-assets. Authors write no Python, so a pack cannot declare the kinds of its files. Restore the resource-printer-asset capability (get_asset_dir) and keep resource-texture (get_texture_dir) as it is. PluginResourcePacks still serves both from one registry, indexed by kind: bed_model (.stl) and bed_texture (.png, .svg) for a printer asset pack, displacement_texture for a texture pack. Each kind is capped at 16 (64 for textures) after sorting. Only printer asset packs resolve printer asset references. Drop get_resource_kinds, the resource-pack capability and its type id. Rewrite docs/HLSD/resource-packs.md for the two types. Not built or run locally. * Keep the Texture and Printer Asset Plugin Types Separate Orca Cloud treats resource-textures and resource-printer-assets as independent types with no per-file kinds, so the slicer keeps them independent too. Each has its own capability, registry, loader branch and tests. Restore PluginPrinterAssets as a registry of its own with a plain file list and the extension helpers the Bed Shape dialog uses, and put the resource texture code (PluginResourceTextures, the texture picker, its callbacks and tests) back as it was on main. Remove the shared PluginResourcePacks registry, the kind index and pack_key. Replace docs/HLSD/resource-packs.md with docs/HLSD/resource-printer-assets.md. Not built or run locally. * Keep the Printer Plugin Keys Out of the G-code Config Dump printer_asset_plugins and printer_plugins are newly-registered printer keys with empty defaults, so append_full_config() would write "; printer_asset_plugins = " and "; printer_plugins = " into every printer's config block, machines that never install a pack included. Both are read from the preset and never parsed back out of the dump, so ban them like farthest_point_timelapse and the IMEX keys. Not built or run locally. * Move a Printer Preset's Legacy Plugins Manifest Into printer_plugins A printer preset written before printer_plugins existed stores its plugin references under the process preset's key, plugins. That key is not a printer option, so remove_invalid_keys() reported it as an incorrect key and dropped it on every start, taking with it the reference the missing-plugin notice needs for a plugin this machine lacks. Rename it before the validation, and merge rather than replace: a child preset's file holds only the references it added, while the parent's manifest already sits in the config it was built from. A config holding both keys is a printer preset's, so the migration needs no type argument. Cover the merge and the untouched process preset in test_config, and the file path in test_preset_bundle_loading. Document the migration in the HLSD. Not built or run locally. * Say Which Presets Block Slicing in the Plugin Gate Comments has_blocking_plugins() replaced has_missing_plugins() as the slicing gate: only a plugin referenced by the process or filament preset blocks, while a printer preset's plugins (printer agents, printer assets) only notify. Three comments still described the old, type-agnostic rule: the cached missing-plugin signature block in Plater::priv, refresh_missing_plugin_block's return value, and plugins_block_slicing. Not built or run locally. * Test That a Missing Process Preset Plugin Blocks Slicing Every existing assertion on has_blocking_plugins() is a negative one, so a body that returned false would keep the suite green while slicing stopped being blocked for a missing slicing-pipeline plugin -- the behavior this change kept. Load an unresolved reference from a process preset: the gate reports it missing and blocks, and clearing the missing-plugin sets unblocks. Not built or run locally. * Keep Inherited Plugin References in a Child Preset's Manifest Preset::save wrote a diff against the parent, and save_to_json derived the plugin manifest from that diff. A child that changed only printer_agent lost the parent's bed pack reference, and the shortened manifest replaced the parent's on reload. save_to_json now takes a manifest_source, and Preset::save passes the whole resolved config. A legacy "plugins" key in the file of a printer preset that inherits a parent was dropped by the parent merge. The user, project-embedded and cloud load paths and Preset::reload now move it into printer_plugins, merged with the parent's manifest. * Write the Printer Plugin Keys to the G-code Config Dump When Set The config block is read back by config_from_gcode, so a printer imported from a G-code that used a printer asset pack kept the bed reference but lost the pack names and the manifest. The two keys are now written when they are not empty, so a printer without packs keeps an unchanged block. * Copy the Printer Plugin Keys When Creating a Nozzle Preset The nozzle flow copied bed_custom_model and bed_custom_texture from the source printer without printer_asset_plugins and printer_plugins, so a reference to a pack that is not installed here was saved with an empty manifest. * Describe the Manifest Derivation and the Pack Constraints in the HLD * Redraw the Bed After a Printer Asset Pack Loads or Unloads A texture-only change goes through update_logo_texture_filename, which does not mark the canvas dirty, so the old texture stayed until the next paint. The pack callback now requests an extra frame, as Plater::on_config_change does. * Match a Printer Asset Pack by File and Keep Unusable Names Out of the Cap capability_name() returned the first capability of the plugin whatever file the reference named, so with two capabilities in one plugin the manifest could name the wrong one. It now matches the file against the pack's listing, as resolve() does, through one shared helper. update_printer_asset_plugins rebuilt the manifest through a resolver that finds a capability by name alone, so a loaded plugin with a capability of the same name replaced the entry of a pack that is not loaded here. The pack's own entry is put back. The 16-file cap counted files a reference cannot name (spaces, device names), which the Bed Shape dialog skips, so a pack could list nothing usable. The listing now drops those names before the cap. * Document the Printer Asset Capability's Python Bindings The capability's pybind11 class and its two methods had no docstrings, so script_list_api and script_describe_api listed them bare and "every public member of the orca package has documentation and named parameters" failed in slic3rutils_tests on every platform. Say what a pack holds and how a preset refers to its files, and what get_asset_dir must return: the checks its folder goes through once at load, and that a rejected folder or a raised exception costs the pack its files. Worded as resource_texture's bindings are. * Harden the Printer Asset Pack Code Against Locale, Preset Type and a Failing Sweep The reference charset used <cctype>, whose predicates follow LC_CTYPE. The app pins LC_NUMERIC only and GUI_App constructs a default wxLocale, so LC_CTYPE is the user's: on a single-byte Windows codepage a pack file named bed_é.stl passes validation, is stored as raw UTF-8, and then parses as a plain path on a machine with a UTF-8 or C locale, drawing the vendor bed with no diagnostic. The HLD promises A-Z a-z 0-9 . _ -. Check those ranges explicitly instead, in is_segment, is_windows_device_name and iends_with. The legacy migration ran for every preset type and asked only that both keys be present. A print or filament file carrying both had its "plugins" moved into "printer_plugins" and erased, and the validation loop then stripped "printer_plugins" as a non-print option: both manifests gone, where main kept "plugins". Only a printer config has "printer_plugins" in its defaults, so gate on that, and say so where the comment claimed a config holding both keys must be a printer preset's. initial_sweep() was called straight from GUI_App::on_init, outside the loader's and the manager's guards, and it lists files. A pack file whose name cannot be converted to the Windows ANSI code page throws filesystem_error out of OnInit and terminates the app. Catch per capability and log, so a fault costs the pack its files, as it does on the loader's path. on_cap_register() also reported a change unconditionally, so a disable and re-enable redrew the bed for an entry nothing had altered. Compare the rebuilt entry against the stored one: pack id, name, folder and file list. Cover the three with tests: non-ASCII and out-of-set characters refused, the 128-character boundary, an escaping and a dangling symlink skipped, and the change flag staying false across a rebuild and turning true when a file is added or removed. * clang tidy missing header --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Lam Wei Lun <weilun.lam@gmail.com>