Maya 1.0
MayaGeometryAll Class Reference

Set of instances along with their frame lists. More...

#include <maya.h>

Public Member Functions

 MayaGeometryAll ()
 Empty.
 
 MayaGeometryAll (const MayaGeometry &)
 Creates a set of geometries from a unique geometry.
 
 MayaGeometryAll (const MayaGeometrySet &)
 Create a set of geometries from a set of geometry.
 
 MayaGeometryAll (const QVector< MayaGeometrySet > &)
 Create a set of instances of geometries from a set of geometry.
 
 MayaGeometryAll (const MayaResources &, const MayaInstanceSet &)
 Create a complex geometry by combining an atlas and a set of instances.
 
 MayaGeometryAll (const MayaResources &, const MayaInstanceAll &)
 Create a complex geometry by combining an atlas and a set of instances.
 
 ~MayaGeometryAll ()
 Empty.
 
void Append (const MayaGeometry &)
 Add an instance to the scene.
 
void Append (const MayaGeometrySet &)
 Add an instance set to the scene.
 
void Append (const QString &, const FrameScaled &)
 Add an instance to the scene with a given name and frame.
 
void SetFramesToAll (QVector< FrameScaled >)
 Set the frames to the entire geometry.
 
void SetMaterial (const MayaMaterial &)
 Set the same material for all the objects.
 
void SetMaterial_EqualName (const QString &, const MayaMaterial &)
 Set the material of all the instances whose name exactly matches the given string.
 
void SetMaterial_ContainsName (const QString &n, const MayaMaterial &mo)
 Set the material of all the instances whose name contains the given string.
 
MayaGeometry GetGeometryByName (const QString &n)
 gets the merged geometry of all objects whose name contains the given string.
 
void Rotate (const Vector &)
 Rotate all instances.
 
void Translate (const Vector &)
 Translate all instances.
 
void Scale (const Vector &)
 Scale all instances.
 
void Remove (const QString &)
 Clears one instance given its name.
 
void Clear ()
 Clears all instances.
 
void Append (const MayaGeometryAll &)
 Append a set of instances.
 
int count () const
 Get the number of instances.
 
QList< QString > GetNames () const
 Get the list of names of the instances in the geometry.
 
MayaGeometrySetoperator[] (const QString &)
 Get the MayaGeometrySet of the geometry.
 
int GetSetSize () const
 Get the size of instances.
 
Box GetBox () const
 Return the Bounding Box of each MayaGeometrySet.
 
MayaGeometry Collapse () const
 Merge all the instances into a single geometry.
 
bool GetMayaGeometrySet (const QString &, MayaGeometrySet &)
 Get one instance given its name.
 
bool GetMayaGeometrySet (const QString &, QVector< MayaGeometrySet > &)
 Get a set of geometrical elements.
 
bool Load_OBJ (const QString &)
 Loads the geometrys from an .obj file into a MayaGeometryAll. Experimental.
 
bool find_MTL_Address (const QString &, const QString &, QString &, QString &)
 Loads the geometrys from an .obj file into a MayaGeometryAll.
 
bool Save_OBJ (const QString &, const bool &=true) const
 Save the geometry as a Maya .obj file (MayaGeometryAll->MayaGeometry).
 
bool Save_OBJ_Collapse (const QString &) const
 Save a single geometry as a Maya .obj file (Collapse the MayaGeomeryAll).
 
bool Save_PBRT (const QString &) const
 Save the geometry as a .pbrt file (MayaGeometryAll->MayaGeometry).
 
bool Save_VUE (const QString &) const
 Save the instances as a Vue python script.
 
bool Save_XML_Instances (const QString &) const
 Save instances positions into an XML file compatible with Mitsuba.
 
bool Save_XML_Object (const QString &, const QString &id) const
 Save instances positions into an XML file compatible with Mitsuba and put it in a shapegroup that can be instanciated.
 
bool Save_XML_Object (const QString &, const QString &id, const QString &objbasename, const QString &texturepath, const QString &relPath) const
 Save objects into an XML file compatible with Mitsuba and put it in a shapegroup that can be instanciated, don't export materials (use Save_XML_Materials() in addition)
 
