From 9dc3613420ee3f500386303c96df495a11a83828 Mon Sep 17 00:00:00 2001 From: Alex Levenson Date: Fri, 5 Dec 2025 23:52:44 -0800 Subject: [PATCH] Fix: Apply type defaults to nodes without class attribute The Types section in stylesheets was only being checked inside the class iteration loop, meaning nodes without any class attribute would never receive type defaults. This adds the type lookup as a fallback after the class loop. --- .../foleys_gui_magic/Layout/foleys_Stylesheet.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/foleys_gui_magic/Layout/foleys_Stylesheet.cpp b/modules/foleys_gui_magic/Layout/foleys_Stylesheet.cpp index aacd6ae0..1287e659 100644 --- a/modules/foleys_gui_magic/Layout/foleys_Stylesheet.cpp +++ b/modules/foleys_gui_magic/Layout/foleys_Stylesheet.cpp @@ -222,6 +222,19 @@ juce::var Stylesheet::getStyleProperty (const juce::Identifier& name, const juce } } + // Check type defaults even if no class is assigned + if (inherit) + { + auto typeNode = currentStyle.getChildWithName (IDs::types).getChildWithName (node.getType()); + if (typeNode.isValid() && typeNode.hasProperty (name)) + { + if (definedHere) + *definedHere = typeNode; + + return typeNode.getProperty (name); + } + } + auto parent = node.getParent(); if (parent.isValid() && parent.getType() != IDs::magic) return getStyleProperty (name, parent, false, definedHere);