diff --git a/src/main/java/net/rptools/maptool/client/ui/AbstractTokenPopupMenu.java b/src/main/java/net/rptools/maptool/client/ui/AbstractTokenPopupMenu.java index 6cb4f9f415..d7ed970207 100644 --- a/src/main/java/net/rptools/maptool/client/ui/AbstractTokenPopupMenu.java +++ b/src/main/java/net/rptools/maptool/client/ui/AbstractTokenPopupMenu.java @@ -120,24 +120,33 @@ public void actionPerformed(ActionEvent e) { protected JMenu createLightSourceMenu() { JMenu menu = new JMenu(I18N.getText("panel.MapExplorer.View.LIGHT_SOURCES")); - if (tokenUnderMouse.hasLightSources()) { + boolean hasAnyLights = false; + boolean hasLights = false; + boolean hasAuras = false; + boolean hasGmAuras = false; + boolean hasOwnerOnlyAuras = false; + + for (GUID tokenGUID : selectedTokenSet) { + Token token = renderer.getZone().getToken(tokenGUID); + hasAnyLights |= token.hasLightSources(); + hasLights |= token.hasLightSourceType(LightSource.Type.NORMAL); + hasAuras |= token.hasLightSourceType(LightSource.Type.AURA); + hasGmAuras |= token.hasGMAuras(); + hasOwnerOnlyAuras |= token.hasOwnerOnlyAuras(); + } + if (hasAnyLights) { menu.add(new ClearLightAction()); - - ZoneRenderer renderer = MapTool.getFrame().getCurrentZoneRenderer(); - for (GUID tokenGUID : selectedTokenSet) { - Token token = renderer.getZone().getToken(tokenGUID); - if (token.hasLightSourceType(LightSource.Type.NORMAL)) { - menu.add(new ClearLightsOnlyAction()); - } - if (token.hasLightSourceType(LightSource.Type.AURA)) { - menu.add(new ClearAurasOnlyAction()); - } - if (token.hasGMAuras()) { - menu.add(new ClearGMAurasOnlyAction()); - } - if (token.hasOwnerOnlyAuras()) { - menu.add(new ClearOwnerAurasOnlyAction()); - } + if (hasLights) { + menu.add(new ClearLightsOnlyAction()); + } + if (hasAuras) { + menu.add(new ClearAurasOnlyAction()); + } + if (hasGmAuras) { + menu.add(new ClearGMAurasOnlyAction()); + } + if (hasOwnerOnlyAuras) { + menu.add(new ClearOwnerAurasOnlyAction()); } menu.addSeparator(); }