Cortex  10.0.0-a4
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
IECoreHoudini::LiveScene Class Reference

#include <LiveScene.h>

+ Inheritance diagram for IECoreHoudini::LiveScene:

Public Types

typedef boost::function< bool(const OP_Node *)> HasFn
 
typedef boost::function< IECore::ConstObjectPtr(const OP_Node *, double &)> ReadFn
 
typedef boost::function< IECore::ConstObjectPtr(const OP_Node *, const Name &, double &)> ReadAttrFn
 
typedef boost::function< bool(const OP_Node *, const Name &, int)> HasTagFn
 
typedef boost::function< void(const OP_Node *, NameList &, int)> ReadTagsFn
 
typedef boost::function< void(const OP_Node *, NameList &)> ReadNamesFn
 
- Public Types inherited from IECore::SceneInterface
enum  MissingBehaviour { ThrowIfMissing = IndexedIO::ThrowIfMissing, NullIfMissing = IndexedIO::NullIfMissing, CreateIfMissing = IndexedIO::CreateIfMissing }
 
enum  TagFilter { DescendantTag = 1, LocalTag = 2, AncestorTag = 4, EveryTag = DescendantTag | LocalTag | AncestorTag }
 
enum  HashType {
  TransformHash, AttributesHash, BoundHash, ObjectHash,
  ChildNamesHash, HierarchyHash
}
 
typedef IndexedIO::EntryID Name
 
typedef IndexedIO::EntryIDList NameList
 
typedef IndexedIO::EntryIDList Path
 
- 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
 

Public Member Functions

 IE_CORE_DECLARERUNTIMETYPEDEXTENSION (LiveScene, LiveSceneTypeId, IECore::SceneInterface)
 
 LiveScene (const UT_String &nodePath, const Path &contentPath, const Path &rootPath, double defaultTime=std::numeric_limits< double >::infinity())
 
virtual std::string fileName () const
 Returns the file that this scene is mapped to. Throws exception if there's no file.
 
virtual Name name () const
 Returns the name of the scene location which this instance is referring to. The root path returns "/".
 
virtual void path (Path &p) const
 
virtual Imath::Box3d readBound (double time) const
 
virtual void writeBound (const Imath::Box3d &bound, double time)
 
virtual IECore::ConstDataPtr readTransform (double time) const
 
virtual Imath::M44d readTransformAsMatrix (double time) const
 
IECore::ConstDataPtr readWorldTransform (double time) const
 
Imath::M44d readWorldTransformAsMatrix (double time) const
 
virtual void writeTransform (const IECore::Data *transform, double time)
 
virtual bool hasAttribute (const Name &name) const
 Convenience method to determine if an attribute exists without reading it.
 
virtual void attributeNames (NameList &attrs) const
 
virtual IECore::ConstObjectPtr readAttribute (const Name &name, double time) const
 Returns the attribute value at the given time.
 
virtual void writeAttribute (const Name &name, const IECore::Object *attribute, double time)
 
virtual bool hasTag (const Name &name, int filter=SceneInterface::LocalTag) const
 
virtual void readTags (NameList &tags, int filter=SceneInterface::LocalTag) const
 
virtual void writeTags (const NameList &tags)
 
virtual bool hasObject () const
 Convenience method to determine if a piece of geometry exists without reading it.
 
virtual IECore::ConstObjectPtr readObject (double time) const
 Reads the object stored at this path in the scene at the given time.
 
virtual IECore::PrimitiveVariableMap readObjectPrimitiveVariables (const std::vector< IECore::InternedString > &primVarNames, double time) const
 
virtual void writeObject (const IECore::Object *object, double time)
 
virtual void childNames (NameList &childNames) const
 
virtual bool hasChild (const Name &name) const
 Convenience method to determine if a child exists.
 
virtual IECore::SceneInterfacePtr child (const Name &name, MissingBehaviour missingBehaviour=SceneInterface::ThrowIfMissing)
 
virtual IECore::ConstSceneInterfacePtr child (const Name &name, MissingBehaviour missingBehaviour=SceneInterface::ThrowIfMissing) const
 Returns a read-only interface for a child location in the scene.
 