bool Save_XML (const QString &, const Camera &, const QString &instancefilename=QString(""), bool=false, const QString &=QString(""), bool objectonly=false) const
 Save scene into an XML file.
 
bool Save_VueScript (const QString &) const
 Export instances in Vue Software format.
 
MayaStatistics GetStatistics () const
 Compute the statistics of the geometry.
 
QString GetText (int=0, bool=false) const
 Get the text information.
 

Static Public Member Functions

static MayaGeometryAll CreateVoxelSurface (const Voxel &)
 Create a set of visible surface patches representing the surface voxel.
 

Protected Attributes

QMap< QString, MayaGeometrySetinstances
 Map between the name of the geometric instances and the MayaGeometrySet structure. A map is used instead of an array to speed up instance search given an input name.
 

Friends

class MayaGpuAll
 

Detailed Description

Set of instances along with their frame lists.

Constructor & Destructor Documentation

◆ MayaGeometryAll() [1/5]

MayaGeometryAll::MayaGeometryAll ( const MayaGeometry & mg)

Creates a set of geometries from a unique geometry.

This function creates a single geometry entry and a unique reference with identity frame.

Parameters
mgInput geometry.

References Append().

◆ MayaGeometryAll() [2/5]

MayaGeometryAll::MayaGeometryAll ( const MayaGeometrySet & mgs)

Create a set of geometries from a set of geometry.

Parameters
mgsInput set of geometry.

References Append().

◆ MayaGeometryAll() [3/5]

MayaGeometryAll::MayaGeometryAll ( const QVector< MayaGeometrySet > & s)

Create a set of instances of geometries from a set of geometry.

Parameters
sInput set of geometry.

References Append(), and instances.

◆ MayaGeometryAll() [4/5]

MayaGeometryAll::MayaGeometryAll ( const MayaResources & atlas,
const MayaInstanceSet & mis )

Create a complex geometry by combining an atlas and a set of instances.

Parameters
atlasThe atlas of models.
misThe set of instances.

References Append(), MayaInstanceSet::GetFrameScaleds(), MayaInstance::GetName(), MayaResources::GetRessource(), MayaGeometryAll(), and SetFramesToAll().

◆ MayaGeometryAll() [5/5]

MayaGeometryAll::MayaGeometryAll ( const MayaResources & atlas,
const MayaInstanceAll & mia )

Create a complex geometry by combining an atlas and a set of instances.

Traverses the set of instances and replace instance by the geometry in the atlas whenever an entry exists.

Parameters
atlasThe atlas of models.
miaMultiple instance object.

References Append(), MayaInstanceAll::GetFrameScaleds(), MayaResources::GetRessource(), MayaInstanceAll::instances, MayaGeometryAll(), and SetFramesToAll().

Member Function Documentation

◆ Append() [1/3]

void MayaGeometryAll::Append ( const MayaGeometry & in)

Add an instance to the scene.

This function checks if the object already exists in the collection of models. If it already exists, it simply creates a reference to it, otherwise it creates a new entry.

Parameters
inThe instance.

References MayaGeometry::GetName(), FrameScaled::Id, and instances.

Referenced by Append(), Load_OBJ(), MayaGeometryAll(), MayaGeometryAll(), MayaGeometryAll(), MayaGeometryAll(), and MayaGeometryAll().

◆ Append() [2/3]

void MayaGeometryAll::Append ( const MayaGeometryAll & scene)

Append a set of instances.

Parameters
sceneThe set of instances.

References Append(), instances, and MayaGeometryAll().

◆ Append() [3/3]

void MayaGeometryAll::Append ( const MayaGeometrySet & in)

Add an instance set to the scene.

This function checks if the object already exists in the collection of models. If so, it simply creates a reference to it, otherwise it creates a new entry.

Parameters
inThe instance.

References MayaGeometrySet::count(), MayaGeometrySet::GetFrameScaled(), MayaGeometrySet::GetName(), and instances.

◆ Collapse()

MayaGeometry MayaGeometryAll::Collapse ( ) const

Merge all the instances into a single geometry.

Note that the resulting geometry can be huge if many instances were used.

