Knob and Slider Duplication

From FlightGear wiki
Jump to navigation Jump to search

Since 2013, knob & slider animations are effectively duplicated if they already take part in certain animations resulting in exaggerated motion. This incorrect behaviour will be removed in a future version, which will reduce the motion of these objects.

Warnings have been added to next when this happens. Aircraft developers can work around the issue and silence the warnings by rearranging the XML so that the knob or slider animation node comes before the other animation node. You may need to multiply the animation factor or property-adjust ranges to match the current range of motion.

Example warning

[ALRT]:general    Deprecation Alert: The knob/slider animations listed below are getting duplicated.
[ALRT]:general        This will be fixed in a future version. Please apply workarounds to ensure compatibility.
[ALRT]:general        For details see: https://wiki.flightgear.org/Knob_and_Slider_Duplication
...
[ALRT]:general    Warning: 2x duplication of knob animation on object "AdjustKnob" is deprecated behaviour (see above)
[ALRT]:general        Animation node at: .../fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/AI/AI-fg1000.xml:142
[ALRT]:general        Duplicated due to: .../fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/AI/AI-fg1000.xml:38

If you see mention of unknown locations such as the log output below, please raise it on the mailing list so that the code can be added to report which node is to blame:

[ALRT]:general        Duplicated scene node '<name>' at unknown location
[ALRT]:general            parent 0 named '<parent0>'
[ALRT]:general            parent 1 named '<parent1>'

Conditions under which this happens

Animation nodes of type "knob" and "slider" are affected (in the example above, the "Animation node" starting at AI-fg1000.xml line 142), for any objects which as a result of another animation (in the example above, the "Duplicated due to" node starting at AI-fg1000.xml line 38) causes the object to appear multiple times in the scene graph. Animations which can cause this duplication in the scene graph include:

  • "material" animations
  • "pick", "knob" and "slider" animations
  • "range" animations

Note that some knob and slider animations are used purely for pick bindings, relying on rotate or translate animations for the actual motion. These are unaffected, and won't trigger warnings. In these cases the knob / slider animation either won't have an axis set, or won't have a property set, in which case they already have no effect and the duplication is already fixed without compatibility issues.

The incorrect behaviour

In versions prior to 2013, the animation will have been applied once. In versions since 2013, the animation will be applied multiple times (2 times in the example above), so the effect of the animation will be multiplied. When the issue is fixed in some future version, the animation will again only be applied once.

Therefore any affected animations created between 2013 and 2023 will have compatibility issues.

The workaround

The XML can be rearranged such that the knob / slider animation (in the example above, the "Animation node" starting at AI-fg1000.xml line 142) is before any causing nodes (in the example above, the "Duplicated due to" node starting at AI-fg1000.xml line 38).

This causes the knob / slider animation to be applied first, avoiding the issue and resulting in consistent behaviour both now and in future versions.

If the animation has been configured by trial and error since 2013, you will need to multiply the animation factor or property-adjust ranges to match the current range of motion (in the example above, by 2x).