mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-30 14:22:07 +00:00
update some comments
This commit is contained in:
@@ -197,8 +197,7 @@ bool PluginConfig::dirty() const
|
|||||||
nlohmann::json capability_get_config(const PluginCapabilityInterface& capability)
|
nlohmann::json capability_get_config(const PluginCapabilityInterface& capability)
|
||||||
{
|
{
|
||||||
// Shares its resolution with the dialogs, so a capability reads back exactly the config its UI
|
// 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
|
// showed as effective. Stored in neither layer: an empty object, indexable unconditionally.
|
||||||
// unconditionally.
|
|
||||||
return active_capability_config(capability_full_identity(capability, "get_config")).config;
|
return active_capability_config(capability_full_identity(capability, "get_config")).config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ public:
|
|||||||
// through PluginManager's store, not through any one PluginConfig instance. The caller owns the
|
// through PluginManager's store, not through any one PluginConfig instance. The caller owns the
|
||||||
// UI: it confirms destructive restores and shows status toasts.
|
// 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
|
// The config sidebar's rows, in the order given. Capabilities no longer loaded are skipped — the
|
||||||
// skipped — the sidebar only offers what can actually be configured.
|
// sidebar only offers what can actually be configured.
|
||||||
static nlohmann::json capabilities_payload(const std::vector<PluginCapabilityIdentifier>& caps);
|
static nlohmann::json capabilities_payload(const std::vector<PluginCapabilityIdentifier>& caps);
|
||||||
|
|
||||||
// One capability's stored config, plus its custom HTML UI when it provides one.
|
// One capability's stored config, plus its custom HTML UI when it provides one.
|
||||||
|
|||||||
@@ -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_PRINT: return &bundle->prints.get_edited_preset();
|
||||||
case Preset::TYPE_PRINTER: return &bundle->printers.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 —
|
// Deliberately unimplemented. We currently don't support any filament-based
|
||||||
// so guessing (extruder 0, or first override wins) would hand a plugin another extruder's
|
// plugin capabilities. We will defer this to when we have filament-based plugins
|
||||||
// settings. Filament capabilities read the base config instead. Nothing reaches this today:
|
// capabilities to have a clearer understanding on how to implement this.
|
||||||
// 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.
|
|
||||||
case Preset::TYPE_FILAMENT: return nullptr;
|
case Preset::TYPE_FILAMENT: return nullptr;
|
||||||
|
|
||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
|
|||||||
@@ -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
|
// 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
|
// 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
|
// 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.
|
// pipeline, so the preset is written the way every other setting is.
|
||||||
class PresetPluginConfigService
|
class PresetPluginConfigService
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ template<class Base> class PyPluginCommonTrampoline : public Base
|
|||||||
public:
|
public:
|
||||||
using Base::Base;
|
using Base::Base;
|
||||||
|
|
||||||
// get_name is required on all capabilities — Python subclass must implement it.
|
|
||||||
std::string get_name() const override
|
std::string get_name() const override
|
||||||
{
|
{
|
||||||
ORCA_PY_OVERRIDE_AUDITED(
|
ORCA_PY_OVERRIDE_AUDITED(
|
||||||
@@ -64,8 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Config UI hooks. Available on every capability type, so they live here rather than in
|
// 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
|
// PyPluginInterfaceTrampoline. A Python exception is rethrown; the caller decides the fallback.
|
||||||
// fallback.
|
|
||||||
bool has_config_ui() const override
|
bool has_config_ui() const override
|
||||||
{
|
{
|
||||||
ORCA_PY_OVERRIDE_AUDITED(
|
ORCA_PY_OVERRIDE_AUDITED(
|
||||||
|
|||||||
@@ -116,8 +116,7 @@ public:
|
|||||||
// The config the "Restore defaults" action writes back. Not overridden -> an empty object, which
|
// 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
|
// 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
|
// 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
|
// every field present). The host neither invents nor validates this value.
|
||||||
// leaves the stored config untouched.
|
|
||||||
virtual nlohmann::json get_default_config() const { return nlohmann::json::object(); }
|
virtual nlohmann::json get_default_config() const { return nlohmann::json::object(); }
|
||||||
|
|
||||||
virtual void on_load() {}
|
virtual void on_load() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user