PlayControl プロパティ セットのアクセス

 
 
 

PlayControl プロパティ セットは、シーンレベルのプロパティの 1 つで、シーンの再生方法を定義します。 このプロパティ セットはシーンレベルなので、名前によって直接識別することが可能です。それ以外のネームスペースは必要ありません(たとえば、GetValue("PlayControl")のようになります)。

ヒント:

SIObject.Name または SIObject::GetName は「Play Control」(スペースあり)ですが、その SIObject.FullName または SIObject::GetFullName は「PlayControl」(スペースなし)です。この違いは重要です。このプロパティ セットにアクセスするときは、Name を使用してプロパティのリストから識別しますが、それ以外の場合は以下に示すように FullName を使用して識別するので、覚えておく必要があります。

Softimage の他のプロパティと同様に、パラメータのデータ値を直接読み取りまたは書き込みするか、Property または Property オブジェクトへのポインタを取得し、Parameter または Parameter オブジェクトを使用してデータを取得および設定できます。

パラメータ値への直接アクセス

PlayControl パラメータの値は、GetValue および SetValue コマンドを PlayControl プロパティ セットの SIObject.Name または SIObject::GetName(「PlayControl」)を使用して直接取得および設定できます。

VBScript の例: GetValue および SetValue コマンドを使用した PlayControl パラメータ値の直接アクセス

' 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
注:

C++ API は、データの読み取りと書き込みを直接行うことができる関数も提供していますが、PlayControl へのポインタは必要です。

Dictionary.GetObject を使用した PlayControl プロパティへのポインタの取得(オブジェクト モデルの場合のみ)

Dictionary.GetObject メソッドは PlayControl プロパティ セットの Name(「PlayControl」)を使用して、取得するオブジェクトを識別します。PlayControl はシーンレベルのプロパティなので、1 つのシーンに対して常に 1 つだけ存在します。そのためネームスペースは必要ありません。

Property へのポインタを取得すると、PlayControl.Parameters を使用して各 Parameter にアクセスできるようになります。 パラメータ値は、Parameter.Value プロパティを使用して取得し、設定できます。

JScript の例: Dictionary.GetObject を使用した PlayControl へのポインタの取得

// 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;

現在のプロジェクトのプロパティを使用した PlayControl プロパティへのポインタの取得

C++ API およびオブジェクト モデルの両方で、現在の(アクティブな)プロジェクト または プロジェクトからシーン レベルのプロパティのコレクションを使用してアクセスする手段を提供しています。このアプローチで大切なのは、他の方法とは違い、PlayControl プロパティ セットを SIObject.FullName または SIObject::GetFullName(「Play Control」)によって、次の例で示すように識別することです。

オブジェクト モデルを使用すると、Property へのポインタを取得した後は、PlayControl.Parameters を使用して各 Parameter にアクセスし、Parameter.Value を使用してパラメータ値を取得および設定できます。

C++ API を使用すると、Property へのポインタを取得した後は、Property クラスに対して使用可能な関数のいずれかを使用して、Parameter クラス(GetParameter または GetParameters)へのポインタの取得や、パラメータ値(GetParameterValue および PutParameterValue)の読み取りおよび書き込みができます。

Python の例: 現在のプロジェクトのプロパティを使用した Play Control へのポインタの取得

# 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 の例: 現在のプロジェクトのプロパティを使用した Play Control へのポインタの取得

// 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