Mudbox/node.h File Reference

#include <QtCore/QHash>

Classes

class  ClassDesc
 This structure represents and describes a class. More...
 
struct  Attribute
 This is an abstract base structure for all attributes. More...
 
class  AttributeVoid
 Used to insert expanded category item. More...
 
struct  AttributeInstance< type >
 This is a generic attribute which can be used instead of the standard built in types. More...
 
class  AttributePointer< type >
 This class can be used instead of standard pointers, when the pointer target class is derived from the Node class. More...
 
class  AttributeThisPointer
 
class  Node
 This is the base class for most classes in the Mudbox SDK. More...
 
class  EventGate
 This class represents an event receiver/triggerer point. More...
 
class  AttributeFloatRange
 This attribute represents a float value which has a minimum and a maximum value. More...
 
class  AttributeNumber
 An attribute that can hold a number and uses the specified number of digits when displaying on the UI. More...
 
class  AttributeEnumeration
 This attribute is very similar to the aint type but on the user interface it will be displayed as a combobox, and the user will be able to choose its value from a list. More...
 
class  AttributeFilename
 Similar to AttributeInstance<String> but it provides a button on the interface where the user can browse for a filename. More...
 
class  AttributeTextureFilename
 Represents a special file name attribute that accepts texture files as value. Provides a create new and a browse interface. More...
 
class  AttributeWatch
 A fake attribute used to watch an attribute in your class which is not a member. More...
 
class  AttributeBoolCollection
 This attribute is a collection of bools. More...
 

Namespaces

 mudbox
 Class: ConvolutionKernel.
 

Macros

#define DECLARE_CLASS
 This macro should be used in declaration of classes which are inherited from the Node class (or any descendant of that) to fill RTTI information. More...
 
#define IMPLEMENT_SDK_VCLASS2(name, parent0, parent1, displayname, instanceclass, version, streamversion)
 
#define IMPLEMENT_SDK_VCLASS(name, parent, displayname, instanceclass, streamversion)   IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, instanceclass, 0, streamversion )
 
#define IMPLEMENT_SDK_CLASS(name, parent, displayname, instanceclass)   IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, instanceclass, 0, 0 )
 
#define IMPLEMENT_VCLASS2(name, parent0, parent1, displayname, version)   IMPLEMENT_SDK_VCLASS2( name, parent0, parent1, displayname, name, version, 0 )
 
#define IMPLEMENT_VCLASS(name, parent, displayname, version)   IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, name, version, 0 )
 
#define IMPLEMENT_CLASS2(name, parent0, parent1, displayname)   IMPLEMENT_SDK_VCLASS2( name, parent0, parent1, displayname, name, 0, 0 )
 
#define IMPLEMENT_CLASS(name, parent, displayname)   IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, name, 0, 0 )
 
#define IMPLEMENT_SCLASS(name, parent, displayname, streamversion)   IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, name, 0, streamversion )
 This macro is the same as the IMPLEMENT_CLASS macro, but it also accepts an additional parameter, which is the stream version for the class. More...
 
#define IMPLEMENT_SCLASS2(name, parent0, parent1, displayname, streamversion)   IMPLEMENT_SDK_VCLASS2( name, parent0, parent1, displayname, name, 0, streamversion )
 
#define OPERATORS_NOEXCMARK(type)
 
#define OPERATORS(type)
 
#define PTROPERATORS(type)
 
#define aptr   AttributePointer
 

Typedefs

typedef AttributeVoid avoid
 
typedef AttributeInstance< intaint
 This type has to be used instead of the general int type. More...
 
typedef AttributeInstance< float > afloat
 This type has to be used instead of the general float type. More...
 
typedef AttributeInstance< bool > abool
 This type has to be used instead of the general bool type. More...
 
typedef AttributeInstance< QStringastring
 This type has to be used instead of the String type. More...
 
typedef EventGate aevent
 
typedef AttributeFloatRange afloatr
 
typedef AttributeNumber anumber
 
typedef AttributeEnumeration aenum
 
typedef AttributeFilename afilename
 
typedef AttributeTextureFilename atexturefilename
 
typedef AttributeBoolCollection aboolc
 

Enumerations

enum  NodeEventType {
  etValueChanged, etSourceChanged, etTargetChanged, etPointerContentChanged,
  etPointerTargetDestroyed, etStatusChanged, etPointerTargetUIChanged, etDeferred,
  etRefreshDialogUI, etEditingFinished, etEventTriggered = etValueChanged
}
 Possible event types when Node::OnNodeEvent is called. More...
 

