HISE Logo Forum
    • Categories
    • Register
    • Login

    Have the "data" object from ScriptPanel on any ScriptComponent.

    Scheduled Pinned Locked Moved General Questions
    18 Posts 6 Posters 1.1k 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.
    • d.healeyD
      d.healey @jonhallur
      last edited by

      @jonhallur Sure it's valid, but I don't see a use case for it yet that isn't already covered in an elegant way.

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

        Here's an example. All the buttons share a single local LAF function, assigned in a loop.

        They all have different icons, can have different colours, etc. All a designer would need to do is edit values in the property editor, they would never need to edit the script. It's also possible to have icons and text in the same button, but that's a little more complicated.

        HiseSnippet 2477.3ocsXstihibEFlYXz18lDkUJO.n4W8Hl3f4lgrJZG6xXv.FWcigF5nnUtsMfMFaiuBrZe2xaPdUxaPxorc2Pm4dmD9A7UUcN041WU3iw9tZFAAt9EJdgxAOiBE+MklbvIbMZspoSAQdxD1p5c2qt0y1n.2AO0f.C8BEK9xdDIJdwqJj94e9Sbp1pNZFmlpPgYtlZFiL2ZFdZV76GZZaKnpanXt8Loa7dQMWGjqsaD3MurT0BdpZaTWYLVkH1KJUn3q6paF55OITMzH.jgyU+vj0tINYxOyLv7dvIgAzEl.aT1zEPqMs0wODoAEJT7U3Sw8Kyh6+PIIScyGm+T7+6SWn7IMNOGT7EeNWh9avkJdlK8pLW5GJMQy2zK7zJD+46KI5DZ3uTU6okiLYK7h+w2WB4BR3DRsUcigfOL3QMtpU0puqL70a+wKuzARrAPR1nLVMbcvk+xkW3arpbP7Jd0P0e7xKf5QPXYSxOk+Kk+ke8GKCet7hKu3O8mJypqe4E4hBK9lZsaQEVcln.VEuYNkGWxLAdm4OAud17sbhY38zss4zZ6vKX4z0yEueIkAq3cqtaf076uwWMG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+55wPKKOclftNhNlgxdF4iEbs0I8NPveXGIExSzPuIuL2CATXZmI+t7NSxRfELgM4hRYo+pERc+y6Brv2f5z+2odsOh5SEIm0HsXkGQPT5Y3GZRRlE4MhgdTyZ35hR7FAaBc8RC4bhUghe2WQPu+jIEe+gyGjXpGt9zD7uesg4p0gmOCguWnXoRviiW3zoGPhW+ufO44fuA2g9S5NK95cmWWh7.a+Owep8o7m+98e89ykkd3tzOkO8gcPC8t6pGYqF9zF5Iu4h7EfSfOoKZRmxNAlgGN+Ma7Mzke0OaW9est3OTBaFps9i6iu3i3i.69+G9X96F42Vp6xkFZgmbvWURX9y8Eg7EL+MtQjprjZnuIPaJMNZ6DnRqY.V2wwvF17REeAgBlMtJYLICLwvQOc.gPjuHMYbw7EoeXwBaU07c+Ysr6UHu8kuKcFvmbReYSWTRhLt7i2FUpTUppE1Zpa9yZZjv+OBWY9w0o1yPm5OCcZ7Lzo4yPmVOCcXdF5z9ypC4cvwFE5tM63.LAta505EK10QEXVorvB+a.9NdTH
        

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

        jonhallurJ 1 Reply Last reply Reply Quote 1
        • jonhallurJ
          jonhallur @d.healey
          last edited by

          @d-healey I already agreed with you, no need to take me to school. :)

          In my case I would just need to have object one level deeper with a list of on and off state.

          g.fillPath(Paths.icons[obj.text][obj.value], obj.area);
          

          And I agree, it is an elegant solution.
          My mind is just already committed on the data object.

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

            @jonhallur said in Have the "data" object from ScriptPanel on any ScriptComponent.:

            In my case I would just need to have object one level deeper with a list of on and off state.

            This isn't necessary, let's keep our designers out of the code :)

            You can use the text property for all kinds of magic. For example you could put on icon,off icon and in your laf function you can check if , appears in the text and if it does you convert the text to an array using join and now you can use the button's value to get the correct icon name.

            My mind is just already committed on the data object.

            Sometimes it's easier to change the way the system works instead of changing the way the programmer works :p

            Edit: Oh I just noticed I have some implementation of that in the link I posted before (it's not as nice as the solution I just suggested though) - https://github.com/davidhealey/LibreWaveBoilerplate/blob/master/LookAndFeel.js#L293

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

            jonhallurJ 2 Replies Last reply Reply Quote 1
            • jonhallurJ
              jonhallur @d.healey
              last edited by

              You can use the text property for all kinds of magic. For example you could put on icon,off icon and in your laf function you can check if , appears in the text and if it does you convert the text to an array using join and now you can use the button's value to get the correct icon name.

              String parsing in every draw call ?
              Now you are just asking for bugs :)

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

                This isn't necessary, let's keep our designers out of the code :)

                @lalalandsynth straight from the horses mouth 😆

                lalalandsynthL 1 Reply Last reply Reply Quote 1
                • d.healeyD
                  d.healey @jonhallur
                  last edited by d.healey

                  @jonhallur

                  String parsing in every draw call ?
                  Now you are just asking for bugs 🙂

                  There shouldn't be any issue with this, it's all happening on the UI thread (and I've been using it in a lot of projects :) ). There was a post a while ago from Christoph that warned against using external data in LAF functions, not sure if this also applied to local LAF. I'll see if I can find the thread.

                  Edit: Here it is - https://forum.hise.audio/topic/3228/look-and-feel-toggle-buttons-and-the-midi-sources-panel/26?_=1671280536688

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

                  jonhallurJ 1 Reply Last reply Reply Quote 0
                  • lalalandsynthL
                    lalalandsynth @jonhallur
                    last edited by

                    @jonhallur I would have to agree :)

                    https://lalalandaudio.com/

                    https://lalalandsynth.com/

                    https://www.facebook.com/lalalandsynth

                    https://www.facebook.com/lalalandsynth

                    1 Reply Last reply Reply Quote 1
                    • jonhallurJ
                      jonhallur @d.healey
                      last edited by jonhallur

                      There shouldn't be any issue with this, it's all happening on the UI thread (and I've been using it in a lot of projects :) ). There was a post a while ago from Christoph that warned against using external data in LAF functions, not sure if this also applied to local LAF. I'll see if I can find the thread.

                      Edit: Here it is - https://forum.hise.audio/topic/3228/look-and-feel-toggle-buttons-and-the-midi-sources-panel/26?_=1671280536688

                      I know I am confusing the LAF for buttons draw functions and the setPaintRoutine() for panels, I know local LAF functions would not have access to the data object and this like the ScriptPanel functions have.

                      If I could access the data object in a LAF call that would also mean I wouldn't have to use external data, like he warns in this post.

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

                        @jonhallur I’m currently using external paths inside LAF, so I imagine this falls into the forbidden zone… What about colour constants ? (like Coulours.red) aren’t they considered external too ?

                        So perhaps in this case populating a data object prior to the LAF would make it more stable, if any of the above can create instabilities of course.

                        As for the relevance of a data object regarding the programming workflow, I can understand the importance of it though I don’t feel personally concerned (at least for today)

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

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

                          @ustk I'm using some external data too in my LAF functions and haven't noticed any issues. I wonder if it was just Christoph being cautious or if the issue was fixed.

                          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

                            It's still a good advice to avoid using external data if possible, but I did in fact work on some multithreading issues since I posted the warning so yes by now it's safe enough to use static preallocated path objects in a LAF function.

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post

                            35

                            Online

                            1.8k

                            Users

                            12.0k

                            Topics

                            104.7k

                            Posts