Attribute Struct Reference

#include <node.h>

Class Description

This is an abstract base structure for all attributes.

Do not use it directly, use AttributeInstance instead.

Each node has a list of attributes with different types. The attributes are used like plain data members of the node class, but in case of attributes, mudbox will be able to get a list of all the attributes in a node, and for example it will be possible so simply display a dialog to the used where it is possible to check and alter the value of the variables.

+ Examples:

Definition at line 181 of file node.h.

+ Inheritance diagram for Attribute:

Public Types

enum  AttributeType {
  typeUnknown, typeInt, typeFloat, typeBool,
  typeString, typePointer, typeColor, typeVector,
  typeEnum, typeWatch
}
 Type of the attribute. More...
 

Public Member Functions

unsigned int TargetCount (void) const
 Returns the number of attributes currently linked to this attribute as target. More...
 
AttributeTarget (unsigned int iIndex) const
 Returns the target with the given index. If iIndex is greater than the number of targets, returns 0;. More...
 
AttributeSource (void) const
 Returns the source attribute, or 0 if there is no source. More...
 
bool operator== (const Attribute &cAttribute) const
 This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details. More...
 
bool operator!= (const Attribute &cAttribute) const
 This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details. More...
 
virtual AttributeType Type (void) const
 Returns the type of the attribute. More...
 
QString ID (void) const
 Returns the unique ID (within this node) of the attribute. More...
 
QString Name (void) const
 Returns the name of the attribute. More...
 
void SetName (const QString &sName)
 Sets the name of the attribute. More...
 
QString Category (void) const
 Returns the category of the attribute. More...
 
void SetCategory (const QString &sCategory, bool bSeparator=false)
 Sets the category of the attribute. This value will be used in the user interface to determine which attribute group to be used. More...
 
bool Separator (void) const
 Returns the separator state of the widget. More...
 
void SetSeparator (bool bSeparator)
 Call this with true to display a separator line below this widget. More...
 
bool Const (void) const
 Gets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface. More...
 
void SetConst (bool bConst)
 Sets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface. More...
 
bool InstantEdit (void) const
 Returns true, if the attribute edition should be instant, i.e. the attribute should change every time the user makes any changes to the widget. Default is false. More...
 
void SetInstantEdit (bool bOn)
 If bOn is true, editing the attribute on the UI will be instant, i.e. More...
 
bool Visible (void) const
 Returns true if the property is visible. More...
 
void SetVisible (bool bVisible)
 Sets the visible status of the property. More...
 
QString ToolTip (void) const
 Gets the tooltip text to be used on the user interface, this is optional. More...
 
void SetToolTip (const QString &sToolTip)
 Sets the tooltip text to be used on the user interface, this is optional. More...
 
unsigned int Size (void) const
 Returns the size of the attribute value in bytes. More...
 
float LabelWidth (void) const
 Returns the width of label relative to the full width of the line. More...
 
void SetLabelWidth (float fLabelWidth)
 Set the width of label. More...
 
int Index (void) const
 Returns the attribute index;. More...
 
void SetIndex (int iIndex)
 Sets the attribute index;. More...
 
NodeOwner (void) const
 Gets the address of the Node which contains this attribute. More...
 
virtual void Serialize (Stream &s)
 Serialize the value of the attribute into a stream. More...
 
virtual QString AsString (bool bLocalized=false) const
 Returns the value of the attribute as a string. More...
 
virtual void SetFromString (const QString &sValue, bool bInternal=true, bool bLocalized=false)
 Sets the value of the attribute as a string. More...
 
virtual ~Attribute (void)
 
virtual void StartEvent (NodeEventType cType) const
 
void SetOwner (Node *pOwner)
 This function sets the owner of the attribute. More...
 
virtual AttributeWidgetCreateEditorWidget (QWidget *pParent, int iWidth)
 This function creates and returns the address of a QWidget object. More...
 
void LogTargets (void)
 
void LogSource (void)
 
void CheckValidity (void)
 
Attribute connecting functions

