|
SGO Mistika: Python Extension
|
Copyright © 2019+ SGO (Soluciones Gráficas por Ordenador SL)
All Rights Reserved.
In Workflows, node properties are always created in code (typically in the node's init() function via addProperty(), addEncryptedProperty(), etc.).
The purpose of the node defaults XML file is to define the default values used by the Node Preferences / Node Defaults system. These values are typically applied when a new instance of the node is created, allowing users to customize defaults globally without modifying the Python node implementation.
Node defaults are stored as one XML file per node.
Typical locations:
Naming rules:
If the node defaults XML file is missing, Workflows falls back to the defaults defined in code, and the node may not appear in Node Preferences as configurable defaults.
A node defaults XML file typically uses this structure:
Notes:
Each element name inside the node section maps to a property id created by the node code. For example, if the node code creates:
then the defaults file may contain:
Some nodes group properties using nested XML elements (often mirroring the nested categories used in the node XSD schema). For example:
In this case, Config is a grouping element and apiKey is the actual property id. Grouping elements are used for organization and do not change the property id; the property id is still the leaf element name (apiKey).
Important:
The value is stored as the text content of the element.
Empty values are typically represented as either:
or:
Both mean an empty string.
Booleans are typically stored as true or false:
Integer/float properties are stored using their textual numeric representation:
Many list-like properties are stored as a single string (for example, comma-separated values):
The exact separator and parsing rules depend on the node implementation.
Path-like properties are typically stored as plain strings:
If a property represents a Universal Path, it is still commonly stored as a string. The node code determines how the string is interpreted (local path, URL, protocol path, etc.).
Properties created with addEncryptedProperty() are stored encrypted and are not shown in clear text in the UI (they are typically displayed as a masked/password field).
In the defaults XML, the value is stored as an encrypted string:
Recommendations:
Properties may contain multiline text. The XML stores the literal newline characters.
If the text contains reserved XML characters such as < or >, they must be escaped as XML entities (<, >, &).
Example (a text field that includes embedded template code):
Note:
A typical precedence model is:
1) The node code defines an initial/default value when creating the property. 2) If a node defaults XML entry exists for that property, Workflows uses it as the default for new node instances and for Node Preferences display.
If you remove a property from the node code, it may remain present in the defaults XML. Such stale entries are harmless but may confuse users; clean them up when you deprecate properties.
If a node does not appear in Node Preferences, or defaults do not apply: