Scene Class Reference

This reference page is linked to from the following overview topics: Scene Graph, Traversing the Scene Graph.



Detailed Description

The Scene class is the container object for all the data in a Mudbox scene.

All the geometry, lights, cameras, etc, are accessed and maintained through this object. To get a pointer to the current Mudbox scene, call Kernel()->Scene()

Definition at line 41 of file scene.h.

#include <scene.h>

Inheritance diagram for Scene:
Inheritance graph
[legend]

List of all members.

Classes

struct   LoadData
  Data structure to hold file import/load options, and diagnostic data. More...

Public Member Functions

virtual mudbox::Camera ActiveCamera (void) const
  Returns a pointer to the camera that is currently being used.
virtual void  SetActiveCamera (mudbox::Camera *camera)
  Sets a different camera to be active.
virtual mudbox::Light ActiveLight (void) const
  Returns a pointer to the currently active light.
virtual unsigned int  CameraCount (void) const
  Returns the number of cameras in the scene.
virtual unsigned int  LightCount (void) const
  Returns the number of lights in the scene.
virtual unsigned int  GeometryCount (void) const
  Returns the number of Geometry objects in the scene.
virtual unsigned int  SelectedGeometryCount (void) const
  Returns the number of Geometry objects that are currently selected.
virtual mudbox::Camera AddCamera (mudbox::Camera *pCamera)
  Adds a camera to the scene. Returns a pointer to the camera you added.
virtual mudbox::Light AddLight (mudbox::Light *pLight)
  Adds a light to the scene. Returns a pointer to the light you added.
virtual mudbox::Geometry AddGeometry (mudbox::Geometry *pGeometry, mudbox::Transformation *pTransformation=0)
  Adds a geometry object to the scene. Returns a pointer to the object you added.
virtual void  RemoveGeometry (mudbox::Geometry *pGeometry)
  Removes a geometry object from the scene.
virtual mudbox::Camera Camera (unsigned int iIndex) const
  Returns a pointer to a Camera in the scene.
virtual mudbox::Light Light (unsigned int iIndex) const
  Returns a pointer to a Light in the scene.
virtual mudbox::Geometry SelectedGeometry (unsigned int iIndex) const
  Returns a pointer to a selected Geometry object in the scene.
virtual mudbox::Geometry Geometry (unsigned int iIndex) const
  Returns a pointer to a Geometry object in the scene.
virtual AxisAlignedBoundingBox  BoundingBox (void) const
  Returns the bounding box of the scene.
virtual void  Render (bool bSkipMaterials=false) const
  Render the scene to the current render target using the current OpenGL pipeline settings.
virtual bool  Export (const QString &sFileName, bool bSelectedOnly=false)
  Export models in the scene to an OBJ file. Returns true if successful.
virtual bool  Load (QString sFileName, Scene::LoadData &cData)
  Load a MUD file into this scene. Returns true if successful.
virtual mudbox::Geometry Import (Scene::LoadData &cData, QString sFileName="")
  Imports data from a file, and returns a Mudbox geometry.
virtual bool  Save (QString sFileName)
  Save this scene. Returns true if successful.
mudbox::Geometry ActiveGeometry () const
  Returns a pointer to the active object (that is, the object whose layers are displayed in the UI)
void  SetActiveGeometry (mudbox::Geometry *geometry) const
  Sets the specified geometry to be active. This means that its layers will be displayed in the UI. This is unrelated to selection.
virtual void  SetActivePaintLayer (mudbox::Layer *layer)
  Sets the specified paint layer to be active.
virtual void  SetActiveTexture (mudbox::TexturePool *layer)
  Sets the layer associated with the active texture pool to be active.
virtual mudbox::Layer ActivePaintLayer () const
  Returns a pointer to the currently active paint layer.
virtual mudbox::TexturePool ActiveTexture () const
  Returns a pointer to the currently active texture map.
virtual void  MakeThumbnail (QImage &image, int iSize=128)
  Creates a thumbnail of the current scene.
virtual QString  FileName () const
  Returns an absolute path to the scene's .mud file on disk, or an empty string if the scene.
