Stellarium Script Editor

Work continues apace on the "new" Stellarium script engine. As part of my work on this I found my workflow a little inefficient - switching between Stellarium and vim in a terminal all the time to edit scripts and then re-run them.

What better then, than to spend a little time making an integrated script editor tool inside Stellarium?

It's not exactly QT Creator, but there are a few nice features:

  • Syntax highlighting (although perhaps my choice of styles could be improved upon).
  • Run scripts from memory without having to save to file
  • A "quick script" combo box, which runs one of a small number of hard-coded scripts. This can be useful if a script dies before it completes, and does not clean up labels / images from the screen.
  • load/save script files from disk
  • SSC pre-processor - run the text in the script window through the script SSC pre-processor. This basically does the inclusion of include files. It can be useful since debug/error message will give line numbers which are after the pre-processor has run.
  • STS pre-processor output (when Stratoscript support is compiled into Stellarium). This will be very useful when I get to finishing this feature.
  • Debug output window to I don't have to keep looking at the terminal to see the output of core.debug() statements and script engine errors.
    • If you want to try it out, you have to build it into the program, and it is not enabled by default. After doing cmake in the build process, use ccmake or cmakegui to set the value of ENABLE_SCRIPT_CONSOLE to 1 and rebuild using make.

      When Stellarium is running, the F12 key toggles the script console window.