Accessing the PlayControl Property Set
 
 
 

The PlayControl property set is one of the scene-level properties; that is, it remembers how you want the scene to play back. Because it is scene-level, it can be identified by name directly, it does not need any other namespace (for example, GetValue("PlayControl")).

Tip

The SIObject.Name or SIObject::GetName of the PlayControl property set is "Play Control" (with space) but its SIObject.FullName or SIObject::GetFullName is "PlayControl" (without space). This distinction is important to remember when you are trying to access it because you use the Name to identify it from the list of properties but you use the FullName otherwise as explained below.

Like other properties in Softimage, you can either read and write its parameter data values directly or get a pointer to the Property or Property object and then use the Parameter or Parameter object to get and set data.

Accessing Parameter Values Directly

You can get and set PlayControl parameter values directly using the GetValue and SetValue commands using the SIObject.Name or SIObject::GetName ("PlayControl") of the PlayControl property set.

VBScript Example: Accessing a PlayControl Parameter Value Directly Using the GetValue and SetValue Commands

' VBScript (command access)
dim near_dist
near_dist = GetValue( "PlayControl.NearDist" ) ' GetValue only returns data values for Parameters
' Double the distance threshold value
SetValue "PlayControl.NearDist", near_dist*2
Note

The C++ API also provides functions that read and write data values directly, but you still need a pointer to the PlayControl property first.

Getting a Pointer to the PlayControl Property via Dictionary.GetObject (OM Only)

The Dictionary.GetObject method uses the Name ("PlayControl") of the PlayControl property set to identify which object to get. Because PlayControl is a scene-level property, there is always only one per scene, so there is no namespace needed.

Once you have a pointer to the Property you can use PlayControl.Parameters to access each Parameter. You can get and set parameter values using the Parameter.Value property.

JScript Example: Getting a Pointer to PlayControl via Dictionary.GetObject

// JScript (object model access)
var remote_control = Dictionary.GetObject( "PlayControl" );
var curr_frame = remote_control.Parameters( "Current" ); ' Dictionary.GetObject returns a pointer to the specified Parameter

// Find out what the current frame is
Application.LogMessage( "Current frame: " + curr_frame.Value );

// Go to frame 10, and then the last frame
curr_frame.Value = 10.0;
curr_frame.Value = remote_control.Parameters( "Out" ).Value;

Getting a Pointer to the PlayControl Property via the Current Project's Properties

Both the C++ API and the object model provide access via the collection of scene-level properties from the current (active) project or project. The trick with this approach is that, unlike the other strategies, you identify the PlayControl property set by its SIObject.FullName or SIObject::GetFullName ("Play Control"), as the examples below demonstrate.

Using the object model, once you have a pointer to the Property you can use PlayControl.Parameters to access each Parameter and then get and set parameter values using the Parameter.Value property.

Using the C++ API, once you have a pointer to the Property you can use any of the functions available to the Property class to get a pointer to the Parameter class (GetParameter or GetParameters) or read and write parameter values (GetParameterValue and PutParameterValue).

Python Example: Getting a Pointer to Play Control via the Current Project's Properties

# Get the current project
app = Application
prj = app.ActiveProject

# The PlayControl property set is stored with scene data under the project
proplist = prj.Properties
playctrl = proplist("Play Control")

# Remember that the fullname of PlayControl is different from its name:
app.LogMessage( "PlayControl's Name: " + playctrl.Name );
app.LogMessage( "PlayControl's FullName: " + playctrl.FullName );

# Expected result
#INFO : PlayControl's Name: Play Control
#INFO : PlayControl's FullName: PlayControl

C++ API Example: Getting a Pointer to Play Control via the Current Project's Properties

// Get the current project
Application app;
Project prj = app.GetActiveProject();

// The PlayControl property set is stored with scene data under the project
CRefArray proplist = prj.GetProperties();
Property playctrl( proplist.GetItem(L"Play Control") );

// Remember that the fullname of PlayControl is different from its name:
app.LogMessage( L"PlayControl's Name: " + playctrl.GetName() );
app.LogMessage( L"PlayControl's FullName: " + playctrl.GetFullName() );

// Expected result
//INFO : PlayControl's Name: Play Control
//INFO : PlayControl's FullName: PlayControl