Python Example: Using Tuples to Access Output Arguments from a Method

 
 
 

This example demonstrates how to use Python tuples to access output arguments for methods.

app = Application
app.NewScene( "", 0 )

root = app.ActiveSceneRoot
grid = root.AddGeometry( "Cube", "MeshSurface" )

mat = grid.AddMaterial()
surface = mat.Parameters("Surface")
app.LogMessage( "basic source: " + surface.Source.FullName )

# Initialize the output variable
prevsrc = 0
blinn, prevsrc = surface.ConnectFromFile( "$SI_HOME\Data\DSPresets\Shaders\Material\Blinn.Preset", prevsrc )
app.LogMessage( "new source: " + blinn.FullName )
app.LogMessage( "old source: " + prevsrc.FullName )

# Output:
# INFO : basic source: cube.Scene_Material.Phong
# INFO : new source: cube.Scene_Material1.Blinn
# INFO : old source: cube.Scene_Material1.Phong

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License