virtual IECore::SceneInterfacePtr createChild (const Name &name)
 
virtual IECore::SceneInterfacePtr scene (const Path &path, MissingBehaviour missingBehaviour=SceneInterface::ThrowIfMissing)
 
virtual IECore::ConstSceneInterfacePtr scene (const Path &path, MissingBehaviour missingBehaviour=SceneInterface::ThrowIfMissing) const
 
virtual void hash (HashType hashType, double time, IECore::MurmurHash &h) const
 Currently raises an exception.
 
const OP_Node * node () const
 Convenience method to access the Houdini node this scene refers to.
 
bool embedded () const
 Convenience method to determine if this scene refers to hierarchy embedded inside a SOP.
 
double getDefaultTime () const
 
void setDefaultTime (double time)
 
- Public Member Functions inherited from IECore::SceneInterface
 IE_CORE_DECLARERUNTIMETYPED (SceneInterface, RunTimeTyped)
 
virtual void path (Path &p) const =0
 Returns the path scene this instance is referring to.
 
virtual bool hasBound () const
 
virtual void attributeNames (NameList &attrs) const =0
 Fills attrs with the names of all attributes available in the current directory.
 
virtual void readTags (NameList &tags, int filter=LocalTag) const =0
 
virtual void writeTags (const NameList &tags)=0
 Adds tags to the current scene location.
 
virtual void childNames (NameList &childNames) const =0
 
virtual SceneInterfacePtr scene (const Path &path, MissingBehaviour missingBehaviour=ThrowIfMissing)=0
 Returns a interface for querying the scene at the given path (full path).
 
virtual ConstSceneInterfacePtr scene (const Path &path, MissingBehaviour missingBehaviour=ThrowIfMissing) const =0
 Returns a const interface for querying the scene at the given path (full path).
 
- 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.
 

Static Public Member Functions

static void registerCustomAttributes (ReadNamesFn namesFn, ReadAttrFn readFn)
 
static void registerCustomTags (HasTagFn hasFn, ReadTagsFn readFn)
 
- Static Public Member Functions inherited from IECore::SceneInterface
static SceneInterfacePtr create (const std::string &path, IndexedIO::OpenMode mode)
 
static std::vector< std::string > supportedExtensions (IndexedIO::OpenMode modes=IndexedIO::Read|IndexedIO::Write|IndexedIO::Append)
 
static void pathToString (const Path &p, std::string &path)
 Converts a internal Path to a path-like string. The root path results in "/".
 
static void stringToPath (const std::string &path, Path &p)
 
- 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.
 

Static Public Attributes

static PRM_Name pTags
 
- Static Public Attributes inherited from IECore::SceneInterface
static const NamerootName
 Constant name assigned to the root location "/".
 
static const Path & rootPath
 Utility variable that can be used anytime you want to refer to the root path in the Scene.
 
static const NamevisibilityName
 Name of the visibility attribute.
 

Protected Member Functions

 LiveScene (const UT_String &nodePath, const Path &contentPath, const Path &rootPath, const LiveScene &parent)
 
virtual LiveScenePtr create () const
 
virtual LiveScenePtr duplicate (const UT_String &nodePath, const Path &contentPath, const Path &rootPath) const
 

Additional Inherited Members

- Protected Types inherited from IECore::SceneInterface
typedef SceneInterfacePtr(* CreatorFn) (const std::string &, IndexedIO::OpenMode)
 
- 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::SceneInterface
static CreatorMap & fileCreators ()
 
static void registerCreator (const std::string &extension, IndexedIO::OpenMode modes, CreatorFn f)
 
- 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

A read-only class for representing a live Houdini scene as an IECore::SceneInterface Note that this class treats time by SceneInterface standards, starting at Frame 0, as opposed to Houdini standards, which start at Frame 1.

Member Function Documentation

virtual IECore::SceneInterfacePtr IECoreHoudini::LiveScene::child ( const Name name,
MissingBehaviour  missingBehaviour = SceneInterface::ThrowIfMissing 
)
virtual

