Cortex
10.0.0-a4
|
Implements a Preset to permit values to be saved and restored from a Parameterised object. More...
Public Member Functions | |
def | __init__ |
The constructor is essentially in two forms: More... | |
def | metadata (self) |
def | applicableTo (self, parameterised, rootParameter) |
def | __call__ |
def | save |
This method will save the specified parameters to disk in such a was as can be loaded by the IECore.ClassLoader. More... | |
![]() | |
def | __init__ |
def | metadata (self) |
def | applicableTo (self, parameterised, rootParameter) |
def | __call__ (self, parameterised, rootParameter) |
Applies the preset to the specified parameterised and root parameter. More... | |
![]() | |
IE_CORE_DECLARERUNTIMETYPED (Parameterised, RunTimeTyped) | |
Parameterised (const std::string &description) | |
Parameterised (const std::string &description, CompoundParameterPtr compoundParameter) | |
Another constructor added later on that gives defines the CompoundParameter object to be hold in this Parameterised instance. | |
const std::string & | description () const |
Returns a description for this parameterised object. | |
CompoundParameter * | parameters () override |
const CompoundParameter * | parameters () const override |
Returns the parameters for query. | |
CompoundObject * | userData () |
Returns an object that anyone can use for storing anything. | |
const CompoundObject * | userData () const |
Read only version of the above. | |
![]() | |
IE_CORE_DECLAREMEMBERPTR (RunTimeTyped) | |
virtual TypeId | typeId () const |
virtual const char * | typeName () const |
virtual bool | isInstanceOf (TypeId typeId) const |
virtual bool | isInstanceOf (const char *typeName) const |
![]() | |
IE_CORE_DECLAREMEMBERPTR (RefCounted) | |
void | addRef () const |
Add a reference to the current object. | |
void | removeRef () const |
Remove a reference from the current object. | |
RefCount | refCount () const |
Returns the current reference count. | |
Additional Inherited Members | |
![]() | |
typedef RefCounted | BaseClass |
A typedef for the class this class derives from. All RunTimeTyped classes define this typedef. | |
![]() | |
typedef size_t | RefCount |
![]() | |
static TypeId | staticTypeId () |
Returns the TypeId for this class, without needing an instance. | |
static const char * | staticTypeName () |
Returns the type name for this class, without needing an instance. | |
static TypeId | baseTypeId () |
static const char * | baseTypeName () |
static bool | inheritsFrom (TypeId typeId) |
Returns true if this class inherits from the specified type. | |
static bool | inheritsFrom (const char *typeName) |
Returns true if this class inherits from the specified type. | |
static bool | inheritsFrom (TypeId type, TypeId baseType) |
Returns true if type inherits from baseType. | |
static bool | inheritsFrom (const char *typeName, const char *baseTypeName) |
Returns true if typeName inherits from baseTypeName. | |
static TypeId | baseTypeId (TypeId typeId) |
Returns the base type of the given type, or InvalidTypeId if no such base exists. | |
static const std::vector< TypeId > & | baseTypeIds (TypeId typeId) |
static const std::set< TypeId > & | derivedTypeIds (TypeId typeId) |
static TypeId | typeIdFromTypeName (const char *typeName) |
static const char * | typeNameFromTypeId (TypeId typeId) |
static void | registerType (TypeId derivedTypeId, const char *derivedTypeName, TypeId baseTypeId) |
Allows external modules to register their own type ids. | |
![]() | |
typedef std::map< TypeId, TypeId > | BaseTypeRegistryMap |
typedef std::map< TypeId, std::vector< TypeId > > | BaseTypesRegistryMap |
typedef std::map< TypeId, std::set< TypeId > > | DerivedTypesRegistryMap |
typedef tbb::spin_rw_mutex | Mutex |
typedef std::map< TypeId, std::string > | TypeIdsToTypeNamesMap |
typedef std::map< std::string, TypeId > | TypeNamesToTypeIdsMap |
![]() | |
static BaseTypeRegistryMap & | baseTypeRegistry () |
static DerivedTypesRegistryMap & | derivedTypesRegistry () |
static BaseTypesRegistryMap & | completeBaseTypesRegistry () |
static DerivedTypesRegistryMap & | completeDerivedTypesRegistry () |
static void | derivedTypeIdsWalk (TypeId typeId, std::set< TypeId > &) |
static TypeIdsToTypeNamesMap & | typeIdsToTypeNames () |
static TypeNamesToTypeIdsMap & | typeNamesToTypeIds () |
![]() | |
static Mutex | g_baseTypeIdsMutex |
static Mutex | g_derivedTypeIdsMutex |
Implements a Preset to permit values to be saved and restored from a Parameterised object.
BasicPresets can be created either as in-memory representations of the parameters, or saved to disk.
The BasicPreset has a single parameter "overwriteMatchingComponents" : Bool, which controls how ClassVector parameter are treated, when the preset is applied.
def IECore.BasicPreset.__init__ | ( | self, | |
pathOrDataOrParameterised, | |||
rootParameter = None , |
|||
parameters = () , |
|||
referenceData = False |
|||
) |
The constructor is essentially in two forms:
IECore.BasicPreset( parameterised, rootParameter=None, parameters=(), referenceData=False )
This is the most common form, and should be used to create a new preset from the given parameterised holding object.
IECore.BasicPreset( pathOrData )
This form is used to restore data into a preset for application, and should rarely be used directly.
pathOrData,this | should be an absolute path to a CompoundObject on disk or a CompoundObject pointer itself. This object should contain the data structure for the preset. |
parameterised,The | Parameterised object holding the parameters to be saved. |
rootParameter,IECore.Parameter,Where | to start in the parmameter hierarchy. |
parameters,( | IECore.Parameter, ... ), A list of Parameters to include in the the preset. This allow certain values not to be included in the preset. |
referenceData,bool,When | enabled, this stops the preset mechanism from copying the value data from the parameters it encapsulates. This can save memory when the preset is to be written straight to disk. The default behaviour copies any parameter values so the preset is not dependent on the source parameters state at the time of application. |
References IECore.BasicPreset._cob, IECore.BasicPreset._data, IECore.BasicPreset._header, IECoreHoudini::SOP_CortexConverter.parameters, IECoreHoudini::ParameterisedHolder< BaseType >.parameters, IECore::Light.parameters(), IECore::ExternalProcedural.parameters(), IECore::Display.parameters(), IECore::Camera.parameters(), IECore::Parameterised.parameters(), IECore::CompoundParameter.parameters(), and IECoreMaya.ParameterPanel.ParameterUIContainer.parameters.
def IECore.BasicPreset.__call__ | ( | self, | |
parameterised, | |||
rootParameter, | |||
parameterList = [] , |
|||
parameterListExcludes = False |
|||
) |
parameterList | A list of Parameter pointers that the preset should apply to. |
parameterListExcludes | A bool, which when True, will treat the parameterList as a 'skip' list, rather than an 'application' list. NOTE: When parameterListExcludes is False, all parent parameters of a desired leaf parameter must be in this list. Otherwise the preset will not consider the parent so will never reach the child. |
References IECore.BasicPreset._applyHierarchy(), IECore.BasicPreset._data, IECore.BasicPreset._ensureData(), and IECore.Preset.applicableTo().
def IECore.BasicPreset.applicableTo | ( | self, | |
parameterised, | |||
rootParameter | |||
) |
References IECore.BasicPreset._applicableTo(), IECore.BasicPreset._data, and IECore.BasicPreset._ensureData().
def IECore.BasicPreset.metadata | ( | self | ) |
"title" : string, The user supplied name the preset. "description" : string, A multi-line string of arbitrary descriptive text. "categories" : ( string, .. ), A list of strings, one for each category the preset is considered part of.
References IECore.BasicPreset._ensureHeader(), and IECore.BasicPreset._header.
def IECore.BasicPreset.save | ( | self, | |
path, | |||
name, | |||
title = "" , |
|||
description = "" , |
|||
categories = () , |
|||
version = 1 , |
|||
classLoadable = True |
|||
) |
This method will save the specified parameters to disk in such a was as can be loaded by the IECore.ClassLoader.
path,string,The | file system location the preset should be saved to note: this should be a directory name, not the desired preset name. |
name,string,The | name of the preset, the preset will be saved under this name inside of 'path'. This name is not sanitised, and it is the responsibility of the caller to ensure that it is a legal file system name. |
title,string,The | title of the preset, no character restrictions. |
description,string,A | description of the preset, no character restrictions. |
categories,( | string, ... ) A list of categories the preset should be tagged with |
version,int,the | version of the preset, this will default to 1, used when saving for the ClassLoader. |
classLoadable,bool,if | True (default) then the preset will be saved in a way that can be loaded by the ClassLoader, otherwise, just a cob file is written containing the presets data. |
References IECore.BasicPreset._addClassToVector(), IECore.BasicPreset._applyClassParameter(), IECore.BasicPreset._applyClassVector(), IECore.BasicPreset._applyHierarchy(), IECore.BasicPreset._applyParameter(), IECore.BasicPreset._cob, IECore.BasicPreset._data, IECore.BasicPreset._header, IECore::Writer.create(), IECore::Reader.create(), IECoreHoudini::SOP_CortexConverter.parameters, IECoreHoudini::ParameterisedHolder< BaseType >.parameters, IECore::Light.parameters(), IECore::ExternalProcedural.parameters(), IECore::Camera.parameters(), IECore::Display.parameters(), IECore::Parameterised.parameters(), IECore::CompoundParameter.parameters(), IECoreMaya.ParameterPanel.ParameterUIContainer.parameters, and IECore.registerRunTimeTyped().