This reference page is linked to from the following overview topics: Attributes.
This is a generic attribute which can be used instead of the standard built in types.
The difference between a standard type and this attribute is that this attribute can be viewed and its value can be changed by the user. Attributes can be linked together also so when the value of an attribute is changed, all target attributes value will be changed also. The owner node also can catch events regarding to the attrbibutes, for example when the user changes the value.
#include <node.h>
Public Member Functions |
|
AttributeInstance (Node *pOwner, const QString &sID) | |
Standard constructor. You have to specify
the name of the attribute which will be used in the user interface.
|
|
AttributeInstance (Node *pOwner, const QString &sID, const type &cValue) | |
Using this constructor you can also specify
the initial value of the attribute with its name. |
|
const type & | Value (void) const |
Returns the value of the attribute. |
|
virtual void | SetValue (type cValue, unsigned int options=0) |
Set the value of the attribute to cValue.
|
|
void | UpdateTargets (void) |
void | Serialize (Stream &s) |
Serialize the value of the attribute into a
stream. |
|
void | AddTarget (Attribute &cTarget) |
Adds a new outgoing connection for this node
to pTarget. |
|
QString | AsString (unsigned int=asStringDefault) const |
Returns the value of the attribute as a
string. See also SetFromString. |
|
void | SetFromString (const QString &sValue, unsigned int options=asStringDefaultSet) |
Sets the value of the attribute as a string.
See also AsString. |
|
AttributeWidget * | CreateEditorWidget (QWidget *pParent, int iWidth) |
This function creates and returns the
address of a QWidget object. |
|
Attribute::AttributeType | Type (void) const |
Returns the type of the attribute. |
|
OPERATORS (type) | |
Public Attributes |
|
type | m_cValue |
Protected Member Functions |
|
AttributeInstance (Node *pOwner, const QString &sName, bool bInstall) | |
Protected constructor, do not use it. You
have to specify the name of the attribute which will be used in the
user interface. |
AttributeInstance | ( | Node * | pOwner, |
const QString & | sID | ||
) | [inline] |
AttributeInstance | ( | Node * | pOwner, |
const QString & | sID, | ||
const type & | cValue | ||
) | [inline] |
AttributeInstance | ( | Node * | pOwner, |
const QString & | sName, | ||
bool | bInstall | ||
) | [inline, protected] |
const type& Value | ( | void | ) | const [inline] |
virtual void SetValue | ( | type | cValue, |
unsigned int | options = 0 |
||
) | [inline, virtual] |
Set the value of the attribute to cValue.
bInternal | if this is false the owner node will receive an event about the value change (See NodeEventType::etValueChanged). |
Reimplemented in AttributePointer< type >, and AttributePointer< NURBSCurve >.
Definition at line 392 of file node.h.
{ m_cValue = cValue; UpdateTargets(); if ( !(options & Attribute::asStringInternal) ) StartEvent( etValueChanged ); };
void UpdateTargets | ( | void | ) | [inline, virtual] |
Update the values of all the connected target attributes with the current value. Used internally only, do not call this directly.
Reimplemented from Attribute.
Definition at line 399 of file node.h.
{ for ( unsigned int i = 0; i < TargetCount(); i++ ) { if ( Target(i)->Size() == Size() ) ((AttributeInstance<type> *)Target(i))->SetValue( m_cValue ); else Target(i)->StartEvent( etValueChanged ); }; };
void Serialize | ( | Stream & | s | ) | [inline, virtual] |
Serialize the value of the attribute into a stream.
Reimplemented from Attribute.
Reimplemented in AttributePointer< type >, and AttributePointer< NURBSCurve >.
Definition at line 302 of file stream.h.
{ s == m_cValue; };
void AddTarget | ( | Attribute & | cTarget | ) | [inline, virtual] |
Adds a new outgoing connection for this node to pTarget.
Reimplemented from Attribute.
Reimplemented in AttributePointer< type >, and AttributePointer< NURBSCurve >.
Definition at line 412 of file node.h.
{ Attribute::AddTarget( cTarget ); if ( cTarget.Size() ) { AttributeInstance<type> *pT = (AttributeInstance<type> *)&cTarget; if ( pT->Value() != Value() ) pT->SetValue( Value() ); }; StartEvent( etTargetChanged ); cTarget.StartEvent( etSourceChanged ); };
QString AsString | ( | unsigned | options =
asStringDefault |
) | const [inline, virtual] |
Returns the value of the attribute as a string. See also SetFromString.
Reimplemented from Attribute.
Reimplemented in AttributeCheckableFloat, AttributePointer< type >, and AttributePointer< NURBSCurve >.
void SetFromString | ( | const QString & | sValue, |
unsigned int | options =
asStringDefaultSet |
||
) | [inline, virtual] |
Sets the value of the attribute as a string. See also AsString.
Reimplemented from Attribute.
Reimplemented in AttributeCheckableFloat, AttributePointer< type >, and AttributePointer< NURBSCurve >.
Definition at line 439 of file node.h.
{ type cValue; unsigned char *tData = (unsigned char *)(void *)(&cValue); for ( int i = 0; i < (int)sizeof(cValue); i++ ) tData[i] = sValue.section(' ', i, i).toInt(); SetValue( cValue, options ); };
AttributeWidget * CreateEditorWidget | ( | QWidget * | pParent, |
int | iWidth | ||
) | [inline, 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.
Reimplemented from Attribute.
Reimplemented in AttributeCheckableFloat, AttributeCheckableFloatArray, AttributeFloatRange, AttributeEnumeration, AttributeFilename, AttributeTextureFilename, and AttributeLocale.
Definition at line 447 of file node.h.
{ return Attribute::CreateEditorWidget( pParent, iWidth ); };
Attribute::AttributeType Type | ( | void | ) | const [inline, virtual] |
Returns the type of the attribute.
Reimplemented from Attribute.
Reimplemented in AttributeCheckableFloat, AttributeCheckableFloatArray, AttributePointer< type >, and AttributePointer< NURBSCurve >.
Definition at line 448 of file node.h.
{ return Attribute::AttributeType(); };
OPERATORS | ( | type | ) |
Reimplemented in AttributeFloatRange, AttributeNumber, and AttributeEnumeration.
type m_cValue |