Difference between revisions of "Motive Batch Processor"

(Created page with "===Introduction=== The Motive Batch Processor is a Windows application that applies a function, in the form of an IronPython or C# script file, to a set of selected Take files...")
 
Line 15: Line 15:
 
<code>Result ProcessTake( Take t, ProgressIndicator progress )</code>.
 
<code>Result ProcessTake( Take t, ProgressIndicator progress )</code>.
  
<code>Result, Take, and ProgressIndicator</code> are all classes defined in the <code>NMotive</code> namespace. The Take object <code>t</code> is an instance of the NMotive <code>Take</code> class. It is the take being processed. The <code>progress</codee> object is an instance of the NMotive ProgressIndicator and allows the script to update the Batch Processor UI with progress and messages. The general format of an Batch Processor C# script is:
+
<code>Result, Take, and ProgressIndicator</code> are all classes defined in the <code>NMotive</code> namespace. The Take object <code>t</code> is an instance of the NMotive <code>Take</code> class. It is the take being processed. The <code>progress</code> object is an instance of the NMotive ProgressIndicator and allows the script to update the Batch Processor UI with progress and messages. The general format of an Batch Processor C# script is:
  
 
<code>
 
<code>
using NMotive;
+
  using NMotive;
// any other using statements
+
  // any other using statements
public class MyCSharpScript : ITakeProcessingScript
+
  public class MyCSharpScript : ITakeProcessingScript
{
+
  public Result ProcessTake(Take t, ProgressIndicator progress)
+
 
   {
 
   {
       Result scriptResult;
+
       public Result ProcessTake(Take t, ProgressIndicator progress)
      // Script processing code here
+
      {
      progress.SetMessage(“Done processing take “ + t.Name);
+
        Result scriptResult;
      progress.SetProgress( 100 );
+
        // Script processing code here
      return scriptResult;
+
        progress.SetMessage(“Done processing take “ + t.Name);
 +
        progress.SetProgress( 100 );
 +
        return scriptResult;
 +
      }
 
   }
 
   }
}</code>
+
</code>

Revision as of 22:35, 16 October 2014

Introduction

The Motive Batch Processor is a Windows application that applies a function, in the form of an IronPython or C# script file, to a set of selected Take files. The Batch Processor includes some example script files but, in general, you must write your own. Scripts make use of the NMotive .NET class library. Note that you can also use the NMotive classes to write .NET programs and IronPython scripts that run outside of the Batch Processor. The NMotive assembly installed in the Global Assembly Cache and also located in the assemblies sub-directory of the Motive install directory. For example, the default location for the assembly included in the 64-bit Motive installer is:

C:\Program Files\OptiTrack\Motive\assemblies\x64

A class reference in Microsoft compiled HTML format can be found in the Help sum-directory of the the Motive install directory. For example the default location for the help file is (64-bit Motive installer): C:\Program Files\OptiTrack\Motive\Help\NMotiveAPI.chm

C# Scripts

Motive Batch Processor can run C# and IronPython scripts. Here we describe the C# script format and give an example.

C# Script Format

A valid Batch Processor C# script file must contain a single class implementing the ItakeProcessingScript interface. This interface defines a single function -

Result ProcessTake( Take t, ProgressIndicator progress ).

Result, Take, and ProgressIndicator are all classes defined in the NMotive namespace. The Take object t is an instance of the NMotive Take class. It is the take being processed. The progress object is an instance of the NMotive ProgressIndicator and allows the script to update the Batch Processor UI with progress and messages. The general format of an Batch Processor C# script is:

  using NMotive;
  // any other using statements
  public class MyCSharpScript : ITakeProcessingScript
  {
     public Result ProcessTake(Take t, ProgressIndicator progress)
     {
        Result scriptResult;
        // Script processing code here
        progress.SetMessage(“Done processing take “ + t.Name);
        progress.SetProgress( 100 );
        return scriptResult;
     }
  }