From bf63be9c1aa1764af6a7b42193437e2a1f0f5261 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Fri, 29 Oct 2010 22:31:04 +0300 Subject: [PATCH] Update: improved values gradient dialog and located bindable properties(texture , tail and mesh param) page. --- .../src/edit_range_widget.cpp | 28 ++-- .../src/located_bindable_form.ui | 40 +++--- .../src/located_bindable_page.cpp | 2 +- .../3d/object_viewer_qt/src/located_page.cpp | 1 + .../3d/object_viewer_qt/src/mesh_form.ui | 21 ++- .../3d/object_viewer_qt/src/mesh_widget.cpp | 3 +- .../src/particle_control_dialog.cpp | 2 +- .../src/particle_system_form.ui | 122 +++++++++--------- .../src/particle_texture_anim_form.ui | 70 +++++++--- .../src/particle_texture_anim_widget.cpp | 8 +- .../src/particle_texture_form.ui | 10 +- .../src/particle_workspace_dialog.cpp | 13 +- .../3d/object_viewer_qt/src/tail_form.ui | 32 ++--- .../src/tail_particle_widget.cpp | 10 -- .../src/tail_particle_widget.h | 1 - .../src/value_gradient_dialog.cpp | 2 +- .../src/value_gradient_dialog.h | 38 +++++- 17 files changed, 237 insertions(+), 166 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/edit_range_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/edit_range_widget.cpp index 4099f03fa..27b715d4e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/edit_range_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/edit_range_widget.cpp @@ -127,13 +127,12 @@ void CEditRangeUIntWidget::setMinimum(int value) void CEditRangeUIntWidget::changeSlider(int value) { + // NeL wrapper + if ((_Wrapper != NULL) && (_Wrapper->get() != uint32(value))) + _Wrapper->setAndUpdateModifiedFlag(value); + if (_emit) Q_EMIT valueChanged(value); - - // NeL wrapper - if (_Wrapper == NULL) return; - if (_Wrapper->get() == uint32(value)) return; - _Wrapper->setAndUpdateModifiedFlag(value); } void CEditRangeUIntWidget::updateUi() @@ -232,13 +231,12 @@ void CEditRangeIntWidget::setMinimum(int value) void CEditRangeIntWidget::changeSlider(int value) { + // NeL wrapper + if ((_Wrapper != NULL) && (_Wrapper->get() != sint32(value))) + _Wrapper->setAndUpdateModifiedFlag(value); + if (_emit) Q_EMIT valueChanged(value); - - // NeL wrapper - if (_Wrapper == NULL) return; - if (_Wrapper->get() == sint32(value)) return; - _Wrapper->setAndUpdateModifiedFlag(value); } void CEditRangeIntWidget::updateUi() @@ -341,13 +339,13 @@ void CEditRangeFloatWidget::changeSlider(int value) int deltaSlider = _ui.horizontalSlider->maximum() - _ui.horizontalSlider->minimum(); float newValue = _ui.startSpinBox->value() + ((delta / deltaSlider) * value); _ui.currentSpinBox->setValue(newValue); - if (_emit) - Q_EMIT valueChanged(newValue); // NeL wrapper - if (_Wrapper == NULL) return; - if (fabs(newValue - _Wrapper->get()) < 0.0001) return; - _Wrapper->setAndUpdateModifiedFlag(newValue); + if ((_Wrapper != NULL) && (fabs(newValue - _Wrapper->get()) > 0.0001)) + _Wrapper->setAndUpdateModifiedFlag(newValue); + + if (_emit) + Q_EMIT valueChanged(newValue); } void CEditRangeFloatWidget::updateUi() diff --git a/code/nel/tools/3d/object_viewer_qt/src/located_bindable_form.ui b/code/nel/tools/3d/object_viewer_qt/src/located_bindable_form.ui index af73d1531..8af23ac48 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/located_bindable_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/located_bindable_form.ui @@ -557,14 +557,7 @@ - - - - Use hermitte interpolation - - - - + Non parametric anim only @@ -574,14 +567,21 @@ - + + + + Use hermitte interpolation + + + + Trail coord. system: - + @@ -605,28 +605,28 @@ - + Length(m): - + false - + LOD degradation: - + @@ -710,6 +710,12 @@ + + NLQT::CParticleTextureWidget + QWidget +
particle_texture_widget.h
+ 1 +
NLQT::CEditRangeUIntWidget QWidget @@ -728,12 +734,6 @@
attrib_widget.h
1
- - NLQT::CParticleTextureWidget - QWidget -
particle_texture_widget.h
- 1 -
NLQT::CMeshWidget QWidget diff --git a/code/nel/tools/3d/object_viewer_qt/src/located_bindable_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/located_bindable_page.cpp index b5c67c8a2..dfafa7a64 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/located_bindable_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/located_bindable_page.cpp @@ -137,7 +137,7 @@ CLocatedBindablePage::CLocatedBindablePage(QWidget *parent) connect(_ui.independantSizeCheckBox, SIGNAL(toggled(bool)), this, SLOT(setIndependantSize(bool))); connect(_ui.alignCheckBox, SIGNAL(toggled(bool)), this, SLOT(setAlignOnMotion(bool))); connect(_ui.ztestCheckBox, SIGNAL(toggled(bool)), this, SLOT(setZTest(bool))); - connect(_ui.alignCheckBox, SIGNAL(toggled(bool)), this, SLOT(setZAlign(bool))); + connect(_ui.zalignCheckBox, SIGNAL(toggled(bool)), this, SLOT(setZAlign(bool))); connect(_ui.rotationPCCheckBox, SIGNAL(toggled(bool)), this, SLOT(setHint(bool))); connect(_ui.blendModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setBlendMode(int))); connect(_ui.zbiasDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZBias(double))); diff --git a/code/nel/tools/3d/object_viewer_qt/src/located_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/located_page.cpp index f63d2ead4..7956a66c8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/located_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/located_page.cpp @@ -54,6 +54,7 @@ CLocatedPage::CLocatedPage(QWidget *parent) _ui.massWidget->init(); _ui.maxNumParticleWidget->setRange(1, 501); + _ui.maxNumParticleWidget->enableUpperBound(1 << 16, true); _ui.maxNumParticleWidget->setWrapper(&_MaxNbParticlesWrapper); connect(_ui.coordSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setMatrixMode(int))); diff --git a/code/nel/tools/3d/object_viewer_qt/src/mesh_form.ui b/code/nel/tools/3d/object_viewer_qt/src/mesh_form.ui index 70b80360b..ef44c2c3a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/mesh_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/mesh_form.ui @@ -7,7 +7,7 @@ 0 0 195 - 114 + 118 @@ -83,5 +83,22 @@ - + + + morphCheckBox + toggled(bool) + editPushButton + setEnabled(bool) + + + 60 + 85 + + + 135 + 86 + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/mesh_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/mesh_widget.cpp index f84ff703c..1c84c5e6f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/mesh_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/mesh_widget.cpp @@ -69,6 +69,8 @@ void CMeshWidget::setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParti NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast(_ShapeParticle); if (cm->getNumShapes() > 1) _ui.morphCheckBox->setChecked(true); + else + _ui.morphCheckBox->setChecked(false); updateForMorph(); } @@ -142,7 +144,6 @@ void CMeshWidget::updateForMorph() _ui.browsePushButton->setEnabled(!enable); _ui.meshLineEdit->setEnabled(!enable); _ui.label->setEnabled(!enable); - _ui.editPushButton->setEnabled(enable); if (!enable) _ui.meshLineEdit->setText(cm->getShape().c_str()); else diff --git a/code/nel/tools/3d/object_viewer_qt/src/particle_control_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/particle_control_dialog.cpp index 9756fb7b0..cbec8578f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/particle_control_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/particle_control_dialog.cpp @@ -167,7 +167,7 @@ void CParticleControlDialog::updateCount() _ui.numWantedFacesLabel->setText(tr("Num wanted faces: %1").arg(numWantedFaces)); // display system date - _ui.systemTimesLabel->setText(tr("System time: %1").arg(ps->getSystemDate())); + _ui.systemTimesLabel->setText(tr("System time: %1").arg(ps->getSystemDate(),0,'f',2)); Q_EMIT changeCount(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/particle_system_form.ui b/code/nel/tools/3d/object_viewer_qt/src/particle_system_form.ui index 7a2a095f0..6e898a7ec 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/particle_system_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/particle_system_form.ui @@ -30,19 +30,6 @@ Integration - - - - - 0 - 0 - - - - Force global lighting - - - @@ -508,26 +495,66 @@ + + + + + Sharable + + + + + + + Auto-LOD + + + + + + + false + + + + 0 + 0 + + + + + 53454 + 16777215 + + + + Settings + + + + + + Max view dist: - + - + LOD Ratio: - + - + Qt::Vertical @@ -548,6 +575,19 @@ + + + + 0 + 0 + + + + Force global lighting + + + + @@ -563,14 +603,14 @@ - + true - + @@ -580,7 +620,7 @@ - + Qt::Vertical @@ -674,46 +714,6 @@ - - - - - Sharable - - - - - - - Auto-LOD - - - - - - - false - - - - 0 - 0 - - - - - 53454 - 16777215 - - - - Settings - - - - - - @@ -865,7 +865,7 @@ - + Qt::Vertical diff --git a/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_form.ui b/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_form.ui index 453868813..139d5b2d3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_form.ui @@ -21,7 +21,7 @@ - + @@ -53,10 +53,16 @@ - + + + + + + + - true + false Texture grouped @@ -66,27 +72,21 @@ - - - - - - - - NLQT::CAttribIntWidget - QWidget -
attrib_widget.h
- 1 -
NLQT::CParticleTextureWidget QWidget
particle_texture_widget.h
1
+ + NLQT::CAttribIntWidget + QWidget +
attrib_widget.h
+ 1 +
@@ -97,12 +97,44 @@ setEnabled(bool) - 81 - 46 + 100 + 67 - 129 - 56 + 285 + 70 + + + + + texAnimCheckBox + toggled(bool) + multitexturingGroupBox + setDisabled(bool) + + + 77 + 24 + + + 86 + 72 + + + + + texAnimCheckBox + toggled(bool) + textureGroupedPushButton + setEnabled(bool) + + + 138 + 17 + + + 174 + 17 diff --git a/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_widget.cpp index 243304250..73ebe4107 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/particle_texture_anim_widget.cpp @@ -61,7 +61,7 @@ void CParticleTextureAnimWidget::setCurrentTextureAnim(NL3D::CPSTexturedParticle _EditedParticle = tp; _MTP = mtp; - _ui.texAnimCheckBox->blockSignals(true); + disconnect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool))); bool isAnimTex = _EditedParticle->getTextureGroup() ? true : false; _ui.texAnimCheckBox->setChecked(isAnimTex); @@ -75,13 +75,16 @@ void CParticleTextureAnimWidget::setCurrentTextureAnim(NL3D::CPSTexturedParticle else _ui.multitexturingGroupBox->hide(); - _ui.texAnimCheckBox->blockSignals(false); + connect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool))); } void CParticleTextureAnimWidget::setEnabledTexAnim(bool state) { if (state) { + if (_MTP) + _ui.multitexturingCheckBox->setChecked(false); + // When you try to load a dummy texture, remove alternative paths, an assertion is thrown otherwise NLMISC::CPath::removeAllAlternativeSearchPath(); @@ -144,7 +147,6 @@ void CParticleTextureAnimWidget::updateTexAnimState(bool state) _ui.texWidget->updateUi(); } _ui.texWidget->setVisible(!state); - _ui.textureGroupedPushButton->setVisible(state); _ui.texIndexWidget->setVisible(state); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/particle_texture_form.ui b/code/nel/tools/3d/object_viewer_qt/src/particle_texture_form.ui index 564bfe7c7..76a89ec9b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/particle_texture_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/particle_texture_form.ui @@ -7,7 +7,7 @@ 0 0 191 - 162 + 176
@@ -18,8 +18,8 @@ - 100 - 100 + 105 + 105 @@ -36,8 +36,8 @@ 0 0 - 94 - 94 + 103 + 103 diff --git a/code/nel/tools/3d/object_viewer_qt/src/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/particle_workspace_dialog.cpp index a8cb755ce..ed5135852 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/particle_workspace_dialog.cpp @@ -221,8 +221,8 @@ void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index) if (index.flags() != Qt::NoItemFlags) _PropertyDialog->setCurrentEditedElement(_currentItem); - if (_currentItem && ((_currentItem->itemType() == ItemType::Workspace) || - (_currentItem->itemType() == ItemType::ParticleSystemNotLoaded))) + if ((_currentItem->itemType() == ItemType::Workspace) || + (_currentItem->itemType() == ItemType::ParticleSystemNotLoaded)) _currentItem = NULL; } @@ -285,6 +285,15 @@ void CParticleWorkspaceDialog::customContextMenu() popurMenu->addAction(_deleteAction); break; } + + bool stopped = Modules::psEdit().getState() == CParticleEditor::State::Stopped ? true : false; + _copyLocatedAction->setEnabled(stopped); + _copyBindableAction->setEnabled(stopped); + _pasteLocatedAction->setEnabled(stopped); + _instanciateAction->setEnabled(stopped); + _savePSAction->setEnabled(stopped); + _saveAsPSAction->setEnabled(stopped); + popurMenu->exec(QCursor::pos()); delete popurMenu; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/tail_form.ui b/code/nel/tools/3d/object_viewer_qt/src/tail_form.ui index f6f9e4b19..476dbfc53 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/tail_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/tail_form.ui @@ -6,8 +6,8 @@ 0 0 - 243 - 107 + 206 + 90 @@ -15,23 +15,6 @@ - - - Tail fading - - - - - - - false - - - Tail persist after death - - - - Ribbon orientation @@ -53,7 +36,7 @@ - + @@ -69,7 +52,7 @@ - + Tail shape @@ -116,6 +99,13 @@ + + + + Tail fading + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.cpp index 2f4e4ff9f..515a1927c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.cpp @@ -34,7 +34,6 @@ CTailParticleWidget::CTailParticleWidget(QWidget *parent) _ui.pathWidget->setMode(Mode::RibbonShape); connect(_ui.tailFadingCheckBox, SIGNAL(toggled(bool)), this, SLOT(setTailFading(bool))); - connect(_ui.tailPersistAfterDeathCheckBox, SIGNAL(toggled(bool)), this, SLOT(setPersistAfterDeath(bool))); connect(_ui.ribbonOrientationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRibbonOrientation(int))); connect(_ui.tailShapeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTailShape(int))); } @@ -55,17 +54,14 @@ void CTailParticleWidget::setCurrentTailParticle(CWorkspaceNode *ownerNode, NL3D { _ui.pathWidget->hide(); _ui.ribbonOrientationComboBox->hide(); - _ui.tailPersistAfterDeathCheckBox->hide(); _ui.tailShapeComboBox->hide(); } else { _ui.pathWidget->show(); _ui.ribbonOrientationComboBox->show(); - _ui.tailPersistAfterDeathCheckBox->show(); _ui.tailShapeComboBox->show(); NL3D::CPSRibbon *r = dynamic_cast(_TailParticle); -// _ui.tailPersistAfterDeathCheckBox = (r->getPersistAfterDeath(); _ui.ribbonOrientationComboBox->setCurrentIndex(r->getOrientation()); // Update graphics widget @@ -85,12 +81,6 @@ void CTailParticleWidget::setTailFading(bool state) } } -void CTailParticleWidget::setPersistAfterDeath(bool state) -{ - nlassert(dynamic_cast(_TailParticle)); -// (dynamic_cast(_TailParticle))->setPersistAfterDeath(state); -} - void CTailParticleWidget::setTailShape(int index) { NL3D::CPSRibbon *r = dynamic_cast(_TailParticle); diff --git a/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.h b/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.h index a5f868cd6..fa74ce848 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/tail_particle_widget.h @@ -49,7 +49,6 @@ public: private Q_SLOTS: void setTailFading(bool state); - void setPersistAfterDeath(bool state); void setTailShape(int index); void setRibbonOrientation(int index); diff --git a/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.cpp index 02e4ae1d7..56be8d500 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.cpp @@ -121,7 +121,7 @@ CGradientDialog::CGradientDialog(CWorkspaceNode *ownerNode, editWidget = _ClientInterface->createDialog(this); _gridLayout->addWidget(editWidget, 4, 1, 1, 2); - setWindowTitle(tr("Dialog")); + setWindowTitle(_ClientInterface->getTitleDialog()); _label->setText(tr("Num samples:")); if (canTuneNbStages) diff --git a/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.h index 5d109857d..1ebaff85a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/value_gradient_dialog.h @@ -60,6 +60,9 @@ public: virtual QWidget *createDialog(QWidget *parent) = 0; + /// Return the title of dialog in client + virtual QString getTitleDialog() const = 0; + /// This enumerate the action that we can apply on a gradient enum TAction { Add, Insert, Delete, Up, Down }; @@ -180,6 +183,8 @@ public: return newDialog(this, parent); } + virtual QString getTitleDialog() const = 0; + /// create a new dialog with given id and wrapper virtual QWidget *newDialog(IPSWrapper *wrapper, QWidget *parent) = 0; @@ -259,6 +264,11 @@ public: return editWidget; } + virtual QString getTitleDialog() const + { + return tr("Float values gradient dialog"); + } + virtual void setCurrentIndex(uint index) { _CurrentEditedIndex = index; @@ -267,7 +277,7 @@ public: virtual void displayValue(uint index, QListWidgetItem *item) { - item->setText(QString("%1").arg(Scheme->getValue(index))); + item->setText(QString("%1").arg(Scheme->getValue(index),0,'f',2)); } CEditRangeFloatWidget *editWidget; @@ -290,6 +300,11 @@ public: return editWidget; } + virtual QString getTitleDialog() const + { + return tr("UInt values gradient dialog"); + } + virtual void setCurrentIndex(uint index) { _CurrentEditedIndex = index; @@ -321,6 +336,11 @@ public: return editWidget; } + virtual QString getTitleDialog() const + { + return tr("Int values gradient dialog"); + } + virtual void setCurrentIndex(uint index) { _CurrentEditedIndex = index; @@ -351,6 +371,11 @@ public: return editWidget; } + virtual QString getTitleDialog() const + { + return tr("Color gradient dialog"); + } + virtual void setCurrentIndex(uint index) { _CurrentEditedIndex = index; @@ -360,7 +385,7 @@ public: virtual void displayValue(uint index, QListWidgetItem *item) { NLMISC::CRGBA color = Scheme->getValue(index); - item->setText(QString("RGBA(%1,%2,%3)").arg(color.R).arg(color.G).arg(color.B)); + item->setText(QString("RGBA(%1,%2,%3,%4)").arg(color.R).arg(color.G).arg(color.B).arg(color.A)); QPixmap pixmap(QSize(16, 16)); QPainter painter(&pixmap); painter.setRenderHint(QPainter::Antialiasing, true); @@ -386,7 +411,10 @@ public: editWidget->setWrapper(wrapper); return editWidget; } - + virtual QString getTitleDialog() const + { + return tr("Plane basis gradient dialog"); + } virtual void setCurrentIndex(uint index) { _CurrentEditedIndex = index; @@ -418,6 +446,10 @@ public: // all method inherited from IValueGradientClient virtual QWidget *createDialog(QWidget *parent); + virtual QString getTitleDialog() const + { + return tr("Texture grouped dialog"); + } virtual bool modifyGradient(TAction, uint index); virtual void displayValue(uint index, QListWidgetItem *item); virtual void setCurrentIndex(uint index);