Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / Script editor with syntax highlighting and more
  RSS 2.0 ATOM  
19 pages: 1.2.3.10.19 last

Script editor with syntax highlighting and more
Rate this thread
 
30199
 
Permlink of this thread   Subscribe to this thread
avatar
  • saajjj
  • Posted: 24 October 2008 02:08 PM
  • Total Posts: 161
  • Joined: 10 June 2008 12:38 PM

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 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:
ScriptEd.1.jpg

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



Replies: 0
avatar
  • saajjj
  • Posted: 24 October 2008 02:49 PM

I’m going to use this post to monitor any reported bugs and stuff in the to-do list:

[Resolved] 7. Reported by junki on 13-Mar-09: ScriptEd doesn’t support Unicode characters.

[Bug In Softimage 7.5] 6. Reported by Hirazi Blue on 11-Mar-09: ScriptEd doesn’t work in layouts with 7.5. Can still be used as stand-alone through View > Others > ScriptEd. Note: The bug was submitted to Autodesk and they have reproduced and acknowledged it. I Hope it gets addressed in the next point release.

[Resolved] 5. Reported by Streaker on 16-Dec-08: Have ScriptEd open. File > Import > OBJ or LWO, then switching tabs in ScriptEd will crash XSI. Note: This does not happen with regular XSI models.

[Resolved] 4. Reported by Streaker on 13-Dec-08: Switching back and forth between the ScriptEd layout and any other layout brings about a glitch in the ScriptEd layout. (grey rectangle over top left area)

[Resolved] 3. Added 13-Dec-08: If one XSI session is open with ScriptEd in it, then a second XSI session will crash as soon as ScriptEd is started in that second session.

[Resolved] 2. Added 25-Nov-08: XSI crashes if two instances of ScriptEd are opened. Addressed in ScriptEd xsiaddon v1.4 (released 8-Dec-08).

[Resolved] 1. Reported by Hirazi Blue on 25-Oct-08: XSI crashes if ScriptEd is inserted into a dual-view layout. :: It turns out that the crashing was occuring due to something else, not connected to ScriptEd.

To-do list (other than resolving the bug(s), if any, above):
-

Wish-list (i.e. will probably never happen)
-



Replies: 0
avatar

Thank you very very very very (ad infinitum) much!!!:clap:

edit: ...removed wrongfully suspected bug… see bug-list



The “other” Softimage community: si-community.com

Replies: 0
avatar

Works pretty sweet so far! Only used it a little bit but this is great. I was following the other thread to see if anything came of it. Thanks a ton for your efforts.

Eric T.



Replies: 0
avatar
  • saajjj
  • Posted: 25 October 2008 08:23 AM

@HB,
Thanks and sorry about the crash, I don’t have a dual monitor setup so I couldn’t test for it. I will try and get access to such a setup and see what goes wrong.

On another note, I’ve finished making the updates mentioned in the 2nd post. Autocomplete now works as I would want it too. The things added in this verison include:

[LIST]
[*] The ability to add a custom auto-completion list. This is handy if you find yourself using a few commands over and over and find the regular auto-complete list irritating. In my case, I rarely use the Commands or Methods list, but use the custom list for commands like ‘LogMessage’ (I tend to use a lot of that). There is a new choice in the autocomplete combobox.
[*] The ability to add more custom highlight words. Each language now has it’s own text file. Other than the keywords which have been hardcoded, you can now modify those text files with keywords for highlighting. I added this since I’m not too sure whether I was able to cover all keywords.
[/LIST]
For both autocomplete and highlighing the words should be space delimited in a single line. All this information is present in the ~README.txt file which now part of the Addon :-) There is also a ~BUGS.txt which is for known/suspected issues and a ~HOWTO.txt, this gives more detail on how to modify the text files for autocompletion/highlighting.

Still trying to figure out how to enable file loading on drag & drop.

I will always have the same link for downloads. Get the latest update here

Cheers,



Replies: 0
avatar

Thank you so much saajjj !!!
It’s working beautifully so far ....

In the future I would love to see
{ } collapse/expand if possible :)

Thank you !!!!!!!!!!!!!!!!



Replies: 0
avatar

Hey,

Any chance you could try to enable a feature like the default script editor that allows you to hit F1 over a word and it takes you to the SDK docs? I use this quite a bit as I’m still learning the ins and outs and find it very useful. If not, no biggie. I love it so far. Glad to see more participation from the community.

Thanks,
Eric T.



Replies: 0
avatar
  • saajjj
  • Posted: 25 October 2008 10:44 PM

Eric,
That’s a pretty good idea! I’ll have to check if there is anyway of triggering the SDK .chm through the C++ API and whether arguments can be passed to it. Added to the wish list.

Cheers.



Replies: 0
avatar

I just wanted to report that my original crash-warning turned out to be wrong! Sorry! The crashes I experienced seem unrelated to your addon, they just started to occur on my PC almost at the same moment I installed your addon… :sweatdrop:
My wishlist would include a “one button to save them all"-feature, to save all scripts residing on different tabs in one go...:wink:



The “other” Softimage community: si-community.com

Replies: 0
avatar
  • saajjj
  • Posted: 26 October 2008 04:15 AM

@HB, That’s a relief! I will take it out of the next BUGS.txt file. Could you possibly modify your original post above about the problem. I should really put up a website with all the information. Edit: “Save All” has been added to the wishlist. I better start using bitmaps for the buttons, otherwise I’ll run out of space at the top.

@Sola, Thanks. About code folding: It was initially on the wish list for a while. The reason I didn’t work on it was because I have never used it personally. I’ll put it back on, albiet with a lower priority.



Replies: 0
avatar

I’ll second the code collapsing function if possible. :) Also, is it possible to allow the history pane to be on the right side instead of at the bottom? I hate having to resize the history pane when debugging, then when done have to re-size. A nice side by side layout may be preferable. Just tossing ideas in.

Later,
Eric T.



Replies: 0
19 pages: 1.2.3.10.19 last




   
  Settings Choose Theme color: