update some comments

This commit is contained in:
Ian Chua
2026-07-14 13:31:28 +08:00
parent fbed6f7dc6
commit 8cc4eaea1e
6 changed files with 10 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -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<PluginCapabilityIdentifier>& caps);
// One capability's stored config, plus its custom HTML UI when it provides one.

View File

@@ -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;

View File

@@ -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

View File

@@ -51,7 +51,6 @@ template<class Base> 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(

View File

@@ -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() {}