Functions

MBDLL_DECL AttributeWidget * CreateNewPtrWidget (QWidget *pParent, int iWidth, Attribute *pAttribute, const ClassDesc *pType)
 
MBDLL_DECL AttributeWidget * CreateNewBoolWidget (QWidget *pParent, int iWidth, abool *pAttribute)
 
MBDLL_DECL AttributeWidget * CreateNewIntWidget (QWidget *pParent, int iWidth, aint *pAttribute)
 
template<typename type >
bool operator== (const Attribute &cA, const AttributeInstance< type > &cB)
 This operator compares the two attributes and NOT their values. More...
 
template<typename type >
Stream & operator== (Stream &s, AttributeInstance< type > &c)
 
template<typename type >
Stream & operator== (Stream &cStream, AttributePointer< type > &cPointer)
 
AttributeWidget * CreateNewEventWidget (QWidget *pParent, int iWidth, EventGate *pAttribute)
 Creates an event widget. More...
 
MBDLL_DECL Stream & operator== (Stream &s, afloatr &a)
 
MBDLL_DECL Stream & operator== (Stream &s, aenum &a)
 
MBDLL_DECL Stream & operator== (Stream &s, afilename &a)
 

Macro Definition Documentation

#define DECLARE_CLASS
Value:
private: \
static mudbox::ClassDesc s_cMyClass; \
public: \
virtual const mudbox::ClassDesc *RuntimeClass( void ) const { return &s_cMyClass; }; \
static const mudbox::ClassDesc *StaticClass( void ); \
static mudbox::Node *CreateInstances( unsigned int iCount = 1 );
This is the base class for most classes in the Mudbox SDK.
Definition: node.h:740
This structure represents and describes a class.
Definition: node.h:22

This macro should be used in declaration of classes which are inherited from the Node class (or any descendant of that) to fill RTTI information.

You have to use this with the IMPLEMENT_CLASS macro. Example:

1 class MyClass : public Node
2 {
3  DECLARE_CLASS
4  // other members follow
5 }

in the corresponding cpp file:

1 #include "MyClass.h"
2 IMPLEMENT_CLASS( MyClass, Node, "My Class" );

After this you will be able to access the following functionality:

  1. Your class will be listed as the implemented classes in mudbox. This means that other plugins, or mudbox itself will be able to create instances of your class. See the Imported class for more details.
  2. It will be possible to identify the runtime type of your objects.
+ Examples:

Definition at line 91 of file node.h.

#define IMPLEMENT_SDK_VCLASS2 (   name,
  parent0,
  parent1,
  displayname,
  instanceclass,
  version,
  streamversion 
)
Value:
mudbox::ClassDesc name::s_cMyClass( parent0::StaticClass(), parent1::StaticClass(), #name, displayname, name::CreateInstances, version, streamversion ); \
const mudbox::ClassDesc *name::StaticClass( void ) { return &s_cMyClass; }; \
mudbox::Node *name::CreateInstances( unsigned int iCount ) \
{ Node *p; \
if ( iCount > 1 ) { p = new instanceclass[iCount]; for ( unsigned int i = 0; i < iCount; i++ ) p[i].Initialize(); } \
else { p = new instanceclass; p->Initialize(); }; \
return p; };
This structure represents and describes a class.
Definition: node.h:22
GLfloat GLfloat p
Definition: GLee.h:5416
GLuint const GLchar * name
Definition: GLee.h:1704

Definition at line 99 of file node.h.

#define IMPLEMENT_SDK_VCLASS (   name,
  parent,
  displayname,
  instanceclass,
  streamversion 
)    IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, instanceclass, 0, streamversion )

Definition at line 108 of file node.h.

#define IMPLEMENT_SDK_CLASS (   name,
  parent,
  displayname,
  instanceclass 
)    IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, instanceclass, 0, 0 )

Definition at line 109 of file node.h.

#define IMPLEMENT_VCLASS2 (   name,
  parent0,
  parent1,
  displayname,
  version 
)    IMPLEMENT_SDK_VCLASS2( name, parent0, parent1, displayname, name, version, 0 )

Definition at line 110 of file node.h.

#define IMPLEMENT_VCLASS (   name,
  parent,
  displayname,
  version 
)    IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, name, version, 0 )
#define IMPLEMENT_CLASS2 (   name,
  parent0,
  parent1,
  displayname 
)    IMPLEMENT_SDK_VCLASS2( name, parent0, parent1, displayname, name, 0, 0 )

Definition at line 112 of file node.h.

