Changed: #1193 If switch between the emmiter properties in a workspace erroneously marked that the particle system has been changed. Added some source groups to cmake for better file structuring

This commit is contained in:
dnk-88 2010-11-15 16:58:27 +02:00
parent 46342e35db
commit acd96ae72b
16 changed files with 174 additions and 164 deletions

View file

@ -40,6 +40,10 @@ QT4_ADD_RESOURCES( OBJECT_VIEWER_RC_SRCS ${OBJECT_VIEWER_RCS} )
QT4_WRAP_CPP( OBJECT_VIEWER_MOC_SRCS ${OBJECT_VIEWER_HDR} ) QT4_WRAP_CPP( OBJECT_VIEWER_MOC_SRCS ${OBJECT_VIEWER_HDR} )
QT4_WRAP_UI( OBJECT_VIEWER_UI_HDRS ${OBJECT_VIEWER_UIS} ) QT4_WRAP_UI( OBJECT_VIEWER_UI_HDRS ${OBJECT_VIEWER_UIS} )
SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_UIS} ${OBJECT_VIEWER_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OBJECT_VIEWER_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_MOC_SRCS})
ADD_EXECUTABLE(object_viewer_qt WIN32 MACOSX_BUNDLE ${OBJECT_VIEWER_SRC} ${OBJECT_VIEWER_MOC_SRCS} ${OBJECT_VIEWER_RC_SRCS} ${OBJECT_VIEWER_UI_HDRS}) ADD_EXECUTABLE(object_viewer_qt WIN32 MACOSX_BUNDLE ${OBJECT_VIEWER_SRC} ${OBJECT_VIEWER_MOC_SRCS} ${OBJECT_VIEWER_RC_SRCS} ${OBJECT_VIEWER_UI_HDRS})
TARGET_LINK_LIBRARIES(object_viewer_qt TARGET_LINK_LIBRARIES(object_viewer_qt

View file

@ -166,7 +166,7 @@ void CAttribWidget::changeUseScheme(int index)
{ {
if (index == 0) if (index == 0)
{ {
if (!useScheme()) if (useScheme())
resetCstValue(); // change constant resetCstValue(); // change constant
cstValueUpdate(); // update ui cstValueUpdate(); // update ui
} }

View file

@ -30,7 +30,7 @@
namespace NLQT { namespace NLQT {
CDirectionWidget::CDirectionWidget(QWidget *parent) CDirectionWidget::CDirectionWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL), _DirectionWrapper(NULL) : QWidget(parent), _Wrapper(NULL), _DirectionWrapper(NULL), _globalName("")
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -50,12 +50,20 @@ CDirectionWidget::CDirectionWidget(QWidget *parent)
connect(_ui.xzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecXZ(float,float))); connect(_ui.xzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecXZ(float,float)));
connect(_ui.yzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecYZ(float,float))); connect(_ui.yzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecYZ(float,float)));
// Set default value +K
setValue(NLMISC::CVector::K);
} }
CDirectionWidget::~CDirectionWidget() CDirectionWidget::~CDirectionWidget()
{ {
} }
void CDirectionWidget::enableGlobalVariable()
{
_ui.globalPushButton->setVisible(true);
_globalName = "";
}
void CDirectionWidget::setWrapper(IPSWrapper<NLMISC::CVector> *wrapper) void CDirectionWidget::setWrapper(IPSWrapper<NLMISC::CVector> *wrapper)
{ {
@ -74,12 +82,42 @@ void CDirectionWidget::setDirectionWrapper(NL3D::CPSDirection *wrapper)
void CDirectionWidget::updateUi() void CDirectionWidget::updateUi()
{ {
_ui.xzWidget->setVector(_Wrapper->get().x, _Wrapper->get().z); setValue(_Wrapper->get(), false);
_ui.yzWidget->setVector(_Wrapper->get().y, _Wrapper->get().z); checkEnabledGlobalDirection();
}
void CDirectionWidget::setValue(const NLMISC::CVector &value, bool emit)
{
_value = value;
_ui.xzWidget->setVector(_value.x, _value.z);
_ui.yzWidget->setVector(_value.y, _value.z);
_ui.xzWidget->repaint(); _ui.xzWidget->repaint();
_ui.yzWidget->repaint(); _ui.yzWidget->repaint();
if (emit)
{
Q_EMIT valueChanged(_value);
if (_Wrapper)
_Wrapper->setAndUpdateModifiedFlag(_value);
}
}
void CDirectionWidget::setGlobalName(const QString &globalName, bool emit)
{
_globalName = globalName;
checkEnabledGlobalDirection(); _ui.xzWidget->setVisible(_globalName.isEmpty());
_ui.yzWidget->setVisible(_globalName.isEmpty());
_ui.incVecIPushButton->setEnabled(_globalName.isEmpty());
_ui.incVecJPushButton->setEnabled(_globalName.isEmpty());
_ui.incVecKPushButton->setEnabled(_globalName.isEmpty());
_ui.decVecIPushButton->setEnabled(_globalName.isEmpty());
_ui.decVecJPushButton->setEnabled(_globalName.isEmpty());
_ui.decVecKPushButton->setEnabled(_globalName.isEmpty());
if (emit)
globalNameChanged(_globalName);
} }
void CDirectionWidget::setGlobalDirection() void CDirectionWidget::setGlobalDirection()
@ -93,62 +131,55 @@ void CDirectionWidget::setGlobalDirection()
if (ok) if (ok)
{ {
setGlobalName(text);
_DirectionWrapper->enableGlobalVectorValue(text.toStdString()); _DirectionWrapper->enableGlobalVectorValue(text.toStdString());
if (!text.isEmpty()) if (!_globalName.isEmpty())
{ {
// take a non NULL value for the direction // take a non NULL value for the direction
NL3D::CParticleSystem::setGlobalVectorValue(text.toStdString(), NLMISC::CVector::I); NL3D::CParticleSystem::setGlobalVectorValue(text.toStdString(), NLMISC::CVector::I);
} }
checkEnabledGlobalDirection();
} }
} }
void CDirectionWidget::incVecI() void CDirectionWidget::incVecI()
{ {
_Wrapper->setAndUpdateModifiedFlag(NLMISC::CVector::I); setValue(NLMISC::CVector::I);
_ui.xzWidget->setVector(NLMISC::CVector::I.x, NLMISC::CVector::I.z);
_ui.yzWidget->setVector(NLMISC::CVector::I.y, NLMISC::CVector::I.z);
} }
void CDirectionWidget::incVecJ() void CDirectionWidget::incVecJ()
{ {
_Wrapper->setAndUpdateModifiedFlag(NLMISC::CVector::J); setValue(NLMISC::CVector::J);
_ui.xzWidget->setVector(NLMISC::CVector::J.x, NLMISC::CVector::J.z);
_ui.yzWidget->setVector(NLMISC::CVector::J.y, NLMISC::CVector::J.z);
} }
void CDirectionWidget::incVecK() void CDirectionWidget::incVecK()
{ {
_Wrapper->setAndUpdateModifiedFlag(NLMISC::CVector::K); setValue(NLMISC::CVector::K);
_ui.xzWidget->setVector(NLMISC::CVector::K.x, NLMISC::CVector::K.z);
_ui.yzWidget->setVector(NLMISC::CVector::K.y, NLMISC::CVector::K.z);
} }
void CDirectionWidget::decVecI() void CDirectionWidget::decVecI()
{ {
_Wrapper->setAndUpdateModifiedFlag( - NLMISC::CVector::I); setValue( - NLMISC::CVector::I);
_ui.xzWidget->setVector((-NLMISC::CVector::I).x, (-NLMISC::CVector::I).z);
_ui.yzWidget->setVector((-NLMISC::CVector::I).y, (-NLMISC::CVector::I).z);
} }
void CDirectionWidget::decVecJ() void CDirectionWidget::decVecJ()
{ {
_Wrapper->setAndUpdateModifiedFlag( - NLMISC::CVector::J); setValue( - NLMISC::CVector::J);
_ui.xzWidget->setVector((-NLMISC::CVector::J).x, (-NLMISC::CVector::J).z);
_ui.yzWidget->setVector((-NLMISC::CVector::J).y, (-NLMISC::CVector::J).z);
} }
void CDirectionWidget::decVecK() void CDirectionWidget::decVecK()
{ {
_Wrapper->setAndUpdateModifiedFlag( - NLMISC::CVector::K); setValue( - NLMISC::CVector::K);
_ui.xzWidget->setVector((-NLMISC::CVector::K).x, (-NLMISC::CVector::K).z);
_ui.yzWidget->setVector((-NLMISC::CVector::K).y, (-NLMISC::CVector::K).z);
} }
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 = _Wrapper->get(); NLMISC::CVector v;
if (_Wrapper)
v = _Wrapper->get();
else
v = _value;
v.x = x; v.x = x;
v.z = y; v.z = y;
@ -165,15 +196,17 @@ void CDirectionWidget::setNewVecXZ(float x, float y)
v.normalize(); v.normalize();
_Wrapper->setAndUpdateModifiedFlag(v); setValue(v);
_ui.xzWidget->setVector(_Wrapper->get().x, _Wrapper->get().z);
_ui.yzWidget->setVector(_Wrapper->get().y, _Wrapper->get().z);
} }
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 = _Wrapper->get(); NLMISC::CVector v;
if (_Wrapper)
v = _Wrapper->get();
else
v = _value;
v.y = x; v.y = x;
v.z = y; v.z = y;
@ -190,9 +223,7 @@ void CDirectionWidget::setNewVecYZ(float x, float y)
v.normalize(); v.normalize();
_Wrapper->setAndUpdateModifiedFlag(v); setValue(v);
_ui.xzWidget->setVector(_Wrapper->get().x, _Wrapper->get().z);
_ui.yzWidget->setVector(_Wrapper->get().y, _Wrapper->get().z);
} }
void CDirectionWidget::checkEnabledGlobalDirection() void CDirectionWidget::checkEnabledGlobalDirection()

