HISE Logo Forum
    • Categories
    • Register
    • Login

    Saving external file in standalone script editor

    Scheduled Pinned Locked Moved Feature Requests
    24 Posts 2 Posters 4.7k 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
      last edited by

      It seems that when switching to a different external file or to a different callback in the drop down menu or by using the back/forward mouse controls any work that wasn't saved/compiled is lost. I think by default switching tabs should save the work and also preserve the undo history.

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

      1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart
        last edited by

        Callbacks work, but external file changes are discarded (unfortunately this is not trivial to fix because of the way external files are handled right now). A workaround is to use multiple code editors in a tab (in this case the mouse buttons switch between the tabs), which retain the external file contents (they also retain the position and more, so in fact this is the recommended way anyway :)

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

          How can I open another tab in a pop-out code editor? I don't see the little + icon

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

          1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart
            last edited by

            You'll have to build this setup yourself using the (ridiculously flexible but yet to be documented) layout system:

            1. View -> Add new floating window
            2. Right Click on the new window and Toggle Global Layout Mode
            3. Right click on the new window and choose Tabs
            4. 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.

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

              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? ;)

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

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                This file (and its .cpp counterpart) contain the modified code editor.

                Link Preview Image
                HISE/hi_scripting/scripting/components/ScriptingCodeEditor.h at master · christophhart/HISE

                The open source framework for sample based instruments - HISE/hi_scripting/scripting/components/ScriptingCodeEditor.h at master · christophhart/HISE

                favicon

                GitHub (github.com)

                What would you like to modify?

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

                  I'd like to tinker with the multiple cursors if I find the time

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

                  1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart
                    last edited by

                    Oh good luck with that one :)

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

                      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.

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

                      1 Reply Last reply Reply Quote 1
                      • Christoph HartC
                        Christoph Hart
                        last edited by

                        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.

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

                          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?

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

                          1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart
                            last edited by

                            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?

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

                              {
                                "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": {
                                        }
                                      }
                                    ]
                                  }
                                ]
                              }
                              

                              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

                                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.

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

                                1 Reply Last reply Reply Quote 0
                                • Christoph HartC
                                  Christoph Hart
                                  last edited by Christoph Hart

                                  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": {
                                            }
                                          }
                                        ]
                                      }
                                  
                                  1 Reply Last reply Reply Quote 1
                                  • d.healeyD
                                    d.healey
                                    last edited by

                                    That's great Christoph, thanks!

                                    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

                                      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.

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

                                      1 Reply Last reply Reply Quote 0
                                      • Christoph HartC
                                        Christoph Hart
                                        last edited by

                                        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 :)

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

                                          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.

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

                                          1 Reply Last reply Reply Quote 0
                                          • Christoph HartC
                                            Christoph Hart
                                            last edited by

                                            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:

                                            1. disconnect the processor (which will load the script's content back into the processor)
                                            2. change it until it works
                                            3. Save the script as file (and overwrite the old file).
                                            4. Connect it back to the overwritten file
                                            5. Recompile all scripts (Shift + F5) so that the changes will be applied to all other instances.
                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            26

                                            Online

                                            1.8k

                                            Users

                                            12.1k

                                            Topics

                                            105.4k

                                            Posts