v5.1
オブジェクトから読み書きされるオブジェクトについての xML フォーマットの情報を戻します。接続スタックは、プリミティブでは ConstructionHistory と呼ばれています。
接続スタックにはへの接続 Operator、FCurve、および Shader とその他のオブジェクトを含むことができるので、単なる「オペレータスタック」以上の役目を果たします。接続スタックのオブジェクトの順序は、評価するシーンの順序を決定するので重要です。たとえば、スクリプトオペレータが、プリミティブに対して読み書きするデフォームオペレータの上のプリミティブから読み取る場合は、元のバージョンではなく、ジオメトリのデフォームバージョンを読み取ります。
このメソッドは、非表示オブジェクトの存在を含むローレベルの情報を戻します(つまり、Softimage での内部使用のために用意されています)。このメソッドは、主として CustomOperator の書き出しおよびデバッグに役立つように、SDK で公開されます。
XML フォーマットは、将来変更されることがあります。 現在、次の属性を戻します。
オブジェクト: オブジェクトの SIObject.FullName。アクティブな接続がない場合は空になります。
type:"in"または"out"。"in"の場合は、クエリされているオブジェクトが接続オブジェクトからデータを読み取ります。
localparameter:特定の Parameter に対して読み書きする一部の接続。この場合は、Parameter.ScriptNameが含まれます。
remoteparameter:接続されているオブジェクトの特定のパラメータに対して接続される場合は、Parameter.ScriptName が含まれます。
hidden:オブジェクトが siNotInspectable 機能を持つ場合は"true"です。ProjectItem.Capabilities を参照してください。
region:内部でのみ使用されます。
datacopy:内部でのみ使用されます。この属性は、オブジェクトへの内部ハンドルです("0x1c9f0448"など)。このハンドルの値は、SDKでは特に意味を持ちません。Softimage は、シーンのクリーン評価をアシストするために、個々のオブジェクトの一時的な"datacopies"を複数作成することがあります。
String DataRepository.GetConnectionStackInfo( Object in_object ); |
oString = DataRepository.GetConnectionStackInfo( Object ); |
XMLString。接続が上から下に並んで表示されます。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Object | Softimage オブジェクト | Property、Primitive などのクエリするオブジェクト。接続は Parameter レベルではなく、オブジェクトレベルで管理されます。 |
/*
This example demonstrates how to use DataRepository.GetConnectionStackInfo
to find which objects read from a particular object.
*/
NewScene( null, false ) ;
CreatePrim( "Sphere", "MeshSurface" );
ApplyOp( "Twist", "sphere", 3, siPersistentOperation, null, 0 );
SetSelFilter( "Vertex" );
AddToSelection( "sphere.pnt[26,33]", null, true );
Translate( null, 1, 0.2, -1.2, siRelative, siView, siObj, siXYZ );
SelectObj( "Sphere.polymsh" ) ;
// Get the connection information
var oDR = XSIUtils.DataRepository ;
opInfo = oDR.GetConnectionStackInfo( Selection(0) )
// This line would dump the actual XML content:
//Application.LogMessage( "\n----------------\nRAW XML OUTPUT\n------------------\n" + opInfo ) ;
// Get the list of output objects
aOutputs = GetOutputObjects( opInfo ) ;
Application.LogMessage( "Objects that read from the Sphere primitive:\n" + aOutputs.join("\n") ) ;
// Helper function to load the XML data using the Microsoft
// implementation of the DOM (see msdn.microsoft.com for documentation)
function ParseXML( strXML )
{
var oXMLParser = new ActiveXObject( "Microsoft.XMLDOM" )
oXMLParser.async = false
oXMLParser.loadXML( opInfo ) ;
if (oXMLParser.parseError.errorCode != 0)
{
Application.LogMessage( "Invalid XML " + oXMLParser.parseError.reason , siError ) ;
return null ;
}
// the xsi_file node
// If this is NULL we must have failed to load the XML
var oTopNode = oXMLParser.documentElement ;
return oTopNode ;
}
// Go through the connection information and determine which connected
// operators/objects are reading from the object
//
// opInfo is the XML string returned by calling DataRespository.GetOperatorStackInfo
function GetOutputObjects( opInfo )
{
aOutputs = new Array() ;
var oTopNode = ParseXML( opInfo ) ;
if ( oTopNode == null )
return aOutputs ;
var oConnections = oTopNode.childNodes ;
for ( var i = 0 ; i < oConnections.length ; i++ )
{
oConnection= oConnections.item(i) ;
oObjNode = oConnection.selectSingleNode( "object" ) ;
strObj = oObjNode.text ;
oTypeNode = oConnection.selectSingleNode( "type" ) ;
if ( oTypeNode != null && oTypeNode.text == "out" )
aOutputs[aOutputs.length] = strObj ;
}
return aOutputs ;
}
//Example output:
//
//INFO : Objects that read from the Sphere primitive:
//sphere.polymsh.secondaryshapemarker
//sphere.polymsh.animationmarker
//sphere.polymsh.shapemarker
//sphere.polymsh.modelingmarker
//sphere.polymsh.movecomponentop
//sphere.polymsh.cls.Point_INTERNAL.AddToClsOp
//sphere.polymsh.twistop
//sphere.polymsh.cls.default_Point.SetClsOp |
/*
This example demonstrates how to use DataRepository.GetConnectionStackInfo
to find which objects are influenced by a parameter.
*/
// Create simple scene
NewScene( null, false );
var oSphere = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface", "sphere" ) ;
var oSphereGlobalPosx = oSphere.Kinematics.Global.posx ;
// posy parameter on light will be driven by posx parameter of the sphere.
// (This creates an Expression object between the two parameters)
CopyPaste( oSphereGlobalPosx, null, "light.kine.global.posy", 1 );
// posz parameter will also be driven by the posx parameter
CopyPaste( oSphereGlobalPosx, null, "light.kine.global.posz", 1 );
aDependentData = FindDataDrivenByParameter( oSphereGlobalPosx )
for ( var i = 0 ; i < aDependentData.length ; i++ )
{
Application.LogMessage( aDependentData[i] ) ;
}
// Get the connection information for a particular parameter. It returns an
// array of strings with the full name of the expression operator or other
// object that is reading the value of the in_Parameter argument
function FindDataDrivenByParameter( in_Parameter )
{
var aConnections = [] ;
// Connection information is managed at the Object level, not Parameter level
var oObj = in_Parameter.Parent ;
var oDR = XSIUtils.DataRepository ;
opInfo = oDR.GetConnectionStackInfo( oObj )
var oXMLParser = new ActiveXObject( "Microsoft.XMLDOM" )
oXMLParser.async = false
oXMLParser.loadXML( opInfo ) ;
var oTopNode = oXMLParser.documentElement ;
var oConnections = oTopNode.childNodes ;
for ( var i = 0 ; i < oConnections.length ; i++ )
{
var oConnection = oConnections(i) ;
oObjNode = oConnection.selectSingleNode( "object" ) ;
if ( oObjNode == null )
continue ; // Not connected to anything
// See if this is a connection to the parameter we are interested in
oParameterNode = oConnection.selectSingleNode( "localparameter" ) ;
if ( oParameterNode != null )
{
strConnectedParameter = oParameterNode.text ;
if ( strConnectedParameter == in_Parameter.ScriptName )
{
// Found a connection to this parameter
strType = oConnection.selectSingleNode( "type" ).text ;
if ( strType == "out" )
{
aConnections[aConnections.length] =oObjNode.text
}
// Tip if the type was "in" then it means that the connection is controlling the
// value of this parameter, e.g. a FCurve, expression, operator. This information
// can also be retrieved with Parameter.Source
}
}
}
return aConnections ;
}
//Output of this example:
//INFO : light.kine.global.pos.posz.Expression
//INFO : light.kine.global.Expression |