35 #ifndef IECOREMAYA_LIVESCENE_H
36 #define IECOREMAYA_LIVESCENE_H
38 #include "boost/function.hpp"
39 #include "tbb/mutex.h"
41 #include "IECore/SceneInterface.h"
42 #include "IECoreMaya/TypeIds.h"
44 #include "maya/MDagPath.h"
49 IE_CORE_FORWARDDECLARE( LiveScene );
72 virtual std::string
fileName()
const;
77 virtual void path( Path &p )
const;
85 virtual Imath::Box3d
readBound(
double time )
const;
87 virtual void writeBound(
const Imath::Box3d &bound,
double time );
95 virtual IECore::ConstDataPtr
readTransform(
double time )
const;
110 virtual IECore::ConstObjectPtr
readAttribute(
const Name &name,
double time )
const;
119 virtual bool hasTag(
const Name &name,
int filter = SceneInterface::LocalTag )
const;
121 virtual void readTags( NameList &tags,
int filter = SceneInterface::LocalTag )
const;
123 virtual void writeTags(
const NameList &tags );
133 virtual IECore::ConstObjectPtr
readObject(
double time )
const;
155 virtual IECore::SceneInterfacePtr
child(
const Name &name, MissingBehaviour missingBehaviour = SceneInterface::ThrowIfMissing );
157 virtual IECore::ConstSceneInterfacePtr
child(
const Name &name, MissingBehaviour missingBehaviour = SceneInterface::ThrowIfMissing )
const;
165 virtual IECore::SceneInterfacePtr
scene(
const Path &path, MissingBehaviour missingBehaviour = SceneInterface::ThrowIfMissing );
168 virtual IECore::ConstSceneInterfacePtr
scene(
const Path &path, MissingBehaviour missingBehaviour = SceneInterface::ThrowIfMissing )
const;
173 typedef boost::function<bool (const MDagPath &)> HasFn;
174 typedef boost::function<IECore::ConstObjectPtr (const MDagPath &)> ReadFn;
175 typedef boost::function<IECore::ConstObjectPtr (const MDagPath &, const Name &)> ReadAttrFn;
176 typedef boost::function<bool (const MDagPath &, const Name &, int )> HasTagFn;
177 typedef boost::function<void (const MDagPath &, NameList &, int)> ReadTagsFn;
178 typedef boost::function<void (const MDagPath &, NameList &)> NamesFn;
179 typedef boost::function<bool (const MDagPath &, const Name &)> MightHaveFn;
184 static void registerCustomObject( HasFn hasFn, ReadFn readFn );
190 static void registerCustomAttributes( NamesFn namesFn, ReadAttrFn readFn );
191 static void registerCustomAttributes( NamesFn namesFn, ReadAttrFn readFn, MightHaveFn mightHaveFn);
196 static void registerCustomTags( HasTagFn hasFn, ReadTagsFn readFn );
200 IECore::SceneInterfacePtr retrieveScene(
const Path &path, MissingBehaviour missingBehaviour = SceneInterface::ThrowIfMissing )
const;
201 IECore::SceneInterfacePtr retrieveChild(
const Name &name, MissingBehaviour missingBehaviour = SceneInterface::ThrowIfMissing )
const;
202 IECore::SceneInterfacePtr retrieveParent()
const;
204 void getChildDags(
const MDagPath& dagPath, MDagPathArray& paths )
const;
214 struct CustomTagReader
221 struct CustomAttributeReader
225 MightHaveFn m_mightHave;
228 static std::vector< CustomReader > &customObjectReaders();
229 static std::vector< CustomAttributeReader > &customAttributeReaders();
230 static std::vector< CustomTagReader > &customTagReaders();
235 LiveScene(
const MDagPath& p,
bool isRoot =
false );
242 virtual LiveScenePtr
duplicate(
const MDagPath& p,
bool isRoot =
false )
const;
244 typedef tbb::mutex Mutex;
245 static Mutex s_mutex;
253 #endif // IECOREMAYA_LIVESCENE_H
virtual void path(Path &p) const
Returns the tokenized dag path this instance is referring to.
virtual IECore::ConstObjectPtr readAttribute(const Name &name, double time) const
Returns the attribute value at the given time, which must be equal to the current maya time in second...
virtual bool hasAttribute(const Name &name) const
Convenience method to determine if an attribute exists without reading it.
virtual bool hasTag(const Name &name, int filter=SceneInterface::LocalTag) const
Uses the custom registered tags to return whether a given tag is present in the scene location or not...
virtual void attributeNames(NameList &attrs) const
Fills attrs with the names of all attributes available in the current directory.
virtual IECore::PrimitiveVariableMap readObjectPrimitiveVariables(const std::vector< IECore::InternedString > &primVarNames, double time) const
virtual LiveScenePtr duplicate(const MDagPath &p, bool isRoot=false) const
virtual void writeTransform(const IECore::Data *transform, double time)
Not currently supported - will throw an exception.
virtual void hash(HashType hashType, double time, IECore::MurmurHash &h) const
Currently raises an exception.
virtual Imath::Box3d readBound(double time) const
virtual bool hasChild(const Name &name) const
Queries weather the named child exists.
virtual IECore::SceneInterfacePtr scene(const Path &path, MissingBehaviour missingBehaviour=SceneInterface::ThrowIfMissing)
Returns an object for querying the scene at the given path (full path).
Definition: MurmurHash.h:64
virtual Imath::M44d readTransformAsMatrix(double time) const
virtual IECore::ConstObjectPtr readObject(double time) const
virtual IECore::SceneInterfacePtr child(const Name &name, MissingBehaviour missingBehaviour=SceneInterface::ThrowIfMissing)
virtual void writeObject(const IECore::Object *object, double time)
Not currently supported - will throw an exception.
Definition: LiveScene.h:61
HashType
Definition: SceneInterface.h:94
virtual void childNames(NameList &childNames) const
Definition: SceneInterface.h:69
virtual void readTags(NameList &tags, int filter=SceneInterface::LocalTag) const
Uses the custom registered tags to list all the tags present in the scene location.
virtual std::string fileName() const
Returns the file that this scene is mapped to. Throws exception if there's no file.
The IECoreMaya namespace holds all the functionality of libIECoreMaya.
Definition: BoolParameterHandler.h:44
virtual void writeTags(const NameList &tags)
Not currently supported - will throw an exception.
Definition: InternedString.h:55
virtual bool hasObject() const
Checks if there are objects in the scene (convertible from Maya or registered as custom objects) ...
virtual void writeBound(const Imath::Box3d &bound, double time)
Not currently supported - will throw an exception.
virtual Name name() const
Returns the name of the scene location which this instance is referring to. The root path returns "/"...
virtual IECore::ConstDataPtr readTransform(double time) const
std::map< std::string, PrimitiveVariable > PrimitiveVariableMap
A simple type to hold named PrimitiveVariables.
Definition: PrimitiveVariable.h:107
virtual IECore::SceneInterfacePtr createChild(const Name &name)
virtual void writeAttribute(const Name &name, const IECore::Object *attribute, double time)
Not currently supported - will throw an exception.