paysages: Made colorgradation dialog sizable and take less space initially.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@294 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
85e19d380a
commit
3f539f5313
4 changed files with 95 additions and 39 deletions
18
TODO
18
TODO
|
@ -1,9 +1,23 @@
|
|||
- Make colorgradation dialog sizable (and reduce minimum size).
|
||||
Technology Preview 1 :
|
||||
- Make all UI more sizable.
|
||||
- Implement scrolling on previews.
|
||||
- Find a licence and apply it.
|
||||
|
||||
Technology Preview 2 :
|
||||
- Add a material editor dialog.
|
||||
- Add a zone editor dialog for localized textures.
|
||||
- Add a terrain modifier dialog with zones.
|
||||
- Improve curve editor.
|
||||
- Replace FILE* by a custom type for Save and Load.
|
||||
- Water and terrain LOD moves with the camera, fix it like in the wanderer.
|
||||
- Implement a file header/versioning.
|
||||
|
||||
Technology Preview 3 :
|
||||
- Restore render progress.
|
||||
- Find a licence and apply it.
|
||||
- Add basic vegetation system (not sure).
|
||||
- Improve sky rendering (colors and light halo).
|
||||
- Add rendering steps in small previews (not sure).
|
||||
|
||||
Release Candidate :
|
||||
- Polish all features and UI.
|
||||
- More translations.
|
||||
|
|
|
@ -21,6 +21,7 @@ DialogColorGradation::DialogColorGradation(QWidget *parent, ColorGradation* grad
|
|||
QWidget* buttons;
|
||||
QWidget* form;
|
||||
QGridLayout* form_layout;
|
||||
QLabel* label;
|
||||
|
||||
_base = gradation;
|
||||
_current = colorGradationCreate();
|
||||
|
@ -33,33 +34,67 @@ DialogColorGradation::DialogColorGradation(QWidget *parent, ColorGradation* grad
|
|||
form->setLayout(form_layout);
|
||||
layout()->addWidget(form);
|
||||
|
||||
form_layout->addWidget(new QLabel(tr("This is the curve editor for color components.\nClick on a component preview below to edit it.\nClick on points and drag them to move them.\nDouble click to add a new point.\nRight click on a point to delete it."), form), 0, 0);
|
||||
label = new QLabel(tr("This is the curve editor for color components.\nClick on a component preview below to edit it.\nClick on points and drag them to move them.\nDouble click to add a new point.\nRight click on a point to delete it."), form);
|
||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
label->setMinimumWidth(150);
|
||||
label->setMaximumWidth(200);
|
||||
label->setWordWrap(true);
|
||||
form_layout->addWidget(label, 0, 1);
|
||||
_curve_editor = new WidgetCurveEditor(form);
|
||||
form_layout->addWidget(_curve_editor, 0, 1);
|
||||
_curve_editor->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
form_layout->addWidget(_curve_editor, 0, 0);
|
||||
connect(_curve_editor, SIGNAL(liveChanged()), this, SLOT(updateColors()));
|
||||
|
||||
form_layout->addWidget(new QLabel(tr("Red preview, click to edit"), form), 1, 0);
|
||||
label = new QLabel(tr("Red preview, click to edit"), form);
|
||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
label->setMinimumWidth(150);
|
||||
label->setMaximumWidth(200);
|
||||
label->setWordWrap(true);
|
||||
form_layout->addWidget(label, 1, 1);
|
||||
_preview_red = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_RED);
|
||||
_preview_red->setMinimumHeight(50);
|
||||
_preview_red->setMinimumHeight(30);
|
||||
_preview_red->setMaximumHeight(60);
|
||||
_preview_red->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
connect(_preview_red, SIGNAL(clicked()), this, SLOT(selectRed()));
|
||||
form_layout->addWidget(_preview_red, 1, 1);
|
||||
form_layout->addWidget(_preview_red, 1, 0);
|
||||
|
||||
form_layout->addWidget(new QLabel(tr("Green preview, click to edit"), form), 2, 0);
|
||||
label = new QLabel(tr("Green preview, click to edit"), form);
|
||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
label->setMinimumWidth(150);
|
||||
label->setMaximumWidth(200);
|
||||
label->setWordWrap(true);
|
||||
form_layout->addWidget(label, 2, 1);
|
||||
_preview_green = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_GREEN);
|
||||
_preview_green->setMinimumHeight(50);
|
||||
_preview_green->setMinimumHeight(30);
|
||||
_preview_green->setMaximumHeight(60);
|
||||
_preview_green->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
connect(_preview_green, SIGNAL(clicked()), this, SLOT(selectGreen()));
|
||||
form_layout->addWidget(_preview_green, 2, 1);
|
||||
form_layout->addWidget(_preview_green, 2, 0);
|
||||
|
||||
form_layout->addWidget(new QLabel(tr("Blue preview, click to edit"), form), 3, 0);
|
||||
label = new QLabel(tr("Blue preview, click to edit"), form);
|
||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
label->setMinimumWidth(150);
|
||||
label->setMaximumWidth(200);
|
||||
label->setWordWrap(true);
|
||||
form_layout->addWidget(label, 3, 1);
|
||||
_preview_blue = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_BLUE);
|
||||
_preview_blue->setMinimumHeight(50);
|
||||
_preview_blue->setMinimumHeight(30);
|
||||
_preview_blue->setMaximumHeight(60);
|
||||
_preview_blue->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
connect(_preview_blue, SIGNAL(clicked()), this, SLOT(selectBlue()));
|
||||
form_layout->addWidget(_preview_blue, 3, 1);
|
||||
form_layout->addWidget(_preview_blue, 3, 0);
|
||||
|
||||
form_layout->addWidget(new QLabel(tr("Final preview"), form), 4, 0);
|
||||
label = new QLabel(tr("Final preview"), form);
|
||||
label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
label->setMinimumWidth(150);
|
||||
label->setMaximumWidth(200);
|
||||
label->setWordWrap(true);
|
||||
form_layout->addWidget(label, 4, 1);
|
||||
_preview_final = new PreviewColorGradation(form, _current, COLORGRADATIONBAND_FINAL);
|
||||
_preview_final->setMinimumHeight(50);
|
||||
form_layout->addWidget(_preview_final, 4, 1);
|
||||
_preview_final->setMinimumHeight(30);
|
||||
_preview_final->setMaximumHeight(60);
|
||||
_preview_final->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
form_layout->addWidget(_preview_final, 4, 0);
|
||||
|
||||
buttons = new QWidget(this);
|
||||
layout()->addWidget(buttons);
|
||||
|
@ -80,6 +115,7 @@ DialogColorGradation::DialogColorGradation(QWidget *parent, ColorGradation* grad
|
|||
_curve = curveCreate();
|
||||
|
||||
setWindowTitle(tr("Paysages 3D - Color gradation editor"));
|
||||
resize(900, 600);
|
||||
|
||||
revert();
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ WidgetCurveEditor::WidgetCurveEditor(QWidget *parent) : QWidget(parent)
|
|||
_dragged = -1;
|
||||
_pen = QColor(0, 0, 0);
|
||||
|
||||
setMinimumSize(500, 500);
|
||||
setMaximumSize(500, 500);
|
||||
setMinimumSize(300, 300);
|
||||
}
|
||||
|
||||
WidgetCurveEditor::~WidgetCurveEditor()
|
||||
|
@ -39,25 +38,32 @@ void WidgetCurveEditor::setPenColor(QColor color)
|
|||
void WidgetCurveEditor::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
int i, n;
|
||||
int width, height;
|
||||
double dwidth, dheight;
|
||||
CurvePoint point;
|
||||
double position, value;
|
||||
|
||||
width = this->width();
|
||||
height = this->height();
|
||||
dheight = (double)(height - 1);
|
||||
dwidth = (double)(width - 1);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(0, 0, 500, 500, QColor(255, 255, 255));
|
||||
painter.fillRect(0, 0, width, height, QColor(255, 255, 255));
|
||||
painter.setPen(_pen);
|
||||
|
||||
for (int x = 0; x < 500; x++)
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
position = ((double)x) / 499.0;
|
||||
position = ((double)x) / dwidth;
|
||||
value = curveGetValue(_curve, position);
|
||||
painter.drawPoint(x, 499 - (int)(value * 499.0));
|
||||
painter.drawPoint(x, height - 1 - (int)(value * dheight));
|
||||
}
|
||||
|
||||
n = curveGetPointCount(_curve);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
curveGetPoint(_curve, i, &point);
|
||||
painter.drawEllipse(QPointF((int)(point.position * 499.0), 499 - (int)(point.value * 499.0)), 4.0, 4.0);
|
||||
painter.drawEllipse(QPointF((int)(point.position * dwidth), height - 1 - (int)(point.value * dheight)), 4.0, 4.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,8 +83,8 @@ void WidgetCurveEditor::mouseMoveEvent(QMouseEvent* event)
|
|||
|
||||
if (_dragged >= 0 && (event->buttons() & Qt::LeftButton))
|
||||
{
|
||||
point.position = ((double)event->x()) / 499.0;
|
||||
point.value = 1.0 - ((double)event->y()) / 499.0;
|
||||
point.position = ((double)event->x()) / (double)(width() - 1);
|
||||
point.value = 1.0 - ((double)event->y()) / (double)(height() - 1);
|
||||
|
||||
point.position = (point.position < 0.0) ? 0.0 : point.position;
|
||||
point.position = (point.position > 1.0) ? 1.0 : point.position;
|
||||
|
@ -127,8 +133,8 @@ void WidgetCurveEditor::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
{
|
||||
if (getPointAt(event->x(), event->y()) < 0)
|
||||
{
|
||||
point.position = ((double)event->x()) / 499.0;
|
||||
point.value = 1.0 - ((double)event->y()) / 499.0;
|
||||
point.position = ((double)event->x()) / (double)(width() - 1);
|
||||
point.value = 1.0 - ((double)event->y()) / (double)(height() - 1);
|
||||
|
||||
curveAddPoint(_curve, &point);
|
||||
curveValidate(_curve);
|
||||
|
@ -144,8 +150,8 @@ int WidgetCurveEditor::getPointAt(int x, int y)
|
|||
int nearest;
|
||||
double distance, ndistance;
|
||||
CurvePoint point;
|
||||
double dx = ((double)x) / 499.0;
|
||||
double dy = 1.0 - ((double)y) / 499.0;
|
||||
double dx = ((double)x) / (double)(width() - 1);
|
||||
double dy = 1.0 - ((double)y) / (double)(height() - 1);
|
||||
|
||||
n = curveGetPointCount(_curve);
|
||||
if (n < 1)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<context>
|
||||
<name>DialogColorGradation</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="36"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="37"/>
|
||||
<source>This is the curve editor for color components.
|
||||
Click on a component preview below to edit it.
|
||||
Click on points and drag them to move them.
|
||||
|
@ -50,42 +50,42 @@ Double cliquez sur le fond pour ajouter un point.
|
|||
Cliquez avec le bouton droit sur un point pour le supprimer.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="41"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="48"/>
|
||||
<source>Red preview, click to edit</source>
|
||||
<translation>Aperçu du rouge, cliquer pour éditer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="47"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="61"/>
|
||||
<source>Green preview, click to edit</source>
|
||||
<translation>Aperçu du vert, cliquer pour éditer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="53"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="74"/>
|
||||
<source>Blue preview, click to edit</source>
|
||||
<translation>Aperçu du bleu, cliquez pour éditer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="59"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="87"/>
|
||||
<source>Final preview</source>
|
||||
<translation>Aperçu du gradient final</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="68"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="103"/>
|
||||
<source>Validate</source>
|
||||
<translation>Valider</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="72"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="107"/>
|
||||
<source>Revert</source>
|
||||
<translation>Recommencer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="76"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="111"/>
|
||||
<source>Cancel</source>
|
||||
<translation>Annuler</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="82"/>
|
||||
<location filename="../gui_qt/dialogcolorgradation.cpp" line="117"/>
|
||||
<source>Paysages 3D - Color gradation editor</source>
|
||||
<translation>Paysages 3D - Editeur de gradients de couleur</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in a new issue