HISE Logo Forum
    • Categories
    • Register
    • Login

    New local LookAndFeel objects

    Scheduled Pinned Locked Moved General Questions
    48 Posts 6 Posters 2.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Christoph HartC
      Christoph Hart
      last edited by Christoph Hart

      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.

      d.healeyD 1 Reply Last reply Reply Quote 7
      • d.healeyD
        d.healey @Christoph Hart
        last edited by

        @christoph-hart Oo this looks good :D

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by

          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");
          

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            @d-healey should be fixed now.

            d.healeyD 1 Reply Last reply Reply Quote 3
            • d.healeyD
              d.healey @Christoph Hart
              last edited by

              @christoph-hart Doesn't seem to work with preset browser floating tiles.

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              Christoph HartC 1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart @d.healey
                last edited by

                @d-healey Does it work with other floating tiles (eg. the keyboard)?

                d.healeyD 2 Replies Last reply Reply Quote 0
                • d.healeyD
                  d.healey @Christoph Hart
                  last edited by

                  @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));
                  });
                  

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  LindonL 1 Reply Last reply Reply Quote -1
                  • LindonL
                    Lindon @d.healey
                    last edited by

                    @Christoph-Hart
                    I'm getting

                    Interface:! Line 4, column 54: Unknown function 'createLocalLookAndFeel'

                    from:

                    const var stdKnoblaf = Content.createLocalLookAndFeel();
                    

                    Using a develop build from today...

                    HISE Development for hire.
                    www.channelrobot.com

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Lindon
                      last edited by

                      @lindon Works here, is this a brand new project or an existing project? Are you certain it's the develop branch you built?

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      LindonL 1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @d.healey
                        last edited by

                        @d-healey
                        58d00719-ca02-4d3c-a837-9a9527c2337d-image.png

                        HISE Development for hire.
                        www.channelrobot.com

                        LindonL 1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @Lindon
                          last edited by Lindon

                          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....

                          HISE Development for hire.
                          www.channelrobot.com

                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @Lindon
                            last edited by

                            @lindon You are missing a set of ()

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            LindonL 1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @d.healey
                              last edited by

                              @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'

                              HISE Development for hire.
                              www.channelrobot.com

                              ustkU 1 Reply Last reply Reply Quote 0
                              • ustkU
                                ustk @Lindon
                                last edited by

                                @lindon Are you sure you are using the latest develop? Your code works here...

                                Can't help pressing F5 in the forum...

                                LindonL 1 Reply Last reply Reply Quote 0
                                • LindonL
                                  Lindon @ustk
                                  last edited by

                                  @ustk I cant get on a more up to date version:

                                  c056ccb2-ff39-42de-91fb-3173c4c6ed1e-image.png

                                  Are either of you on windows?

                                  HISE Development for hire.
                                  www.channelrobot.com

                                  ustkU 1 Reply Last reply Reply Quote 0
                                  • ustkU
                                    ustk @Lindon
                                    last edited by

                                    @lindon Mac for me

                                    Can't help pressing F5 in the forum...

                                    LindonL 1 Reply Last reply Reply Quote 0
                                    • LindonL
                                      Lindon @ustk
                                      last edited by

                                      OKAY - anyone on Windows can confirm the local LAF is/isnt working?

                                      HISE Development for hire.
                                      www.channelrobot.com

                                      Christoph HartC 1 Reply Last reply Reply Quote 0
                                      • Christoph HartC
                                        Christoph Hart @Lindon
                                        last edited by

                                        @lindon Nope, works here perfectly.

                                        LindonL 1 Reply Last reply Reply Quote 0
                                        • LindonL
                                          Lindon @Christoph Hart
                                          last edited by

                                          @christoph-hart damn it. What can it be?

                                          HISE Development for hire.
                                          www.channelrobot.com

                                          LindonL 1 Reply Last reply Reply Quote 0
                                          • LindonL
                                            Lindon @Lindon
                                            last edited by

                                            @lindon - its not even in the API list

                                            7fa01f44-c252-4706-8633-8c6af6e6b3b4-image.png

                                            HISE Development for hire.
                                            www.channelrobot.com

                                            d.healeyD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            44

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.9k

                                            Posts