SeExpr
ExprColorCurve.h
Go to the documentation of this file.
1/*
2* Copyright Disney Enterprises, Inc. All rights reserved.
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License
6* and the following modification to it: Section 6 Trademarks.
7* deleted and replaced with:
8*
9* 6. Trademarks. This License does not grant permission to use the
10* trade names, trademarks, service marks, or product names of the
11* Licensor and its affiliates, except as required for reproducing
12* the content of the NOTICE file.
13*
14* You may obtain a copy of the License at
15* http://www.apache.org/licenses/LICENSE-2.0
16*
17* @file ExprColorCurve.h
18* @brief Contains PyQt4 Ramp Widget to emulate Maya's ramp widget
19* @author Arthur Shek
20* @version ashek 05/04/09 Initial Version
21*/
22#ifndef _ExprColorCurve_h_
23#define _ExprColorCurve_h_
24
25#include <vector>
26
27#include <QObject>
28#include <QComboBox>
29#include <QGraphicsProxyWidget>
30#include <QGraphicsView>
31#include <QLineEdit>
32
33#include "../Vec.h"
34#include "ExprCurve.h"
35
36/*
37 This class overrides QGraphicsScene so we can handle mouse
38 press, drag and keyboard events
39*/
40class CCurveScene : public QGraphicsScene {
41 Q_OBJECT
42
45
46 public:
49
50 void addPoint(double x, const SeExpr2::Vec3d y, const T_INTERP interp, const bool select = true);
51
52 void removePoint(const int index);
53 void removeAll();
54
55 virtual void keyPressEvent(QKeyEvent *event);
56
57 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
58 virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
59 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
60 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
61 void drawRect();
62
63 void drawPoints();
64
65 QPixmap &getPixmap();
66 void emitCurveChanged();
67
68 void rebuildCurve();
69
70 std::vector<T_CURVE::CV> _cvs; // unsorted cvs
71
72 friend class ExprColorCurve;
73
74 public slots:
75 void interpChanged(const int interp);
76 void selPosChanged(double pos);
77 void selValChanged(const SeExpr2::Vec3d &val);
78 void resize(const int width, const int height);
79
80 signals:
81 void cvSelected(double x, const SeExpr2::Vec3d y, const T_INTERP interp);
83
84 private:
86
87 QByteArray getCPixmap();
88
89 int _width;
93 std::vector<QGraphicsEllipseItem *> _circleObjects;
95 QPixmap _pixmap;
97 QWidget *_baseRectW;
98 QGraphicsProxyWidget *_baseRect;
99 bool _lmb;
100};
101
102class ExprCBoxWidget : public QWidget {
103 Q_OBJECT
104 public:
105 ExprCBoxWidget(CCurveScene *curveScene, QWidget *parent = 0) : QWidget(parent), _curveScene(curveScene) {}
107
108 protected:
109 virtual void paintEvent(QPaintEvent *event);
110
111 private:
113};
114
115class ExprCSwatchFrame : public QFrame {
116 Q_OBJECT
117 public:
118 ExprCSwatchFrame(SeExpr2::Vec3d value, QWidget *parent = 0);
120
121 void setValue(const SeExpr2::Vec3d &value);
122 SeExpr2::Vec3d getValue() const;
123
124 protected:
125 virtual void paintEvent(QPaintEvent *event);
126 virtual void mousePressEvent(QMouseEvent *event);
127
128signals:
130 void swatchChanged(QColor color);
131
132 private:
134 QColor _color;
135};
136
137class ExprColorCurve : public QWidget {
138 Q_OBJECT
139
142
143 public:
144 ExprColorCurve(QWidget *parent = 0,
145 QString pLabel = "",
146 QString vLabel = "",
147 QString iLabel = "",
148 bool expandable = true);
150
151 // Convenience Functions
152 void addPoint(const double x, const SeExpr2::Vec3d y, const T_INTERP interp, bool select = false);
153 void setSwatchColor(QColor color);
154 QColor getSwatchColor();
155
157
158 public slots:
159 void cvSelectedSlot(const double pos, const SeExpr2::Vec3d val, const T_INTERP interp);
160 void selPosChanged();
161 void openDetail();
162
163 signals:
164 void selPosChangedSignal(double pos);
166 void swatchChanged(QColor color);
167
168 private slots:
169 void internalSwatchChanged(QColor color);
170
171 private:
172 QLineEdit *_selPosEdit;
174 QComboBox *_interpComboBox;
175};
176#endif
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QByteArray getCPixmap()
QPixmap _pixmap
QGraphicsProxyWidget * _baseRect
void curveChanged()
SeExpr2::Curve< SeExpr2::Vec3d > T_CURVE
QWidget * _baseRectW
SeExpr2::Vec3d _color
void removePoint(const int index)
QPixmap & getPixmap()
std::vector< QGraphicsEllipseItem * > _circleObjects
void emitCurveChanged()
void selPosChanged(double pos)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
std::vector< T_CURVE::CV > _cvs
void cvSelected(double x, const SeExpr2::Vec3d y, const T_INTERP interp)
void addPoint(double x, const SeExpr2::Vec3d y, const T_INTERP interp, const bool select=true)
void selValChanged(const SeExpr2::Vec3d &val)
virtual void keyPressEvent(QKeyEvent *event)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
T_CURVE * _curve
void interpChanged(const int interp)
T_CURVE::InterpType T_INTERP
void resize(const int width, const int height)
T_INTERP _interp
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
CCurveScene * _curveScene
ExprCBoxWidget(CCurveScene *curveScene, QWidget *parent=0)
virtual void paintEvent(QPaintEvent *event)
void selValChangedSignal(SeExpr2::Vec3d value)
void swatchChanged(QColor color)
virtual void paintEvent(QPaintEvent *event)
ExprCSwatchFrame(SeExpr2::Vec3d value, QWidget *parent=0)
SeExpr2::Vec3d _value
SeExpr2::Vec3d getValue() const
void setValue(const SeExpr2::Vec3d &value)
virtual void mousePressEvent(QMouseEvent *event)
void internalSwatchChanged(QColor color)
void addPoint(const double x, const SeExpr2::Vec3d y, const T_INTERP interp, bool select=false)
T_CURVE::InterpType T_INTERP
void swatchChanged(QColor color)
void setSwatchColor(QColor color)
ExprColorCurve(QWidget *parent=0, QString pLabel="", QString vLabel="", QString iLabel="", bool expandable=true)
void selValChangedSignal(SeExpr2::Vec3d val)
CCurveScene * _scene
void cvSelectedSlot(const double pos, const SeExpr2::Vec3d val, const T_INTERP interp)
SeExpr2::Curve< SeExpr2::Vec3d > T_CURVE
QComboBox * _interpComboBox
ExprCSwatchFrame * _selValEdit
QLineEdit * _selPosEdit
void selPosChangedSignal(double pos)
Interpolation curve class for double->double and double->Vec3D.
Definition Curve.h:38
InterpType
Supported interpolation types.
Definition Curve.h:43
</pre >< h3 > A simple variable reference</h3 > This is not a very interesting subclass of expression until we add some additional variables Variables on some applications may be very dynamic In this we only need x
Definition tutorial.txt:108
This is the same as the prman cellnoise function< br ></div >< br > float< b > float y< br > float< b > float y
Definition userdoc.txt:218
The result is computed int int< br >< div style="margin-left: 40px;"> Picks values randomly between loRange and hiRange based on supplied index(which is automatically hashed). &nbsp
For any rgb or hsl value(except for negative s values)