How to toggle multi-state layer

I have a helicopter that has 4 counters: flying, hovering, flying (reduced), hovering (reduced).
Is there an elegant way to have 2 toggles as right-click actions that can switch appropriately? I.e. right-clicking and choosing “Reduce” would flip the counter to the reduced side based on current condition (flying v. hovering) and another option that switches between flying and hovering, but is smart enough to know that it is reduced and will use those counters instead?

I would consider the Layer follows expression feature and setting the counter state using one or more Dynamic Properties.

1 Like

Here’s a minimal module demonstrating the above. A 4-state counter with only two context menu actions ever available.

That’s some sweet code, Joel. Worked like a charm!

1 Like