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

This commit is contained in:
timon 2010-11-23 14:57:27 +02:00
parent fb8dff80cf
commit 03ed1919f9
2 changed files with 12 additions and 18 deletions

View file

@ -36,11 +36,12 @@ CZonePage::CZonePage(QWidget *parent)
_ui.setupUi(this); _ui.setupUi(this);
_ui.bounceFactorWidget->setRange(0.f, 1.f); _ui.bounceFactorWidget->setRange(0.f, 1.f);
_ui.bounceFactorWidget->setWrapper(&_BounceFactorWrapper);
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.bounceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setBounce(int))); connect(_ui.bounceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setBounce(int)));
connect(_ui.bounceFactorWidget, SIGNAL(valueChanged(float)), this, SLOT(setBounceFactor(float)));
} }
CZonePage::~CZonePage() CZonePage::~CZonePage()
@ -54,12 +55,7 @@ void CZonePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindabl
_Zone = dynamic_cast<NL3D::CPSZone *>(_LBTarget); _Zone = dynamic_cast<NL3D::CPSZone *>(_LBTarget);
updateTargets(); updateTargets();
_ui.bounceFactorWidget->setValue(_Zone->getBounceFactor() ,false);
_BounceFactorWrapper.OwnerNode = _Node;
_BounceFactorWrapper.Z = _Zone;
_ui.bounceFactorWidget->updateUi();
_ui.bounceComboBox->setCurrentIndex( _Zone->getCollisionBehaviour()); _ui.bounceComboBox->setCurrentIndex( _Zone->getCollisionBehaviour());
} }
@ -108,6 +104,12 @@ void CZonePage::setBounce(int index)
Modules::psEdit().resetAutoCount(_Node); Modules::psEdit().resetAutoCount(_Node);
} }
void CZonePage::setBounceFactor(float value)
{
_Zone->setBounceFactor(value);
updateModifiedFlag();
}
void CZonePage::updateTargets() void CZonePage::updateTargets()
{ {
uint k; uint k;

View file

@ -48,17 +48,9 @@ private Q_SLOTS:
void removeTarget(); void removeTarget();
void setBounce(int index); void setBounce(int index);
void setBounceFactor(float value);
private: private:
/// wrapper to set the bounce factor of a collision zone
struct CBounceFactorWrapper : public IPSWrapperFloat
{
// the zone being wrapped
NL3D::CPSZone *Z ;
float get(void) const { return Z->getBounceFactor() ; }
void set(const float &v) { Z->setBounceFactor(v) ; }
} _BounceFactorWrapper ;
void updateTargets(); void updateTargets();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); } void updateModifiedFlag() { if (_Node) _Node->setModified(true); }