Cortex  10.0.0-a4
Public Member Functions | List of all members
IECore.BasicPreset Class Reference

Implements a Preset to permit values to be saved and restored from a Parameterised object. More...

+ Inheritance diagram for IECore.BasicPreset:

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...
 
- Public Member Functions inherited from IECore.Preset
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...
 
- Public Member Functions inherited from IECore::Parameterised
 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.
 
CompoundParameterparameters () override
 
const CompoundParameterparameters () const override
 Returns the parameters for query.
 
CompoundObjectuserData ()
 Returns an object that anyone can use for storing anything.
 
const CompoundObjectuserData () const
 Read only version of the above.
 
- Public Member Functions inherited from IECore::RunTimeTyped
 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
 
- Public Member Functions inherited from IECore::RefCounted
 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

- Public Types inherited from IECore::RunTimeTyped
typedef RefCounted BaseClass
 A typedef for the class this class derives from. All RunTimeTyped classes define this typedef.
 
- Public Types inherited from IECore::RefCounted
typedef size_t RefCount
 
- Static Public Member Functions inherited from IECore::RunTimeTyped
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.
 
- Protected Types inherited from IECore::RunTimeTyped
typedef std::map< TypeId, TypeIdBaseTypeRegistryMap
 
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, TypeIdTypeNamesToTypeIdsMap
 
- Static Protected Member Functions inherited from IECore::RunTimeTyped
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 Protected Attributes inherited from IECore::RunTimeTyped
static Mutex g_baseTypeIdsMutex
 
static Mutex g_derivedTypeIdsMutex
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
pathOrData,thisshould 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,TheParameterised object holding the parameters to be saved.
rootParameter,IECore.Parameter,Whereto 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,Whenenabled, 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.

Member Function Documentation

def IECore.BasicPreset.__call__ (   self,
  parameterised,
  rootParameter,
  parameterList = [],
  parameterListExcludes = False 
)
See also
IECore.Preset.__call__
Parameters
parameterListA list of Parameter pointers that the preset should apply to.
parameterListExcludesA 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 
)
See also
IECore.Preset.applicableTo

References IECore.BasicPreset._applicableTo(), IECore.BasicPreset._data, and IECore.BasicPreset._ensureData().

def IECore.BasicPreset.metadata (   self)
Returns
a dictionary of metatdata about the preset. BasicPresets provide the following keys, when a preset has been saved to disk. NOTE: Presets created by the 'Copy' method will not contain any pertinent information in theses fields:

"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.

Parameters
path,string,Thefile system location the preset should be saved to note: this should be a directory name, not the desired preset name.
name,string,Thename 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,Thetitle of the preset, no character restrictions.
description,string,Adescription of the preset, no character restrictions.
categories,(string, ... ) A list of categories the preset should be tagged with
version,int,theversion of the preset, this will default to 1, used when saving for the ClassLoader.
classLoadable,bool,ifTrue (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().


The documentation for this class was generated from the following file: