Saving external file in standalone script editor
-
How can I open another tab in a pop-out code editor? I don't see the little + icon
-
You'll have to build this setup yourself using the (ridiculously flexible but yet to be documented) layout system:
- View -> Add new floating window
- Right Click on the new window and Toggle Global Layout Mode
- Right click on the new window and choose Tabs
- Add some tabs with code editors.
You can even go further and put eg. a Console on the bottom of the window - so basically create your own scripting workspace that will be displayed in an external window. This layout can be saved and restored as JSON data.
-
Thank you, I shall enjoy this :) if one wanted to edit the C++ behind the script editor to add some functionality which modules should they be looking at? ;)
-
This file (and its .cpp counterpart) contain the modified code editor.
What would you like to modify?
-
I'd like to tinker with the multiple cursors if I find the time
-
Oh good luck with that one :)
-
I like this layout customisation - I shall make a video about this:) It would be nice if we could save all our JSON layouts to a folder that HISE could read from so that we could select custom layouts from the view menu (or a sub-menu) without having to paste the JSON.
-
That's awesome. I think a video tutorial would be the best documentation, because this subject is very point & clicky. Do you need some kind of reference on how it works or will you figure it out all by yourself?
Having a location for custom layouts is a good idea.
-
I think I understand it all but there may be some secrets that I have yet to discover. This is the popup I've made so far: https://pasteboard.co/GDtLmyV.png
Anything special you think should be mentioned?
-
Yes, you can remove the close buttons for some panels in order to prevent accidentally destroying your precious workspace. Can you post the JSON, then I'll do some changes and add some comments?
-
{ "Type": "HorizontalTile", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Content": [ { "Type": "VerticalTile", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.78887251, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Content": [ { "Type": "Tabs", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.203125, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Content": [ { "Type": "ApiCollection", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } }, { "Type": "FileBrowser", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } }, { "Type": "ModuleBrowser", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } } ], "CurrentTab": 0 }, { "Type": "Tabs", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -1.1253906, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Content": [ { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 } ], "CurrentTab": 0 } ] }, { "Type": "VerticalTile", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.21112749, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Content": [ { "Type": "Console", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.82851562, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } } ] } ] }
-
I've found a little bug with this, if I have my popout window on another desktop and I right-click in the API browser it will switch to the desktop with the main HISE interface on instead of opening the info where I clicked. I've only tested this on Windows.
-
I made some of the containers not
Dynamic
, which causes the close button to appear and give it a more "hardcoded" style. I also changed some size values to absolute values (eg. the left panel doesn't need to increase in size when the window gets bigger). I also added a "Global Script Connector", which sets the processor of all child panels (so you don't have to set each script editor explicitely.This is the updated JSON:
{ "Type": "HorizontalTile", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Dynamic": false, "Content": [ { "Type": "VerticalTile", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.97559917, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Dynamic": false, "Content": [ { "Type": "Tabs", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": 357, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Dynamic": false, "Content": [ { "Type": "ApiCollection", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } }, { "Type": "FileBrowser", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } }, { "Type": "ModuleBrowser", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } } ], "CurrentTab": 2 }, { "Type": "HorizontalTile", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.58047337, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Dynamic": false, "Content": [ { "Type": "GlobalConnectorJavascriptProcessor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": 18, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "Tabs", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": -1, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "Content": [ { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 }, { "Type": "ScriptEditor", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.5, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { }, "ProcessorId": "", "Index": -1 } ], "CurrentTab": 0 } ] } ] }, { "Type": "Console", "StyleData": { }, "LayoutData": { "ID": "anonymous", "Size": -0.31327334, "Folded": 0, "Visible": true, "ForceFoldButton": 0, "MinSize": -1 }, "ColourData": { } } ] }
-
That's great Christoph, thanks!
-
When I add a MIDI processor and use connect to an external script, any changes I make to the script within HISE don't seem to be written to the external file.
-
Ah, nice catch! Connecting a script to a MIDI processor is a read-only connection (that's why the script editor will be hidden in the main panel). However, it's still fully accessible in the Scripting workspace, but it will not write to the file because of the "read-onlyness".
It has to be read only in order to make sure that multiple scripts that use the same external file have the same state.
I "fixed" it by removing connected script processors from the editor drop down - not sure if this is a satifying answer for you though :)
-
Well it solves the problem :) however it creates another question for me. What if I want to edit the file in the HISE editor? I'm trying to remove the need for an external text editor and do everything in HISE.
-
Well, I added this feature for scripts that are somewhat "finished" and just need to be reused (so as long as you're working on a script, it's recommended to not connect it to an external file). However if you want to make changes to this script - nobody's perfect :), you can:
- disconnect the processor (which will load the script's content back into the processor)
- change it until it works
- Save the script as file (and overwrite the old file).
- Connect it back to the overwritten file
- Recompile all scripts (Shift + F5) so that the changes will be applied to all other instances.
-
Cool, that seems pretty straightforward