virtual bool  Dirty () const
  This indicates if the scene has been dirtied since the last time it was saved.
virtual void  SetDirty (bool bDirty=true)
  Sets the dirty status of the scene. When set to true, the user will be prompted.

Public Attributes

aevent  m_eSceneRender

Protected Member Functions

  Scene (void)
  Do not use the constructor directly.

Constructor & Destructor Documentation

Scene ( void  ) [protected]

Do not use the constructor directly.

It is unlikely that you would ever create your own scene in a plug-in. If you do need to, you should not call the constructor directly. Instead, use CreateInstances, like this:

        Scene *myNewScene = CreateInstance<Scene>();  

Member Function Documentation

virtual mudbox::Camera* ActiveCamera ( void  ) const [virtual]

Returns a pointer to the camera that is currently being used.

Examples:
SampleViewportFilter/SampleViewportFilter.cpp.
virtual void SetActiveCamera ( mudbox::Camera camera ) [virtual]

Sets a different camera to be active.

virtual mudbox::Light* ActiveLight ( void  ) const [virtual]

Returns a pointer to the currently active light.

virtual unsigned int CameraCount ( void  ) const [virtual]

Returns the number of cameras in the scene.

virtual unsigned int LightCount ( void  ) const [virtual]

Returns the number of lights in the scene.

virtual unsigned int GeometryCount ( void  ) const [virtual]

Returns the number of Geometry objects in the scene.

virtual unsigned int SelectedGeometryCount ( void  ) const [virtual]

Returns the number of Geometry objects that are currently selected.

virtual mudbox::Camera* AddCamera ( mudbox::Camera pCamera ) [virtual]

Adds a camera to the scene. Returns a pointer to the camera you added.

Once you add a camera to the scene, the scene is responsible for deleting it.

Parameters:
[in] pCamera a pointer to an instance of a Camera
virtual mudbox::Light* AddLight ( mudbox::Light pLight ) [virtual]

Adds a light to the scene. Returns a pointer to the light you added.

Once you add a light to the scene, the scene is responsible for deleting it.

Parameters:
[in] pLight a pointer to an instance of a Light
virtual mudbox::Geometry* AddGeometry ( mudbox::Geometry pGeometry,
mudbox::Transformation pTransformation = 0 
) [virtual]

Adds a geometry object to the scene. Returns a pointer to the object you added.

Once you add a geometry object to the scene, the scene is responsible for deleting it.

Parameters:
[in] pGeometry a pointer to an instance of a Geometry object
[in] pTransformation a pointer to an instance of a Transformation for the Geometry
virtual void RemoveGeometry ( mudbox::Geometry pGeometry ) [virtual]

Removes a geometry object from the scene.

Note that the removed geometry is not deleted. Once the geometry is removed, it becomes the caller's responsibility to delete it.

Parameters:
[in] pGeometry a pointer to the object that you want removed.
virtual mudbox::Camera* Camera ( unsigned int  iIndex ) const [virtual]

Returns a pointer to a Camera in the scene.

(If the index is out of range, NULL is returned. To find out how many cameras are in the scene, call CameraCount().)

Parameters:
[in] iIndex the index of the camera to be returned (0-based)
virtual mudbox::Light* Light ( unsigned int  iIndex ) const [virtual]

Returns a pointer to a Light in the scene.

(If the index is out of range, NULL is returned. To find out how many lights are in the scene, call LightCount().)

Parameters:
[in] iIndex the index of the light to be returned (0-based)
virtual mudbox::Geometry* SelectedGeometry ( unsigned int  iIndex ) const [virtual]

Returns a pointer to a selected Geometry object in the scene.

(If the index is out of range, NULL is returned. To find out how many geometry objects are selected in the scene, call SelectedGeometryCount().)

Parameters:
[in] iIndex the index of the selected geometry object to be returned (0-based)
virtual mudbox::Geometry* Geometry ( unsigned int  iIndex ) const [virtual]

Returns a pointer to a Geometry object in the scene.

(If the index is out of range, NULL is returned. To find out how many geometry objects are in the scene, call GeometryCount().)

