Good stuff Alan. Thanks for the tip. Must not be reading the docs as thoroughly as I should. :)
-------------------------------------------- Eric Thivierge http://www.ethivierge.com On Mon, Jul 30, 2012 at 8:33 AM, Alan Fregtman <[email protected]>wrote: > If you ever looked at how to parse the operator stack you must've seen the > doc page for *ConstructionHistory*: > > http://download.autodesk.com/global/docs/softimage2012/en_us/sdkguide/index.html?url=si_om/ConstructionHistory.html,topicNumber=si_om_ConstructionHistory_html > > Third paragraph under Description: > *"The construction history is one example of the more general concept of > "Connection Stack", see > DataRepository.GetConnectionStackInfo<http://download.autodesk.com/global/docs/softimage2012/en_us/sdkguide/si_om/DataRepository.GetConnectionStackInfo.html> > for > details."* > > > > On Sun, Jul 29, 2012 at 6:02 PM, Eric Thivierge <[email protected]>wrote: > >> Black magic! I've never even heard of that object. :( >> >> -------------------------------------------- >> Eric Thivierge >> http://www.ethivierge.com >> >> >> On Mon, Jul 30, 2012 at 7:32 AM, Alan Fregtman >> <[email protected]>wrote: >> >>> Hey guys, >>> >>> *You're all forgetting the ConnectionStack.* It tells you what's >>> connected under the hood. *No need to scan through all expressions in >>> the scene!* >>> >>> >>> import xml.etree.ElementTree as ET >>> def getExpressionsDrivenByParameter( param ): >>> stack = XSIUtils.DataRepository.GetConnectionStackInfo(param) >>> >>> expressions = XSIFactory.CreateObject('XSI.Collection') >>> xml = ET.fromstring(stack) >>> for conn in xml.findall('connection'): >>> if conn.find('type').text == 'out': >>> item = conn.find('object').text >>> if item.endswith('.Expression'): >>> expressions.AddItems(item) >>> >>> return expressions >>> >>> >>> >>> It took 4.5s on my laptop to find 10,752 expressions that were pointing >>> to one single parameter. Fast enough for ya? :) -- In a less ludicrous use >>> case, it's pretty much instant. >>> >>> -- Alan >>> >>> >>> >>> On Sat, Jul 28, 2012 at 11:51 AM, Alok Gandhi <[email protected] >>> > wrote: >>> >>>> Hi Jeremy, >>>> >>>> I missed this first time but to make it more elegant you (not a speed >>>> up) you can even do: >>>> def getExpressionsDrivenByParameter( param ): >>>> return PARAM_EXPR_DICT.get(param.FullName) >>>> >>>> which is exactly the same as before but cleaner code, >>>> >>> >>> >> >