View file

@ -45,13 +45,22 @@ public:
CDirectionWidget(QWidget *parent = 0); CDirectionWidget(QWidget *parent = 0);
~CDirectionWidget(); ~CDirectionWidget();
void enableGlobalVariable();
void setWrapper(IPSWrapper<NLMISC::CVector> *wrapper); void setWrapper(IPSWrapper<NLMISC::CVector> *wrapper);
/// The CPSDirection object is used to see if a global variable can be bound to the direction. /// 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) /// When set to NULL it has no effect (the default)
void setDirectionWrapper(NL3D::CPSDirection *wrapper); void setDirectionWrapper(NL3D::CPSDirection *wrapper);
void updateUi(); void updateUi();
Q_SIGNALS:
void valueChanged(const NLMISC::CVector &value);
void globalNameChanged(const QString &globalName);
public Q_SLOTS:
void setValue(const NLMISC::CVector &value, bool emit = true);
void setGlobalName(const QString &globalName, bool emit = true);
private Q_SLOTS: private Q_SLOTS:
void setGlobalDirection(); void setGlobalDirection();
void incVecI(); void incVecI();
@ -67,7 +76,9 @@ private:
void checkEnabledGlobalDirection(); void checkEnabledGlobalDirection();
IPSWrapper<NLMISC::CVector> *_Wrapper ; IPSWrapper<NLMISC::CVector> *_Wrapper ;
NL3D::CPSDirection *_DirectionWrapper; NL3D::CPSDirection *_DirectionWrapper;
NLMISC::CVector _value;
QString _globalName;
Ui::CDirectionWidget _ui; Ui::CDirectionWidget _ui;

