The ScriptedSequencer

November 27th, 2005 by Andrea Interguglielmi - Viewed 10959 times -




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.

Download the ScriptedSequencer addon and a sample scene here (XSI 5.X required).

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

7 Responses to “The ScriptedSequencer”

  1. kim aldis says:

    that”s purty, Andrea.

  2. Carlos Valcarcel says:

    Thanks for sharing this tool ! :) It”s gonna help a lot in debuging transforms ;)

  3. Helge Mathee says:

    Wow that”s scary. I had no idea you could draw in GL that easily.

  4. Martin Matzeder says:

    really cool! It”s very handy right now, I will use this a lot from now on

  5. Bonifacius says:

    Great article. I am just sad I dont know how to reply properly, though, since I want to show my appreciation like many other.

  6. Best Cameras says:

    Good Blog keep it up…

  7. Edwin says:

    Osmund

    The mill cannot grind with the water that is past…