Changed: #1193 If switch between the force properties in a workspace erroneously marked that the particle system has been changed.
This commit is contained in:
parent
74d5adb2bb
commit
6a657037b1
10 changed files with 161 additions and 226 deletions
|
@ -84,7 +84,6 @@ Using this widget you can set the color(RGBA) using the four sliders or through
|
||||||
CDirectionWidget
|
CDirectionWidget
|
||||||
</b><br>
|
</b><br>
|
||||||
This widget helps to choose from several preset directions, or to choose a custom one.
|
This widget helps to choose from several preset directions, or to choose a custom one.
|
||||||
To use it you have to create a wrapper.
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="cdirection_widget.png" alt="CDirectionWidget">
|
<img src="cdirection_widget.png" alt="CDirectionWidget">
|
||||||
@see
|
@see
|
||||||
|
|
|
@ -25,12 +25,11 @@
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/vector.h>
|
#include <nel/misc/vector.h>
|
||||||
#include <nel/3d/particle_system.h>
|
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT {
|
||||||
|
|
||||||
CDirectionWidget::CDirectionWidget(QWidget *parent)
|
CDirectionWidget::CDirectionWidget(QWidget *parent)
|
||||||
: QWidget(parent), _Wrapper(NULL), _DirectionWrapper(NULL), _globalName("")
|
: QWidget(parent), _globalName("")
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -59,31 +58,10 @@ CDirectionWidget::~CDirectionWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDirectionWidget::enableGlobalVariable()
|
void CDirectionWidget::enabledGlobalVariable(bool enabled)
|
||||||
{
|
{
|
||||||
_ui.globalPushButton->setVisible(true);
|
_ui.globalPushButton->setVisible(enabled);
|
||||||
_globalName = "";
|
setGlobalName("", false);
|
||||||
}
|
|
||||||
|
|
||||||
void CDirectionWidget::setWrapper(IPSWrapper<NLMISC::CVector> *wrapper)
|
|
||||||
{
|
|
||||||
_Wrapper = wrapper;
|
|
||||||
_ui.globalPushButton->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDirectionWidget::setDirectionWrapper(NL3D::CPSDirection *wrapper)
|
|
||||||
{
|
|
||||||
_DirectionWrapper = wrapper;
|
|
||||||
if (_DirectionWrapper && _DirectionWrapper->supportGlobalVectorValue())
|
|
||||||
_ui.globalPushButton->show();
|
|
||||||
else
|
|
||||||
_ui.globalPushButton->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDirectionWidget::updateUi()
|
|
||||||
{
|
|
||||||
setValue(_Wrapper->get(), false);
|
|
||||||
checkEnabledGlobalDirection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDirectionWidget::setValue(const NLMISC::CVector &value, bool emit)
|
void CDirectionWidget::setValue(const NLMISC::CVector &value, bool emit)
|
||||||
|
@ -97,8 +75,6 @@ void CDirectionWidget::setValue(const NLMISC::CVector &value, bool emit)
|
||||||
if (emit)
|
if (emit)
|
||||||
{
|
{
|
||||||
Q_EMIT valueChanged(_value);
|
Q_EMIT valueChanged(_value);
|
||||||
if (_Wrapper)
|
|
||||||
_Wrapper->setAndUpdateModifiedFlag(_value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,24 +98,13 @@ void CDirectionWidget::setGlobalName(const QString &globalName, bool emit)
|
||||||
|
|
||||||
void CDirectionWidget::setGlobalDirection()
|
void CDirectionWidget::setGlobalDirection()
|
||||||
{
|
{
|
||||||
nlassert(_DirectionWrapper);
|
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QString text = QInputDialog::getText(this, tr("Enter Name"),
|
QString text = QInputDialog::getText(this, tr("Enter Name"),
|
||||||
"", QLineEdit::Normal,
|
"", QLineEdit::Normal,
|
||||||
QString(_DirectionWrapper->getGlobalVectorValueName().c_str()), &ok);
|
QString(_globalName), &ok);
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
|
||||||
setGlobalName(text);
|
setGlobalName(text);
|
||||||
|
|
||||||
_DirectionWrapper->enableGlobalVectorValue(text.toStdString());
|
|
||||||
if (!_globalName.isEmpty())
|
|
||||||
{
|
|
||||||
// take a non NULL value for the direction
|
|
||||||
NL3D::CParticleSystem::setGlobalVectorValue(text.toStdString(), NLMISC::CVector::I);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDirectionWidget::incVecI()
|
void CDirectionWidget::incVecI()
|
||||||
|
@ -175,11 +140,7 @@ void CDirectionWidget::decVecK()
|
||||||
void CDirectionWidget::setNewVecXZ(float x, float y)
|
void CDirectionWidget::setNewVecXZ(float x, float y)
|
||||||
{
|
{
|
||||||
const float epsilon = 10E-3f;
|
const float epsilon = 10E-3f;
|
||||||
NLMISC::CVector v;
|
NLMISC::CVector v = _value;
|
||||||
if (_Wrapper)
|
|
||||||
v = _Wrapper->get();
|
|
||||||
else
|
|
||||||
v = _value;
|
|
||||||
|
|
||||||
v.x = x;
|
v.x = x;
|
||||||
v.z = y;
|
v.z = y;
|
||||||
|
@ -202,11 +163,7 @@ void CDirectionWidget::setNewVecXZ(float x, float y)
|
||||||
void CDirectionWidget::setNewVecYZ(float x, float y)
|
void CDirectionWidget::setNewVecYZ(float x, float y)
|
||||||
{
|
{
|
||||||
const float epsilon = 10E-3f;
|
const float epsilon = 10E-3f;
|
||||||
NLMISC::CVector v;
|
NLMISC::CVector v = _value;
|
||||||
if (_Wrapper)
|
|
||||||
v = _Wrapper->get();
|
|
||||||
else
|
|
||||||
v = _value;
|
|
||||||
|
|
||||||
v.y = x;
|
v.y = x;
|
||||||
v.z = y;
|
v.z = y;
|
||||||
|
@ -226,23 +183,4 @@ void CDirectionWidget::setNewVecYZ(float x, float y)
|
||||||
setValue(v);
|
setValue(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDirectionWidget::checkEnabledGlobalDirection()
|
|
||||||
{
|
|
||||||
bool enableUserDirection = true;
|
|
||||||
_ui.xzWidget->show();
|
|
||||||
_ui.yzWidget->show();
|
|
||||||
if (_DirectionWrapper && _DirectionWrapper->supportGlobalVectorValue() && !_DirectionWrapper->getGlobalVectorValueName().empty())
|
|
||||||
{
|
|
||||||
enableUserDirection = false;
|
|
||||||
_ui.xzWidget->hide();
|
|
||||||
_ui.yzWidget->hide();
|
|
||||||
}
|
|
||||||
_ui.incVecIPushButton->setEnabled(enableUserDirection);
|
|
||||||
_ui.incVecJPushButton->setEnabled(enableUserDirection);
|
|
||||||
_ui.incVecKPushButton->setEnabled(enableUserDirection);
|
|
||||||
_ui.decVecIPushButton->setEnabled(enableUserDirection);
|
|
||||||
_ui.decVecJPushButton->setEnabled(enableUserDirection);
|
|
||||||
_ui.decVecKPushButton->setEnabled(enableUserDirection);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -28,7 +28,6 @@
|
||||||
#include <nel/3d/ps_direction.h>
|
#include <nel/3d/ps_direction.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT {
|
||||||
|
|
||||||
|
@ -45,13 +44,7 @@ public:
|
||||||
CDirectionWidget(QWidget *parent = 0);
|
CDirectionWidget(QWidget *parent = 0);
|
||||||
~CDirectionWidget();
|
~CDirectionWidget();
|
||||||
|
|
||||||
void enableGlobalVariable();
|
void enabledGlobalVariable(bool enabled);
|
||||||
void setWrapper(IPSWrapper<NLMISC::CVector> *wrapper);
|
|
||||||
|
|
||||||
/// The CPSDirection object is used to see if a global variable can be bound to the direction.
|
|
||||||
/// When set to NULL it has no effect (the default)
|
|
||||||
void setDirectionWrapper(NL3D::CPSDirection *wrapper);
|
|
||||||
void updateUi();
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged(const NLMISC::CVector &value);
|
void valueChanged(const NLMISC::CVector &value);
|
||||||
|
@ -73,10 +66,6 @@ private Q_SLOTS:
|
||||||
void setNewVecYZ(float x, float y);
|
void setNewVecYZ(float x, float y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkEnabledGlobalDirection();
|
|
||||||
|
|
||||||
IPSWrapper<NLMISC::CVector> *_Wrapper ;
|
|
||||||
NL3D::CPSDirection *_DirectionWrapper;
|
|
||||||
NLMISC::CVector _value;
|
NLMISC::CVector _value;
|
||||||
QString _globalName;
|
QString _globalName;
|
||||||
|
|
||||||
|
|
|
@ -280,17 +280,20 @@ void CEmitterPage::setDirectionMode(int index)
|
||||||
void CEmitterPage::setSpeedInheritanceFactor(float value)
|
void CEmitterPage::setSpeedInheritanceFactor(float value)
|
||||||
{
|
{
|
||||||
_Emitter->setSpeedInheritanceFactor(value);
|
_Emitter->setSpeedInheritanceFactor(value);
|
||||||
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::setConicEmitterRadius(float value)
|
void CEmitterPage::setConicEmitterRadius(float value)
|
||||||
{
|
{
|
||||||
dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter)->setRadius(value);
|
dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter)->setRadius(value);
|
||||||
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::setEmitDelay(float value)
|
void CEmitterPage::setEmitDelay(float value)
|
||||||
{
|
{
|
||||||
_Emitter->setEmitDelay(value);
|
_Emitter->setEmitDelay(value);
|
||||||
Modules::psEdit().resetAutoCount(_Node);
|
Modules::psEdit().resetAutoCount(_Node);
|
||||||
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::setMaxEmissionCount(uint32 value)
|
void CEmitterPage::setMaxEmissionCount(uint32 value)
|
||||||
|
@ -304,6 +307,7 @@ void CEmitterPage::setMaxEmissionCount(uint32 value)
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
|
||||||
_ui.maxEmissionCountWidget->setValue((uint32)_Emitter->getMaxEmissionCount(), false);
|
_ui.maxEmissionCountWidget->setValue((uint32)_Emitter->getMaxEmissionCount(), false);
|
||||||
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
Modules::psEdit().resetAutoCount(_Node);
|
Modules::psEdit().resetAutoCount(_Node);
|
||||||
}
|
}
|
||||||
|
@ -311,6 +315,7 @@ void CEmitterPage::setMaxEmissionCount(uint32 value)
|
||||||
void CEmitterPage::setDir(const NLMISC::CVector &value)
|
void CEmitterPage::setDir(const NLMISC::CVector &value)
|
||||||
{
|
{
|
||||||
dynamic_cast<NL3D::CPSDirection *>(_Emitter)->setDir(value);
|
dynamic_cast<NL3D::CPSDirection *>(_Emitter)->setDir(value);
|
||||||
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::updatePeriodWidget()
|
void CEmitterPage::updatePeriodWidget()
|
||||||
|
|
|
@ -41,18 +41,17 @@ CForcePage::CForcePage(QWidget *parent)
|
||||||
_ui.forceIntensityWidget->init();
|
_ui.forceIntensityWidget->init();
|
||||||
|
|
||||||
_ui.parametricFactorWidget->setRange(0.0, 64.0);
|
_ui.parametricFactorWidget->setRange(0.0, 64.0);
|
||||||
_ui.parametricFactorWidget->setWrapper(&_ParamFactorWrapper);
|
|
||||||
|
|
||||||
_ui.radialViscosityWidget->setRange(0.0, 1.0);
|
_ui.radialViscosityWidget->setRange(0.0, 1.0);
|
||||||
_ui.radialViscosityWidget->setWrapper(&_RadialViscosityWrapper);
|
|
||||||
|
|
||||||
_ui.tangentialViscosityWidget->setRange(0, 1);
|
_ui.tangentialViscosityWidget->setRange(0, 1);
|
||||||
_ui.tangentialViscosityWidget->setWrapper(&_TangentialViscosityWrapper);
|
|
||||||
|
|
||||||
_ui.directionWidget->setWrapper(&_DirectionWrapper);
|
|
||||||
|
|
||||||
connect(_ui.toTargetsPushButton, SIGNAL(clicked()), this, SLOT(addTarget()));
|
connect(_ui.toTargetsPushButton, SIGNAL(clicked()), this, SLOT(addTarget()));
|
||||||
connect(_ui.toAvaibleTargetsPushButton, SIGNAL(clicked()), this, SLOT(removeTarget()));
|
connect(_ui.toAvaibleTargetsPushButton, SIGNAL(clicked()), this, SLOT(removeTarget()));
|
||||||
|
|
||||||
|
connect(_ui.parametricFactorWidget, SIGNAL(valueChanged(float)), this, SLOT(setFactorBrownianForce(float)));
|
||||||
|
connect(_ui.radialViscosityWidget, SIGNAL(valueChanged(float)), this, SLOT(setRadialViscosity(float)));
|
||||||
|
connect(_ui.tangentialViscosityWidget, SIGNAL(valueChanged(float)), this, SLOT(setTangentialViscosity(float)));
|
||||||
|
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector)));
|
||||||
|
connect(_ui.directionWidget, SIGNAL(globalNameChanged(QString)), this, SLOT(setGlobalName(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CForcePage::~CForcePage()
|
CForcePage::~CForcePage()
|
||||||
|
@ -61,10 +60,11 @@ CForcePage::~CForcePage()
|
||||||
|
|
||||||
void CForcePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
|
void CForcePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
|
||||||
{
|
{
|
||||||
hideWrappersWidget();
|
nlassert(locatedBindable);
|
||||||
|
|
||||||
|
hideAdditionalWidget();
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
|
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
|
||||||
|
|
||||||
updateTargets();
|
updateTargets();
|
||||||
|
|
||||||
// force with intensity case
|
// force with intensity case
|
||||||
|
@ -77,41 +77,33 @@ void CForcePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab
|
||||||
}
|
}
|
||||||
|
|
||||||
// vortex (to tune viscosity)
|
// vortex (to tune viscosity)
|
||||||
if (dynamic_cast<NL3D::CPSCylindricVortex *>(_LBTarget))
|
NL3D::CPSCylindricVortex *cylindricVortex = dynamic_cast<NL3D::CPSCylindricVortex *>(_LBTarget);
|
||||||
|
if (cylindricVortex)
|
||||||
{
|
{
|
||||||
_RadialViscosityWrapper.OwnerNode = _Node;
|
_ui.radialViscosityWidget->setValue(cylindricVortex->getRadialViscosity(), false);
|
||||||
_RadialViscosityWrapper.V = dynamic_cast<NL3D::CPSCylindricVortex *>(_LBTarget);
|
|
||||||
|
|
||||||
_ui.radialViscosityWidget->updateUi();
|
|
||||||
_ui.radialViscosityLabel->show();
|
_ui.radialViscosityLabel->show();
|
||||||
_ui.radialViscosityWidget->show();
|
_ui.radialViscosityWidget->show();
|
||||||
|
|
||||||
_TangentialViscosityWrapper.OwnerNode = _Node;
|
_ui.tangentialViscosityWidget->setValue(cylindricVortex->getTangentialViscosity(), false);
|
||||||
_TangentialViscosityWrapper.V = dynamic_cast<NL3D::CPSCylindricVortex *>(_LBTarget);
|
|
||||||
|
|
||||||
_ui.tangentialViscosityWidget->updateUi();
|
|
||||||
_ui.tangentialViscosityLabel->show();
|
_ui.tangentialViscosityLabel->show();
|
||||||
_ui.tangentialViscosityWidget->show();
|
_ui.tangentialViscosityWidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// deals with emitters that have a direction
|
// deals with emitters that have a direction
|
||||||
if (dynamic_cast<NL3D::CPSDirection *>(_LBTarget))
|
NL3D::CPSDirection *direction = dynamic_cast<NL3D::CPSDirection *>(_LBTarget);
|
||||||
|
if (direction)
|
||||||
{
|
{
|
||||||
_DirectionWrapper.OwnerNode = _Node;
|
_ui.directionWidget->setValue(direction->getDir(), false);
|
||||||
_DirectionWrapper.E = dynamic_cast<NL3D::CPSDirection *>(_LBTarget);
|
_ui.directionWidget->enabledGlobalVariable(direction->supportGlobalVectorValue());
|
||||||
_ui.directionWidget->setDirectionWrapper(dynamic_cast<NL3D::CPSDirection *>(_LBTarget));
|
_ui.directionWidget->setGlobalName(QString(direction->getGlobalVectorValueName().c_str()), false);
|
||||||
|
|
||||||
_ui.directionWidget->updateUi();
|
|
||||||
_ui.directionWidget->show();
|
_ui.directionWidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Brownian (to tune parametric factor)
|
// Brownian (to tune parametric factor)
|
||||||
if (dynamic_cast<NL3D::CPSBrownianForce *>(_LBTarget))
|
NL3D::CPSBrownianForce *brownianForce = dynamic_cast<NL3D::CPSBrownianForce *>(_LBTarget);
|
||||||
|
if (brownianForce)
|
||||||
{
|
{
|
||||||
_ParamFactorWrapper.OwnerNode = _Node;
|
_ui.parametricFactorWidget->setValue(brownianForce->getParametricFactor(), false);
|
||||||
_ParamFactorWrapper.F = static_cast<NL3D::CPSBrownianForce *>(_LBTarget);
|
|
||||||
|
|
||||||
_ui.parametricFactorWidget->updateUi();
|
|
||||||
_ui.parametricFactorLabel->show();
|
_ui.parametricFactorLabel->show();
|
||||||
_ui.parametricFactorWidget->show();
|
_ui.parametricFactorWidget->show();
|
||||||
}
|
}
|
||||||
|
@ -168,8 +160,47 @@ void CForcePage::removeTarget()
|
||||||
_ui.avaibleTargetsListWidget->addItem(item);
|
_ui.avaibleTargetsListWidget->addItem(item);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
void CForcePage::setRadialViscosity(float value)
|
||||||
|
{
|
||||||
|
nlassert(_LBTarget);
|
||||||
|
dynamic_cast<NL3D::CPSCylindricVortex *>(_LBTarget)->setRadialViscosity(value);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
void CForcePage::hideWrappersWidget()
|
void CForcePage::setTangentialViscosity(float value)
|
||||||
|
{
|
||||||
|
nlassert(_LBTarget);
|
||||||
|
dynamic_cast<NL3D::CPSCylindricVortex *>(_LBTarget)->setTangentialViscosity(value);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CForcePage::setDir(const NLMISC::CVector &value)
|
||||||
|
{
|
||||||
|
nlassert(_LBTarget);
|
||||||
|
dynamic_cast<NL3D::CPSDirection *>(_LBTarget)->setDir(value);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CForcePage::setGlobalName(const QString &globalName)
|
||||||
|
{
|
||||||
|
nlassert(_LBTarget);
|
||||||
|
dynamic_cast<NL3D::CPSDirection *>(_LBTarget)->enableGlobalVectorValue(globalName.toStdString());
|
||||||
|
if (!globalName.isEmpty())
|
||||||
|
{
|
||||||
|
// take a non NULL value for the direction
|
||||||
|
NL3D::CParticleSystem::setGlobalVectorValue(globalName.toStdString(), NLMISC::CVector::I);
|
||||||
|
}
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CForcePage::setFactorBrownianForce(float value)
|
||||||
|
{
|
||||||
|
nlassert(_LBTarget);
|
||||||
|
dynamic_cast<NL3D::CPSBrownianForce *>(_LBTarget)->setParametricFactor(value);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CForcePage::hideAdditionalWidget()
|
||||||
{
|
{
|
||||||
_ui.directionWidget->hide();
|
_ui.directionWidget->hide();
|
||||||
_ui.parametricFactorLabel->hide();
|
_ui.parametricFactorLabel->hide();
|
||||||
|
@ -182,6 +213,7 @@ void CForcePage::hideWrappersWidget()
|
||||||
|
|
||||||
void CForcePage::updateTargets()
|
void CForcePage::updateTargets()
|
||||||
{
|
{
|
||||||
|
nlassert(_LBTarget);
|
||||||
uint k;
|
uint k;
|
||||||
uint nbTarg = _LBTarget->getNbTargets();
|
uint nbTarg = _LBTarget->getNbTargets();
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,12 @@ private Q_SLOTS:
|
||||||
void addTarget();
|
void addTarget();
|
||||||
void removeTarget();
|
void removeTarget();
|
||||||
|
|
||||||
|
void setRadialViscosity(float value);
|
||||||
|
void setTangentialViscosity(float value);
|
||||||
|
void setDir(const NLMISC::CVector &value);
|
||||||
|
void setGlobalName(const QString &globalName);
|
||||||
|
void setFactorBrownianForce(float value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// wrapper to tune the intensity of a force
|
/// wrapper to tune the intensity of a force
|
||||||
|
@ -84,40 +90,7 @@ private:
|
||||||
void setScheme(scheme_type *s) {F->setIntensityScheme(s); }
|
void setScheme(scheme_type *s) {F->setIntensityScheme(s); }
|
||||||
} _ForceIntensityWrapper;
|
} _ForceIntensityWrapper;
|
||||||
|
|
||||||
/// wrapper to tune the radial viscosity for vortices
|
void hideAdditionalWidget();
|
||||||
struct CRadialViscosityWrapper : public IPSWrapperFloat
|
|
||||||
{
|
|
||||||
NL3D::CPSCylindricVortex *V;
|
|
||||||
float get(void) const { return V->getRadialViscosity(); }
|
|
||||||
void set(const float &value) { V->setRadialViscosity(value); }
|
|
||||||
} _RadialViscosityWrapper;
|
|
||||||
|
|
||||||
/// wrapper to tune the tangential viscosity for vortices
|
|
||||||
struct CTangentialViscosityWrapper : public IPSWrapperFloat
|
|
||||||
{
|
|
||||||
NL3D::CPSCylindricVortex *V;
|
|
||||||
float get(void) const { return V->getTangentialViscosity(); }
|
|
||||||
void set(const float &value) { V->setTangentialViscosity(value); }
|
|
||||||
} _TangentialViscosityWrapper;
|
|
||||||
|
|
||||||
/// wrappers to tune the direction
|
|
||||||
struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
|
|
||||||
{
|
|
||||||
NL3D::CPSDirection *E;
|
|
||||||
NLMISC::CVector get(void) const { return E->getDir(); }
|
|
||||||
void set(const NLMISC::CVector &d){ E->setDir(d); }
|
|
||||||
} _DirectionWrapper;
|
|
||||||
|
|
||||||
/// wrappers to tune the parametric factor of brownian force
|
|
||||||
struct CParamFactorWrapper : public IPSWrapperFloat
|
|
||||||
{
|
|
||||||
NL3D::CPSBrownianForce *F;
|
|
||||||
float get(void) const { return F->getParametricFactor(); }
|
|
||||||
void set(const float &f){ F->setParametricFactor(f); }
|
|
||||||
} _ParamFactorWrapper;
|
|
||||||
|
|
||||||
|
|
||||||
void hideWrappersWidget();
|
|
||||||
|
|
||||||
void updateTargets();
|
void updateTargets();
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,14 @@ CPSMoverPage::CPSMoverPage(QWidget *parent)
|
||||||
_ui.scaleZWidget->setRange(0.f, 4.f);
|
_ui.scaleZWidget->setRange(0.f, 4.f);
|
||||||
_ui.scaleZWidget->setWrapper(&_ZScaleWrapper);
|
_ui.scaleZWidget->setWrapper(&_ZScaleWrapper);
|
||||||
|
|
||||||
_ui.directionWidget->setWrapper(&_DirectionWrapper);
|
//_ui.directionWidget->setWrapper(&_DirectionWrapper);
|
||||||
|
|
||||||
connect(_ui.xDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setXPosition(double)));
|
connect(_ui.xDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setXPosition(double)));
|
||||||
connect(_ui.yDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setYPosition(double)));
|
connect(_ui.yDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setYPosition(double)));
|
||||||
connect(_ui.zDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZPosition(double)));
|
connect(_ui.zDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZPosition(double)));
|
||||||
|
|
||||||
|
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector)));
|
||||||
|
|
||||||
connect(_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
connect(_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||||
this, SLOT(changeSubComponent()));
|
this, SLOT(changeSubComponent()));
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,7 @@ void CPSMoverPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
|
||||||
_ui.listWidget->clear();
|
_ui.listWidget->clear();
|
||||||
hideWrappersWidget();
|
hideAdditionalWidget();
|
||||||
|
|
||||||
uint numBound = _EditedLocated->getNbBoundObjects();
|
uint numBound = _EditedLocated->getNbBoundObjects();
|
||||||
|
|
||||||
|
@ -101,7 +103,7 @@ void CPSMoverPage::updatePosition(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPSMoverPage::hideWrappersWidget()
|
void CPSMoverPage::hideAdditionalWidget()
|
||||||
{
|
{
|
||||||
_ui.scaleLabel->hide();
|
_ui.scaleLabel->hide();
|
||||||
_ui.scaleXLabel->hide();
|
_ui.scaleXLabel->hide();
|
||||||
|
@ -162,7 +164,7 @@ void CPSMoverPage::setZPosition(double value)
|
||||||
|
|
||||||
void CPSMoverPage::changeSubComponent()
|
void CPSMoverPage::changeSubComponent()
|
||||||
{
|
{
|
||||||
hideWrappersWidget();
|
hideAdditionalWidget();
|
||||||
NL3D::IPSMover *m = getMoverInterface();
|
NL3D::IPSMover *m = getMoverInterface();
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
|
|
||||||
|
@ -213,15 +215,17 @@ void CPSMoverPage::changeSubComponent()
|
||||||
|
|
||||||
if (m->onlyStoreNormal())
|
if (m->onlyStoreNormal())
|
||||||
{
|
{
|
||||||
_DirectionWrapper.OwnerNode = _Node;
|
_ui.directionWidget->setValue(getMoverInterface()->getNormal(getLocatedIndex()), false);
|
||||||
_DirectionWrapper.M = m;
|
|
||||||
_DirectionWrapper.Index = _EditedLocatedIndex;
|
|
||||||
|
|
||||||
_ui.directionWidget->updateUi();
|
|
||||||
_ui.directionWidget->show();
|
_ui.directionWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPSMoverPage::setDir(const NLMISC::CVector &value)
|
||||||
|
{
|
||||||
|
getMoverInterface()->setNormal(getLocatedIndex(), value);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
NL3D::IPSMover *CPSMoverPage::getMoverInterface(void)
|
NL3D::IPSMover *CPSMoverPage::getMoverInterface(void)
|
||||||
{
|
{
|
||||||
nlassert(_EditedLocated);
|
nlassert(_EditedLocated);
|
||||||
|
|
|
@ -92,6 +92,8 @@ private Q_SLOTS:
|
||||||
void setZPosition(double value);
|
void setZPosition(double value);
|
||||||
void changeSubComponent();
|
void changeSubComponent();
|
||||||
|
|
||||||
|
void setDir(const NLMISC::CVector &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// wrappers to scale objects
|
/// wrappers to scale objects
|
||||||
|
@ -142,18 +144,9 @@ private:
|
||||||
}
|
}
|
||||||
} _ZScaleWrapper ;
|
} _ZScaleWrapper ;
|
||||||
|
|
||||||
/// wrapper for direction
|
void hideAdditionalWidget();
|
||||||
struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
|
|
||||||
{
|
|
||||||
uint32 Index ;
|
|
||||||
NL3D::IPSMover *M ;
|
|
||||||
NLMISC::CVector get(void) const { return M->getNormal(Index) ; }
|
|
||||||
void set(const NLMISC::CVector &v) { M->setNormal(Index, v) ; }
|
|
||||||
|
|
||||||
|
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
||||||
} _DirectionWrapper ;
|
|
||||||
|
|
||||||
void hideWrappersWidget();
|
|
||||||
|
|
||||||
/// update the mouse listener position when the user entered a value with the keyboard
|
/// update the mouse listener position when the user entered a value with the keyboard
|
||||||
void updateListener(void) ;
|
void updateListener(void) ;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
/*
|
/*
|
||||||
Object Viewer Qt
|
Object Viewer Qt
|
||||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -23,8 +23,10 @@
|
||||||
namespace NLQT {
|
namespace NLQT {
|
||||||
|
|
||||||
CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent)
|
CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent), _Node(ownerNode), _BasicSpinner(sf)
|
||||||
{
|
{
|
||||||
|
nlassert(_BasicSpinner);
|
||||||
|
|
||||||
_verticalLayout = new QVBoxLayout(this);
|
_verticalLayout = new QVBoxLayout(this);
|
||||||
_nbSamplesLabel = new QLabel(this);
|
_nbSamplesLabel = new QLabel(this);
|
||||||
_verticalLayout->addWidget(_nbSamplesLabel);
|
_verticalLayout->addWidget(_nbSamplesLabel);
|
||||||
|
@ -43,26 +45,35 @@ CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerN
|
||||||
_verticalLayout->addWidget(_dirWidget);
|
_verticalLayout->addWidget(_dirWidget);
|
||||||
|
|
||||||
setWindowTitle(tr("Edit spinner"));
|
setWindowTitle(tr("Edit spinner"));
|
||||||
|
|
||||||
_nbSamplesLabel->setText(tr("Nb samples:"));
|
_nbSamplesLabel->setText(tr("Nb samples:"));
|
||||||
|
|
||||||
_AxisWrapper.OwnerNode = ownerNode;
|
|
||||||
_NbSampleWrapper.OwnerNode = ownerNode;
|
|
||||||
_NbSampleWrapper.S = sf;
|
|
||||||
_AxisWrapper.S = sf;
|
|
||||||
|
|
||||||
_nbSamplesWidget->setRange(1, 512);
|
_nbSamplesWidget->setRange(1, 512);
|
||||||
_nbSamplesWidget->setWrapper(&_NbSampleWrapper);
|
|
||||||
_nbSamplesWidget->enableLowerBound(0, true);
|
_nbSamplesWidget->enableLowerBound(0, true);
|
||||||
_nbSamplesWidget->updateUi();
|
_nbSamplesWidget->setValue(_BasicSpinner->_F.getNumSamples(), false);
|
||||||
|
_dirWidget->setValue(_BasicSpinner->_F.getAxis());
|
||||||
_dirWidget->setWrapper(&_AxisWrapper);
|
|
||||||
_dirWidget->updateUi();
|
|
||||||
|
|
||||||
setFixedHeight(sizeHint().height());
|
setFixedHeight(sizeHint().height());
|
||||||
|
|
||||||
|
connect(_nbSamplesWidget, SIGNAL(valueChanged(uint32)), this, SLOT(setNumSamples(uint32)));
|
||||||
|
connect(_dirWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setAxis(NLMISC::CVector)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSpinnerDialog::~CSpinnerDialog()
|
CSpinnerDialog::~CSpinnerDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSpinnerDialog::setNumSamples(uint32 value)
|
||||||
|
{
|
||||||
|
nlassert(_BasicSpinner);
|
||||||
|
_BasicSpinner->_F.setNumSamples(value);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSpinnerDialog::setAxis(const NLMISC::CVector &axis)
|
||||||
|
{
|
||||||
|
nlassert(_BasicSpinner);
|
||||||
|
_BasicSpinner->_F.setAxis(axis);
|
||||||
|
updateModifiedFlag();
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -43,29 +43,20 @@ public:
|
||||||
CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent = 0);
|
CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent = 0);
|
||||||
~CSpinnerDialog();
|
~CSpinnerDialog();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void setNumSamples(uint32 value);
|
||||||
|
void setAxis(const NLMISC::CVector &axis);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
||||||
/// Wrapper to set the number of samples in the spinner
|
|
||||||
struct CNbSampleWrapper : public IPSWrapperUInt
|
|
||||||
{
|
|
||||||
NL3D::CPSBasisSpinner *S;
|
|
||||||
uint32 get(void) const { return S->_F.getNumSamples(); }
|
|
||||||
void set(const uint32 &val) { S->_F.setNumSamples(val); }
|
|
||||||
} _NbSampleWrapper;
|
|
||||||
|
|
||||||
|
|
||||||
/// Wrapper to set the axis of the spinner
|
|
||||||
struct CAxisWrapper : public IPSWrapper<NLMISC::CVector>
|
|
||||||
{
|
|
||||||
NL3D::CPSBasisSpinner *S;
|
|
||||||
NLMISC::CVector get(void) const { return S->_F.getAxis(); }
|
|
||||||
void set(const NLMISC::CVector &axis) { S->_F.setAxis(axis); }
|
|
||||||
} _AxisWrapper;
|
|
||||||
|
|
||||||
QLabel *_nbSamplesLabel;
|
QLabel *_nbSamplesLabel;
|
||||||
QVBoxLayout *_verticalLayout;
|
QVBoxLayout *_verticalLayout;
|
||||||
CEditRangeUIntWidget *_nbSamplesWidget;
|
CEditRangeUIntWidget *_nbSamplesWidget;
|
||||||
CDirectionWidget *_dirWidget;
|
CDirectionWidget *_dirWidget;
|
||||||
|
|
||||||
|
CWorkspaceNode *_Node;
|
||||||
|
NL3D::CPSBasisSpinner *_BasicSpinner;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
Loading…
Reference in a new issue