#define IMPLEMENT_SCLASS (   name,
  parent,
  displayname,
  streamversion 
)    IMPLEMENT_SDK_VCLASS2( name, parent, parent, displayname, name, 0, streamversion )

This macro is the same as the IMPLEMENT_CLASS macro, but it also accepts an additional parameter, which is the stream version for the class.

When the IMPLEMENT_CLASS macro is used, the local stream version for the class is default to zero. This version number will be automatically written to each stream. When the stream is loaded, you can check which version of your class implementation was writing it, so you know how to read the content of the file. Normally you increase the local version number in your class by 1, when you change something in your Serialize function implementation. For example id your serialize function looks like this:

1 IMPLEMENT_SCLASS( MyClass, Node, "MyClass", 4 );
2 
3 void MyClass::Serialize( Stream &s )
4 {
5  s == m_bEnabled == m_sName;
6 };

And you want to add a new member variable to the stream, you change the code to the following:

1 IMPLEMENT_SCLASS( MyClass, Node, "MyClass", 5 );
2 
3 void MyClass::Serialize( Stream &s )
4 {
5  s == m_bEnabled == m_sName;
6  if ( s.IsNewerThan( 4, this )
7  s == m_iLevel; // this path will be executed when you load/save the most recent file format
8  else
9  m_iLevel = 0; // and this path will be executed when you load an old file format
10 };

This way, you will be able to load old files without problem, and maintain compatibility.

+ Examples:

Definition at line 144 of file node.h.

#define IMPLEMENT_SCLASS2 (   name,
  parent0,
  parent1,
  displayname,
  streamversion 
)    IMPLEMENT_SDK_VCLASS2( name, parent0, parent1, displayname, name, 0, streamversion )

Definition at line 145 of file node.h.

#define OPERATORS_NOEXCMARK (   type)
Value:
\
inline operator type( void ) const { return AttributeInstance<type>::Value(); }; \ \
inline type const &operator ~( void ) const { return AttributeInstance<type>::Value(); }; \ \
inline type operator =( type cValue ) { SetValue( cValue, true ); return cValue; }; \ \
inline type operator =( const AttributeInstance<type> &cValue ) { /*AttributeInstance<type>::*/SetValue( cValue.AttributeInstance<type>::Value(), true ); return cValue; }; \ \
inline bool operator ==( type cValue ) const { return AttributeInstance<type>::Value() == cValue; }; \ \
inline bool operator !=( type cValue ) const { return AttributeInstance<type>::Value() != cValue; }; \ \
inline const QString &operator <<=( const QString &sCategory ) { AttributeInstance<type>::SetCategory( sCategory ); return sCategory; };
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
#define inline
Definition: image.h:2490
MBDLL_DECL Stream & operator==(Stream &s, afilename &a)
bool operator!=(const QByteArray &a1, const QByteArray &a2)
Definition: qbytearray.h:533

Definition at line 456 of file node.h.

#define OPERATORS (   type)
Value:
inline bool operator !( void ) { return !AttributeInstance<type>::Value(); };
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
#define inline
Definition: image.h:2490
#define OPERATORS_NOEXCMARK(type)
Definition: node.h:456

Definition at line 475 of file node.h.

#define PTROPERATORS (   type)
Value:
inline type *operator =( int iValue ) { MB_ASSERT( iValue == 0 ); return operator =( (type *)(uint64)iValue ); }; \ \
inline bool operator ==( int iValue ) { MB_ASSERT( iValue == 0 ); return operator ==( (type *)(uint64)iValue ); }; \ \
inline bool operator !=( int iValue ) { MB_ASSERT( iValue == 0 ); return operator !=( (type *)(uint64)iValue ); }; \ \
inline type *operator ->( void ) { return AttributeInstance<type *>::Value(); }; \ \
inline const type *operator ->( void ) const { return AttributeInstance<type *>::Value(); }; \ \
inline operator bool( void ) const { return AttributeInstance<type *>::Value() != 0; };
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
#define MB_ASSERT(condition)
Definition: mudbox.h:73
#define inline
Definition: image.h:2490
unsigned long long uint64
Definition: mudbox.h:177
MBDLL_DECL Stream & operator==(Stream &s, afilename &a)
const type * & Value(void) const
Returns the value of the attribute.
Definition: node.h:406
bool operator!=(const QByteArray &a1, const QByteArray &a2)
Definition: qbytearray.h:533
#define OPERATORS(type)
Definition: node.h:475

Definition at line 697 of file node.h.

#define aptr   AttributePointer

Definition at line 723 of file node.h.

Go to the source code of this file.