HISE Logo Forum
    • Categories
    • Register
    • Login

    Insert instead of replace

    Scheduled Pinned Locked Moved General Questions
    16 Posts 5 Posters 623 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.
    • ustkU
      ustk @MikeB
      last edited by

      @MikeB You might use external .js files for that (globally or locally), so you can share them easily. Though if you don't think about GUI only but also modules this might be trickier to implement...

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

      MikeBM 1 Reply Last reply Reply Quote 1
      • MikeBM
        MikeB @ustk
        last edited by

        @ustk I already do that - always, but as you said, only the content of the .js file can be transferred, not the elements used in the file.

        However, if I could insert a snippet into my project in its own namespace* "Snippet", for example, it would save a lot of time.

        *Of course, any similarities in the names of variables or elements would have to be ensured by encapsulating the code used.

        "One hour of trial and error can save 10 minutes of reading the manual."
        "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
        HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

        d.healeyD ustkU 2 Replies Last reply Reply Quote 1
        • d.healeyD
          d.healey @MikeB
          last edited by

          @MikeB You can create factory scripts to add ui components and modules. I do this to build reusable project templates so I don't have to keep rebuilding the same UI elements over and over for different projects.

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

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

            @MikeB As @d-healey said you can still script the modules in an external file, though it's a bit more painful, at least to me because I'm not used to it... But I'm sure Dave can do this in a blink of an eye :)

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

              @ustk No it's painful for me too :p but it's a one time job.

              All of my instruments that I'm working on have basically the same interface. So I built it once using the usual tools (interface designer, etc.). Then I spent a day writing a script that would do exactly the same thing.

              Now when I start a new project I run the script and my interface is built. Then I remove the script because it's no longer needed in the project.

              Here's the script (or an old version of it) - https://github.com/davidhealey/LibreWaveBoilerplate/blob/master/UIFactory.js

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

              ustkU MikeBM 2 Replies Last reply Reply Quote 4
              • ustkU
                ustk @d.healey
                last edited by

                @d-healey said in Insert instead of replace:

                Then I remove the script because it's no longer needed in the project.

                I imagine that's why you seem to be relying a lot on getComponent(), clever 😎

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

                1 Reply Last reply Reply Quote 0
                • MikeBM
                  MikeB @d.healey
                  last edited by MikeB

                  @d-healey Thanks Dave - but unfortunately I can't get your script to work!

                  No error is reported - it just does nothing.

                  A video?

                  "One hour of trial and error can save 10 minutes of reading the manual."
                  "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                  HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                    @MikeB You don't want to use my script, that is just an example (unless your project has the same UI as mine).

                    I'm creating a UI using scripting instead of using the interface designer (but once the UI is created I remove the extra script and do further work in the UI designer).

                    There is nothing special here, these are the same functions you'll be using in your secondary (non-main interface) scripts to build those UIs.

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

                    MikeBM 1 Reply Last reply Reply Quote 1
                    • MikeBM
                      MikeB @d.healey
                      last edited by

                      @d-healey No - I don't want to use your UI. I just wanted to understand the function.
                      I understand the principle of how it works.
                      Do you have a current snippet?

                      "One hour of trial and error can save 10 minutes of reading the manual."
                      "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                      HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                        @MikeB I don't have a snippet that would make it any clearer. Add the script via include, then call the createShell function.

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

                        1 Reply Last reply Reply Quote 0
                        • orangeO
                          orange @MikeB
                          last edited by orange

                          @MikeB

                          In most cases, I directly use the below method to create UI controls. Every UI property can be set inside the JSON data.

                          This way, no need to repeat the process again and just copying / pasting the code will create the UI control quickly.

                          After creating the UI controls, you can also delete the code and go on with the interface designer too 🙂

                          addPanel, addKnob, addButton, addComboBox, addFloatingTile...etc.

                          // Create Panel ------------------------------------
                          const var Panel1 = Content.addPanel("Panel1", 10, 10);
                          Content.setPropertiesFromJSON("Panel1", {
                              "width": 230,
                              "height": 220,
                              "borderRadius": 0.0,
                              "borderSize": 2.0,
                              "bgColour": 0,
                              "itemColour": 0,
                              "itemColour2": 0,
                              "textColour": 0x550095FE,
                          });
                          
                          
                          
                          
                          
                          // Create Knob  ------------------------------------
                          const var TheKnob1 = Content.addKnob("TheKnob1", 30, 40);
                          Content.setPropertiesFromJSON("TheKnob1", {
                              "text": "The Knob1",
                              "tooltip": "This is the tooltip",
                              "isPluginParameter": true,
                              "pluginParameterName": "The Knob One",
                              "isMetaParameter": true,
                              "useUndoManager": true,
                              "width": 161.0,
                              "height": 45.0,
                              "parentComponent": "Panel1",
                              "min": -1.0,
                              "middlePosition": 0.0,
                              "stepSize": "0.1"
                          });
                          
                          
                          
                          
                          // Create Button  ------------------------------------
                          const var Button1 = Content.addButton("Button1", 50, 120);
                          Content.setPropertiesFromJSON("Button1", {
                              "parentComponent": "Panel1",
                              "isPluginParameter": true,
                              "isMetaParameter": true,
                              "tooltip": "The Button 1 tooltip",
                              "useUndoManager": true,
                              "pluginParameterName": "The Button One",
                              "isMomentary": false,
                              "textColour": 0xFFFF3F3F,
                              "bgColour": 0x55F83F3F
                          });
                          
                          HiseSnippet 1299.3ocsW0raaaDDdorYPjZRfCPaOVPnSJ.1NRxVoosnPt9GU3lZagH6fbKXM4JqElbWBxkIV0H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tOK7RkzOV2D5NLuTusOLcXJx8i206apqCHWQLLMpA603zeD2jAVw68WIdgtCCh7mIHEG8TzgSYZntoX4iSlNZ6hv4DYD8e+ExYHJlGxNRqsHYh3S0WjdpZjrx38GxZ9SRJSIFel4T55StUmAbkLfUZJ0rn6TrQOYh9FolVtUPJZZ.WGFsb1IKfqQ94d6LQerB4OuR2C82J2GuXtIsMNrqlPabjlmsZOXAXmwgz1ogzqv.wLcpYF6lQbIKU74lSqS5LhaSMQrlY4lmSPo518laljo1s6+bl91425Vnv8ekNQtTU4KEi29OQ.FkKdST71lBH5Ot3WGbGtoby4dS4E0EerYetxdzz8wJSwGwhr+G7wjuu3glGLbHyVk6fqZ160K6GS7Q19WJiTbwEGQUAbjzdbj2.HSayfcW.zyPj+TA6yqeuI9NFAFvDNwubC7jHrUJYCE1JUHwiZGHeist6N9EL2OFA7IQLKrJ7kiv6VYM0wZtlPwpC+M113weCnBb51zdIrYqkvlsWBa5rD17rkvlubIr44y0F76X+tHkzSWN..8OHd3pgwABJvrhYgj+Cv04YUK
                          

                          develop Branch / XCode 13.1
                          macOS Monterey / M1 Max

                          MikeBM DabDabD 2 Replies Last reply Reply Quote 3
                          • MikeBM
                            MikeB @orange
                            last edited by

                            @orange That works - thank you

                            "One hour of trial and error can save 10 minutes of reading the manual."
                            "It's easier to hit the developer with feature requests than to spend 10 minutes reading the manual. :-)))"
                            HISE Develop - Mac Pro 5.1, OS X 10.14.6, Projucer 6.02, Xcode 10.3

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

                              I just remembered Christoph wrote about this ages ago in this post (lots of other good stuff in there too) - https://forum.hise.audio/topic/79/scripting-best-practices

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

                              1 Reply Last reply Reply Quote 2
                              • DabDabD
                                DabDab @orange
                                last edited by

                                @orange Hmmm.... Exactly.

                                Bollywood Music Producer and Trance Producer.

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

                                24

                                Online

                                1.7k

                                Users

                                11.8k

                                Topics

                                102.8k

                                Posts