MCPcopy Create free account
hub / github.com/ImageEngine/cortex / __findClassesWalk

Function __findClassesWalk

python/IECore/ParameterAlgo.py:66–101  ·  view source on GitHub ↗
( parameter, parameterPath, uiPath, classTypeFilter, classNameFilter, result )

Source from the content-addressed store, hash-verified

64 return result
65
66def __findClassesWalk( parameter, parameterPath, uiPath, classTypeFilter, classNameFilter, result ) :
67
68 if isinstance( parameter, IECore.ClassParameter ) :
69 cl = parameter.getClass()
70 if cl and isinstance( cl, classTypeFilter ) and classNameFilter.match( cl.path ) :
71 result.append(
72 {
73 "parent" : parameter,
74 "parameterPath" : parameterPath,
75 "uiPath" : uiPath,
76 "classInstance" : cl
77 }
78 )
79 elif isinstance( parameter, IECore.ClassVectorParameter ) :
80 cls = parameter.getClasses( True )
81 for cl in cls :
82 if isinstance( cl[0], classTypeFilter ) and classNameFilter.match( cl[0].path ) :
83
84 label = cl[1]
85 if cl[0].parameters().has_key( "label" ) :
86 label = cl[0]["label"].getTypedValue()
87
88 result.append(
89 {
90 "parent" : parameter,
91 "parameterPath" : parameterPath + [ cl[1] ],
92 "uiPath" : uiPath + [ label ],
93 "classInstance" : cl[0]
94 }
95 )
96
97 if isinstance( parameter, IECore.CompoundParameter ) :
98 for n, p in parameter.items() :
99 newParameterPath = parameterPath[:] + [ n ]
100 newUIPath = parameterPath[:] + [ n ]
101 __findClassesWalk( p, newParameterPath, newUIPath, classTypeFilter, classNameFilter, result )
102
103## Recurses down from srcParameter and dstParameter simultaneously, syncing the dstParameter tree to
104# srcParameter by making sure the ClassParameters and ClassVectorParameters there hold instances of the same classes

Callers 1

findClassesFunction · 0.85

Calls 7

matchMethod · 0.80
appendMethod · 0.80
getClassesMethod · 0.80
has_keyMethod · 0.80
getClassMethod · 0.45
parametersMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected