Hiding specific pieces only?

I like the built-in “Hide Pieces” button in Vassal, but my particular module could benefit from a variant of it. Is there a way to create a command that hides only pieces that match a specific property?

I have multiple “altitude” levels in my game, and units are stacked from highest to lowest. An altitude-specific Hide would be useful for players to get aircraft out of the way to see any ground units under them, for example. I also use pieces for bridges and other structures, and it would be nice to keep those unhidden. Is it possible?

You can achieve this effect by using Game Piece Layers. In your main map add a game piece layer. You can call the property STACK and add layers GROUND and AIR. Then add a MARKER trait to each of your units pieces. For the ground units, add a MARKER called STACK that equals GROUND and of course for the air units it will equal AIR. Then, add a GAME PIECE LAYER CONTROL. Set it to SWITCH LAYER BETWEEN ACTIVE AND INACTIVE and set it to the AIR layer.

Good Luck!