aboutsummaryrefslogtreecommitdiff
path: root/NvBlast/tools/CurveEditor/source/Attribute.h
diff options
context:
space:
mode:
authorBryan Galdrikian <[email protected]>2017-02-21 12:07:59 -0800
committerBryan Galdrikian <[email protected]>2017-02-21 12:07:59 -0800
commit446ce137c6823ba9eff273bdafdaf266287c7c98 (patch)
treed20aab3e2ed08d7b3ca71c2f40db6a93ea00c459 /NvBlast/tools/CurveEditor/source/Attribute.h
downloadblast-1.0.0-beta.tar.xz
blast-1.0.0-beta.zip
first commitv1.0.0-beta
Diffstat (limited to 'NvBlast/tools/CurveEditor/source/Attribute.h')
-rw-r--r--NvBlast/tools/CurveEditor/source/Attribute.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/NvBlast/tools/CurveEditor/source/Attribute.h b/NvBlast/tools/CurveEditor/source/Attribute.h
new file mode 100644
index 0000000..c8af7f7
--- /dev/null
+++ b/NvBlast/tools/CurveEditor/source/Attribute.h
@@ -0,0 +1,109 @@
+#ifndef ATTRIBUTE_H__
+#define ATTRIBUTE_H__
+
+#include "Curve.h"
+#include <vector>
+
+namespace nvidia {
+namespace CurveEditor {
+
+class CurveEditorMainWindow;
+
+enum CurveAttributeType
+{
+ eSingleAttr,
+ eGroupAttr,
+ eColorAttr,
+};
+
+class CURVEEDITOR_EXPORT CurveAttributeBase
+{
+ friend class CurveEditorMainWindow;
+public:
+ std::string getName() const { return _name; }
+ CurveAttributeType getType() const { return _type; }
+
+ inline bool canMoveControlPointHorizontally() { return _canMoveControlPointHorizontally; }
+ inline bool canAddRemoveControlPoint() { return _canAddRemoveControlPoint; }
+ inline bool canChangeTangentType() { return _canChangeTangentType; }
+
+protected:
+ CurveAttributeBase(const std::string& name, CurveAttributeType type, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
+ : _name(name)
+ , _type(type)
+ , _canMoveControlPointHorizontally(canMoveControlPointHorizontally)
+ , _canAddRemoveControlPoint(canAddRemoveControlPoint)
+ , _canChangeTangentType(canChangeTangentType)
+ {
+ }
+
+protected:
+ std::string _name;
+ CurveAttributeType _type;
+ bool _canMoveControlPointHorizontally;
+ bool _canAddRemoveControlPoint;
+ bool _canChangeTangentType;
+};
+
+class CURVEEDITOR_EXPORT CurveAttribute : public CurveAttributeBase
+{
+public:
+ CurveAttribute()
+ : CurveAttributeBase("", eSingleAttr)
+ {
+ }
+
+ CurveAttribute(const std::string& name, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
+ : CurveAttributeBase(name, eSingleAttr, canMoveControlPointHorizontally, canAddRemoveControlPoint, canChangeTangentType)
+ {
+ }
+
+ CurveAttribute(const CurveAttribute& attr)
+ : CurveAttributeBase(attr._name, eSingleAttr)
+ {
+ }
+
+ ~CurveAttribute()
+ {
+ }
+
+ QColor color;
+ Curve curve;
+};
+
+class CURVEEDITOR_EXPORT CurveAttributeGroup : public CurveAttributeBase
+{
+public:
+ CurveAttributeGroup(std::string name, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
+ : CurveAttributeBase(name, eGroupAttr, canMoveControlPointHorizontally, canAddRemoveControlPoint, canChangeTangentType)
+ {
+ }
+
+ std::vector<CurveAttribute*> attributes;
+};
+
+class CURVEEDITOR_EXPORT ColorAttribute : public CurveAttributeBase
+{
+ friend class CurveEditor;
+public:
+ ColorAttribute()
+ : CurveAttributeBase("", eSingleAttr)
+ , useAlphaFromColor(false)
+ {
+ }
+
+ ColorAttribute(const std::string& name, bool canMoveControlPointHorizontally = false, bool canAddRemoveControlPoint = false, bool canChangeTangentType = false)
+ : CurveAttributeBase(name, eColorAttr, canMoveControlPointHorizontally, canAddRemoveControlPoint, canChangeTangentType)
+ , useAlphaFromColor(false)
+ {
+ }
+
+ ColorCurve colorCurve;
+ ColorCurve alphaCurve;
+ bool useAlphaFromColor;
+};
+
+} // namespace CurveEditor
+} // namespace nvidia
+
+#endif // ATTRIBUTE_H__