References instances, and MayaGeometry::Merge().

Referenced by Save_OBJ_Collapse().

◆ CreateVoxelSurface()

MayaGeometryAll MayaGeometryAll::CreateVoxelSurface ( const Voxel & voxel)
static

Create a set of visible surface patches representing the surface voxel.

This function differs from MayaGeometrySet::CreateVoxel(const Voxel&) in the sense that there will be no coplanar faces between neighboring cubes.

See also
CreateVoxel(const Voxel&)
Parameters
voxelThe voxel.

References MayaInstanceAll::Append(), MayaResources::Append(), Voxel::At(), Array::Cell(), Array::CellSizeX(), Array::CellSizeY(), Array::CellSizeZ(), Box::Center(), MayaGeometryAll(), FrameScaled::Translation(), and Array::UnitCell().

◆ find_MTL_Address()

bool MayaGeometryAll::find_MTL_Address ( const QString & url,
const QString & name,
QString & nameR,
QString & nameA )

Loads the geometrys from an .obj file into a MayaGeometryAll.

Parameters
urlFile name (which should contain the extension .obj).

Loads the geometrys from an .obj file into a MayaGeometryAll.

Parameters
urlFile name (which should contain the extension .obj).
nameName of the current material.
nameRTexture name of the diffuse map.
nameATexture name of the alpha map.
Returns
A boolean checking if loading has been successful.

Referenced by Load_OBJ().

◆ GetGeometryByName()

MayaGeometry MayaGeometryAll::GetGeometryByName ( const QString & n)

gets the merged geometry of all objects whose name contains the given string.

Parameters
nString that will be searched and matched with the names.

References instances, and MayaGeometry::Merge().

◆ GetMayaGeometrySet() [1/2]

bool MayaGeometryAll::GetMayaGeometrySet ( const QString & n,
MayaGeometrySet & mgs )

Get one instance given its name.

Parameters
nName of the instance.
mgsGeometry set.

References instances.

◆ GetMayaGeometrySet() [2/2]

bool MayaGeometryAll::GetMayaGeometrySet ( const QString & n,
QVector< MayaGeometrySet > & mgs )

Get a set of geometrical elements.

Parameters
nName.
mgsSet of objects.

References instances.

◆ GetStatistics()

MayaStatistics MayaGeometryAll::GetStatistics ( ) const

Compute the statistics of the geometry.

Returns
The statistics.

References instances.

◆ GetText()

QString MayaGeometryAll::GetText ( int spaces = 0,
bool html = false ) const

Get the text information.

Parameters
spacesSpacing for indenting the text.
htmlFlag to specify syntax highlighting.

References instances.

◆ Load_OBJ()

bool MayaGeometryAll::Load_OBJ ( const QString & url)

Loads the geometrys from an .obj file into a MayaGeometryAll. Experimental.

Parameters
urlFile name (which should contain the extension .obj).

References Append(), count(), and find_MTL_Address().

Referenced by MayaResources::Append().

◆ operator[]()

MayaGeometrySet & MayaGeometryAll::operator[] ( const QString & n)
inline

Get the MayaGeometrySet of the geometry.

Parameters
nName.

References instances.

◆ Remove()

void MayaGeometryAll::Remove ( const QString & n)

Clears one instance given its name.

Parameters
nName of the instance.

References instances.

◆ Rotate()

void MayaGeometryAll::Rotate ( const Vector & r)

Rotate all instances.

Parameters
rRotation vector.

References instances.

◆ Save_OBJ()

bool MayaGeometryAll::Save_OBJ ( const QString & url,
const bool & eraseTexture = true ) const

Save the geometry as a Maya .obj file (MayaGeometryAll->MayaGeometry).

Parameters
urlFilename.
eraseTextureBoolean to confirm or not to erase the existing texture.
Returns
A boolean indicating whether the file has been successfully created or not.

References instances, MayaGeometry::Save_OBJ(), and MayaGeometry::SetName().

◆ Save_OBJ_Collapse()

bool MayaGeometryAll::Save_OBJ_Collapse ( const QString & url) const

Save a single geometry as a Maya .obj file (Collapse the MayaGeomeryAll).

