When it comes to math, sometimes is hard to visualize what you are doing, if you are working with vectors and transformations the debugging process can be slow and tedious, you cannot even use primitives to trace positions and rotations if you are writing scripted operators.

My workflow was to write quick run-once scripts in the script editor, use curves and nulls to be sure that everything was ok and then write the scripted operator. But, if scripting is meant to make your life easier, this case makes you change your mind a bit. So I decided to take advantage of both c++ and scripting by wrapping some simple OpenGL drawing functions and exposing them to scripting.

Since the result seems to be quite handy, I decided to make this little utility available on XSIBlog. Lionhead, the company I work for, kindly allowed me to publish it.

So here is the ScriptedSequencer, a small utility to draw vectors and rotation axis on screen.

The tool uses a JScript object to wrap some c++ registered commands, you can use this object from Python and VBScript as well.

First get an instance of the object:

1

var s = NewSequencer();

then call one of the drawing functions:

1
2

var vec = XSIMath.CreateVector3();
vec.Set(0,1,0); s.DrawVector(vec);

to erase the stack and start again use:

1

s.Flush();

All the drawings are collected by the c++ plug-in and then rendered at the right time using the GraphicSequencer, so you don’t have to care about synchronizing with the viewport’s OpenGL rendering, which means in other words that you can draw OpenGL stuff from wherever you are, run once scripts, scripted operators or compiled plug-ins at any moment.

As it is nothing more than a debugging utility it doesn’t support multiple clients, it means that every time you’ll flush the stack all the drawings drawn by every script will be flushed at once.

By typing NewSequencer().Help() you’ll get a quick help about the sequencer object and its methods.

I hope you’ll find it useful to debug your scripts!

Please note that this utility is not released by Lionhead Ltd., it is not covered by any guarantee and nobody is responsible in any way for any possible troubleshoot.

You are more than welcome to report possible bugs or give me suggestions, just drop me a line at andrea@ray-t.net.

This entry was posted
on Sunday, November 27th, 2005 at 3:10 pm and is filed under C++, JScript, Plugins, Python, Tools, VBScript.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.