HISE Logo Forum
    • Categories
    • Register
    • Login

    GRID HELPER || Free Script

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 310 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.
    • ChazroxC
      Chazrox
      last edited by

      If you're like me and just need an extra visual helper, you might find this useful.

      Screenshot 2025-05-31 at 4.19.37 PM.png

      Drop a panel in your project and name it "Grid1".

      namespace GridHelper
      {
      	const var Grid1 = Content.getComponent("Grid1");
      	
      	Grid1.setPaintRoutine(function(g) 
      	{
      		drawPandelGrid();
      	});
      	
      	inline function drawPandelGrid()
      	{
      		local a = this.getLocalBounds(0);
      		
      		// Size Controls
      		local NumBarsX = 10; // Number of Vertical Lines
      		local NumBarsY = 10; // Number of Horizontal Lines
      		local BarHeight = 1; // Horizontal Bar Size
      		local BarWidth = 1; // Vertical Bar Size
      		
      		// Colour Controls
      		local BarColour = Colours.withAlpha(Colours.black, 0.5); // Bar Colour
      		local BackgroundColour = Colours.withAlpha(Colours.pink, 0.5); // Optional Background Colour
      		
      		// Spacer Logic
      		local spacerY = a[3]/NumBarsY; // Horizontal Line Spacing
      		local spacerX = a[2]/NumBarsX; // Vertical Line Spacing
      		
      		// Paint Background		
      		g.fillAll(BackgroundColour); // Optional Background Colour
      		g.setFont("ArialBOLD", 12);
      		g.drawAlignedText("GRIDHELPER1.0", [5,5,100,5], "left");
      	
      		// Paint Lines
      		for (i=0;i<=NumBarsX;i++) // Vertical Lines
      		{					
      			local x = i * spacerX - (BarWidth/2); // Center Line ON grid
      			
      			g.setColour(BarColour);
      			g.fillRect([x,0,BarWidth,a[3]]);	
      		}
      		for (i=0;i<=NumBarsY;i++) // Horizontal Lines
      		{			
      			local y = i * spacerY - (BarHeight/2); // Center Line ON grid
      					
      			g.setColour(BarColour);
      			g.fillRect([0,y,a[2],BarHeight]);
      		}
      	}
      }
      

      Its a snippet from @Morphoice that I modified to have both horizontal and vertical lines, made it modular with the all the controls variables and customizable so you can set a different amount of x or y bars/lines. Comes in handy sometimes when I just want to visualize a certain part of my plugin and make sure its equally spaced to my desired paramaters.

      (idk if something like this exists already but I thought it was good excercise regardless). Bless! 🙏

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

        @Chazrox said in GRID HELPER || Free Script:

        idk if something like this exists already but I thought it was good excercise regardless

        Try incorporating this https://docs.hise.audio/scripting/scripting-api/content/index.html#addvisualguide

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

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

          @d-healey ah. Nice. I'll try that too. 👍

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

          20

          Online

          1.8k

          Users

          11.9k

          Topics

          104.0k

          Posts