Object Hierarchy | 関連する C++クラス:ProxyParameter
ProxyParameter
v3.0
Proxyパラメータは、シーン内の他の場所にある他のパラメータのクローンとして機能します。シーン Explorer ではプロキシパラメータがイタリック体で表示されるため、識別できます。プロキシパラメータは、CustomProperty.AddProxyParameterを呼び出して、作成します。プロキシパラメータは、元のパラメータと同じ範囲とUI範囲を所有します。EditParameterDefinitionを呼び出して、新しいUI範囲を指定することが可能ですが、実際の範囲は変更できません。
'
' Proxy Parameters are a useful way to centralize parameters from
' different objects on the same property, or even to build a simplified
' version of a property page.
'
' This example demonstrates creation of a custom property set
' that only shows a few items of the Shader that it controls,
' but maintains a pleasing layout.
'
g_Logic = _
"sub Enable_OnChanged()" & vbCrLf & _
" bEnable = PPG.Enable.Value" & vbCrLf & _
" 'To disable the color control we just disable the proxy" & vbCrLf & _
" ' parameter representing the ""red"" component" & vbCrLf & _
" PPG.Ambient.Enable bEnable " & vbCrLf & _
" PPG.Diffuse.Enable bEnable " & vbCrLf & _
"end sub" & vbCrLf
NewScene , false
set oSphere = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface" )
oSphere.AddMaterial "Phong"
set oPhongShader = oSphere.Material.Shaders(0)
' This is a Boolean for enabling diffuse
set oDiffuseEnable = oPhongShader.Parameters( "diffuse_inuse" )
' These are CompoundParameters, each with R,G,B sub-parameters
set oAmbientParam = oPhongShader.Parameters( "ambient" )
set oDiffuseParam = oPhongShader.Parameters( "diffuse" )
set oCustomProperty = oSphere.AddProperty("CustomProperty",false,"Proxies")
' We specify a name to avoid having a long one like "sphere_Material_Phong_diffuse_inuse"
oCustomProperty.AddProxyParameter oDiffuseEnable, "Enable", "Enable"
oCustomProperty.AddProxyParameter oDiffuseParam.Parameters("red"), "Diffuse", "Diffuse"
oCustomProperty.AddProxyParameter oDiffuseParam.Parameters("green")
oCustomProperty.AddProxyParameter oDiffuseParam.Parameters("blue")
oCustomProperty.AddProxyParameter oAmbientParam.Parameters("red"), "Ambient", "Ambient"
oCustomProperty.AddProxyParameter oAmbientParam.Parameters("green")
oCustomProperty.AddProxyParameter oAmbientParam.Parameters("blue")
' If we inspect the object now we would see 6 separate sliders,
' each controlling a different component of the colors
' We can create a custom layout to clean up the display
set oLayout = oCustomProperty.PPGLayout
oLayout.AddGroup "Phong Diffuse"
oLayout.AddItem "Enable"
' Just for fun, show the ambient before the diffuse, which
' is the opposite of the normal Phong Property Page
oLayout.AddColor "Ambient", "Ambient", false
oLayout.AddColor "Diffuse", "Diffuse", false
oLayout.EndGroup
oLayout.Logic = g_Logic
oLayout.Language = "VBScript"
' Show both dialogs. You will see that both items
' are identical.
InspectObj oCustomProperty, , , siLock
InspectObj oPhongShader, , , siLock
|