MaxwellMayaShape class
Description
This is the abstract base class for all the renderable objects in Maxwell. It implements common operations such as setting the material, transformation or render flags and allows you to identify the type of the underlying object through the GetShapeType
method.
Subclasses: MaxwellMayaMesh
, MaxwellMayaExtensionShape
, MaxwellMayaMXSReference,
MaxwellMayaInstance.
Methods
ShapeType | GetShapeType() const |
void | SetName(const MString& name) |
| GetName() const |
bool | SetMaterial(const MaxwellMayaMaterial* material); |
MaxwellMayaMaterial* | GetMaterial() |
const MaxwellMayaMaterial* | GetMaterial() const |
bool | SetTransformation(const MMatrix& worldMatrix, const MMatrix& pivot, double timeOffset, bool scaleTranslation) |
bool | SetRenderFlags(int flags) |
int | GetRenderFlags() const |
void | Destroy() |
ShapeType GetShapeType() const
Returns the concrete type of the Maxwell object as one of the following:
ShapeType_Mesh
: triangle mesh. The object can be cast toMaxwellMayaMesh
.ShapeType_Instance
: instance. The object can be cast toMaxwellMayaInstance
.ShapeType_ProceduralExtension
: procedural geometry. Maxwell calls this object at render time to determine ray intersections so it can be used to implement new primitive types. Examples include Maxwell Particles (procedural spheres) and Maxwell Hair (procedural cones). The object can be cast toMaxwellMayaExtensionShape
.ShapeType_LoaderExtension
: this kind of extension is called to create triangle meshes when Maxwell processes the scene before rendering. It can be used to add support for new geometric file formats, e.g. RealFlow BIN mesh files. The object can be cast toMaxwellMayaExtensionShape
.ShapeType_MXSReference
: external reference to a MXS file. The object can be cast toMaxwellMayaInstance
.
void SetName(const MString& name)
Sets the name of the object in the Maxwell scene. The Python version takes a regular Python string, not a MString object.
MString GetName() const
Returns the name of the object in the Maxwell scene. The Python version returns a regular Python string.
bool SetMaterial(const MaxwellMayaMaterial* material)
Applies a material on the entire object. The Python version raises an exception of the argument is not a subclass of maxwell.Material
.
MaxwellMayaMaterial* GetMaterial()
const MaxwellMayaMaterial* GetMaterial() const
Returns the material currently assigned to the object. If no material is currently assigned, the C++ version returns NULL and the Python version returns None.
bool SetTransformation(const MMatrix& worldMatrix, const MMatrix& pivot, double timeOffset, bool scaleTranslation)
Sets the world matrix and pivot for the object. The timeOffset argument is relevant for motion blur, as it specifies the time inside the frame at which the transformation applies as a fraction of the exposure time (0.0 means shutter open, 1.0 means shutter close). When scaleTranslation is true, Maxwell converts the translation component of the matrices from Maya work units to meters, since Maxwell always works in meters. This argument is not affected by and does not affect the ProcessingFlag_UnitConversion
flag passed to MaxwellMayaAPI::SetCurrentShapeOutput
(see here for details on that flag); set it to true if you do not convert the translation (position) to meters yourself, regardless of whether or not you're calling MaxwellMayaAPI::SetCurrentShapeOutput, or if you're passing ProcessingFlag_UnitConversion
to it.
bool SetRenderFlags(int flags)
Sets the object render flags as a combination of the following values:
RenderFlag_Hidden
: the object is completely invisible.RenderFlag_HideToCam
: the object is not directly visible, but can be seen through transparent materials, or in reflections.RenderFlag_HideToSecRays
: the object is not visible in reflections or through transparent objects.RenderFlag_HideToGI
: the object does not contribute to global illumination, so it doesn't cast shadows, bounce light etc.RenderFlag_HideToZClip
: the object is not affected by Z clipping.
int GetRenderFlags() const
Returns the render flags as a combination of RenderFlag values.
void Destroy()
Removes the object from the Maxwell scene. As explained here, this method does not destroy the API handle, so in C++ you must still call DeleteThis()
when you are done with it (or let a smart pointer do it).