Changed: #1193 If switch between the located and sound properties in a workspace erroneously marked that the particle system has been changed.

This commit is contained in:
timon 2010-11-26 13:23:02 +02:00
parent 80481eb23e
commit 50266d831a
4 changed files with 38 additions and 47 deletions

View file

@ -55,7 +55,6 @@ CLocatedPage::CLocatedPage(QWidget *parent)
_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)));
connect(_ui.disgradeWithLODCheckBox, SIGNAL(toggled(bool)), this, SLOT(setDisgradeWithLod(bool)));
@ -63,7 +62,9 @@ CLocatedPage::CLocatedPage(QWidget *parent)
connect(_ui.trigerOnDeathCheckBox, SIGNAL(toggled(bool)), this, SLOT(setTriggerOnDeath(bool)));
connect(_ui.editPushButton, SIGNAL(clicked()), this, SLOT(editTriggerOnDeath()));
connect(_ui.limitedLifeTimeCheckBox, SIGNAL(toggled(bool)), this, SLOT(setLimitedLifeTime(bool)));
connect(_ui.setCurrentCountPushButton, SIGNAL(clicked()), this, SLOT(setCount()));
connect(_ui.setCurrentCountPushButton, SIGNAL(clicked()), this, SLOT(setCurrentCount()));
connect(_ui.maxNumParticleWidget, SIGNAL(valueChanged(uint32)), this, SLOT(setNewMaxSize(uint32)));
}
CLocatedPage::~CLocatedPage()
@ -91,9 +92,7 @@ void CLocatedPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
if (_Located->getOwner())
_ui.maxNumParticleWidget->setEnabled(!_Located->getOwner()->getAutoCountFlag());
_MaxNbParticlesWrapper.Located = _Located;
_MaxNbParticlesWrapper.Node = _Node;
_ui.maxNumParticleWidget->updateUi();
_ui.maxNumParticleWidget->setValue(_Located->getMaxSize(), false);
_ui.coordSystemComboBox->setCurrentIndex(int(_Located->getMatrixMode()));
_ui.limitedLifeTimeCheckBox->setChecked(!_Located->getLastForever());
@ -217,10 +216,25 @@ void CLocatedPage::setMatrixMode(int index)
}
}
void CLocatedPage::setCount()
void CLocatedPage::setCurrentCount()
{
_Located->resize(_Located->getSize()); // set new max size
_ui.maxNumParticleWidget->updateUi();
// set new max size
_ui.maxNumParticleWidget->setValue(_Located->getSize());
updateModifiedFlag();
}
void CLocatedPage::setNewMaxSize(uint32 value)
{
// if the max new size is lower than the current number of instance, we must suppress item
// in the CParticleTreeCtrl
if (value < _Located->getSize())
{
nlassert(_Node);
/// WARNING:
///TreeCtrl->suppressLocatedInstanceNbItem(*Node, v);
}
_Located->resize(value);
updateModifiedFlag();
}
@ -238,19 +252,6 @@ void CLocatedPage::updateTriggerOnDeath(void)
_ui.editPushButton->setEnabled(enable && _Located->isTriggerOnDeathEnabled());
}
void CLocatedPage::CMaxNbParticlesWrapper::set(const uint32 &v)
{
// if the max new size is lower than the current number of instance, we must suppress item
// in the CParticleTreeCtrl
if (v < Located->getSize())
{
nlassert(Node);
/// WARNING:
///TreeCtrl->suppressLocatedInstanceNbItem(*Node, v);
}
Located->resize(v);
}
void CLocatedPage::CLifeWrapper::set(const float &v)
{
Located->setInitialLife(v);

View file

@ -61,20 +61,12 @@ private Q_SLOTS:
void editTriggerOnDeath();
void setTriggerOnDeath(bool state);
void setMatrixMode(int index);
void setCount();
void setCurrentCount();
void setNewMaxSize(uint32 value);
private:
/// wrapper to tune the max number of particles
struct CMaxNbParticlesWrapper : public IPSWrapperUInt
{
CWorkspaceNode *Node;
NL3D::CPSLocated *Located;
uint32 get(void) const { return Located->getMaxSize(); }
void set(const uint32 &v);
} _MaxNbParticlesWrapper;
/// wrapper to tune the mass of particles
struct CMassWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{

View file

@ -53,7 +53,6 @@ CSoundPage::CSoundPage(QWidget *parent)
// setup dialog the percent of sound emissions
_ui.emissionWidget->setRange(0.f, 1.f);
_ui.emissionWidget->setWrapper(&_EmissionPercentWrapper);
connect(_ui.browsePushButton ,SIGNAL(clicked()), this, SLOT(browse()));
connect(_ui.playPushButton ,SIGNAL(clicked()), this, SLOT(play()));
@ -61,6 +60,8 @@ CSoundPage::CSoundPage(QWidget *parent)
connect(_ui.muteCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setMute(bool)));
connect(_ui.keepPitchCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setKeepPitch(bool)));
connect(_ui.soundNameLineEdit ,SIGNAL(textChanged(QString)), this, SLOT(setSoundName(QString)));
connect(_ui.emissionWidget, SIGNAL(valueChanged(float)), this, SLOT(setEmissionPercent(float)));
}
CSoundPage::~CSoundPage()
@ -74,9 +75,7 @@ void CSoundPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab
nlassert(_Sound);
_EmissionPercentWrapper.OwnerNode = _Node;
_EmissionPercentWrapper.S = _Sound;
_ui.emissionWidget->updateUi();
_ui.emissionWidget->setValue(_Sound->getEmissionPercent(), false);
_GainWrapper.S = _Sound;
_ui.gainWidget->setWorkspaceNode(_Node);
@ -165,4 +164,10 @@ void CSoundPage::setSoundName(const QString &text)
_Sound->setSoundName(NLMISC::CStringMapper::map(text.toStdString()));
}
void CSoundPage::setEmissionPercent(float value)
{
_Sound->setEmissionPercent(value);
updateModifiedFlag();
}
} /* namespace NLQT */

View file

@ -62,6 +62,7 @@ private Q_SLOTS:
void setMute(bool state);
void setKeepPitch(bool state);
void setSoundName(const QString &text);
void setEmissionPercent(float value);
private:
@ -85,14 +86,6 @@ private:
void setScheme(scheme_type *s) { S->setPitchScheme(s); }
} _PitchWrapper;
/// wrapper to set the percentage of sound emissions
struct CEmissionPercentWrapper : public IPSWrapperFloat
{
NL3D::CPSSound *S;
float get(void) const { return S->getEmissionPercent(); }
void set(const float &v) { S->setEmissionPercent(v); }
} _EmissionPercentWrapper;
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
/// the sound being edited