Returns an object for the specified child location in the scene. If the child does not exist then it will behave according to the missingBehavior parameter. May throw and exception, may return a NULL pointer, or may create the child (if that is possible). Bounding boxes will be automatically propagated up from the children to the parent as it is written.

Implements IECore::SceneInterface.

virtual IECore::SceneInterfacePtr IECoreHoudini::LiveScene::createChild ( const Name name)
virtual

Returns a writable interface to a new child. Throws an exception if it already exists. Bounding boxes will be automatically propagated up from the children to the parent as it is written.

Implements IECore::SceneInterface.

double IECoreHoudini::LiveScene::getDefaultTime ( ) const

These methods provide a default cooking time for methods that do not accept time as an argument (e.g. hasObject or childNames). In a LiveScene which points at a SOP, it is necessary to use time in these methods. The default time will pass through to children automatically. If left unset, CHgetEvalTime() will be used for these queries. See ROP_SceneCacheWriter for a use case.

virtual bool IECoreHoudini::LiveScene::hasTag ( const Name name,
int  filter = SceneInterface::LocalTag 
) const
virtual

Utility function that quickly checks for the existence of one tag relative to the current scene location and the given filter.

Parameters
filterWill filter the results based on a combination of flags DescendantTag, LocalTag and AncestorTag. Use LocalTag for tags stored in the current scene location (default). DescendantTags for tags stored in child locations and AncestorTags for tags stored in parent locations. Some implementations may not support all combinations of these flags and will ignore them.

Implements IECore::SceneInterface.

virtual Imath::Box3d IECoreHoudini::LiveScene::readBound ( double  time) const
virtual

Returns the bounding box for the entire scene contents from path() down, inclusive of the object at this path, but exclusive of the transform at this path.

Implements IECore::SceneInterface.

virtual IECore::PrimitiveVariableMap IECoreHoudini::LiveScene::readObjectPrimitiveVariables ( const std::vector< IECore::InternedString > &  primVarNames,
double  time 
) const
virtual

Reads primitive variables from the object of type Primitive stored at this path in the scene at the given time. Raises exception if it turns out not to be a Primitive object.

Implements IECore::SceneInterface.

virtual IECore::ConstDataPtr IECoreHoudini::LiveScene::readTransform ( double  time) const
virtual

Returns the interpolated transform object of this node at the specified point in time.

Implements IECore::SceneInterface.

virtual Imath::M44d IECoreHoudini::LiveScene::readTransformAsMatrix ( double  time) const
virtual

Returns the transform of this node at the specified point in time as a matrix.

Implements IECore::SceneInterface.

IECore::ConstDataPtr IECoreHoudini::LiveScene::readWorldTransform ( double  time) const
Todo:
: consider making these virtual methods of SceneInterface itself
virtual void IECoreHoudini::LiveScene::writeAttribute ( const Name name,
const IECore::Object attribute,
double  time 
)
virtual

Writers the attribute to this path within the scene Raises an exception if you try to write an attribute in the root path with a time different than 0.

Implements IECore::SceneInterface.

virtual void IECoreHoudini::LiveScene::writeBound ( const Imath::Box3d &  bound,
double  time 
)
virtual

Writes the bound for this path, overriding the default bound that would be written automatically. Note that it might be useful when writing objects which conceptually have a bound but don't derive from VisibleRenderable.

Implements IECore::SceneInterface.

virtual void IECoreHoudini::LiveScene::writeObject ( const IECore::Object object,
double  time 
)
virtual

Writes a geometry to this path in the scene. Raises an exception if you try to write an object in the root path.

Implements IECore::SceneInterface.

virtual void IECoreHoudini::LiveScene::writeTransform ( const IECore::Data transform,
double  time 
)
virtual

Writes the transform applied to this path within the scene. Raises an exception if you try to write transform in the root path Currently it only accepts M44dData or TransformationMatrixdData.

Implements IECore::SceneInterface.

Member Data Documentation

PRM_Name IECoreHoudini::LiveScene::pTags
static

The parameter name used to identify user defined tags on any OBJ node. This will be accessed by hasTag and readTags as a string parameter, and will be split on spaces to separate tags.


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