These functions are related to creating dependent connections between attributes.

When a source attribute value changes, the target attribute value will change also.

void ClearTargets (void)
 Removes all outgoing connections from the attribute. More...
 
void ClearSource (void)
 Removes the incoming connection for this attribute. More...
 
virtual void AddTarget (Attribute &cTarget, bool bInternal=false)
 Adds a new outgoing connection for this node to pTarget. More...
 
void Connect (Attribute &cSource, bool bInternal=false)
 Connect this attribute to another one. More...
 
virtual void UpdateTargets (void)
 
Pointer attribute functions

These functions are intended for use only with AttributePointer.

virtual const ClassDescTargetType (void) const
 This is valid only for pointer attributes (See AttributePointer). Returns the type of the pointer. More...
 
virtual void SetPointerValue (Node *pValue, bool bLink=true)
 This is valid only for pointer attributes (See AttributePointer). More...
 
virtual NodePointerValue (void) const
 This is valid only for pointer attributes (See AttributePointer). More...
 
virtual bool ValidatePointerValue (const Node *pValue)
 Validate a possible value for the pointer, returns true if the value is acceptable. More...
 
Parameter functions

These functions allow you to query or modify the parameters associated with an attribute.

Returns the number of parameters assigned to this attribute.

virtual unsigned int ParameterCount (void) const
 
virtual QString ParameterName (unsigned int iIndex) const
 Returns the name of a parameter with a given index. More...
 
virtual QString ParameterValue (unsigned int iIndex) const
 Returns the value of parameter with a given index. More...
 
virtual void SetParameterValue (const QString &sName, const QString &sValue)
 Set the value of a parameter. More...
 

Protected Member Functions

 Attribute (Node *pOwner, const QString &sID)
 
 Attribute (Node *pOwner, bool bInstall)
 
void Uninstall (void)
 

Protected Attributes

int m_iSize
 
Attributem_pSource
 
Attributem_pNext
 
Store< Attribute * > m_aTargets
 
Nodem_pNode
 
QString m_sName
 
bool m_bSeparator
 
QString m_sCategory
 
QString m_sToolTip
 
float m_fLabelWidth
 
bool m_bConst
 
bool m_bVisible
 
int m_iIndex
 
bool m_bInstantEdit
 
QString m_sID
 

Friends

class Node
 

Member Enumeration Documentation

Type of the attribute.

Enumerator
typeUnknown 

Unknown attribute.

typeInt 

Standard integer, 4 bytes.

typeFloat 

Standard float, 4 bytes.

typeBool 

Standard bool, 1 bytes.

typeString 

String attribute, can store any UNICODE text.

typePointer 

Pointer attribute, see AttributePointer.

typeColor 

Color attribute, 4xfloat, See Color.

typeVector 

Vector, 3xfloat, see Vector.

typeEnum 

Standard enum attribute, 4 bytes.

typeWatch 

Empty attribute, used only to catch events. See AttributeWatch.

Definition at line 184 of file node.h.

185  {
187  typeUnknown,
189  typeInt,
191  typeFloat,
193  typeBool,
195  typeString,
197  typePointer,
199  typeColor,
201  typeVector,
203  typeEnum,
205  typeWatch
206  };
Standard enum attribute, 4 bytes.
Definition: node.h:203
String attribute, can store any UNICODE text.
Definition: node.h:195
Standard float, 4 bytes.
Definition: node.h:191
Color attribute, 4xfloat, See Color.
Definition: node.h:199
Standard bool, 1 bytes.
Definition: node.h:193
Standard integer, 4 bytes.
Definition: node.h:189
Pointer attribute, see AttributePointer.
Definition: node.h:197
Empty attribute, used only to catch events. See AttributeWatch.
Definition: node.h:205
Vector, 3xfloat, see Vector.
Definition: node.h:201
Unknown attribute.
Definition: node.h:187

Constructor & Destructor Documentation

virtual ~Attribute ( void  )
virtual
Attribute ( Node pOwner,
const QString sID 
)
protected
Attribute ( Node pOwner,
bool  bInstall 
)
protected

