Minimal part-switch example

This example shows the smallest useful V-SwiFT part-switch block.

Example

@use "VSwift:*";

:parts #container_2v_inline_liquids {
    @include part-switch() {
        +Length {
            VariantSetLocalizationKey: "MyMod/Length";

            +Short {
                VariantLocalizationKey: "MyMod/Length/Short";
                +DefaultMassVisualizer {}
                +MassModifier {
                    Modifier: -0.10;
                }
            }

            +Long {
                VariantLocalizationKey: "MyMod/Length/Long";
                +DefaultMassVisualizer {}
                +MassModifier {
                    Modifier: 0.20;
                }
            }
        }
    }
}

What it demonstrates

  • loading the V-SwiFT mixin library

  • creating Module_PartSwitch and Data_PartSwitch

  • defining one VariantSet

  • defining two variants

  • attaching transformers by symbolic transformer name

Why this is a good starting point

The example uses only transformer names and fields that exist in the local runtime code, while staying small enough to copy into a real part patch.