HISE Logo Forum
    • Categories
    • Register
    • Login

    Drawing SVG's inside panels by using arrays in a loop?

    Scheduled Pinned Locked Moved General Questions
    4 Posts 2 Posters 280 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.
    • gorangroovesG
      gorangrooves
      last edited by

      I've been trying to draw SVG images inside panels using arrays inside a loop but with no success.

      Here is the simple, working code for 3 panels and 3 svg's:

      const var IconPanel0 = Content.getComponent("IconPanel0");
      const var IconPanel1 = Content.getComponent("IconPanel1");
      const var IconPanel2 = Content.getComponent("IconPanel2");
      
      IconPanel0.setPaintRoutine(function(g)
      {
      	g.drawSVG(IconPaths.KickIconPathSVG, this.getLocalBounds(0), 1.0);
      });
      
      
      IconPanel1.setPaintRoutine(function(g)
      {
      	g.drawSVG(IconPaths.SnareIconPathSVG, this.getLocalBounds(0), 1.0);
      });
      
      
      IconPanel2.setPaintRoutine(function(g)
      {
      	g.drawSVG(IconPaths.HatsIconPathSVG, this.getLocalBounds(0), 1.0);
      });
      

      Is it possible to simplify this using arrays of panels and SVG names?

      Ideally, by utilizing something like this to get references for the panels:

      const var PanelArray = [Content.getComponent("IconPanel0"),
                              Content.getComponent("IconPanel1"),
                              Content.getComponent("IconPanel2")];
      
      

      This would allow me to scale the number of panels and SVG's easier.

      Goran Rista
      https://gorangrooves.com

      Handy Drums and Handy Grooves
      https://library.gorangrooves.com

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

        @gorangrooves

        How to share a paint routine

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

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

          Here's another way to do it, if you don't need as much independent control

          HiseSnippet 793.3ocsUstZSDDEdlzrglnUrfO.KAD1B0PRuofH11bQBZaWL0h+qLc2IICc2YV2c1pKh+y2Ge0D7AndlY1bqMDaBX9QXOW9NmuYNWF2XgGMIQDivkOOKhhvO1pWFWNr4PBii51Bgeh0IjDIM11n53rHRRB0Ggwq8NkBb4hH8ue+1iIADtGchJD5BAyi9AVHSNQq6gumEDzg3SOmENk26cXWOAuoHPjB7YMq5nHh20jAzSIJ2JXgvkZ6yjh3dRhjl.9brvOq2PwW4F+ufkvtJfpDZf5AAxnF0bHKv2czYMAgvEcmbxWybxel0ILe1X8StAdp1f8DDSeGfKrHJ0XInDdJJUzPoMs54EyhjSrn3yir5xgBReBbUOMUL9hJ7ErUSA3AWVKjbMsSLHLFgyA0qusM72VutRk9obOISvsCybgSq7ihTIiScFrUkuWo7fZ8g5zQAANxgrjZCnRmpWMvTeptEf+GUp.ErDocDgSCRrei8n7B9B3ZJBiDbPNwopqxkp5jJhschrY7bX5bEUKgJmgCyRIc1FSWA+TgjdF2QiErXeWS86OWaJ9EKBBnwy0rpeLdQ.c3ogWQi219FRPJcriPAa1tfROrt.Oy00TNJ3c4L4YQzb4Nh.eU0U8886YP422vWepaKhjnZix0A9EQikLEcvsn2.ygllpxVsnIWKEQPTGWgPXKo15FiZ4T0FDCR85V5uaf9F3D9mPtxTenR5ntAHnkfE.2pGiWhXtiIlEw4wrD9Nw7OatzwbWSLe9nX9q6DyaQ6ah48G2fAcgeZ.QN6zuZMWtAnYXlQN0XEOgIyldM3RrRn9BWI7Po3lVtLo2v4ywBygiPax+CNluHcCq186S8jSHXQqNedU2Z9ORuY+vfSHxXlpveZZXOnR6QgryUqWT8.ETsPF45JY0MPOJ2WKbK7K2XCkLN2XiQFQgDuXwkdlU.pU0qq0.bhqeYpL7DIHa2.oWK.3rpWqNJDd03ROO0w+Evz67wryJfY2U.ydq.l8WALGrBXd4Jf4UKDi5A6iRkhPy3.nvssd+HF2lSfNKcWH5uPqPagB
          

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

          gorangroovesG 1 Reply Last reply Reply Quote 0
          • gorangroovesG
            gorangrooves @d.healey
            last edited by

            @d-healey Thanks, Dave.
            Unfortunately, this doesn't solve my challenge. I haven't figured out how to properly loop through 2 arrays for drawing SVG's inside panels.

            I guess I'll just stick to the manual way I have above. It is not too laborious.

            Goran Rista
            https://gorangrooves.com

            Handy Drums and Handy Grooves
            https://library.gorangrooves.com

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

            25

            Online

            1.7k

            Users

            11.9k

            Topics

            103.4k

            Posts