v5.0
値がパラメータによってサポートされている場合は True を戻します。たとえば、シェーダの多くは siTextureSpaceParameterType の入力型パラメータを持ちますが(Shader.GetShaderInputType を参照)、サポートされるのは頂点カラーの Property オブジェクトのみです。このメソッドはプロパティの名前または実際のプロパティ本体を渡すことができます。
Boolean Parameter.IsSupportedInstanceValue( Object in_obj, Object ); |
oBoolean = Parameter.IsSupportedInstanceValue( Object, Value ); |
/* This example demonstrates how to set a map lookup shader on a parameter and then test it for supported maps */ NewScene( null, false ); // Create a grid with a map lookup shader var root = Application.ActiveProject.ActiveScene.Root; var grid = root.AddGeometry( "Grid", "MeshSurface" ); BlendInPresets( "Image", grid, 1, false ); CreateProjection( grid, siTxtSpherical, siTxtDefaultSpherical, "TxtSupport", "TxtProjection" ); var filename = Application.InstallationPath( siFactoryPath ) + "\\Data\\XSI_SAMPLES\\Pictures\\xsilogo.jpg"; var imageclip = CreateImageClip( filename, "XSILogo" ); var mat = grid.Material; var shaders = mat.FindShaders( siShaderFilter ); var textureshader = shaders("Image"); var txtparam = textureshader.Parameters("tspace_id"); // Don't want to deal with cluster to find UVW prop txtparam.SetInstanceValue( grid, "TxtProjection" ); var txtuvw = txtparam.GetInstanceValue( grid, true ); // true == bind to object var cav = grid.ActivePrimitive.Geometry.AddVertexColor(); var weightmap = CreateWeightMap( "WeightMap", grid, "Weight_Map" )(0); var txtmap = Create2DMap( grid, "Texture_Map", siDefaultPropagation )(0); txtmap.Parameters("ImageClipName").Value = imageclip.Name; txtmap.Parameters("UVReference").SetInstanceValue( grid, txtuvw ); var polycls = grid.ActivePrimitive.Geometry.AddCluster( siPolygonCluster,"RenderMapCluster" ); var rendermap = polycls.AddProperty( "RenderMap" ); // Replace image shader with map lookup var ambient_blend = shaders("ambient_blend"); var maplookup = ambient_blend.Parameters("color1").ConnectFromProgID( "Softimage.map_lookup_color" ); var mapparam = maplookup.Parameters("map"); // Setup maps array var maps = Array( weightmap, cav, txtuvw, txtmap, rendermap ); // Test map lookup shader for supported maps for ( var i = 0; i < maps.length; i++ ) { if ( mapparam.IsSupportedInstanceValue( grid, maps[i] ) ) { Application.LogMessage( mapparam.FullName + " parameter supports objects of "+ maps[i].Type ); } else { Application.LogMessage( mapparam.FullName + " parameter does not supports objects of "+ maps[i].Type ); } } // Expected results: //INFO : grid.Scene_Material1.Phong.ambient_blend.Softimage.map parameter supports objects of wtmap //INFO : grid.Scene_Material1.Phong.ambient_blend.Softimage.map parameter supports objects of vertexcolor //INFO : grid.Scene_Material1.Phong.ambient_blend.Softimage.map parameter supports objects of uvspace //INFO : grid.Scene_Material1.Phong.ambient_blend.Softimage.map parameter supports objects of TextureProp //INFO : grid.Scene_Material1.Phong.ambient_blend.Softimage.map parameter does not supports objects of rendermap |