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

Method setClass

python/IECore/ClassParameter.py:65–87  ·  view source on GitHub ↗
( self, className, classVersion, searchPathEnvVar=None )

Source from the content-addressed store, hash-verified

63 ## Sets the class being held. The specified class is loaded using a ClassLoader and
64 # the class' parameters are added to this parameter as children.
65 def setClass( self, className, classVersion, searchPathEnvVar=None ) :
66
67 searchPathToUse = searchPathEnvVar if searchPathEnvVar is not None else self.__searchPathEnvVar
68
69 if ( className, classVersion, searchPathToUse ) == ( self.__className, self.__classVersion, self.__searchPathEnvVar ) :
70 return
71
72 self.__classInstance = None
73 self.clearParameters()
74
75 if className!="" :
76
77 loader = IECore.ClassLoader.defaultLoader( searchPathToUse )
78
79 self.__classInstance = loader.load( className, classVersion )()
80
81 self.addParameters(
82 self.__classInstance.parameters().values()
83 )
84
85 self.__className = className
86 self.__classVersion = classVersion
87 self.__searchPathEnvVar = searchPathToUse
88
89 @staticmethod
90 def _serialise( parameter, value ) :

Callers 11

__init__Method · 0.95
testSetClassMethod · 0.95
testSetNoClassMethod · 0.95
testSerialiseAndParseMethod · 0.95
_parseMethod · 0.45
copyClassesFunction · 0.45
_applyClassParameterMethod · 0.45
_applyClassVectorMethod · 0.45
_addClassToVectorMethod · 0.45
testFindClassesMethod · 0.45
testCopyClassesMethod · 0.45

Calls 6

clearParametersMethod · 0.80
defaultLoaderMethod · 0.80
addParametersMethod · 0.80
loadMethod · 0.45
valuesMethod · 0.45
parametersMethod · 0.45

Tested by 5

testSetClassMethod · 0.76
testSetNoClassMethod · 0.76
testSerialiseAndParseMethod · 0.76
testFindClassesMethod · 0.36
testCopyClassesMethod · 0.36