|
Hello,
A while back I started a thread about using a Text Editor Widget based script editor for XSI. My primary reason was to be able to exploit the syntax highlighting it offered. In another related thread Steven Caron refered to pyQT/wxPython. That started me off with an idea.
Instead of pyQT or wxPython, I used C++ and wxWidgets (from which wxPython is derived) to make a script editor.
I have uploaded the addon here, right click - save link (this link will always point to the latest release), screenshot below.
The script editor (creatively named ‘ScriptEd’) features the following:
- Support for XSI 32-bit and 64-bit versions on Windows
- Syntax highlighting for JScript, Python and VBScript. Also, for each language, you may add more keywords to be highlighted
- Split screen editing for a single document (ref. 1st screen shot)
- Multiple views for looking at various documents (ref. 2nd screen shot)
- Code folding
- Multiple tabs (10+ possible since v1.8)
- Auto-completion of XSI Commands, Methods or a Custom list
- Change font size on the fly (Ctrl + mousewheel)
- There is a preferences box, which propagates changes instantly through all the tabs of the editor and also saves the settings for future use.
- Drag and drop support to open files by dropping them on to the editing window
- Auto-Save unsaved scripts to a folder of the users choice (Please set this folder on first use in Preferences, remember to click ‘Save As Defaults’)
- Integrated into a custom layout
- Code commenting/uncommenting
- Customizable background colour for the editing text box
- Context sensitive help on XSI commands
- Unicode / ANSI friendly
- Context menu similar to native script editor
A few notes on installation:
If the addon doesn’t work on first use, then you need to have the Microsoft Visual C++ 2008 SP1 Redistributable Package (x86/x64) installed. Get them here:
- x86
- x64
If for some reason the above links don’t work, Google for: vc++ 2008 redistributable. The distributable is required because the plug-in uses MS libraries.
Upgrade/Re-installation:
Please remember to both: uninstall & delete the previous version from XSI and system before installing the new version.
Inside XSI the editor is available under View - Other - ScriptEd. (I’ve mapped it to Alt + 4 in my system). You may also switch to the “ScriptEd” layout which integrates ScriptEd into the XSI interface.
Other stuff:
I have tested ScriptEd on Vista (32b/64b) and XP Pro (32b/64b) for v7+ and v6.5 without issues. The addon file contains plugins for both 32 and 64 bit versions. XSI loads the correct version depending on the platform. This basically means (like many other addons) you can plug this addon into x64 or x86 versions of XSI without any change.
Scripted has solely been tested by myself (and a few others). It hasn’t given me any touble yet, but we all know bugs multiply proportionally to the userbase. The screenshot below shows ScriptEd in it’s own window. You may also use the bundled layout, View - Layouts - ScriptEd, which integrates ScriptEd into the XSI layout.
I have tried to keep the UI as simple as possible. All buttons are self-explanatory other than the first combo-box and the last four. Here’s a quick run down on them:
- The very first combobox represents a list (if any) of recently loaded files.
- ’L‘ : ScriptEd allows you to set each tab to a different language i.e. the language selection in the combo box is remembered per tab. Hitting ‘L’ will lock all tabs to the current selected language.
- ’-‘ : Enables the view splitter. I tend to use this in lengthy code when scrolling becomes a time waster. Drag the splitter out of view to go back to single pane mode.
- ’#‘ : This pops up the preferences box. Changes to any setting are applied instantly through all the tabs, but only saving ensure that those settings are respected the next time you load ScriptEd.
- ’?‘ : A little information on the plug-in and the list of supported short-cut keys.
There are a few more features I would like to implement (read the to-do list in the post below). Also, ideally, some of the base code could be changed to enable simple customizations. But I feel this is ready for most purposes.
Please read the ~README.txt and ~HOWTO.txt files (present in the addon directory) for further information.
Other than the expected shortcut keys (Ctrl+ Z, Ctrl + C, etc). The following keyboard shorcuts apply:
Context sensitive help : F1
Run Code (all or selected) : F5
Go back and forth between Tabs : Ctrl + Tab / Ctrl + Shift + Tab New Tab : Ctrl + N
File Open/Save : Ctrl + O/S
Font Size : Ctrl + Mousewheel
Find and Replace : Ctrl + H
Find : Ctrl + F
Go to matching brace : Ctrl + B
Code comment and uncomment : Ctrl + K / Ctrl + U
when the time is right, I will be releasing the source-code as well. There are a few reasons behind this:
- I want people to be able to customize the editor to their hearts content. Technical people tend to be very particular in what they want and need. I hope this piece of code can serve as a base for them to build upon. Actually, it would be extremely simple to strip out the editor code and plug your own code in to make a new CDH based plug-in. At this stage, I can’t recommend wxWidgets enough, it’s fantastic.
- It took me (and my brother) a bit of head scratching to figure out how the Custom Display Host works. However, now that I look back upon it, linking any application to a CDH should be ridiculously simple. As stated elsewhere in the forum, one needs to implement just three callbacks.
- It’s something back to the community which has taught me tons.
Feedback is welcome.
Cheers,
P.S. I don’t know why the combo boxes don’t pick up the XSI styling.
Screen shot showing autocompletion and split view for a single document:

The following screen shot shows how multiple files may be viewed by dragging a tab to any edge of the ScriptEd editing window:

|