New local LookAndFeel objects
-
From the category of "why the hell haven't I implemented this earlier?", I present you: Local LookAndFeel objects!
You don't need to create a global look and feel and branch out with super weird conditions anymore (did this the first time myself now and it's super awkward LOL), but now you can assign different look and feel objects to individual components:
const var gf = Engine.createGlobalScriptLookAndFeel(); gf.registerFunction("drawRotarySlider", function(g, obj) { g.fillAll(Colours.yellow); }); const var laf1 = Content.createLocalLookAndFeel(); laf1.registerFunction("drawRotarySlider", function(g, obj) { g.fillAll(Colours.green); }); const var laf2 = Content.createLocalLookAndFeel(); laf2.registerFunction("drawRotarySlider", function(g, obj) { g.fillAll(Colours.red); }); const var Knob1 = Content.getComponent("Knob1"); const var Knob2 = Content.getComponent("Knob2"); Knob1.setLocalLookAndFeel(laf1); Knob2.setLocalLookAndFeel(laf2);
As you can see it will override the global look and feel (which you still need if you want to customize "global" stuff like alert windows and so on, so if you comment out the last lines, they will show up yellow, but this allows a much better code organisation for projects that use different styles.
Please let me know if there are any quirks, but it just expands on the existing look and feel system, so there should not be too many side effects.
-
@christoph-hart Oo this looks good :D
-
Build error :D
../../../../../HISE/hi_backend/../hi_modules/../hi_scripting/../hi_sampler/../hi_components/../hi_dsp/../hi_dsp_library/snex_basics/snex_ArrayTypes.h:236:84: error: type/value mismatch at argument 2 in template parameter list for ‘template<class, class> struct std::is_same’ 236 | static_assert(std::is_same<OpType, SpanOperators<T>::assign>(), "only assignment supported");
-
@d-healey should be fixed now.
-
@christoph-hart Doesn't seem to work with preset browser floating tiles.
-
@d-healey Does it work with other floating tiles (eg. the keyboard)?
-
@christoph-hart Doesn't seem to. This gives no output and the keyboard is unaffected.
const laf = Content.createLocalLookAndFeel(); const var FloatingTile1 = Content.getComponent("FloatingTile1"); FloatingTile1.setLocalLookAndFeel(laf); laf.registerFunction("drawBlackNote", function(g, obj) { Console.print(trace(obj)); });
-
@Christoph-Hart
I'm gettingInterface:! Line 4, column 54: Unknown function 'createLocalLookAndFeel'
from:
const var stdKnoblaf = Content.createLocalLookAndFeel();
Using a develop build from today...
-
@lindon Works here, is this a brand new project or an existing project? Are you certain it's the develop branch you built?
-
-
strange this works:
const var stdKnoblaf = Content.createLocalLookAndFeel;
but totally fails on the next line:
stdKnoblaf.registerFunction("drawRotarySlider", function(g,obj){
with
Interface:! Line 6, column 28: Unknown function 'registerFunction'
whihch of course is telling me that the line 4 doesnt actually work....
-
@lindon You are missing a set of
()
-
@d-healey no Im not...
this doesnt work:
const var laf1 = Content.createLocalLookAndFeel(); laf1.registerFunction("drawRotarySlider", function(g, obj) { g.fillAll(Colours.green); });
it says :
Interface:! Line 3, column 48: Unknown function 'createLocalLookAndFeel'
-
@lindon Are you sure you are using the latest develop? Your code works here...
-
@ustk I cant get on a more up to date version:
Are either of you on windows?
-
@lindon Mac for me
-
OKAY - anyone on Windows can confirm the local LAF is/isnt working?
-
@lindon Nope, works here perfectly.
-
@christoph-hart damn it. What can it be?
-
@lindon - its not even in the API list