Member Function Documentation

unsigned int TargetCount ( void  ) const

Returns the number of attributes currently linked to this attribute as target.

Attribute* Target ( unsigned int  iIndex) const

Returns the target with the given index. If iIndex is greater than the number of targets, returns 0;.

Attribute* Source ( void  ) const

Returns the source attribute, or 0 if there is no source.

bool operator== ( const Attribute cAttribute) const

This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details.

bool operator!= ( const Attribute cAttribute) const

This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details.

QString ID ( void  ) const

Returns the unique ID (within this node) of the attribute.

QString Name ( void  ) const

Returns the name of the attribute.

void SetName ( const QString sName)

Sets the name of the attribute.

QString Category ( void  ) const

Returns the category of the attribute.

void SetCategory ( const QString sCategory,
bool  bSeparator = false 
)

Sets the category of the attribute. This value will be used in the user interface to determine which attribute group to be used.

bool Separator ( void  ) const

Returns the separator state of the widget.

void SetSeparator ( bool  bSeparator)

Call this with true to display a separator line below this widget.

bool Const ( void  ) const

Gets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface.

void SetConst ( bool  bConst)

Sets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface.

bool InstantEdit ( void  ) const

Returns true, if the attribute edition should be instant, i.e. the attribute should change every time the user makes any changes to the widget. Default is false.

void SetInstantEdit ( bool  bOn)

If bOn is true, editing the attribute on the UI will be instant, i.e.

the attribute will change value every time when the user make changes in the widget. Default is false.

bool Visible ( void  ) const

Returns true if the property is visible.

void SetVisible ( bool  bVisible)

Sets the visible status of the property.

QString ToolTip ( void  ) const

Gets the tooltip text to be used on the user interface, this is optional.

void SetToolTip ( const QString sToolTip)

Sets the tooltip text to be used on the user interface, this is optional.

unsigned int Size ( void  ) const

Returns the size of the attribute value in bytes.

float LabelWidth ( void  ) const

Returns the width of label relative to the full width of the line.

A value 0.4 means that the label will take 40%, while the value part will take 60% of the available space.

void SetLabelWidth ( float  fLabelWidth)

Set the width of label.

int Index ( void  ) const

Returns the attribute index;.

void SetIndex ( int  iIndex)

Sets the attribute index;.

Node* Owner ( void  ) const

Gets the address of the Node which contains this attribute.

virtual void SetFromString ( const QString sValue,
bool  bInternal = true,
bool  bLocalized = false 
)
virtual

Sets the value of the attribute as a string.

See also AsString.

Parameters
bInternalif this is false the owner node will receive an event about the value change (See NodeEventType::etValueChanged).
bLocalizedif this is true the string representation of the value is assumed to be localized (translated)

Reimplemented in AttributeCheckableFloat, AttributePointer< type >, AttributePointer< NURBSCurve >, AttributeInstance< type >, AttributeInstance< Color >, AttributeInstance< StampConfiguration >, AttributeInstance< float >, AttributeInstance< QString >, AttributeInstance< int >, AttributeInstance< NURBSCurve * >, AttributeInstance< CheckableFloatArray >, AttributeInstance< bool >, AttributeInstance< type * >, AttributeInstance< CheckableFloat >, and AttributeInstance< MirrorConfiguration >.

void ClearTargets ( void  )

Removes all outgoing connections from the attribute.

void ClearSource ( void  )

Removes the incoming connection for this attribute.

virtual void AddTarget ( Attribute cTarget,
bool  bInternal = false 
)
virtual
void Connect ( Attribute cSource,
bool  bInternal = false 
)

Connect this attribute to another one.

Parameters
bInternalif this is false the owner node will receive an event about the value change
virtual const ClassDesc* TargetType ( void  ) const
virtual

This is valid only for pointer attributes (See AttributePointer). Returns the type of the pointer.

virtual void SetPointerValue ( Node pValue,
bool  bLink = true 
)
virtual

