From 8cc4eaea1ef76b2025cf877a1b5a7e38e4252885 Mon Sep 17 00:00:00 2001 From: Ian Chua Date: Tue, 14 Jul 2026 13:31:28 +0800 Subject: [PATCH] update some comments --- src/slic3r/plugin/PluginConfig.cpp | 3 +-- src/slic3r/plugin/PluginConfig.hpp | 4 ++-- src/slic3r/plugin/PresetPluginConfig.cpp | 13 ++++--------- src/slic3r/plugin/PresetPluginConfig.hpp | 2 +- src/slic3r/plugin/PyPluginTrampoline.hpp | 4 +--- src/slic3r/plugin/PythonPluginInterface.hpp | 3 +-- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/slic3r/plugin/PluginConfig.cpp b/src/slic3r/plugin/PluginConfig.cpp index 3f262591da..7d2642ee36 100644 --- a/src/slic3r/plugin/PluginConfig.cpp +++ b/src/slic3r/plugin/PluginConfig.cpp @@ -197,8 +197,7 @@ bool PluginConfig::dirty() const nlohmann::json capability_get_config(const PluginCapabilityInterface& capability) { // Shares its resolution with the dialogs, so a capability reads back exactly the config its UI - // showed as effective. Stored in neither layer: an empty object, so a plugin can index it - // unconditionally. + // showed as effective. Stored in neither layer: an empty object, indexable unconditionally. return active_capability_config(capability_full_identity(capability, "get_config")).config; } diff --git a/src/slic3r/plugin/PluginConfig.hpp b/src/slic3r/plugin/PluginConfig.hpp index a672ec2f6e..39b16fe51b 100644 --- a/src/slic3r/plugin/PluginConfig.hpp +++ b/src/slic3r/plugin/PluginConfig.hpp @@ -89,8 +89,8 @@ public: // through PluginManager's store, not through any one PluginConfig instance. The caller owns the // UI: it confirms destructive restores and shows status toasts. - // The config sidebar's rows, in the order given. Capabilities that are no longer loaded are - // skipped — the sidebar only offers what can actually be configured. + // The config sidebar's rows, in the order given. Capabilities no longer loaded are skipped — the + // sidebar only offers what can actually be configured. static nlohmann::json capabilities_payload(const std::vector& caps); // One capability's stored config, plus its custom HTML UI when it provides one. diff --git a/src/slic3r/plugin/PresetPluginConfig.cpp b/src/slic3r/plugin/PresetPluginConfig.cpp index efe744b471..94683cb192 100644 --- a/src/slic3r/plugin/PresetPluginConfig.cpp +++ b/src/slic3r/plugin/PresetPluginConfig.cpp @@ -46,15 +46,10 @@ const Preset* active_preset_for(Preset::Type type) case Preset::TYPE_PRINT: return &bundle->prints.get_edited_preset(); case Preset::TYPE_PRINTER: return &bundle->printers.get_edited_preset(); - // Deliberately unimplemented, not forgotten. There is no single active filament preset — one is - // selected per extruder, and get_config() does not say which extruder the capability runs for — - // so guessing (extruder 0, or first override wins) would hand a plugin another extruder's - // settings. Filament capabilities read the base config instead. Nothing reaches this today: - // preset_type_for_capability only names TYPE_FILAMENT once a filament option declares a - // plugin_type, and none does. To lift it, push the extruder onto the plugin call context the - // trampoline already maintains (ScopedPluginAuditContext) and resolve the preset from that. The - // extruder must be optional: whole slicing steps (posSlice, psGCodePostProcess) span every - // extruder and have no current filament, and this fallback is the honest answer for them. + + // Deliberately unimplemented. We currently don't support any filament-based + // plugin capabilities. We will defer this to when we have filament-based plugins + // capabilities to have a clearer understanding on how to implement this. case Preset::TYPE_FILAMENT: return nullptr; default: return nullptr; diff --git a/src/slic3r/plugin/PresetPluginConfig.hpp b/src/slic3r/plugin/PresetPluginConfig.hpp index c241035995..b37e64de28 100644 --- a/src/slic3r/plugin/PresetPluginConfig.hpp +++ b/src/slic3r/plugin/PresetPluginConfig.hpp @@ -50,7 +50,7 @@ std::string plugin_config_source_to_string(PluginConfigSource source); // Resolves a capability's effective config as `preset override -> base config -> none`, and mutates // the override layer. It works on a CapabilityConfigDocument the caller owns, never on a Preset and -// never on the base config file, which is what keeps the two layers from writing to each other: +// never on the base config file, which keeps the two layers from writing to each other: // PluginConfigField holds the document and feeds the edited text back through the normal field/dirty // pipeline, so the preset is written the way every other setting is. class PresetPluginConfigService diff --git a/src/slic3r/plugin/PyPluginTrampoline.hpp b/src/slic3r/plugin/PyPluginTrampoline.hpp index 468e519ff1..c91e44dd22 100644 --- a/src/slic3r/plugin/PyPluginTrampoline.hpp +++ b/src/slic3r/plugin/PyPluginTrampoline.hpp @@ -51,7 +51,6 @@ template class PyPluginCommonTrampoline : public Base public: using Base::Base; - // get_name is required on all capabilities — Python subclass must implement it. std::string get_name() const override { ORCA_PY_OVERRIDE_AUDITED( @@ -64,8 +63,7 @@ public: } // Config UI hooks. Available on every capability type, so they live here rather than in - // PyPluginInterfaceTrampoline. A Python exception is rethrown and the caller decides the - // fallback. + // PyPluginInterfaceTrampoline. A Python exception is rethrown; the caller decides the fallback. bool has_config_ui() const override { ORCA_PY_OVERRIDE_AUDITED( diff --git a/src/slic3r/plugin/PythonPluginInterface.hpp b/src/slic3r/plugin/PythonPluginInterface.hpp index 373dedbd90..0286b3f934 100644 --- a/src/slic3r/plugin/PythonPluginInterface.hpp +++ b/src/slic3r/plugin/PythonPluginInterface.hpp @@ -116,8 +116,7 @@ public: // The config the "Restore defaults" action writes back. Not overridden -> an empty object, which // is right for a capability that keeps its stored config sparse and applies its own defaults on // read. Override it to write an explicit starting config instead (e.g. to seed a form UI with - // every field present). The host neither invents nor validates this value, so a throwing override - // leaves the stored config untouched. + // every field present). The host neither invents nor validates this value. virtual nlohmann::json get_default_config() const { return nlohmann::json::object(); } virtual void on_load() {}