Parameters
urlFilename.
Returns
A boolean indicating whether the file has been successfully created or not.

References Collapse(), and MayaGeometry::Save_OBJ().

◆ Save_PBRT()

bool MayaGeometryAll::Save_PBRT ( const QString & url) const

Save the geometry as a .pbrt file (MayaGeometryAll->MayaGeometry).

Parameters
urlFilename.
Returns
A boolean indicating whether the file has been successfully created or not.

References instances, MayaGeometry::Save_PBRT(), and MayaGeometry::SetName().

◆ Save_VUE()

bool MayaGeometryAll::Save_VUE ( const QString & url) const

Save the instances as a Vue python script.

Parameters
urlFilename.
Returns
A boolean indicating whether the file has been successfully created or not.

References instances.

◆ Save_VueScript()

bool MayaGeometryAll::Save_VueScript ( const QString & url) const

Export instances in Vue Software format.

Returns
String of the file.

References instances.

◆ Save_XML()

bool MayaGeometryAll::Save_XML ( const QString & url,
const Camera & camera,
const QString & instancefilename = QString(""),
bool use_normals = false,
const QString & shape = QString(""),
bool objectonly = false ) const

Save scene into an XML file.

The XML format is compatible with Mitsuba.

Parameters
urlFilename.
cameraThe camera.
instancefilenameWhat ?
use_normalsWhat ?
shapeWhat ?
Returns
A boolean indicating whether the file has been successfully created or not.

References Camera::At(), MayaMaterial::diffuse, Camera::Eye(), instances, and Camera::Up().

◆ Save_XML_Instances()

bool MayaGeometryAll::Save_XML_Instances ( const QString & url) const

Save instances positions into an XML file compatible with Mitsuba.

Parameters
urlFilename.
Returns
A boolean indicating whether the file has been successfully created or not.

References instances.

◆ Save_XML_Object() [1/2]

bool MayaGeometryAll::Save_XML_Object ( const QString & url,
const QString & id ) const

Save instances positions into an XML file compatible with Mitsuba and put it in a shapegroup that can be instanciated.

Parameters
urlFilename.
Returns
A boolean indicating whether the file has been successfully created or not.

References MayaMaterial::diffuse, and instances.

◆ Save_XML_Object() [2/2]

bool MayaGeometryAll::Save_XML_Object ( const QString & url,
const QString & id,
const QString & objbasename,
const QString & texturepath,
const QString & relPath ) const

Save objects into an XML file compatible with Mitsuba and put it in a shapegroup that can be instanciated, don't export materials (use Save_XML_Materials() in addition)

Parameters
urlFilename.
ididentifier of the object
objbasenamethe basename of the object (that shares textures)
texturepaththe path where all the textures should be stored
Returns
A boolean indicating whether the file has been successfully created or not.

References instances, and MayaMaterial::name.

◆ Scale()

void MayaGeometryAll::Scale ( const Vector & s)

Scale all instances.

Parameters
sScaling vector.

References instances.

◆ SetFramesToAll()

void MayaGeometryAll::SetFramesToAll ( QVector< FrameScaled > s)

Set the frames to the entire geometry.

Parameters
sSet of frames.

References instances.

Referenced by MayaGeometryAll(), and MayaGeometryAll().

◆ SetMaterial()

void MayaGeometryAll::SetMaterial ( const MayaMaterial & mo)

Set the same material for all the objects.

Parameters
moMaterial.

References instances.

◆ SetMaterial_ContainsName()

void MayaGeometryAll::SetMaterial_ContainsName ( const QString & n,
const MayaMaterial & mo )

Set the material of all the instances whose name contains the given string.

Parameters
nString that will be searched and matched with the names.
moMaterial.

References instances.

◆ SetMaterial_EqualName()

void MayaGeometryAll::SetMaterial_EqualName ( const QString & n,
const MayaMaterial & mo )

Set the material of all the instances whose name exactly matches the given string.

Parameters
nString that will be searched and matched with the names.
moMaterial.

References instances.

◆ Translate()

void MayaGeometryAll::Translate ( const Vector & t)

Translate all instances.

Parameters
tTranslation vector.

References instances.