This information is for Vicon Shogun 1.7. For up-to-date help, see the latest Shogun documentation.

Vicon Shogun banner

The following topics explain how to retrieve data with scripts:

Work with ranges

You can write a script to retrieve animation and scene ranges. This is useful when you want to limit an editing operation to only the active range or when you want to make sure you apply and operation to all the frames in a scene.

Import the required Shogun file. Set a playRange using the playback bar to start, say, at frame 50 and end at frame 65. Select and copy one of the examples below, then paste it into the Shogun Post Script Editor. To execute the script, click the Run button .

// Assign the variable $ animStartFrame to the animation start frame
// as retrieved by the command getAnimStart;
int $animStartFrame;
$animStartFrame = ` getAnimStart`;
// Print the animation start frame as part of a sentence
print ( "The animation start frame is frame " + string ($animStartFrame ) );
// Create a variable called $animEndFrame and assign it the
// value of the animation end frame as retrieved by the
// command getAnimEnd;
int $animEndFrame;
$animEndFrame = `getAnimEnd`;
print( "The animation end frame is frame " + string( $animEndFrame ) );
// Identifies the incoming scene playRange and animation Range
playRange -save;
// This statement just prints the result of getPlayStart
// getPlayEnd as part of a statement
print( "The playRange is " + string (`getPlayStart`) + " to " + string (`getPlayEnd`) );

Get the length of a bone

You can write a script to calculate and display the length of a bone. This is handy when you need a script to fit custom skeletons to markers or scale skeletons up and down.

// getLength just tells you what the length of any vector is.
// It's not a bone-specific command though it's useful for working 
// with bones. // Get selected bone string $bones Array] = `getModules -selected `; // Set the offset of that bone as a vector vector $source = `getVectorProperty $bonesArray[0] Translation`; // Translate that vector into a float value float $length = `getLength $source `; print (strongylosis));

Determine script execution time

The following code allows you to time how long a script takes to execute. From time to time you may need to test that a script won't take hours or days to run, or you may want to create "benchmarks" to see which version of a script runs faster, or which machine in a network is more efficient for editing.

Before you execute this script you must load a suitable Shogun file.

//Script timer------------------------------------
int $sysTimeStart = `getSystemTime`;
int $sysTimeEnd;
string $sysTimeString = (`formatTime $sysTimeStart`);
print ("Script started on " + $sysTimeString);
//Script timer------------------------------------
// Insert a nested script or specific script commands below
selectByType Marker;
selectProperty Translation;
selectRange -all;
fillGaps -all;
filter 0.1 35;
//Script timer End---------------------------------
print ("Script started " + $sysTimeString);
$sysTimeEnd = `getSystemTime`;
$sysTimeString = (`formatTime $sysTimeEnd`);
print ("Script ended " + $sysTimeString);
//Script timer End---------------------------------

Determine which executable file is running

The following code shows you how to return the name of the executable file you are running (ShogunPost.exe). You can then pass the results to another script that requires it.

string $str = `appInfo "exepath"`;
string $name = `getFileTitle( str )`;