15 #ifndef __MUDBOXSDK_BRUSH_H__
16 #define __MUDBOXSDK_BRUSH_H__
18 #include <QtCore/QHash>
19 #include <QtCore/QSharedPointer>
20 #include <QtCore/QCoreApplication>
44 unsigned int ID(
void )
const;
47 virtual QString Name(
void )
const;
49 virtual QString StringID(
void )
const;
51 virtual QString DisplayName(
void )
const;
53 virtual void SetDisplayName(
const QString & sDisplayName );
57 virtual int Version(
void )
const;
59 virtual const ClassDesc *OperationClass(
void )
const;
63 virtual QString DisplayCategory()
const;
65 virtual void Serialize(
Stream&
s );
72 QString m_sStringID, m_sToolTip, m_sCategory;
73 QString m_sDisplayName, m_sCategoryTr;
104 MirrorConfiguration(
const MirrorConfiguration &
v );
108 void SetMirrorMode(
enum MirrorMode
mode );
120 Matrix TransformationMatrix(
122 bool bNormalizeLocalFrame =
false
136 inline bool operator ==(
const MirrorConfiguration & )
const throw() {
return false; };
140 virtual void Serialize(
Stream&
s );
144 Matrix AxisTransformationMatrix(
152 Matrix TangentTransformationMatrix(
154 bool bNormalizeLocalFrame =
false
175 Attribute::AttributeType amirrorcfg::Type(
void )
const {
return typeUnknown; };
181 void amirrorcfg::SetFromString(
const QString &mode,
bool ,
bool ) { m_cValue.SetMirrorMode(
MirrorMode(mode.
toInt())); };
190 m_bOrientToStroke =
true;
192 m_bFlipX = m_bFlipY = m_bRandomize = m_bRandomizeFlipX = m_bRandomizeFlipY =
false;
193 m_fRotation = m_fRandomizeScale = m_fRandomizeStrength = 0.0f;
194 m_fRandomizeRotation = 0.35f;
195 m_fRandomizePositionX = m_fRandomizePositionY = 0.4f;
209 float m_fRandomizeScale, m_fRandomizeRotation, m_fRandomizePositionX, m_fRandomizePositionY,
m_fRandomizeStrength;
220 Attribute::AttributeType astampcfg::Type(
void )
const {
return typeUnknown; };
223 QString astampcfg::AsString(
bool )
const
225 return QString(
"%0 %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13")
226 .
arg(m_cValue.m_bActive)
227 .
arg(m_cValue.m_bOrientToStroke)
228 .
arg(m_cValue.m_bStretch)
229 .
arg(m_cValue.m_bFlipX)
230 .
arg(m_cValue.m_bFlipY)
231 .
arg(m_cValue.m_fRotation)
232 .
arg(m_cValue.m_bRandomize)
233 .
arg(m_cValue.m_bRandomizeFlipX)
234 .
arg(m_cValue.m_bRandomizeFlipY)
235 .
arg(m_cValue.m_fRandomizeScale)
236 .
arg(m_cValue.m_fRandomizeRotation)
237 .
arg(m_cValue.m_fRandomizePositionX)
238 .
arg(m_cValue.m_fRandomizePositionY)
239 .
arg(m_cValue.m_fRandomizeStrength);
243 void astampcfg::SetFromString(
const QString &
s ,
bool ,
bool )
245 m_cValue.m_bActive = s.
section(
' ', 0,0 ) ==
"1" ?
true :
false;
246 m_cValue.m_bOrientToStroke = s.
section(
' ', 1,1 ) ==
"1" ?
true :
false;
247 m_cValue.m_bStretch = s.
section(
' ', 2,2) ==
"1" ?
true :
false;
248 m_cValue.m_bFlipX = s.
section(
' ', 3,3 ) ==
"1" ?
true :
false;
249 m_cValue.m_bFlipY = s.
section(
' ', 4,4 ) ==
"1" ?
true :
false;
251 m_cValue.m_bRandomize = s.
section(
' ', 6,6 ) ==
"1" ?
true :
false;
252 m_cValue.m_bRandomizeFlipX = s.
section(
' ', 7,7 ) ==
"1" ?
true :
false;
253 m_cValue.m_bRandomizeFlipY = s.
section(
' ', 8,8 ) ==
"1" ?
true :
false;
255 m_cValue.m_fRandomizeRotation = s.
section(
' ', 10,10 ).
toFloat();
256 m_cValue.m_fRandomizePositionX = s.
section(
' ', 11,11 ).
toFloat();
257 m_cValue.m_fRandomizePositionY = s.
section(
' ', 12,12 ).
toFloat();
347 BrushBehavior(
void ) { m_eType = eBehaviorNone; m_sTarget =
""; m_iHotkey = 0; };
350 BehaviorType m_eType;
357 bool IsValid(
void ) {
return m_pSurfacePoint != 0; };
379 virtual bool IsScreenSpace(
void )
const;
381 virtual float BrushSize(
void )
const;
383 virtual float BrushStrength(
void )
const;
385 virtual void SetBrushSize(
float fSize );
387 virtual void SetBrushStrength(
float fStrength );
389 virtual float EffectiveBrushSize(
void )
const;
391 virtual float EffectiveBrushStrength(
void )
const;
393 virtual float BrushSizeBias(
void )
const;
395 virtual float BrushStrengthBias(
void )
const;
397 virtual float MaxBrushSize(
void )
const;
399 virtual float MaxBrushStrength(
void )
const;
402 virtual bool UsesStrokeSmoothing(
void )
const;
404 virtual float StrokeSmoothingDistance(
void )
const;
406 virtual void SetStrokeSmoothing(
bool bEnable,
float fDistance );
408 virtual bool HasCustomCursor(
void );
411 virtual bool UsesSteadyStroke(
void )
const;
413 virtual float SteadyStrokeDistance(
void )
const;
415 virtual void SetSteadyStroke(
bool bEnable,
float fDistance );
423 virtual const NURBSCurve *Falloff(
void )
const;
425 virtual void SetFalloff(
NURBSCurve *pCurve );
431 return FalloffData()[
int(fValue*(FalloffData().ItemCount()-1))];
434 virtual bool UsesFalloffBasedOnFacingAngle(
void )
const;
436 virtual void SetFalloffBasedOnFacingAngle(
bool bEnable );
439 void SetFalloffType( FalloffType eType );
441 FalloffType GetFalloffType()
const;
444 virtual bool UsesStampRandomize(
void )
const;
446 virtual void SetStampRandomize(
bool bEnable );
449 virtual bool IsMaskEnabled( MaskType
type = eMaskAny )
const;
451 virtual const Image *MaskImage( MaskType
type = eMaskAny )
const;
453 virtual Matrix MaskMatrix( MaskType
type = eMaskAny )
const;
455 virtual bool IsMaskInverted( MaskType
type = eMaskAny )
const;
457 virtual float MaskFactor( MaskType
type = eMaskAny )
const;
459 virtual bool IsMaskTiled( MaskType
type = eMaskAny )
const;
461 virtual QString MaskName( MaskType
type = eMaskAny )
const;
463 virtual bool MaskBuildUp( MaskType
type = eMaskAny )
const;
465 virtual const Image *MaskOpacityImage( MaskType
type = eMaskAny )
const;
467 virtual float MaskOffset( MaskType
type = eMaskAny )
const;
469 virtual void OnMaskChanged( MaskType
type = eMaskAny );
472 virtual float BuildUpRate(
void )
const;
474 virtual bool PatchesAtRelease(
void )
const;
476 virtual bool PressureControlsBrushSize(
void )
const;
478 virtual bool PressureControlsBrushStrength(
void )
const;
480 virtual bool IsInverted(
void )
const;
482 virtual bool IsOrientedToSurface(
void )
const;
484 virtual void SetOrientedToSurface(
bool bOriented );
486 virtual bool IsStrokeOnCurveEnabled(
void )
const;
489 Direction Direction(
void )
const;
491 virtual void SetDirectionVector(
const Vector &vDirection )
const;
493 Vector PreviousPatchPosition(
void )
const;
496 virtual void BeginStroke(
Mesh *pMesh,
Modifier eModifier, TriggerType eTriggerType );
498 virtual void EndStroke(
void );
500 virtual void MouseMove(
float fXPosition,
float fYPosition,
float fXDelta,
float fYDelta,
AxisAlignedBoundingBox &cDirtyWorldArea,
float fPressure );
504 virtual void Flood(
Mesh *pTarget,
float fStrength = 1.0
f,
bool bFromCamera =
false );
506 void SetPatchParameters(
const SurfacePoint *pS,
float fSize,
float fStrength,
Vector vMove );
509 float EffectiveBrushSize(
void );
511 float EffectiveBrushStrength(
void );
516 virtual void SetActiveConfiguration(
const QString &sName );
520 virtual void ResetBrushConfiguration(
void);
525 static unsigned int ConfigurationCount(
void );
529 static void ClearConfigurations(
void );
536 void SetStamp(
bool bEnable,
const QString &sFileName =
"" );
539 void SetBrushSizeScale(
float fScale );
541 void SetBrushStrengthScale(
float fScale );
544 bool UsesGlobalBrushSize(
void )
const;
548 Modifier CurrentModifier(
void )
const;
551 const MirrorConfiguration &MirrorConfig(
void )
const;
553 virtual void SetMirrorConfig( MirrorConfiguration newConfig );
568 static void SerializeConfigurationStates(
Stream &s );
571 virtual QString OverlayIcon(
void );
573 virtual QPointF OverlayOffset(
void );
576 virtual bool ExecuteAndInvert(
void );
584 virtual bool CanLockLayer(
void )
const;
588 virtual bool CustomPicker(
void );
592 virtual Node *AttributeHolderNode(
void );
595 virtual void SetFalloffIndex(
int iIndex );
598 virtual int FalloffIndex(
void )
const;
601 virtual unsigned int AlternateBehaviorCount(
void )
const;
604 virtual const BrushBehavior &AlternateBehavior(
unsigned int iIndex )
const;
607 virtual bool IsSnapToCurve(
void )
const;
610 virtual float SnapDistance(
void )
const;
613 bool StrokeInterrupted(
void )
const;
616 virtual bool ShowBrushInStroke(
void )
const;
619 virtual void SetConstrainToSurface(
bool bCts );
622 virtual bool ConstrainToSurface()
const;
670 #define MB_ADD_CONFIG( classname, id, name, nametr, category, tooltip ) \
671 mudbox::BrushOperation::AddConfiguration( new BrushConfiguration( classname::StaticClass(), id, name, nametr, category, tooltip ) );
673 #define MB_ADD_CONFIG2( classname, id, name, nametr, category, categoryTr, tooltip ) \
674 mudbox::BrushOperation::AddConfiguration( new BrushConfiguration( classname::StaticClass(), id, name, nametr, category, categoryTr, tooltip ) );
676 #define MB_ADD_CONFIG3( classname, id, name, nametr, category, categoryTr, tooltip, version ) \
677 mudbox::BrushOperation::AddConfiguration( new BrushConfiguration( classname::StaticClass(), id, name, nametr, category, categoryTr, tooltip, version ) );
GLuint GLuint GLsizei GLenum type
AttributeInstance< MirrorConfiguration > amirrorcfg
float m_fRandomizeStrength
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
virtual void OnNodeEvent(const Attribute &cAttribute, NodeEventType cType)
This function is called if an event occurs with any of the attributes of the node.
Container class for stamp related properties and functions.
Stamp resized with the 2 points defining the radius (starting point is the center) ...
virtual QString DisplayName(void) const
Returns the display name of the node.
aptr< NURBSCurve > m_pFalloffCurve
Represents a 3D vector or point with S23E8 floating point elements.
This class represents an action which can be triggered by the user.
A Mesh is a collection of vertices organized into faces, and optional Texture Coordinate information...
This attribute represents a float value which has a minimum and a maximum value.
Direction
Values for the brush direction property.
abool m_bScreenSpace
ATTRIBUTES:
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
This class can be used to define configurations for different brush behaviours of the same class...
int MirrorPlanes(void) const
Returns the number of mirroring planes.
The structure contains information about mirroring of the operation.
MBDLL_DECL AttributeWidget * CreateNewStampConfigurationWidget(QWidget *pParent, int iWidth, astampcfg *pAttribute)
MirrorMode
Possible values for the brush mirror attribute.
MBDLL_DECL AttributeWidget * CreateNewMirrorConfigurationWidget(QWidget *pParent, int iWidth, amirrorcfg *pAttribute)
Represents a bounding box whose axes are aligned with the coordinate system.
Describes a location somewhere on the surface of a Mesh.
This is the base class for most classes in the Mudbox SDK.
NodeEventType
Possible event types when Node::OnNodeEvent is called.
afloatr m_fMaxBrushStrength
BrushBehavior m_cAlternateBehavior2
const Store< mudbox::Vector > & MirrorPlanePositions(void) const
Returns the mirror plane positions.
StampSizingMode
Values for stamp resizing mode.
abool m_bConstrainToSurface
PatchParameters m_cPatchParameters
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
float FalloffValue(float fValue) const
Returns the falloff value in the specified curve position.
int toInt(bool *ok=0, int base=10) const
This class represents a 4x4 transformation matrix.
afloatr m_fNormalBrushStrength
float m_fBrushStrengthScale
Category
Set's the category your program should be listed in in the mixer.
This structure represents and describes a class.
FalloffType
Values for the falloff type property.
acheckablefloat m_fSnapToCurve
This class represents an event receiver/triggerer point.
bool operator!=(const QByteArray &a1, const QByteArray &a2)
Mirror using topology symmmetry.
MaskType
Values for mask types that can be add to the brush effect as a multiplier.
#define INTRODUCED_IN_MUDBOX_2013_OR_EARLIER
Used to insert expanded category item.
aevent m_cFloodFromCamera
afloatr m_fBrushStrengthBias
acheckablefloat m_fSteadyStroke
Modifier
Values for the brush effect modifier.
virtual QString StringID(const ClassDesc *pClass=0) const
Returns the string id of the node.
Class: ConvolutionKernel.
This is an abstract base structure for all attributes.
QString section(QChar sep, int start, int end=-1, SectionFlags flags=SectionDefault) const
The base class of all operations.
TriggerType
This value represents how the user triggered the brush.
bool IsMirrorLocal(void) const
Returns if the mirroring is local.
static QString number(int, int base=10)
TriggerType m_eTriggerType
bool m_bStrokeInterrupted
Streams are used to read information from a file, or to write it to a file.
#define DECLARE_CLASS
This macro should be used in declaration of classes which are inherited from the Node class (or any d...
AttributeInstance< StampConfiguration > astampcfg
This attribute is very similar to the aint type but on the user interface it will be displayed as a c...
afloatr m_fScreenBrushStrength
virtual void Serialize(Stream &s)
Serializes the node.
The BrushOperation class is the base class for brush functionality.
const Store< mudbox::Vector > & MirrorPlaneNormals(void) const
Returns the mirror plane normals.
This is the base image type defining the interface to images.
#define Q_DECLARE_TR_FUNCTIONS(context)
float toFloat(bool *ok=0) const
acheckablefloat m_fStrokeSmoothing
Tool behaviour structure for storing alternate brushing modes.
AttributeWidget * CreateEditorWidget(QWidget *pParent, int iWidth)
AttributeCheckableFloatArray m_aFalloffBasedonFacingAngle
BrushConfiguration * m_pActiveConfiguration