This is valid only for pointer attributes (See AttributePointer).

Sets the value of the pointer. This function is used only if you dont know exactly the type of the attribute. Use AttributePointer::SetValue otherwise.

Reimplemented in AttributePointer< type >, and AttributePointer< NURBSCurve >.

virtual Node* PointerValue ( void  ) const
virtual

This is valid only for pointer attributes (See AttributePointer).

Gets the value of the pointer. This function is used only if you dont know exactly the type of the attribute. Use AttributePointer::Value otherwise.

virtual bool ValidatePointerValue ( const Node pValue)
virtual

Validate a possible value for the pointer, returns true if the value is acceptable.

virtual void StartEvent ( NodeEventType  cType) const
virtual
void SetOwner ( Node pOwner)

This function sets the owner of the attribute.

The owner receives all events for this attribute

The owner is the receiver of all events from the attribute. This function removes any old owner & installs a new owner. If NULL or 0 is used as an argument then the old owner is removed and no owner exists for this attribute.

virtual AttributeWidget* CreateEditorWidget ( QWidget pParent,
int  iWidth 
)
virtual

This function creates and returns the address of a QWidget object.

The object then can be used in the interface to give the user control over the attribute value. Mudbox calls this function for every attribute in a node when it displays a properties dialog box for it. You must override it if you implement a new kind of attribute and want a special interface.

Parameters
iWidthWidth of the control in pixels.

Reimplemented in AttributeCheckableFloatArray, AttributeCheckableFloat, AttributeTextureFilename, AttributeFilename, AttributeEnumeration, AttributeFloatRange, AttributeInstance< type >, AttributeInstance< Color >, AttributeInstance< StampConfiguration >, AttributeInstance< float >, AttributeInstance< QString >, AttributeInstance< int >, AttributeInstance< NURBSCurve * >, AttributeInstance< CheckableFloatArray >, AttributeInstance< bool >, AttributeInstance< type * >, AttributeInstance< CheckableFloat >, AttributeInstance< MirrorConfiguration >, and AttributeLocale.

virtual unsigned int ParameterCount ( void  ) const
virtual

Reimplemented in AttributeFilename.

virtual QString ParameterName ( unsigned int  iIndex) const
virtual

Returns the name of a parameter with a given index.

Reimplemented in AttributeFilename.

virtual QString ParameterValue ( unsigned int  iIndex) const
virtual

Returns the value of parameter with a given index.

Reimplemented in AttributeFilename.

virtual void SetParameterValue ( const QString sName,
const QString sValue 
)
virtual

Set the value of a parameter.

Reimplemented in AttributeFilename.

void LogTargets ( void  )

Log all targets (for debug purposes)

void LogSource ( void  )

Log source (for debug purposes)

void CheckValidity ( void  )

Check validity (for debug purposes)

void Uninstall ( void  )
protected

Friends And Related Function Documentation

friend class Node
friend

Definition at line 372 of file node.h.

Member Data Documentation

int m_iSize
protected

Definition at line 355 of file node.h.

Attribute* m_pSource
protected

Definition at line 356 of file node.h.

Attribute * m_pNext
protected

Definition at line 356 of file node.h.

Store<Attribute *> m_aTargets
protected

Definition at line 357 of file node.h.

Node* m_pNode
protected

Definition at line 358 of file node.h.

QString m_sName
protected

Definition at line 359 of file node.h.

bool m_bSeparator
protected

Definition at line 360 of file node.h.

QString m_sCategory
protected

Definition at line 361 of file node.h.

QString m_sToolTip
protected

Definition at line 362 of file node.h.

float m_fLabelWidth
protected

Definition at line 363 of file node.h.

bool m_bConst
protected

Definition at line 364 of file node.h.

bool m_bVisible
protected

Definition at line 365 of file node.h.

int m_iIndex
protected

Definition at line 366 of file node.h.

bool m_bInstantEdit
protected

Definition at line 367 of file node.h.

QString m_sID
protected

Definition at line 368 of file node.h.


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