ModuleDefinitionTransformer

ModuleDefinitionTransformer targets one field on another stock module-data object and stores that override for generated part data.

Purpose

Use this transformer when a variant needs to patch a field on an existing module definition and there is no more specific V-SwiFT transformer for that job. It is the most flexible transformer in the set, but also the one that asks the most from the author.

Type

Source-backed runtime type: VSwift.Modules.Transformers.ModuleDefinitionTransformer

Fields

  • BehaviourType: string

  • DataType: string

  • Key: string

  • Value: JToken

Behavior

  • ApplyCommon: no effect

  • ApplyInOab: attempts to resolve the target behaviour and module-data types, shut down the target module, set one reflected field on the module-data object, rebuild the data context, and reinitialize the module

  • ApplyInFlight: no effect

State handling

  • Reverter: yes, via ModuleDefinitionReverter.GetInstanceFor(...)

  • Saves information: yes, through ModuleDefinitionLoader

  • Visualizes information: no

Example

This fragment shows the real transformer fields. Replace the placeholder type names and field key with the stock module you actually intend to patch.

Transformers: [
  {
    Name: "ModuleDefinitionTransformer",
    BehaviourType: "Module_Light",
    DataType: "Data_Light",
    Key: "...",
    Value: true
  }
]

Caveats

  • BehaviourType and DataType must resolve through the runtime module registries used by V-SwiFT.

  • This is an advanced transformer. You need to know the exact module-data field name and provide a value that deserializes correctly into that field type.

  • The current ApplyInOab implementation appears to contain a logic issue: it returns early when TryGetValue succeeds, which means successful type resolution may prevent the reflected field write from running. Treat that as a current implementation caveat, not as intended authoring behavior.

Related