View file

@ -67,11 +67,6 @@ public:
/// NB : The 'OwnerNode' field of the wrapper /// NB : The 'OwnerNode' field of the wrapper
void setWrapper(IPSWrapperUInt *wrapper); void setWrapper(IPSWrapperUInt *wrapper);
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(uint32 value, bool emit = true);
/// Convenience function to set the minimum, and maximum values with a single function call /// Convenience function to set the minimum, and maximum values with a single function call
void setRange(uint32 minValue, uint32 maxValue); void setRange(uint32 minValue, uint32 maxValue);
@ -102,7 +97,13 @@ public:
Q_SIGNALS: Q_SIGNALS:
void valueChanged(uint32 value); void valueChanged(uint32 value);
public Q_SLOTS:
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(uint32 value, bool emit = true);
private Q_SLOTS: private Q_SLOTS:
void setMaximum(int value); void setMaximum(int value);
void setMinimum(int value); void setMinimum(int value);
@ -153,11 +154,6 @@ public:
/// NB : The 'OwnerNode' field of the wrapper /// NB : The 'OwnerNode' field of the wrapper
void setWrapper(IPSWrapperInt *wrapper); void setWrapper(IPSWrapperInt *wrapper);
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(sint32 value, bool emit = true);
/// Convenience function to set the minimum, and maximum values with a single function call /// Convenience function to set the minimum, and maximum values with a single function call
void setRange(sint32 minValue, sint32 maxValue); void setRange(sint32 minValue, sint32 maxValue);
@ -188,7 +184,13 @@ public:
Q_SIGNALS: Q_SIGNALS:
void valueChanged(sint32 value); void valueChanged(sint32 value);
public Q_SLOTS:
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(sint32 value, bool emit = true);
private Q_SLOTS: private Q_SLOTS:
void setMaximum(int value); void setMaximum(int value);
void setMinimum(int value); void setMinimum(int value);
@ -238,11 +240,6 @@ public:
/// NB : The 'OwnerNode' field of the wrapper /// NB : The 'OwnerNode' field of the wrapper
void setWrapper(IPSWrapperFloat *wrapper); void setWrapper(IPSWrapperFloat *wrapper);
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(float value, bool emit = true);
/// Convenience function to set the minimum, and maximum values with a single function call /// Convenience function to set the minimum, and maximum values with a single function call
void setRange(float minValue, float maxValue); void setRange(float minValue, float maxValue);
@ -274,6 +271,12 @@ public:
Q_SIGNALS: Q_SIGNALS:
void valueChanged(float value); void valueChanged(float value);
public Q_SLOTS:
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(float value, bool emit = true);
private Q_SLOTS: private Q_SLOTS:
void changeRange(); void changeRange();
void changeSlider(int value); void changeSlider(int value);