Parameters:
[in] iIndex the index of the geometry object to be returned (0-based)
virtual AxisAlignedBoundingBox BoundingBox ( void  ) const [virtual]

Returns the bounding box of the scene.

This bounding box is axis-aligned, and in World Space.

virtual void Render ( bool  bSkipMaterials = false ) const [virtual]

Render the scene to the current render target using the current OpenGL pipeline settings.

Note: This method is not part of the regular refresh cycle. To force the screen to refresh after making changes, call Kernel->Refresh() Use this method when you need to render the scene for purposes internal to your plug-in. For example, you can create a custom texture, make it the render target (see the Texture class defined in material.h), set up whatever special shaders you need, then call this method to render the scene into your texture. By default, objects will be rendered with their own materials. If you want to render everything with a shader that you set up, set bSkipMaterials to true.

Parameters:
[in] bSkipMaterials If true, then the materials attached to objects in the scene are ignored. Everything uses the current shader.
virtual bool Export ( const QString &  sFileName,
bool  bSelectedOnly = false 
) [virtual]

Export models in the scene to an OBJ file. Returns true if successful.

Parameters:
[in] sFileName The path to the file to be saved (with a .obj extension)
[in] bSelectedOnly If true, only selected models will be saved
virtual bool Load ( QString  sFileName,
Scene::LoadData cData 
) [virtual]

Load a MUD file into this scene. Returns true if successful.

Parameters:
[in] sFileName The path to the MUD file to be loaded
[in] cData The load options
virtual mudbox::Geometry* Import ( Scene::LoadData cData,
QString  sFileName = "" 
) [virtual]

Imports data from a file, and returns a Mudbox geometry.

If cData.Merge() is true, then the contents of the file are merged into the current scene, otherwise the first geometry contained within the file is returned, but not added to the scene. If sFileName is blank, a file dialog is opened. returns a geometry corresponding to the file, or NULL on error.

Parameters:
[in] cData Import options
[in] sFileName Path to the file
virtual bool Save ( QString  sFileName ) [virtual]

Save this scene. Returns true if successful.

Parameters:
[in] sFileName The path to the MUD file to be saved (with a .mud extension )
mudbox::Geometry* ActiveGeometry ( ) const

Returns a pointer to the active object (that is, the object whose layers are displayed in the UI)

Note that the 'active' object is unrelated to 'selected' objects. 'Active' refers to the object that is currently the focus of the user interface. For example, only one object at a time displays its layer information --- this is the active object.

void SetActiveGeometry ( mudbox::Geometry geometry ) const

Sets the specified geometry to be active. This means that its layers will be displayed in the UI. This is unrelated to selection.

Parameters:
[in] geometry a pointer to the geometry to be made active
virtual void SetActivePaintLayer ( mudbox::Layer layer ) [virtual]

Sets the specified paint layer to be active.

Parameters:
[in] layer A pointer to the layer to be made active
virtual void SetActiveTexture ( mudbox::TexturePool layer ) [virtual]

Sets the layer associated with the active texture pool to be active.

Parameters:
[in] layer A pointer to the texture to be made active
virtual mudbox::Layer* ActivePaintLayer ( ) const [virtual]

Returns a pointer to the currently active paint layer.

The active paint layer can be used in different ways, Use TexturePool::Usage to determine how a paint layer is being used.

virtual mudbox::TexturePool* ActiveTexture ( ) const [virtual]

Returns a pointer to the currently active texture map.

virtual void MakeThumbnail ( QImage &  image,
int  iSize = 128 
) [virtual]

Creates a thumbnail of the current scene.

virtual QString FileName ( ) const [virtual]

Returns an absolute path to the scene's .mud file on disk, or an empty string if the scene.

has not been saved yet.

virtual bool Dirty ( ) const [virtual]

This indicates if the scene has been dirtied since the last time it was saved.

virtual void SetDirty ( bool  bDirty = true ) [virtual]

Sets the dirty status of the scene. When set to true, the user will be prompted.

to save the scene when he closes the file, or exits Mudbox.


Member Data Documentation


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

Scene Scene Scene Scene Scene Scene Scene Scene Scene Scene
Scene Scene Scene Scene Scene Scene Scene Scene Scene Scene