Mudbox/scene.h Source File

scene.h
Go to the documentation of this file.
1 
2 //**************************************************************************/
3 // Copyright (c) 2008 Autodesk, Inc.
4 // All rights reserved.
5 //
6 // Use of this software is subject to the terms of the Autodesk license
7 // agreement provided at the time of installation or download, or which
8 // otherwise accompanies this software in either electronic or hard copy form.
9 //
10 //**************************************************************************/
11 // DESCRIPTION:
12 // CREATED: October 2008
13 //**************************************************************************/
14 
15 namespace mudbox {
16 
19 {
21 
23  m_eType( eUnknownType ),
24  m_eSource( eUnknownSource )
25  {};
26 
28  enum Type
29  {
30  eAboutToAdd, // a node is about to be added into a scene, maybe not the same scene as Kernel()->Scene().
31  eAdded, // a node is just added into a scene, maybe not the same scene as Kernel()->Scene().
32  eAboutToRemove, // a node is about to be removed from a scene, maybe not the same scene as Kernel()->Scene().
33  eRemoved, // a node is just removed from a scene, maybe not the same scene as Kernel()->Scene().
34  eUnknownType = -1
35  } m_eType;
36 
38  enum Source
39  {
40  eFile,
41  eUnknownSource = -1
42  } m_eSource;
43 
45  aptr<TreeNode> m_pNode;
46 };
47 
53 class MBDLL_DECL Scene : virtual public TreeNode
54 {
56 
57 protected:
66  Scene( void );
67 
68 public:
69 
72  {
78  {
79  updateGeometries = 0x00000001,
80  updateCameras = 0x00000002,
81  updateAll = 0xffffffff,
82  updateNone = 0x00000000
83  };
84 
87  {
88  includeGeometries = 0x00000001,
89  includeCameras = 0x00000002,
90  includeMaterials = 0x00000004,
91  includeLights = 0x00000008,
92  includeCurves = 0x00000010,
93  includeSelectionSets = 0x00000020,
94  includeTransformationPalettes = 0x00000040,
95  includeAll = 0xffffffff,
96  includeNone = 0x00000000
97  };
98 
101  int& IncludeFilter() { return m_eIncludeFilter; }
102 
105  int& UpdateFilter() { return m_eUpdateFilter; }
106 
108  bool& Merge() { return m_bMerge; }
109 
111  void AddDiagnosticMessage( const QString& sMessage ) { m_aDiagnosticMessages.push_back( sMessage ); }
112 
114  void LogDiagnosticMessages() const;
115 
117  LoadData( bool bMerge = false, int eIncludeFilter = includeAll, int eUpdateFilter = updateNone );
118 
120  LoadData( int eUpdateFilter, bool bMerge = false );
121 
123  static LoadData ByInclude( bool bGeoms, bool bCams, bool bMats, bool bLights, bool bCurves, bool bSets, bool bPalettes );
124 
128  static LoadData& ByMerge( bool bMerge = false );
129 
131  bool IncludeGeometries() const { return m_eIncludeFilter & includeGeometries; }
132 
134  bool IncludeCameras() const { return m_eIncludeFilter & includeCameras; }
135 
137  bool IncludeMaterials() const { return m_eIncludeFilter & includeMaterials; }
138 
140  bool IncludeLights() const { return m_eIncludeFilter & includeLights; }
141 
143  bool IncludeCurves() const { return m_eIncludeFilter & includeCurves; }
144 
146  bool IncludeSelectionSets() const { return m_eIncludeFilter & includeSelectionSets; }
147 
149  bool IncludeTransformationPalettes() const { return m_eIncludeFilter & includeTransformationPalettes; }
150 
152  bool UpdateGeometries() const { return m_eUpdateFilter & updateGeometries; }
153 
155  bool UpdateCameras() const { return m_eUpdateFilter & updateCameras; }
156 
157  private:
158  int m_eIncludeFilter;
159 
160  int m_eUpdateFilter;
161 
162  bool m_bMerge;
163 
164  QStringList m_aDiagnosticMessages;
165  };
166 
167  // Returns a list of strings of all selected items in the Object List
168  virtual QStringList SelectedObjectListNames ( void );
169 
171  virtual mudbox::CurveBase *ActiveCurve( void ) const;
172 
174  virtual void SetActiveCurve( mudbox::CurveBase *curve );
175 
177  virtual mudbox::Camera *ActiveCamera( void ) const;
178 
180  virtual void SetActiveCamera( mudbox::Camera *camera );
181 
183  virtual mudbox::Light *ActiveLight( void ) const;
184 
186  virtual void SetActiveLight( mudbox::Light *light );
187 
189  virtual unsigned int CameraCount( void ) const;
190 
193  virtual unsigned int CurveCount( void ) const;
194 
196  virtual unsigned int SelectedCurveCount( void ) const;
197 
199  virtual unsigned int LightCount( void ) const;
200 
202  virtual unsigned int GeometryCount( void ) const;
203 
205  virtual unsigned int SelectedGeometryCount( void ) const;
206 
211  virtual mudbox::Camera *AddCamera(
212  mudbox::Camera *pCamera
213  );
214 
218  virtual mudbox::Light *AddLight(
219  mudbox::Light *pLight
220  );
221 
225  virtual mudbox::CurveBase *AddCurve(
226  mudbox::CurveBase *pCurve,
227  mudbox::Transformation* pTransformation = 0
228  );
229 
230 
235  virtual void RemoveCurve(
236  mudbox::CurveBase *pCurve
237  );
238 
242  virtual mudbox::Geometry *AddGeometry(
243  mudbox::Geometry *pGeometry,
244  mudbox::Transformation* pTransformation = 0
245  );
246 
247 
252  virtual void RemoveGeometry(
253  mudbox::Geometry *pGeometry
254  );
255 
260  virtual mudbox::Camera *Camera(
261  unsigned int iIndex
262  ) const;
263 
268  virtual mudbox::Light *Light(
269  unsigned int iIndex
270  ) const;
271 
276  virtual mudbox::CurveBase *SelectedCurve(
277  unsigned int iIndex
278  ) const;
279 
284  virtual mudbox::CurveBase *Curve(
285  unsigned int iIndex
286  ) const;
287 
292  virtual mudbox::Geometry *SelectedGeometry(
293  unsigned int iIndex
294  ) const;
295 
300  virtual mudbox::Geometry *Geometry(
301  unsigned int iIndex
302  ) const;
303 
307  virtual AxisAlignedBoundingBox BoundingBox( void ) const;
308 
320  virtual void Render(
321  bool bSkipMaterials = false
322  ) const;
323 
325  virtual bool Export(
326  const QString &sFileName,
327  bool bSelectedOnly = false
328  ); // export data to an obj file
329 
331  virtual bool Load(
332  QString sFileName,
333  Scene::LoadData& cData
334  );
335 
342  virtual mudbox::Geometry *Import(
343  Scene::LoadData& cData,
344  QString sFileName = ""
345  );
346 
348  virtual bool Save(
349  QString sFileName
350  );
351 
357  mudbox::Geometry *ActiveGeometry() const;
358 
360  void SetActiveGeometry(
361  mudbox::Geometry *geometry
362  ) const;
363 
365  virtual void SetActivePaintLayer(
367  );
368 
370  virtual void SetActivePaintLayerGroup(
371  mudbox::LayerGroup* layergroup
372  );
373 
375  virtual void SetActiveTexture(
377  );
378 
383  virtual mudbox::Layer *ActivePaintLayer() const;
384 
387  virtual mudbox::LayerGroup *ActivePaintLayerGroup() const;
388 
390  virtual mudbox::TexturePool *ActiveTexture() const;
391 
393  virtual void MakeThumbnail(QImage &image, int iSize = 128);
394 
397  virtual QString FileName() const;
398 
400  virtual bool Dirty() const;
401 
404  virtual void SetDirty( bool bDirty = true );
405 
409  Mesh *CreateMesh(
410  Topology::FaceType eType
411  );
412 
415 
419 
428  static aptr<SceneMembershipEventNotifier> SceneMembershipEvent;
429 
432  static aptr<Node> SelectedNode;
433 
436 
439 
442 
445 
448 };
449 
450 }; // end of namespace mudbox
LayerGroup acts as a logical sub-container for the layers, it does not own the these layers...
Definition: layer.h:158
bool IncludeSelectionSets() const
Convenience method to determine if selection sets should be included in the load operation.
Definition: scene.h:146
A Mesh is a collection of vertices organized into faces, and optional Texture Coordinate information...
Definition: mesh.h:452
The Scene class is the container object for all the data in a Mudbox scene.
Definition: scene.h:53
This is a container class for simple textures.
Definition: material.h:467
Base class for Curve types.
Definition: curve.h:20
bool & Merge()
Indicates if the loaded data should be merged into the current scene.
Definition: scene.h:108
Holds information about the a recent or in-progress scene membership event.
Definition: scene.h:18
bool IncludeMaterials() const
Convenience method to determine if materials should be included in the load operation.
Definition: scene.h:137
This is the base class for anything which is an element of a list with a fixed order and a transparen...
Definition: layer.h:20
static aevent MaterialChangeEvent
This event is triggered after a new material is set to a mesh.
Definition: scene.h:414
static aptr< SceneMembershipEventNotifier > SceneMembershipEvent
This is a pointer to the latest scene membership event.
Definition: scene.h:428
Represents a bounding box whose axes are aligned with the coordinate system.
Definition: math.h:838
bool IncludeCameras() const
Convenience method to determine if cameras should be included in the load operation.
Definition: scene.h:134
This is the base class for most classes in the Mudbox SDK.
Definition: node.h:740
void AddDiagnosticMessage(const QString &sMessage)
While loading scenes, Mudbox can append diagnostic messages to this data structure.
Definition: scene.h:111
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: GLee.h:882
static aevent PaintLayerRemovedEvent
This event is triggered after a paint layer is deleted.
Definition: scene.h:441
static aevent ActiveCameraChangeEvent
This event is triggered after a different camera is set as the active camera in the SetActiveCamera()...
Definition: scene.h:418
bool UpdateGeometries() const
Convenience method to determine if matching geometries should be updated in the load operation...
Definition: scene.h:152
bool UpdateCameras() const
Convenience method to determine if matching cameras should be updated in the load operation...
Definition: scene.h:155
UpdateFilter
This is used to determine which elements in the current scene get merged/updated with data from an im...
Definition: scene.h:77
Definition: qimage.h:87
static aevent PaintSelectionEvent
This event is triggered when selection set of faces vary, i.e. more faces or less faces are selected...
Definition: scene.h:435
This class represents an event receiver/triggerer point.
Definition: node.h:999
static aevent GeometryTransformedEvent
This event is triggered when a geometry is transformed by translate/rotate/scale tools.
Definition: scene.h:447
GLenum GLuint GLint GLint layer
Definition: GLee.h:8587
int & UpdateFilter()
A bit-field that indicates what types of scene elements should be updated in the load operation...
Definition: scene.h:105
Represents a camera (point of view) in a Mudbox scene.
Definition: camera.h:20
Class: ConvolutionKernel.
Definition: array.h:15
This class is the base of all node types that can be structured in a hierarchy.
Definition: treenode.h:18
bool IncludeGeometries() const
Convenience method to determine if geometries should be included in the load operation.
Definition: scene.h:131
bool IncludeLights() const
Convenience method to determine if lights should be included in the load operation.
Definition: scene.h:140
A Transformation is a node in the Mudbox scene that controls the size and position of other nodes...
Represents a light source in the scene.
Definition: light.h:18
static aptr< Node > SelectedNode
This pointer contains the address of the currently selected node in the scene.
Definition: scene.h:432
IncludeFilter
This is used to determine which types of scene elements should get loaded/merged into the scene...
Definition: scene.h:86
bool IncludeCurves() const
Convenience method to determine if curves should be included in the load operation.
Definition: scene.h:143
Represents a 3d object in the scene.
Definition: geometry.h:18
Data structure to hold file import/load options, and diagnostic data.
Definition: scene.h:71
#define DECLARE_CLASS
This macro should be used in declaration of classes which are inherited from the Node class (or any d...
Definition: node.h:91
bool IncludeTransformationPalettes() const
Convenience method to determine if transformation palettes should be included in the load operation...
Definition: scene.h:149
#define MBDLL_DECL
Definition: dllinterface.h:35
static aevent PaintLayerPropertiesChangedEvent
This event is triggered after changes happend to existing paint layers.
Definition: scene.h:444
int & IncludeFilter()
A bit-field that indicates what types of scene elements should be included in the load operation...
Definition: scene.h:101
static aevent PaintLayerAddedEvent
This event is triggered after a paint layer is created.
Definition: scene.h:438