# # Softimage 2013 SP1 Python snippet # from sipyutils import si # win32com.client.Dispatch('XSI.Application') from sipyutils import siut # win32com.client.Dispatch('XSI.Utils') from sipyutils import siui # win32com.client.Dispatch('XSI.UIToolkit') from sipyutils import simath # win32com.client.Dispatch('XSI.Math') from sipyutils import log # LogMessage from sipyutils import disp # win32com.client.Dispatch from sipyutils import C # win32com.client.constants si=si() siut=siut() from xml.etree import ElementTree as ET def getExpressionsDrivenByLocalParameter( obj, param="posx" ): stack = siut.DataRepository.GetConnectionStackInfo( obj.Parameters(param) ) # print stack expressions = XSIFactory.CreateObject("XSI.Collection") expressions.Unique = True xmlRoot = ET.fromstring(stack) for xmlCnx in xmlRoot.findall('connection'): if xmlCnx.find('type').text == 'out' and xmlCnx.find('localparameter') is not None and xmlCnx.find('localparameter').text == param: item = xmlCnx.find('object').text if item.endswith('.Expression'): expressions.AddItems(item) return expressions # Create an expression where the Scene Material diffuse red drives the diffuse red of a Lambert shader Application.SetExpr("Sources.Materials.DefaultLib.Lambert.Lambert.diffuse.red", "Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse.red") x = getExpressionsDrivenByLocalParameter( si.Dictionary.GetObject("Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse"), param="red" ) log( x ) # INFO : Sources.Materials.DefaultLib.Lambert.Lambert.diffuse.red.Expression
Reference and credits: