# Convenience printing
def BrowseValueMap( in_map ) :
aNames = in_map.Names
aValues = in_map.Values
if (len(aNames) < 1) :
return
Application.LogMessage("------------")
i = 0
while i < len(aNames) :
Application.LogMessage(aNames[i] + ", " + str(aValues[i]))
i = i + 1
Application.LogMessage(" ")
#
# This example demonstrates how to set, modify, and remove
# values on a RendererOptions ValueMap (defined on the fly)
#
app = Application
oShaderDef = XSIFactory.CreateShaderDef("baddog", "mr_piddles", 1, 0)
oRendererDef = oShaderDef.AddRendererDef("kitchensink")
# Add new values and print the list
oRendererDef.RendererOptions.Set("bowl", 1)
oRendererDef.RendererOptions.Set("cherries", 200)
oRendererDef.RendererOptions.Set("pits", 1)
Application.LogMessage("After initially adding entries...")
BrowseValueMap(oRendererDef.RendererOptions)
# Remove one value and reprint
oRendererDef.RendererOptions.Remove("cherries")
Application.LogMessage("After removing cherries...")
BrowseValueMap(oRendererDef.RendererOptions)
# Add a new value and modify an existing one and reprint again
oRendererDef.RendererOptions.Set("plums", 10)
oRendererDef.RendererOptions.Set("pits", 0)
Application.LogMessage("After setting more values...")
BrowseValueMap(oRendererDef.RendererOptions)
# INFO : After initially adding entries...
# INFO : ------------
# INFO : bowl, 1
# INFO : cherries, 200
# INFO : pits, 1
# INFO :
# INFO : After removing cherries...
# INFO : ------------
# INFO : bowl, 1
# INFO : pits, 1
# INFO :
# INFO : After setting more values...
# INFO : ------------
# INFO : bowl, 1
# INFO : pits, 0
# INFO : plums, 10
# INFO :
|