Classes | Namespaces | Defines | Typedefs | Enumerations | Functions

node.h File Reference

This reference page is linked to from the following overview topics: File Event Handling, Writing a File Event Handler Plug-in, Writing Plug-ins, Run-Time Type Information (RTTI).


Go to the source code of this file.

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. These values will be used in the user interface only, but the user will be able to assign values out of the range to the attribute. 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

namespace   mudbox
 

Class: ConvolutionKernel.


Defines

#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.
#define  IMPLEMENT_SDK_VCLASS2(name, parent0, parent1, displayname, instanceclass, version, 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.
#define  OPERATORS_NOEXCMARK(type)
#define  OPERATORS(type)
#define  PTROPERATORS(type)
#define  aptr   AttributePointer

Typedefs

typedef AttributeVoid  avoid
typedef AttributeInstance< int >  aint
  This type has to be used instead of the general int type.
typedef AttributeInstance< float >  afloat
  This type has to be used instead of the general float type.
typedef AttributeInstance< bool >  abool
  This type has to be used instead of the general bool type.
typedef AttributeInstance
< QString > 
astring
  This type has to be used instead of the String type.
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, 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. Returns true only if the two attribute instances are the same (See Node::OnNodeEvent).
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.
MBDLL_DECL Stream &  operator== (Stream &s, afloatr &a)
MBDLL_DECL Stream &  operator== (Stream &s, aenum &a)
MBDLL_DECL Stream &  operator== (Stream &s, afilename &a)

Define 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 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:

 class MyClass : public Node
 {
     DECLARE_CLASS
     // other members follow
 }

in the corresponding cpp file:

 #include "MyClass.h"
 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:
CurveBrush/CurveCreator.h, CurveBrush/CurveDisplayer.h, FixedFunctionMaterial/FixedFunctionMaterial.h, ImmediateModeRenderer/ImmediateModeRenderer.h, MeshDisplace/displacer.h, PLYImport/Importer.cpp, PtexExtractor/PtexLayout.h, PtexExtractor/PtexPaintExporter.h, PtexExtractor/PtexUtilizer.h, PtexImporter/PtexImporter.h, SampleViewportFilter/SampleViewportFilter.h, STLExport/STLExporter.cpp, TextureSwapperViewportFilter/TextureSwapperViewportFilter.h, and ToonMaterial/ToonMaterial.h.

Definition at line 82 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; };

Definition at line 90 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 99 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 100 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 102 of file node.h.

#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.

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:

 IMPLEMENT_SCLASS( MyClass, Node, "MyClass", 4 );

 void MyClass::Serialize( Stream &s )
 {
        s == m_bEnabled == m_sName;
 };

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

 IMPLEMENT_SCLASS( MyClass, Node, "MyClass", 5 );

 void MyClass::Serialize( Stream &s )
 {
        s == m_bEnabled == m_sName;
    if ( s.IsNewerThan( 4, this )
            s == m_iLevel;  // this path will be executed when you load/save the most recent file format
        else
            m_iLevel = 0;   // and this path will be executed when you load an old file format
 };

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

Examples:
PtexExtractor/PtexLayout.cpp, and PtexExtractor/PtexUtilizer.cpp.

Definition at line 132 of file node.h.

#define OPERATORS_NOEXCMARK (   type )
Value:
 \
    inline operator const type( void ) const { return AttributeInstance<type>::Value(); }; \ \
    inline type const &operator ~( void ) const { return AttributeInstance<type>::Value(); }; \ \
    inline type operator =( type cValue ) { SetValue( cValue, Attribute::asStringInternal ); return cValue; }; \ \
    inline type operator =( const AttributeInstance<type> &cValue ) { /*AttributeInstance<type>::*/SetValue( cValue.AttributeInstance<type>::Value(), Attribute::asStringInternal ); 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; };

Definition at line 454 of file node.h.

#define OPERATORS (   type )
Value:
OPERATORS_NOEXCMARK( type ) \ \
    inline bool operator !( void ) { return !AttributeInstance<type>::Value(); };

Definition at line 469 of file node.h.

#define PTROPERATORS (   type )
Value:
OPERATORS( type* ); \ \
    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; };

Definition at line 643 of file node.h.

#define aptr   AttributePointer

Definition at line 669 of file node.h.