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,
>