v1.0
プロパティ編集
プロパティ エディタにオブジェクトをロードします。
これにより、ユーザはオブジェクトのパラメータをインタラクティブに参照および編集できます。 Mode パラメータに siModal
モードを使用することで、ユーザとやり取りができます(ダイアログ ボックスのように)。以下の最初の例に示します。
プロパティ ページには、一度に複数のオブジェクトを表示できます。 オブジェクトのタイプが異なる場合には、順々に表示されます。
たとえば、球を調べる際には X3DObject、プリミティブ、オペレータがこの順で表示されます。
一方、同じタイプのオブジェクトの場合には、「マルチ」モードで表示されます。
このモードは、多数のオブジェクトのパラメータを同時に変更する際に便利です。 以下の例は、両方の場合を扱っています。
通常、あるオブジェクトを調べると、そのオブジェクトにネストされているオブジェクトも同じフレームで検査されます。
キーワードのリストを使用して、ネストされたオブジェクトの検査対象を制限することができます。 たとえば、Keyword パラメータに
siAnimationKeyword を指定すると、Animation プロパティのセットのみを表示することができます。
oReturn = InspectObj( [InputObjs], [Keywords], [Title], [Mode], [Throw] ); |
コマンドがキャンセルされ、Throw 引数が False に設定されている場合には True を戻します。 コマンドがキャンセルされ、Throw 引数が指定されていない(または True に設定されている)場合には、コマンドはエラーを発行します。 それ以外の場合には False を戻します。
| パラメータ | タイプ | 詳細 |
|---|---|---|
| InputObjs | 文字列 | 調べるオブジェクトのリスト。
デフォルト値: 現在選択されている値 注: 選択されている値に複数のオブジェクトが含まれている場合は、最初のオブジェクトのみが表示されます。 |
| Keywords | Keywords | 指定のオブジェクトに対して、表示するプロパティ セット(Animation、Hair、IK、Deform など)を指定します。
デフォルト値:""(現在のマーキングを消去) |
| Title | 文字列 | プロパティ エディタ ダイアログのタイトル。 注:
ModeパラメータにsiModeを使用する場合、ここで使用するタイトルは、プロパティエディタにのみ表示されます。
デフォルト値:入力オブジェクトの名前から作成されます。 |
| Mode | siInspectMode | ダイアログがロック、リサイクル、フォーカス、モーダルであるかどうかを指定します。
デフォルト値: siRecycle |
| Throw | ブール | コマンドがキャンセルされたときにエラーを発行する場合には True。 注: この引数がFalseに設定され、ユーザがコマンドをキャンセルすると、コマンドはエラーを発行せずにTrueを戻します。 デフォルト値: True |
'
' In modal mode, a property editor has Ok and Cancel buttons.
' Here's how to open a modal property editor
'
NewScene , false
On Error Resume Next
InspectObj "Light",,"Inspecting Light", siModal
' Check if user clicked Ok
if Err.Number = 0 then
LogMessage "User has pressed OK in the modal property editor"
else
LogMessage "User has pressed CANCEL in the modal property editor"
end if
' Open a property editor and lock it
InspectObj "Camera",,, siLock
LogMessage "User has opened a property editor and has locked it"
|
'
' This example demonstrates how you can inspect multiple objects on the same Property Page
'
NewScene , false
SelectObj "Scene_Root"
CreatePrim "Sphere", "MeshSurface"
'Add a custom property set and a bend operator
SIAddCustomParameter "sphere", "Param", siDouble, 0, 0, 1, , 5, 0, 1
ApplyOp "Bend", "sphere", 3, siPersistentOperation
set myPPGList = CreateObject("XSI.Collection")
myPPGList.Add "sphere.CustomPSet"
myPPGList.Add "sphere.polymsh.bendop"
'The property page will show both the custom property set and
'the bend operation.
InspectObj myPPGList
|
' ' The following uses InspectObj to inspect several properties ' in a multi-edit fashion ' NewScene , false CreatePrim "Sphere", "MeshSurface" CreatePrim "Cylinder", "MeshSurface" SelectObj "cylinder.kine.global,sphere.kine.global" InspectObj LogMessage "The global kinestate of both the sphere and the cylinder" LogMessage "are inspected together in a bulk-edit fashion" |
' Set up a sphere NewScene ,False set oSphere = CreatePrim( "Sphere", "MeshSurface" ) ' Open a general property editor InspectObj , siGeneralKeyword ' Set up a deform on the sphere ApplyOp "Bulge", oSphere, 3, siPersistentOperation ' Open the Deform property editor for the sphere InspectObj , siDeformKeyword ' Add some animation SaveKey oSphere.active SetValue "PlayControl.Key", 65 SetValue "PlayControl.Current", 65 Translate , 3.9582518712148, 3.40954109797705, -0.340954109797705, siRelative, siView, siObj, siXYZ SaveKey oSphere.active ' Open the Animation property editor for the sphere InspectObj , siAnimationKeyword |
'
' Another example demonstrating inspecting objects in multi-edit mode.
'
NewScene , false
SelectObj "Scene_Root"
set oSphere1 = CreatePrim( "Sphere", "MeshSurface", "FirstSphere")
set oSphere2 = CreatePrim( "Sphere", "MeshSurface", "SecondSphere")
set myPPGList = CreateObject("XSI.Collection")
myPPGList.Add oSphere1.Primitives(1)
myPPGList.Add oSphere2.Primitives(1)
'The property page will show just a single Radius control
'that will control both spheres
InspectObj myPPGList, "Primitive"
|
/*
This example shows how to create a temporary instance of the Self-Installed
Custom Property called "CustomColor".
*/
var oColor = XSIFactory.CreateObject( "CustomColor" )
bCancelled = InspectObj( oColor,null,"Pick your favorite color",siModal,false ) ;
if ( !bCancelled )
{
LogMessage( "You picked " + oColor.Color_R.Value + "," + oColor.Color_G.Value + "," + oColor.Color_B.Value ) ;
}
|
/*
This example demonstrates the use of the Throw argument.
When you run this script, make sure you close the dialog using
the X (close) button on the top right or the Cancel button in
the main body of the dialog.
*/
// Set up a quick dialog in a property page
NewScene( null, false );
var pset = SetUpPSet();
// Canceling here returns 'true'
var rtn1 = InspectObj( pset, "", "Throw = FALSE", siModal, false );
LogMessage( "Value returned: " + rtn1 );
// Canceling here throws an error.
try
{
var rtn2 = InspectObj( pset, "", "Throw = TRUE", siModal );
// This line is never executed if the user presses cancel
LogMessage( "Value returned: " + rtn2 );
}
catch(e)
{
LogMessage( "User cancelled" );
}
// This is a convenience function that sets up the property page apart
// from the main demo
function SetUpPSet( )
{
// Create the underlying pset
var prop = XSIFactory.CreateObject("CustomProperty");
prop.Name = "Jetsam" ;
prop.AddParameter3( "SelectOne", siFloat, 0 );
// Set up its appearance
var pout = prop.PPGLayout;
var avals = new Array(
"One", 1,
"Two", 2,
"Three", 3,
"Four", 4,
"Five", 5
);
pout.AddEnumControl( "SelectOne", avals, "", siControlCombo );
// Return the property set
return prop;
}
|