Skip to main content

Source Contracts

All Sources participate in the same graph contract.

SaveFlowSource

Base exported properties:

PropertyTypePurpose
enabledboolDisables the Source completely when false.
save_enabledboolAllows the Source to gather data.
load_enabledboolAllows the Source to apply data.
phaseintOrders Sources inside graph operations.

Common methods:

get_save_key() -> String
get_source_key() -> String
get_phase() -> int
get_saveflow_authoring_warnings() -> PackedStringArray
gather_save_data() -> Variant
apply_save_data(data: Variant, context: Dictionary = {}) -> SaveResult

Most users should not subclass SaveFlowSource directly. Use one of the focused Sources below.

SaveFlowDataSource

Use custom SaveFlowDataSource when project-specific gather/apply logic is actually needed.

Exported properties:

PropertyTypePurpose
data_versionintLocal data version for this Source payload.

Override these in your script:

func gather_data() -> Dictionary:
return {}

func apply_data(data: Dictionary) -> void:
pass

SaveFlowDataSource wraps these methods in the normal Source contract.

SaveFlowTypedDataSource

Use when a Resource, node, or node property provides a payload contract.

Exported properties:

PropertyTypePurpose
dataResourceDirect typed data object.
targetNodeNode that provides or owns the typed data.
data_propertyStringProperty name on target that contains the typed data object.

Accepted payload methods:

to_saveflow_payload() -> Dictionary
apply_saveflow_payload(payload: Dictionary) -> void
get_saveflow_property_names() -> PackedStringArray
get_saveflow_payload_info() -> Dictionary

PascalCase equivalents are accepted for C# objects:

ToSaveFlowPayload()
ApplySaveFlowPayload(...)
GetSaveFlowPropertyNames()
GetSaveFlowPayloadInfo()

SaveFlowTypedData

SaveFlowTypedData is the low-boilerplate GDScript Resource base.

Override when needed:

func on_saveflow_post_apply(payload: Dictionary) -> void:
pass

It automatically gathers exported script variables that use storage.

SaveFlowNodeSource

Use when one Godot object owns the saved data.

Key exported properties:

PropertyTypePurpose
save_keyStringOptional stable key override.
targetNodeOptional target override.
property_selection_modeintExported fields, additional properties, or both.
additional_propertiesPackedStringArrayNon-exported properties that should be saved.
ignored_propertiesPackedStringArrayExported properties that should not be saved.
include_target_built_insboolEnables built-in Godot node state capture.
included_target_builtin_idsPackedStringArrayExplicit built-in serializer IDs.
target_builtin_field_overridesDictionaryField whitelist per built-in serializer.
included_pathsPackedStringArrayChild participants included in this object payload.
excluded_pathsPackedStringArrayChild participants excluded from this object payload.
participant_discovery_modeintDirect children only or recursive.

Useful helper methods:

clear_target_builtin_field_overrides() -> void
set_target_builtin_field_selection(serializer_id: String, field_ids: PackedStringArray) -> void

SaveFlowEntityCollectionSource

Use when one runtime container owns a changing set of entities.

Key exported properties:

PropertyTypePurpose
target_containerNodeRuntime entity container override.
failure_policyintReport only or fail on invalid entities.
restore_policyintApply existing, create missing, or clear and restore.
include_direct_children_onlyboolControls entity discovery depth.
entity_factorySaveFlowEntityFactoryFactory that restores descriptors.
auto_register_factoryboolRegisters factory automatically in runtime scenes.

Policies:

RestorePolicy.APPLY_EXISTING
RestorePolicy.CREATE_MISSING
RestorePolicy.CLEAR_AND_RESTORE

FailurePolicy.REPORT_ONLY
FailurePolicy.FAIL_ON_MISSING_OR_INVALID

Restore report access:

get_last_restore_report() -> Dictionary

The returned dictionary is a defensive copy of the latest gather or restore report. After restore, it uses the same structure as SaveFlow.restore_entities(), including entity_restore_issues, first_issue, and restore count fields.

SaveFlowPrefabEntityFactory

Use when one prefab maps cleanly to one entity type.

Exported properties:

PropertyTypePurpose
target_containerNodeContainer to add restored entities to.
auto_create_containerboolCreate target container if missing.
container_nameStringName used when auto-creating a container.
type_keyStringEntity type this factory handles.
entity_scenePackedScenePrefab to instantiate.

Common methods:

get_supported_entity_types() -> PackedStringArray
get_target_container() -> Node
apply_saved_data(node: Node, payload: Variant, context: Dictionary = {}) -> void