View file

@ -57,31 +57,30 @@ CEmitterPage::CEmitterPage(QWidget *parent)
// SPEED_INHERITANCE_FACTOR // SPEED_INHERITANCE_FACTOR
_ui.speedInherFactorWidget->setRange(-1.f, 1.f); _ui.speedInherFactorWidget->setRange(-1.f, 1.f);
_ui.speedInherFactorWidget->setWrapper(&_SpeedInheritanceFactorWrapper); //_ui.speedInherFactorWidget->setWrapper(&_SpeedInheritanceFactorWrapper);
// DELAYED_EMISSION // DELAYED_EMISSION
_ui.delayedEmissionWidget->setRange(0.f, 10.f); _ui.delayedEmissionWidget->setRange(0.f, 10.f);
_ui.delayedEmissionWidget->enableLowerBound(0.f, false); _ui.delayedEmissionWidget->enableLowerBound(0.f, false);
_ui.delayedEmissionWidget->setWrapper(&_DelayedEmissionWrapper);
// MAX_EMISSION_COUNT // MAX_EMISSION_COUNT
_ui.maxEmissionCountWidget->setRange(0, 100); _ui.maxEmissionCountWidget->setRange(0, 100);
_ui.maxEmissionCountWidget->enableUpperBound(256, false); _ui.maxEmissionCountWidget->enableUpperBound(256, false);
_ui.maxEmissionCountWidget->setWrapper(&_MaxEmissionCountWrapper);
_MaxEmissionCountWrapper.widget = _ui.maxEmissionCountWidget;
_MaxEmissionCountWrapper.parent = this;
// radius for conic emitter // radius for conic emitter
_ui.radiusWidget->setRange(0.1f, 2.1f); _ui.radiusWidget->setRange(0.1f, 2.1f);
_ui.radiusWidget->setWrapper(&_ConicEmitterRadiusWrapper);
_ui.directionWidget->setWrapper(&_DirectionWrapper);
connect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int))); connect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
connect(_ui.typeEmissionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTypeOfEmission(int))); connect(_ui.typeEmissionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTypeOfEmission(int)));
connect(_ui.directionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirectionMode(int))); connect(_ui.directionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirectionMode(int)));
connect(_ui.bypassAutoLODCheckBox, SIGNAL(toggled(bool)), this, SLOT(setBypassAutoLOD(bool))); connect(_ui.bypassAutoLODCheckBox, SIGNAL(toggled(bool)), this, SLOT(setBypassAutoLOD(bool)));
connect(_ui.forceConsistentCheckBox, SIGNAL(toggled(bool)), this, SLOT(setConsistentEmission(bool))); connect(_ui.forceConsistentCheckBox, SIGNAL(toggled(bool)), this, SLOT(setConsistentEmission(bool)));
connect(_ui.speedInherFactorWidget, SIGNAL(valueChanged(float)), this, SLOT(setSpeedInheritanceFactor(float)));
connect(_ui.delayedEmissionWidget, SIGNAL(valueChanged(float)), this, SLOT(setEmitDelay(float)));
connect(_ui.radiusWidget, SIGNAL(valueChanged(float)), this, SLOT(setConicEmitterRadius(float)));
connect(_ui.maxEmissionCountWidget, SIGNAL(valueChanged(uint32)), this, SLOT(setMaxEmissionCount(uint32)));
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector)));
} }
CEmitterPage::~CEmitterPage() CEmitterPage::~CEmitterPage()
@ -95,19 +94,9 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
updateEmittedType(); updateEmittedType();
_SpeedInheritanceFactorWrapper.OwnerNode = _Node; _ui.speedInherFactorWidget->setValue(_Emitter->getSpeedInheritanceFactor(), false);
_SpeedInheritanceFactorWrapper.E = _Emitter; _ui.delayedEmissionWidget->setValue(_Emitter->getEmitDelay(), false);
_ui.speedInherFactorWidget->updateUi(); _ui.maxEmissionCountWidget->setValue(_Emitter->getMaxEmissionCount(), false);
_DelayedEmissionWrapper.Node = _Node;
_DelayedEmissionWrapper.OwnerNode = _Node;
_DelayedEmissionWrapper.E = _Emitter;
_ui.delayedEmissionWidget->updateUi();
_MaxEmissionCountWrapper.Node = _Node;
_MaxEmissionCountWrapper.OwnerNode = _Node;
_MaxEmissionCountWrapper.E = _Emitter;
_ui.maxEmissionCountWidget->updateUi();
_PeriodWrapper.Node = _Node; _PeriodWrapper.Node = _Node;
_PeriodWrapper.E = _Emitter; _PeriodWrapper.E = _Emitter;
@ -133,10 +122,8 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
// deals with emitters that have a direction // deals with emitters that have a direction
if (dynamic_cast<NL3D::CPSDirection *>(_Emitter)) if (dynamic_cast<NL3D::CPSDirection *>(_Emitter))
{ {
_DirectionWrapper.E = dynamic_cast<NL3D::CPSDirection *>(_Emitter);
_ui.directionWidget->setDirectionWrapper(dynamic_cast<NL3D::CPSDirection *>(_Emitter));
_ui.directionWidget->updateUi();
_ui.directionWidget->show(); _ui.directionWidget->show();
_ui.directionWidget->setValue(dynamic_cast<NL3D::CPSDirection *>(_Emitter)->getDir(), false);
} }
else else
_ui.directionWidget->hide(); _ui.directionWidget->hide();
@ -145,8 +132,7 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
// radius for conic emitter // radius for conic emitter
if (dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter)) if (dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter))
{ {
_ConicEmitterRadiusWrapper.E = dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter); _ui.radiusWidget->setValue(dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter)->getRadius(),false);
_ui.radiusWidget->updateUi();
_ui.radiusWidget->show(); _ui.radiusWidget->show();
_ui.radiusLabel->show(); _ui.radiusLabel->show();
} }
@ -291,6 +277,42 @@ void CEmitterPage::setDirectionMode(int index)
updateModifiedFlag(); updateModifiedFlag();
} }
void CEmitterPage::setSpeedInheritanceFactor(float value)
{
_Emitter->setSpeedInheritanceFactor(value);
}
void CEmitterPage::setConicEmitterRadius(float value)
{
dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter)->setRadius(value);
}
void CEmitterPage::setEmitDelay(float value)
{
_Emitter->setEmitDelay(value);
Modules::psEdit().resetAutoCount(_Node);
}
void CEmitterPage::setMaxEmissionCount(uint32 value)
{
if (!_Emitter->setMaxEmissionCount((uint8)value))
{
QMessageBox::critical(this, tr("NeL Particle Editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
_ui.maxEmissionCountWidget->setValue((uint32)_Emitter->getMaxEmissionCount(), false);
}
Modules::psEdit().resetAutoCount(_Node);
}
void CEmitterPage::setDir(const NLMISC::CVector &value)
{
dynamic_cast<NL3D::CPSDirection *>(_Emitter)->setDir(value);
}
void CEmitterPage::updatePeriodWidget() void CEmitterPage::updatePeriodWidget()
{ {
bool bEnable = _Emitter->getEmissionType() == NL3D::CPSEmitter::regular; bool bEnable = _Emitter->getEmissionType() == NL3D::CPSEmitter::regular;
@ -349,26 +371,4 @@ void CEmitterPage::CGenNbWrapper::setScheme(scheme_type *s)
Modules::psEdit().resetAutoCount(Node); Modules::psEdit().resetAutoCount(Node);
} }
void CEmitterPage::CDelayedEmissionWrapper::set(const float &f)
{
E->setEmitDelay(f);
Modules::psEdit().resetAutoCount(Node);
}
void CEmitterPage::CMaxEmissionCountWrapper::set(const uint32 &count)
{
if (!E->setMaxEmissionCount((uint8) count))
{
QMessageBox::critical(parent, tr("NeL Particle Editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
widget->updateUi();
}
Modules::psEdit().resetAutoCount(Node);
}
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -66,6 +66,12 @@ private Q_SLOTS:
void setConsistentEmission(bool state); void setConsistentEmission(bool state);
void setBypassAutoLOD(bool state); void setBypassAutoLOD(bool state);
void setDirectionMode(int index); void setDirectionMode(int index);
void setSpeedInheritanceFactor(float value);
void setConicEmitterRadius(float value);
void setEmitDelay(float value);
void setMaxEmissionCount(uint32 value);
void setDir(const NLMISC::CVector &value);
private: private:
@ -101,51 +107,6 @@ private:
void setScheme(scheme_type *s) { E->setEmitteeSpeedScheme(s); } void setScheme(scheme_type *s) { E->setEmitteeSpeedScheme(s); }
} _ModulatedStrenghtWrapper; } _ModulatedStrenghtWrapper;
/// wrappers to set the speed inheritance factor
struct CSpeedInheritanceFactorWrapper : public IPSWrapperFloat
{
NL3D::CPSEmitter *E;
float get(void) const { return E->getSpeedInheritanceFactor(); }
void set(const float &f) { E->setSpeedInheritanceFactor(f); }
} _SpeedInheritanceFactorWrapper;
/// wrappers to tune the direction of emitters
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;
/// wrapper to tune the radius of an emitter
struct CConicEmitterRadiusWrapper : public IPSWrapperFloat
{
NL3D::CPSEmitterConic *E;
float get(void) const { return E->getRadius(); }
void set(const float &f) { E->setRadius(f); }
} _ConicEmitterRadiusWrapper;
/// wrapper to tune delayed emission
struct CDelayedEmissionWrapper : public IPSWrapperFloat
{
CWorkspaceNode *Node;
NL3D::CPSEmitter *E;
float get(void) const { return E->getEmitDelay(); }
void set(const float &f);
} _DelayedEmissionWrapper;
/// wrapper to tune max number of emissions
struct CMaxEmissionCountWrapper : public IPSWrapperUInt
{
CWorkspaceNode *Node;
CEditRangeUIntWidget *widget;
QWidget *parent;
NL3D::CPSEmitter *E;
uint32 get(void) const { return E->getMaxEmissionCount(); }
void set(const uint32 &count);
} _MaxEmissionCountWrapper;
// the emitter being edited // the emitter being edited
NL3D::CPSEmitter *_Emitter; NL3D::CPSEmitter *_Emitter;

View file

@ -95,19 +95,19 @@ void CVegetableApperancePage::setVegetableToEdit(NL3D::CVegetable *vegetable)
setEnabled(false); setEnabled(false);
} }
void CVegetableApperancePage::setNoiseValueBendPhase(NLMISC::CNoiseValue value) void CVegetableApperancePage::setNoiseValueBendPhase(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->BendPhase = value; _Vegetable->BendPhase = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableApperancePage::setNoiseValueBendFactor(NLMISC::CNoiseValue value) void CVegetableApperancePage::setNoiseValueBendFactor(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->BendFactor = value; _Vegetable->BendFactor = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableApperancePage::setNoiseValueColor(NLMISC::CNoiseValue value) void CVegetableApperancePage::setNoiseValueColor(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Color.NoiseValue = value; _Vegetable->Color.NoiseValue = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();

View file

@ -47,9 +47,9 @@ public:
void setVegetableToEdit(NL3D::CVegetable *vegetable); void setVegetableToEdit(NL3D::CVegetable *vegetable);
private Q_SLOTS: private Q_SLOTS:
void setNoiseValueBendPhase(NLMISC::CNoiseValue value); void setNoiseValueBendPhase(const NLMISC::CNoiseValue &value);
void setNoiseValueBendFactor(NLMISC::CNoiseValue value); void setNoiseValueBendFactor(const NLMISC::CNoiseValue &value);
void setNoiseValueColor(NLMISC::CNoiseValue value); void setNoiseValueColor(const NLMISC::CNoiseValue &value);
void browseColor(QListWidgetItem * item); void browseColor(QListWidgetItem * item);
void addNewColor(); void addNewColor();
void insNewColor(); void insNewColor();

View file

@ -225,7 +225,7 @@ void CVegetableDensityPage::updateAngleMode()
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableDensityPage::setDensity(NLMISC::CNoiseValue value) void CVegetableDensityPage::setDensity(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Density = value; _Vegetable->Density = value;

View file

@ -54,7 +54,7 @@ private Q_SLOTS:
void setDistanceOfCreat(int value); void setDistanceOfCreat(int value);
void setEnabledMaxDensity(bool state); void setEnabledMaxDensity(bool state);
void updateAngleMode(); void updateAngleMode();
void setDensity(NLMISC::CNoiseValue value); void setDensity(const NLMISC::CNoiseValue &value);
void setMaxDensity(float value); void setMaxDensity(float value);
void setAngleMinSlider(int pos); void setAngleMinSlider(int pos);
void setAngleMaxSlider(int pos); void setAngleMaxSlider(int pos);

View file

@ -46,7 +46,7 @@ public:
void setDefaultRangeFreq(float defRangeMin, float defRangeMax); void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
Q_SIGNALS: Q_SIGNALS:
void noiseValueChanged(NLMISC::CNoiseValue value); void noiseValueChanged(const NLMISC::CNoiseValue &value);
private Q_SLOTS: private Q_SLOTS:
void setSlider(int value); void setSlider(int value);

View file

@ -72,19 +72,19 @@ void CVegetableRotatePage::setVegetableToEdit(NL3D::CVegetable *vegetable)
setEnabled(false); setEnabled(false);
} }
void CVegetableRotatePage::setNoiseValueRotateX(NLMISC::CNoiseValue value) void CVegetableRotatePage::setNoiseValueRotateX(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Rx = value; _Vegetable->Rx = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableRotatePage::setNoiseValueRotateY(NLMISC::CNoiseValue value) void CVegetableRotatePage::setNoiseValueRotateY(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Ry = value; _Vegetable->Ry = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableRotatePage::setNoiseValueRotateZ(NLMISC::CNoiseValue value) void CVegetableRotatePage::setNoiseValueRotateZ(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Rz = value; _Vegetable->Rz = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();

View file

@ -47,9 +47,9 @@ public:
void setVegetableToEdit(NL3D::CVegetable *vegetable); void setVegetableToEdit(NL3D::CVegetable *vegetable);
private Q_SLOTS: private Q_SLOTS:
void setNoiseValueRotateX(NLMISC::CNoiseValue value); void setNoiseValueRotateX(const NLMISC::CNoiseValue &value);
void setNoiseValueRotateY(NLMISC::CNoiseValue value); void setNoiseValueRotateY(const NLMISC::CNoiseValue &value);
void setNoiseValueRotateZ(NLMISC::CNoiseValue value); void setNoiseValueRotateZ(const NLMISC::CNoiseValue &value);
private: private:

View file

@ -71,13 +71,13 @@ void CVegetableScalePage::setVegetableToEdit(NL3D::CVegetable *vegetable)
setEnabled(false); setEnabled(false);
} }
void CVegetableScalePage::setNoiseValueXYSize(NLMISC::CNoiseValue value) void CVegetableScalePage::setNoiseValueXYSize(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Sxy = value; _Vegetable->Sxy = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableScalePage::setNoiseValueZSize(NLMISC::CNoiseValue value) void CVegetableScalePage::setNoiseValueZSize(const NLMISC::CNoiseValue &value)
{ {
_Vegetable->Sz = value; _Vegetable->Sz = value;
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();

View file

@ -47,8 +47,8 @@ public:
void setVegetableToEdit(NL3D::CVegetable *vegetable); void setVegetableToEdit(NL3D::CVegetable *vegetable);
private Q_SLOTS: private Q_SLOTS:
void setNoiseValueXYSize(NLMISC::CNoiseValue value); void setNoiseValueXYSize(const NLMISC::CNoiseValue &value);
void setNoiseValueZSize(NLMISC::CNoiseValue value); void setNoiseValueZSize(const NLMISC::CNoiseValue &value);
void setFreqFactor(float value); void setFreqFactor(float value);
private: private: