This commit is contained in:
timon 2010-11-23 17:11:34 +02:00
commit 38844bcbf2
2 changed files with 12 additions and 18 deletions

View file

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

View file

@ -48,17 +48,9 @@ private Q_SLOTS:
void removeTarget();
void setBounce(int index);
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 setBounceFactor(float value);
private:
void updateTargets();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }