SeExpr
ExprCurve.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 ExprCurve.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 _ExprCurve_h_
23#define _ExprCurve_h_
24
25#include <vector>
26
27#include <QObject>
28#include <QComboBox>
29#include <QGraphicsPolygonItem>
30#include <QGraphicsView>
31#include <QLineEdit>
32
33#include "../Curve.h"
34
35/*
36 This class overrides QGraphicsView so we can get resize events
37*/
38class CurveGraphicsView : public QGraphicsView {
39 Q_OBJECT
40 public:
42 setTransformationAnchor(QGraphicsView::NoAnchor);
43 setResizeAnchor(QGraphicsView::NoAnchor);
44 }
46
47 virtual void resizeEvent(QResizeEvent *event);
48
49signals:
50 void resizeSignal(int width, int height);
51};
52
53/*
54 This class overrides QGraphicsScene so we can handle mouse
55 press, drag and keyboard events
56*/
57class CurveScene : public QGraphicsScene {
58 Q_OBJECT
59
62
63 public:
64 CurveScene();
66
67 void addPoint(double x, double y, const T_INTERP interp, const bool select = true);
68
69 void removePoint(const int index);
70 void removeAll();
71
72 virtual void keyPressEvent(QKeyEvent *event);
73
74 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
75 virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
76 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
77 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
78 void drawRect();
79
80 void drawPoly();
81
82 void drawPoints();
83
84 void emitCurveChanged();
85
86 void rebuildCurve();
87
88 std::vector<T_CURVE::CV> _cvs; // unsorted cvs
89
90 friend class ExprCurve;
91
92 private:
94 public
95slots:
96 void interpChanged(const int interp);
97 void selPosChanged(double pos);
98 void selValChanged(double val);
99 void resize(const int width, const int height);
100
101signals:
102 void cvSelected(double x, double y, T_INTERP interp);
104
105 private:
109 std::vector<QGraphicsEllipseItem *> _circleObjects;
111 QGraphicsPolygonItem *_curvePoly;
112 QGraphicsRectItem *_baseRect;
113 bool _lmb;
114};
115
116class ExprCurve : public QWidget {
117 Q_OBJECT
118
121
122 public:
123 ExprCurve(QWidget *parent = 0,
124 QString pLabel = "",
125 QString vLabel = "",
126 QString iLabel = "",
127 bool expandable = true);
129
130 // Convenience Functions
131 void addPoint(const double x, const double y, const T_INTERP interp, bool select = false);
132
134
135 public
136slots:
137 void cvSelectedSlot(double pos, double val, T_INTERP interp);
138 void selPosChanged();
139 void selValChanged();
140 void openDetail();
141
142signals:
143 void selPosChangedSignal(double pos);
144 void selValChangedSignal(double val);
145
146 private:
147 QLineEdit *_selPosEdit;
148 QLineEdit *_selValEdit;
149 QComboBox *_interpComboBox;
150};
151#endif
virtual void resizeEvent(QResizeEvent *event)
Definition: ExprCurve.cpp:43
void resizeSignal(int width, int height)
void drawPoints()
Definition: ExprCurve.cpp:239
void cvSelected(double x, double y, T_INTERP interp)
int _height
Definition: ExprCurve.h:107
void removeAll()
Definition: ExprCurve.cpp:41
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
Definition: ExprCurve.cpp:104
void resize(const int width, const int height)
Definition: ExprCurve.cpp:56
int _selectedItem
Definition: ExprCurve.h:110
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
Definition: ExprCurve.cpp:150
QGraphicsRectItem * _baseRect
Definition: ExprCurve.h:112
void drawRect()
Definition: ExprCurve.cpp:212
void selValChanged(double val)
Definition: ExprCurve.cpp:197
int _width
Definition: ExprCurve.h:106
void rebuildCurve()
Definition: ExprCurve.cpp:66
void removePoint(const int index)
Definition: ExprCurve.cpp:87
T_CURVE::InterpType T_INTERP
Definition: ExprCurve.h:61
std::vector< QGraphicsEllipseItem * > _circleObjects
Definition: ExprCurve.h:109
void drawPoly()
Definition: ExprCurve.cpp:221
void emitCurveChanged()
Definition: ExprCurve.cpp:209
bool _lmb
Definition: ExprCurve.h:113
virtual void keyPressEvent(QKeyEvent *event)
Definition: ExprCurve.cpp:97
void addPoint(double x, double y, const T_INTERP interp, const bool select=true)
Definition: ExprCurve.cpp:73
QGraphicsPolygonItem * _curvePoly
Definition: ExprCurve.h:111
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition: ExprCurve.cpp:140
std::vector< T_CURVE::CV > _cvs
Definition: ExprCurve.h:88
SeExpr2::Curve< double > T_CURVE
Definition: ExprCurve.h:60
void curveChanged()
void selPosChanged(double pos)
Definition: ExprCurve.cpp:185
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
Definition: ExprCurve.cpp:168
T_INTERP _interp
Definition: ExprCurve.h:108
T_CURVE * _curve
Definition: ExprCurve.h:93
void interpChanged(const int interp)
Definition: ExprCurve.cpp:174
QLineEdit * _selValEdit
Definition: ExprCurve.h:148
~ExprCurve()
Definition: ExprCurve.h:128
void addPoint(const double x, const double y, const T_INTERP interp, bool select=false)
Definition: ExprCurve.cpp:442
void cvSelectedSlot(double pos, double val, T_INTERP interp)
Definition: ExprCurve.cpp:378
void selValChanged()
Definition: ExprCurve.cpp:396
void selValChangedSignal(double val)
SeExpr2::Curve< double > T_CURVE
Definition: ExprCurve.h:119
QComboBox * _interpComboBox
Definition: ExprCurve.h:149
void selPosChangedSignal(double pos)
void openDetail()
Definition: ExprCurve.cpp:403
CurveScene * _scene
Definition: ExprCurve.h:133
QLineEdit * _selPosEdit
Definition: ExprCurve.h:147
T_CURVE::InterpType T_INTERP
Definition: ExprCurve.h:120
void selPosChanged()
Definition: ExprCurve.cpp:389
ExprCurve(QWidget *parent=0, QString pLabel="", QString vLabel="", QString iLabel="", bool expandable=true)
Definition: ExprCurve.cpp:260
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