Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / Script editor with syntax highlighting and more
  RSS 2.0 ATOM  
19 pages: 7.8.9.10.11.19 first last

Script editor with syntax highlighting and more
Rate this thread
 
30199
 
Permlink of this thread  
avatar

Back on topic:
There seems to be something fishy going on with the auto-indent-feature of ScriptEd in Python. Don’t log this as a bug yet, because the situation is quite unclear, but I seem to be getting “indentation level"-errors, where there really should be none… But I am well-known for being wrong (see my first bug report). Maybe someone else could comment if the same problems occur outside of my own little world… :o



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

Replies: 0
avatar
  • saajjj
  • Posted: 18 December 2008 08:14 AM

HB,
You might be on to something. Megavotch mentioned indentation levels in Python a few posts earlier. It would be great If you can pass me some reproducible step.



Replies: 0
avatar
  • saajjj
  • Posted: 18 December 2008 09:07 AM

One thing I can say straight away is that once a Python file has been loaded and then the preference for tab indent is changed to another number, the Python parser will break. Specifcally like this:

[LIST=1]
[*] In prefs, set default language to Python and tab indent to 4.
[*] Paste in the following code:

if(1):
    
Application.LogMessage("a");
    if(
1):
        
Application.LogMessage("b");

[*]In prefs, change the tab indent to 3.
[*]Now if we go to the end of the last line and press Enter, the caret comes below the A in Application, this is fine. However, if we press Tab now, the caret only moves one space. This will break the code.
[/LIST]
In the above, the Python file was written with indents set to 4. The indents were then changed to 3, therefore the code will break. Since Python is indent sensitive this way, it’s best not to change the tab indent level midway. If you do want to change the indent, then:

[LIST=1]
[*]Save all Python scripts
[*]Change the tab indent in the preferences box
[*]Reload all Python files (on reload the files will be reformatted to the new indent level)
[/LIST]
I could look into reformatting the loaded script automatically if the tab indent level is changed.

Please let me know if this is what’s breaking the parser.

Cheers,



Replies: 0
avatar
  • saajjj
  • Posted: 18 December 2008 10:14 AM

After a bit of testing, I realise that the above safe-indentation-hack I posted is… a hack. It shouldn’t be the users burden to ‘keep this and that in mind’. I’ve fixed the code so that changing the ‘Tab Indent’ value in the preferences box, reformats all loaded documents on the fly.

Download the fixed add-on here (right click, ‘save as...’)

Please remember to uninstall (from XSI) and delete the directory of the old version before installing the new one.

If the Tab indent issue mentioned earlier than this post still persists, please post!

Cheers,



Replies: 0
avatar

Brilliant! I guess, this means I can stop looking for reproducability…
On another note:
FEATURE REQUEST:
As the XSISDK-Wizard generates code it opens a generic (normal) XSI-Script-Editor-Window or an external editor (if specified) to display the code and make it available for further editing. Would it be possible to reroute this code into ScriptEd as well, preferably automatically???
(Maybe I am just missing something, ScriptEd already does, if so: please tell me how I can do this)



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

Replies: 0
avatar
  • saajjj
  • Posted: 19 December 2008 02:36 AM

HB,
XSI does allow the user to define an ‘External Editor’ in File > Preferences > Scripting. However, only an executable can be define. I don’t think there’s anyway to reroute the editing to ScriptEd.

If ScriptEd had a massive userbase, I suppose SI/AD could be requested to include some kind of plugin support for external editors too.

I will however look further into this.



Replies: 0
avatar

[QUOTE=saajjj;16765]
If ScriptEd had a massive userbase(...)

Only a matter of time, I’m sure! :whistling:



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

Replies: 0
avatar

Thinking about my own “feature request” some more: the SDK-Wizards create their own saved files.  If nothing else, wouldn’t it be possible to “intercept” the path and the name of these files (not the content itself), the SDK-Wizards create to auto-load them from disk back into a new ScriptEd-Tab?
(I hope you understand what I am trying to say...)



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

Replies: 0
avatar
  • saajjj
  • Posted: 19 December 2008 05:29 AM

The problem is essentially the same: if I can capture the path, I can easily capture the content too. If I have access to some kind of a hook which is fired when the wizard generates the file, then I could use the hook to trigger ScriptEd. Since the wizard supports the ‘external editor’ value, I’m pretty sure that it’s the file path that gets sent to the XSI script editor.

May be I should just email SI/AD and find out, if what we’re trying to do is possible at all.



Replies: 0
avatar

Hi Sajjad,
This is great! Thanxs



Replies: 0
19 pages: 7.8.9.10.11.19 first last