Changed: #1193 Code cleanup.

This commit is contained in:
dnk-88 2010-12-04 14:03:31 +02:00
parent 388161b7b5
commit 8f01cb0d3a
84 changed files with 510 additions and 453 deletions

View file

@ -88,7 +88,7 @@ void CAnimationSetDialog::updateListObject()
std::vector<std::string> listObjects; std::vector<std::string> listObjects;
Modules::objView().getListObjects(listObjects); Modules::objView().getListObjects(listObjects);
for (size_t i = 0; i < listObjects.size(); i++) for (size_t i = 0; i < listObjects.size(); ++i)
ui.objectsComboBox->addItem(QString(listObjects[i].c_str())); ui.objectsComboBox->addItem(QString(listObjects[i].c_str()));
if (listObjects.empty()) if (listObjects.empty())
@ -118,22 +118,22 @@ void CAnimationSetDialog::updateListAnim()
return; return;
CEntity &entity = Modules::objView().getEntity(curObj); CEntity &entity = Modules::objView().getEntity(curObj);
std::vector<std::string>& animationList = entity.getAnimationList(); std::vector<std::string> &animationList = entity.getAnimationList();
std::vector<std::string>& swtList = entity.getSWTList(); std::vector<std::string> &swtList = entity.getSWTList();
std::vector<std::string>& playListAnimation = entity.getPlayListAnimation(); std::vector<std::string> &playListAnimation = entity.getPlayListAnimation();
// update animation list widget // update animation list widget
for(size_t i = 0; i < animationList.size(); ++i) for(size_t i = 0; i < animationList.size(); ++i)
{ {
QTreeWidgetItem *item = new QTreeWidgetItem(ui.animTreeWidget); QTreeWidgetItem *item = new QTreeWidgetItem(ui.animTreeWidget);
item->setText(0,QString(animationList[i].c_str())); item->setText(0, QString(animationList[i].c_str()));
} }
// update skeleton weight template list widget // update skeleton weight template list widget
for(size_t i = 0; i < swtList.size(); ++i) for(size_t i = 0; i < swtList.size(); ++i)
{ {
QTreeWidgetItem *item = new QTreeWidgetItem(ui.skeletonTreeWidget); QTreeWidgetItem *item = new QTreeWidgetItem(ui.skeletonTreeWidget);
item->setText(0,QString(swtList[i].c_str())); item->setText(0, QString(swtList[i].c_str()));
} }
// update PlayList animation widget // update PlayList animation widget
@ -224,9 +224,9 @@ void CAnimationSetDialog::resetAnim()
void CAnimationSetDialog::addAnim() void CAnimationSetDialog::addAnim()
{ {
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject()); CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
QList<QTreeWidgetItem*> list = ui.animTreeWidget->selectedItems(); QList<QTreeWidgetItem *> list = ui.animTreeWidget->selectedItems();
Q_FOREACH(QTreeWidgetItem* item, list) Q_FOREACH(QTreeWidgetItem *item, list)
{ {
std::string animName = item->text(0).toStdString(); std::string animName = item->text(0).toStdString();
entity.addAnimToPlayList(animName); entity.addAnimToPlayList(animName);
@ -237,9 +237,9 @@ void CAnimationSetDialog::addAnim()
void CAnimationSetDialog::removeAnim() void CAnimationSetDialog::removeAnim()
{ {
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject()); CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
QList<QListWidgetItem*> list = ui.animPlaylistWidget->selectedItems(); QList<QListWidgetItem *> list = ui.animPlaylistWidget->selectedItems();
Q_FOREACH(QListWidgetItem* item, list) Q_FOREACH(QListWidgetItem *item, list)
{ {
int row = ui.animPlaylistWidget->row(item); int row = ui.animPlaylistWidget->row(item);
QListWidgetItem *removeItem = ui.animPlaylistWidget->takeItem(row); QListWidgetItem *removeItem = ui.animPlaylistWidget->takeItem(row);
@ -252,7 +252,7 @@ void CAnimationSetDialog::removeAnim()
void CAnimationSetDialog::upAnim() void CAnimationSetDialog::upAnim()
{ {
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject()); CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
QList<QListWidgetItem*> list = ui.animPlaylistWidget->selectedItems(); QList<QListWidgetItem *> list = ui.animPlaylistWidget->selectedItems();
if (list.empty()) if (list.empty())
return; return;
@ -273,7 +273,7 @@ void CAnimationSetDialog::upAnim()
void CAnimationSetDialog::downAnim() void CAnimationSetDialog::downAnim()
{ {
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject()); CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
QList<QListWidgetItem*> list = ui.animPlaylistWidget->selectedItems(); QList<QListWidgetItem *> list = ui.animPlaylistWidget->selectedItems();
if (list.empty()) if (list.empty())
return; return;

View file

@ -45,11 +45,12 @@ namespace NLQT
CAttribWidget::CAttribWidget(QWidget *parent) CAttribWidget::CAttribWidget(QWidget *parent)
: QGroupBox(parent), : QGroupBox(parent),
_SrcInputEnabled(true), _SrcInputEnabled(true),
_EnableConstantValue(true), _EnableConstantValue(true),
_DisableMemoryScheme(false), _DisableMemoryScheme(false),
_NbCycleEnabled(true), _NbCycleEnabled(true),
_Node(NULL), _SchemeWidget(NULL) _Node(NULL),
_SchemeWidget(NULL)
{ {
_ui.setupUi(this); _ui.setupUi(this);
_ui.constRangeUIntWidget->hide(); _ui.constRangeUIntWidget->hide();

View file

@ -32,30 +32,25 @@ namespace NLQT
{ {
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent) CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
: QDialog(parent), _Node(ownerNode), _PS(ps) : QDialog(parent),
_Node(ownerNode),
_PS(ps)
{ {
_ui.setupUi(this); _ui.setupUi(this);
setFixedHeight(sizeHint().height()); setFixedHeight(sizeHint().height());
_DistRatioWrapper.PS = _PS;
_MaxDistLODBiasWrapper.PS = _PS;
_DistRatioWrapper.OwnerNode = _Node;
_MaxDistLODBiasWrapper.OwnerNode = _Node;
// Edit the distance at which LOD starts // Edit the distance at which LOD starts
_ui.startPercentDistWidget->setRange(0.f, 0.99f); _ui.startPercentDistWidget->setRange(0.f, 0.99f);
_ui.startPercentDistWidget->enableUpperBound(1.f, true); _ui.startPercentDistWidget->enableUpperBound(1.f, true);
_ui.startPercentDistWidget->enableLowerBound(0.f, false); _ui.startPercentDistWidget->enableLowerBound(0.f, false);
_ui.startPercentDistWidget->setWrapper(&_DistRatioWrapper); _ui.startPercentDistWidget->setValue(_PS->getAutoLODStartDistPercent());
_ui.startPercentDistWidget->updateUi();
// For non-shared systems only : Set the LOD bias at the max distance, so that some particles are still displayed // For non-shared systems only : Set the LOD bias at the max distance, so that some particles are still displayed
_ui.maxDistBiasWidget->setRange(0.f, 1.0f); _ui.maxDistBiasWidget->setRange(0.f, 1.0f);
_ui.maxDistBiasWidget->enableUpperBound(1.f, false); _ui.maxDistBiasWidget->enableUpperBound(1.f, false);
_ui.maxDistBiasWidget->enableLowerBound(0.f, false); _ui.maxDistBiasWidget->enableLowerBound(0.f, false);
_ui.maxDistBiasWidget->setWrapper(&_MaxDistLODBiasWrapper); _ui.maxDistBiasWidget->setValue(_PS->getMaxDistLODBias());
_ui.maxDistBiasWidget->updateUi();
if (_PS->isSharingEnabled()) if (_PS->isSharingEnabled())
{ {
@ -86,4 +81,16 @@ void CAutoLODDialog::setSkipParticles(bool state)
_PS->setAutoLODMode(state); _PS->setAutoLODMode(state);
} }
void CAutoLODDialog::setDistRatio(float value)
{
_PS->setupAutoLOD(value, _PS->getAutoLODDegradationExponent());
_Node->setModified(true);
}
void CAutoLODDialog::setMaxDistLODBias(float value)
{
_PS->setMaxDistLODBias(value);
_Node->setModified(true);
}
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -47,36 +47,12 @@ private Q_SLOTS:
void setDegradationExponent(int value); void setDegradationExponent(int value);
void setSkipParticles(bool state); void setSkipParticles(bool state);
void setDistRatio(float value);
void setMaxDistLODBias(float value);
private: private:
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
NL3D::CParticleSystem *_PS;
NL3D::CParticleSystem *_PS;
struct CDistRatioWrapper : IPSWrapperFloat
{
NL3D::CParticleSystem *PS;
virtual float get() const
{
return PS->getAutoLODStartDistPercent();
}
virtual void set(const float &v)
{
PS->setupAutoLOD(v, PS->getAutoLODDegradationExponent());
}
} _DistRatioWrapper;
struct CMaxDistLODBiasWrapper : IPSWrapperFloat
{
NL3D::CParticleSystem *PS;
virtual float get() const
{
return PS->getMaxDistLODBias();
}
virtual void set(const float &v)
{
PS->setMaxDistLODBias(v);
}
} _MaxDistLODBiasWrapper;
Ui::CAutoLODDialog _ui; Ui::CAutoLODDialog _ui;
}; /* class CAutoLODDialog */ }; /* class CAutoLODDialog */

View file

@ -34,8 +34,10 @@ namespace NLQT
NLMISC::CMatrix BuildEulerMatrix(float psi, float theta, float phi) NLMISC::CMatrix BuildEulerMatrix(float psi, float theta, float phi)
{ {
float ca = cosf(psi), sa = sinf(psi) float ca = cosf(psi), sa = sinf(psi)
, cb = cosf(theta), sb = sinf(theta) , cb = cosf(theta)
, cc = cosf(phi), sc = sinf(phi); , sb = sinf(theta)
, cc = cosf(phi)
, sc = sinf(phi);
NLMISC::CMatrix m; NLMISC::CMatrix m;
m.identity(); m.identity();
m.setRot(NLMISC::CVector(ca * cb * cc - sa * sc, -cc * sa - ca * cb *sc, ca * sb) m.setRot(NLMISC::CVector(ca * cb * cc - sa * sc, -cc * sa - ca * cb *sc, ca * sb)
@ -113,8 +115,10 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
for (uint k = 0; k < 8; ++k) for (uint k = 0; k < 8; ++k)
{ {
float ca = cosf(sol[k].x), sa = sinf(sol[k].x) float ca = cosf(sol[k].x), sa = sinf(sol[k].x)
, cb = cosf(sol[k].y), sb = sinf(sol[k].y) , cb = cosf(sol[k].y)
, cc = cosf(sol[k].z), sc = sinf(sol[k].z); , sb = sinf(sol[k].y)
, cc = cosf(sol[k].z)
, sc = sinf(sol[k].z);
float gap = fabsf(m[0][0] - ca * cb * cc + sa * sc); float gap = fabsf(m[0][0] - ca * cb * cc + sa * sc);
gap += fabsf(m[1][0] + cc * sa + ca * cb *sc); gap += fabsf(m[1][0] + cc * sa + ca * cb *sc);
@ -135,7 +139,8 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
} }
CBasicEditWidget::CBasicEditWidget(QWidget *parent) CBasicEditWidget::CBasicEditWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL) : QWidget(parent),
_Wrapper(NULL)
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -155,7 +160,8 @@ void CBasicEditWidget::setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper)
void CBasicEditWidget::updateUi() void CBasicEditWidget::updateUi()
{ {
if (_Wrapper == NULL) return; if (_Wrapper == NULL)
return;
NL3D::CPlaneBasis pb = _Wrapper->get(); NL3D::CPlaneBasis pb = _Wrapper->get();
NLMISC::CMatrix mat; NLMISC::CMatrix mat;
mat.setRot(pb.X, pb.Y, pb.X ^ pb.Y); mat.setRot(pb.X, pb.Y, pb.X ^ pb.Y);
@ -178,7 +184,8 @@ void CBasicEditWidget::updateUi()
void CBasicEditWidget::updateGraphics() void CBasicEditWidget::updateGraphics()
{ {
if (_Wrapper == NULL) return; if (_Wrapper == NULL)
return;
NLMISC::CVector angles(2.f * (float) NLMISC::Pi * _ui.psiSpinBox->value() / 360.f NLMISC::CVector angles(2.f * (float) NLMISC::Pi * _ui.psiSpinBox->value() / 360.f
, 2.f * (float) NLMISC::Pi * _ui.thetaSpinBox->value() / 360.f , 2.f * (float) NLMISC::Pi * _ui.thetaSpinBox->value() / 360.f

View file

@ -41,8 +41,8 @@ CBinOpDialog::CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent)
setWindowTitle(tr("Bin operator")); setWindowTitle(tr("Bin operator"));
_comboBox->clear(); _comboBox->clear();
qobject_cast<QGroupBox*>(widget1)->setTitle(tr("Arg1")); qobject_cast<QGroupBox *>(widget1)->setTitle(tr("Arg1"));
qobject_cast<QGroupBox*>(widget2)->setTitle(tr("Arg2")); qobject_cast<QGroupBox *>(widget2)->setTitle(tr("Arg2"));
connect(_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setNewOp(int))); connect(_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setNewOp(int)));
} }

View file

@ -31,7 +31,9 @@ namespace NLQT
{ {
CColorEditWidget::CColorEditWidget(QWidget *parent) CColorEditWidget::CColorEditWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL), _emit(true) : QWidget(parent),
_Wrapper(NULL),
_emit(true)
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -77,15 +79,23 @@ void CColorEditWidget::updateUi()
_ui.gSpinBox->setValue(_Wrapper->get().G); _ui.gSpinBox->setValue(_Wrapper->get().G);
_ui.bSpinBox->setValue(_Wrapper->get().B); _ui.bSpinBox->setValue(_Wrapper->get().B);
_ui.aSpinBox->setValue(_Wrapper->get().A); _ui.aSpinBox->setValue(_Wrapper->get().A);
_ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(), _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value())); _ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
} }
void CColorEditWidget::setRed(int r) void CColorEditWidget::setRed(int r)
{ {
_ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(), _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value())); _ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
if (_emit) if (_emit)
Q_EMIT colorChanged(NLMISC::CRGBA(r, _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value())); Q_EMIT colorChanged(NLMISC::CRGBA(r, _ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
if (_Wrapper == NULL) if (_Wrapper == NULL)
return; return;
@ -102,10 +112,16 @@ void CColorEditWidget::setRed(int r)
void CColorEditWidget::setGreen(int g) void CColorEditWidget::setGreen(int g)
{ {
_ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(), _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value())); _ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
if (_emit) if (_emit)
Q_EMIT colorChanged(NLMISC::CRGBA(_ui.rSpinBox->value(), g, _ui.bSpinBox->value(), _ui.aSpinBox->value())); Q_EMIT colorChanged(NLMISC::CRGBA(_ui.rSpinBox->value(),
g,
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
if (_Wrapper == NULL) return; if (_Wrapper == NULL) return;
@ -120,10 +136,16 @@ void CColorEditWidget::setGreen(int g)
void CColorEditWidget::setBlue(int b) void CColorEditWidget::setBlue(int b)
{ {
_ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(), _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value())); _ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
if (_emit) if (_emit)
Q_EMIT colorChanged(NLMISC::CRGBA(_ui.rSpinBox->value(), _ui.gSpinBox->value(), b, _ui.aSpinBox->value())); Q_EMIT colorChanged(NLMISC::CRGBA(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
b,
_ui.aSpinBox->value()));
if (_Wrapper == NULL) return; if (_Wrapper == NULL) return;
@ -138,10 +160,16 @@ void CColorEditWidget::setBlue(int b)
void CColorEditWidget::setAlpha(int a) void CColorEditWidget::setAlpha(int a)
{ {
_ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(), _ui.gSpinBox->value(), _ui.bSpinBox->value(), a)); _ui.graphicsWidget->setColor(QColor(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
a));
if (_emit) if (_emit)
Q_EMIT colorChanged(NLMISC::CRGBA(_ui.rSpinBox->value(), _ui.gSpinBox->value(), _ui.bSpinBox->value(), a)); Q_EMIT colorChanged(NLMISC::CRGBA(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
a));
if (_Wrapper == NULL) return; if (_Wrapper == NULL) return;

View file

@ -201,7 +201,8 @@ CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaul
{ {
if (var.size() >= 3) if (var.size() >= 3)
{ {
if (var.size() > 4) nlwarning("RGBA value in config value '%s' is too long, ignoring unused values"); if (var.size() > 4)
nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255); return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
} }
nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A); nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A);

View file

@ -70,9 +70,9 @@ private:
void disconnectGlobalTexAnim(); void disconnectGlobalTexAnim();
void updateGlobalTexAnim(int value); void updateGlobalTexAnim(int value);
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
NL3D::CPSConstraintMesh *_CM; NL3D::CPSConstraintMesh *_CM;
Ui::CConstraintMeshWidget _ui; Ui::CConstraintMeshWidget _ui;
}; /* class CConstraintMeshWidget */ }; /* class CConstraintMeshWidget */

View file

@ -27,7 +27,11 @@ namespace NLQT
{ {
CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent) CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent)
: QDialog(parent) , _Curve(curve), _scale(1.0), _pos(0.0), _Node(ownerNode) : QDialog(parent),
_scale(1.0),
_pos(0.0),
_Node(ownerNode),
_Curve(curve)
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -90,7 +94,7 @@ void CurveEditDialog::curveChanged(const QPolygonF &points)
_Curve->removeCtrlPoint(0); _Curve->removeCtrlPoint(0);
else if (_Curve->getNumCtrlPoints() < uint(points.size())) else if (_Curve->getNumCtrlPoints() < uint(points.size()))
_Curve->addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f)); _Curve->addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
for (int i = 0; i < points.size(); i++) for (int i = 0; i < points.size(); ++i)
_Curve->setCtrlPoint(uint(i), NL3D::CPSFloatCurveFunctor::CCtrlPoint(points.at(i).x() / _ui.curveWidget->width(), _Curve->setCtrlPoint(uint(i), NL3D::CPSFloatCurveFunctor::CCtrlPoint(points.at(i).x() / _ui.curveWidget->width(),
(_ui.curveWidget->height() - points.at(i).y() + _pos) / (_ui.curveWidget->height() * _scale))); (_ui.curveWidget->height() - points.at(i).y() + _pos) / (_ui.curveWidget->height() * _scale)));
} }
@ -146,7 +150,7 @@ void CurveEditDialog::setNumSamples(uint32 value)
void CurveEditDialog::buildPoints() void CurveEditDialog::buildPoints()
{ {
QPolygonF points; QPolygonF points;
for (uint i = 0; i < _Curve->getNumCtrlPoints(); i++) for (uint i = 0; i < _Curve->getNumCtrlPoints(); ++i)
points << QPointF((_Curve->getControlPoint(i).Date * _ui.curveWidget->width()), points << QPointF((_Curve->getControlPoint(i).Date * _ui.curveWidget->width()),
_pos + _ui.curveWidget->height() - (_scale * _Curve->getControlPoint(i).Value * _ui.curveWidget->height())); _pos + _ui.curveWidget->height() - (_scale * _Curve->getControlPoint(i).Value * _ui.curveWidget->height()));

View file

@ -52,9 +52,6 @@ public:
CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent = 0); CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent = 0);
~CurveEditDialog(); ~CurveEditDialog();
/// the scheme being edited
NL3D::CPSFloatCurveFunctor *_Curve;
private Q_SLOTS: private Q_SLOTS:
void setSmoothing(bool state); void setSmoothing(bool state);
void setDisplayInterpolation(bool state); void setDisplayInterpolation(bool state);
@ -74,8 +71,10 @@ protected:
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
HoverPoints *_hoverPoints; /// the scheme being edited
NL3D::CPSFloatCurveFunctor *_Curve;
HoverPoints *_hoverPoints;
Ui::CurveEditDialog _ui; Ui::CurveEditDialog _ui;
}; /* CurveEditDialog */ }; /* CurveEditDialog */

View file

@ -34,7 +34,9 @@ namespace NLQT
const int max_range = 9999; const int max_range = 9999;
CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent) CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL), _emit(true) : QWidget(parent),
_Wrapper(NULL),
_emit(true)
{ {
_ui.setupUi(this); _ui.setupUi(this);

View file

@ -58,7 +58,6 @@ 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);
// DELAYED_EMISSION // DELAYED_EMISSION
_ui.delayedEmissionWidget->setRange(0.f, 10.f); _ui.delayedEmissionWidget->setRange(0.f, 10.f);

View file

@ -133,7 +133,7 @@ private:
} _ModulatedStrenghtWrapper; } _ModulatedStrenghtWrapper;
// the emitter being edited // the emitter being edited
NL3D::CPSEmitter *_Emitter; NL3D::CPSEmitter *_Emitter;
// contains pointers to the located // contains pointers to the located
std::vector<NL3D::CPSLocated *> _LocatedList; std::vector<NL3D::CPSLocated *> _LocatedList;

View file

@ -43,7 +43,23 @@ using namespace NL3D;
namespace NLQT namespace NLQT
{ {
CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo) CSlotInfo::CSlotInfo()
: Animation("empty"),
Skeleton("empty"),
Offset(0),
StartTime(0),
EndTime(0),
StartBlend(1),
EndBlend (1),
Smoothness(1),
SpeedFactor(1),
ClampMode(0),
SkeletonInverted(false),
Enable(true)
{
}
CSlotInfo &CSlotInfo::operator=(const CSlotInfo &slotInfo)
{ {
if ( this != &slotInfo) if ( this != &slotInfo)
{ {
@ -63,11 +79,16 @@ CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
return *this; return *this;
} }
CEntity::CEntity(void): CEntity::CEntity(void)
_Name("<Unknown>"), _FileNameShape(""), : _Name("<Unknown>"),
_FileNameSkeleton(""), _inPlace(false), _incPos(false), _FileNameShape(""),
_Instance(NULL), _Skeleton(NULL), _FileNameSkeleton(""),
_PlayList(NULL), _AnimationSet(NULL) _inPlace(false),
_incPos(false),
_Instance(NULL),
_Skeleton(NULL),
_PlayList(NULL),
_AnimationSet(NULL)
{ {
_CharacterScalePos = 1; _CharacterScalePos = 1;
} }
@ -188,7 +209,7 @@ void CEntity::update(NL3D::TAnimationTime time)
void CEntity::resetChannel() void CEntity::resetChannel()
{ {
for(uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++) for(uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; ++i)
_PlayList->setAnimation(i, UPlayList::empty); _PlayList->setAnimation(i, UPlayList::empty);
} }
@ -386,7 +407,7 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
void CEntity::animateChannelMixer() void CEntity::animateChannelMixer()
{ {
for (uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++) for (uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; ++i)
{ {
if (_SlotInfo[i].Enable) if (_SlotInfo[i].Enable)
{ {

View file

@ -48,13 +48,7 @@ namespace NLQT
class CSlotInfo class CSlotInfo
{ {
public: public:
CSlotInfo (): CSlotInfo();
Animation("empty"), Skeleton("empty"),
Offset(0), StartTime(0), EndTime(0),
StartBlend(1), EndBlend (1), Smoothness(1),
SpeedFactor(1), ClampMode(0),
SkeletonInverted(false),
Enable(true) {} ;
std::string Animation; std::string Animation;
std::string Skeleton; std::string Skeleton;
@ -104,8 +98,8 @@ public:
float SpeedAnim; float SpeedAnim;
int Mode; int Mode;
SAnimationStatus(): SAnimationStatus()
LoopAnim(false), PlayAnim(false), : LoopAnim(false), PlayAnim(false),
CurrentTimeAnim(0), StartAnim(0), CurrentTimeAnim(0), StartAnim(0),
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {} EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
}; };
@ -262,44 +256,44 @@ private:
bool removeLast); bool removeLast);
// The name of the entity // The name of the entity
std::string _Name; std::string _Name;
std::string _FileNameShape; std::string _FileNameShape;
std::string _FileNameSkeleton; std::string _FileNameSkeleton;
SAnimationStatus _AnimationStatus; SAnimationStatus _AnimationStatus;
bool _inPlace; bool _inPlace;
bool _incPos; bool _incPos;
float _CharacterScalePos; float _CharacterScalePos;
// The mesh instance associated to this entity // The mesh instance associated to this entity
NL3D::UInstance _Instance; NL3D::UInstance _Instance;
// The skeleton binded to the instance // The skeleton binded to the instance
NL3D::USkeleton _Skeleton; NL3D::USkeleton _Skeleton;
NL3D::UPlayList *_PlayList; NL3D::UPlayList *_PlayList;
NL3D::UAnimationSet *_AnimationSet; NL3D::UAnimationSet *_AnimationSet;
// Animation input file // Animation input file
std::vector<std::string> _AnimationList; std::vector<std::string> _AnimationList;
// Skeleton weight input file // Skeleton weight input file
std::vector<std::string> _SWTList; std::vector<std::string> _SWTList;
// Play list animation // Play list animation
std::vector<std::string > _PlayListAnimation; std::vector<std::string> _PlayListAnimation;
// Slot info for this object // Slot info for this object
CSlotInfo _SlotInfo[NL3D::CChannelMixer::NumAnimationSlot]; CSlotInfo _SlotInfo[NL3D::CChannelMixer::NumAnimationSlot];
friend class CObjectViewer; friend class CObjectViewer;
}; /* class CEntity */ }; /* class CEntity */
typedef std::map<std::string, CEntity> CEntities; typedef std::map<std::string, CEntity> CEntities;
typedef CEntities::iterator EIT; typedef CEntities::iterator EIT;
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -176,10 +176,10 @@ void CPluginManager::setPluginState(CPluginSpec *spec, int destState)
void CPluginManager::stopAll() void CPluginManager::stopAll()
{ {
Q_FOREACH (CPluginSpec *spec, _pluginSpecs) Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
setPluginState(spec, State::Stopped); setPluginState(spec, State::Stopped);
Q_FOREACH (CPluginSpec *spec, _pluginSpecs) Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
setPluginState(spec, State::Deleted); setPluginState(spec, State::Deleted);
} }

View file

@ -99,7 +99,7 @@ QString CPluginSpec::errorString() const
bool CPluginSpec::setFileName(const QString &fileName) bool CPluginSpec::setFileName(const QString &fileName)
{ {
_name = _version _name = _version
= _vendor = _vendor
= _description = _description
= _location = _location
= _filePath = _filePath
@ -138,7 +138,7 @@ bool CPluginSpec::loadLibrary()
if (!loader.load()) if (!loader.load())
return reportError(loader.errorString()); return reportError(loader.errorString());
IPlugin *pluginObject = qobject_cast<IPlugin*>(loader.instance()); IPlugin *pluginObject = qobject_cast<IPlugin *>(loader.instance());
if (!pluginObject) if (!pluginObject)
{ {
loader.unload(); loader.unload();

View file

@ -30,7 +30,9 @@ namespace NLQT
{ {
CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent) CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent)
: QDialog(parent), _FollowPath(pbfs), _Node(ownerNode) : QDialog(parent),
_FollowPath(pbfs),
_Node(ownerNode)
{ {
resize(270, 90); resize(270, 90);
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

View file

@ -56,7 +56,7 @@ protected:
QPushButton *pushButton; QPushButton *pushButton;
NL3D::CPSPlaneBasisFollowSpeed *_FollowPath; NL3D::CPSPlaneBasisFollowSpeed *_FollowPath;
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
}; /* class CFollowPathDialog */ }; /* class CFollowPathDialog */
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -32,8 +32,6 @@ CGlobalWindDialog::CGlobalWindDialog(QWidget *parent)
{ {
_ui.setupUi(this); _ui.setupUi(this);
//_ui.directionWidget->setWrapper(&_DirectionWrapper);
connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setWndPower(int))); connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setWndPower(int)));
connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(updateWnd(bool))); connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(updateWnd(bool)));
} }
@ -55,17 +53,6 @@ void CGlobalWindDialog::updateWnd(bool visible)
return; return;
_ui.horizontalSlider->setValue(int(Modules::objView().getScene()->getGlobalWindPower() * _ui.horizontalSlider->maximum())); _ui.horizontalSlider->setValue(int(Modules::objView().getScene()->getGlobalWindPower() * _ui.horizontalSlider->maximum()));
// _ui.directionWidget->updateUi();
}
/*
NLMISC::CVector CGlobalWindDialog::CDirectionWrapper::get(void) const
{
return Modules::objView().getScene()->getGlobalWindDirection();
} }
void CGlobalWindDialog::CDirectionWrapper::set(const NLMISC::CVector &d)
{
Modules::objView().getScene()->setGlobalWindDirection(d);
}
*/
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -44,12 +44,6 @@ private Q_SLOTS:
void updateWnd(bool visible); void updateWnd(bool visible);
private: private:
/// wrappers to tune the direction of wind
/* struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
{
NLMISC::CVector get(void) const;
void set(const NLMISC::CVector &d);
} _DirectionWrapper;*/
Ui::CGlobalWindDialog _ui; Ui::CGlobalWindDialog _ui;

View file

@ -117,7 +117,7 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
} }
else else
{ {
for(uint k = 1; k < _verts.size(); k++) for(uint k = 1; k < _verts.size(); ++k)
{ {
painter.drawLine(int((width() / 2.0) * (1 + _verts[k - 1].x)), painter.drawLine(int((width() / 2.0) * (1 + _verts[k - 1].x)),
int((height() / 2.0) * (1 - _verts[k - 1].y)), int((height() / 2.0) * (1 - _verts[k - 1].y)),

View file

@ -120,11 +120,11 @@ void CGraphicsViewport::resizeEvent(QResizeEvent *resizeEvent)
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
bool CGraphicsViewport::winEvent(MSG * message, long * result) bool CGraphicsViewport::winEvent(MSG *message, long *result)
{ {
if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive()) if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive())
{ {
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver())->getDriver(); NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver())->getDriver();
if (driver) if (driver)
{ {
winProc proc = (winProc)driver->getWindowProc(); winProc proc = (winProc)driver->getWindowProc();
@ -137,7 +137,7 @@ bool CGraphicsViewport::winEvent(MSG * message, long * result)
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e); typedef bool (*cocoaProc)(NL3D::IDriver *, const void *e);
bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event) bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event)
{ {
@ -146,7 +146,7 @@ bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event)
if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive()) if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive())
{ {
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver())->getDriver(); NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver())->getDriver();
if (driver) if (driver)
{ {
cocoaProc proc = (cocoaProc)driver->getWindowProc(); cocoaProc proc = (cocoaProc)driver->getWindowProc();
@ -165,7 +165,7 @@ bool CGraphicsViewport::x11Event(XEvent *event)
{ {
if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive()) if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive())
{ {
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver())->getDriver(); NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver())->getDriver();
if (driver) if (driver)
{ {
x11Proc proc = (x11Proc)driver->getWindowProc(); x11Proc proc = (x11Proc)driver->getWindowProc();

View file

@ -81,7 +81,7 @@ protected:
virtual void resizeEvent(QResizeEvent *resizeEvent); virtual void resizeEvent(QResizeEvent *resizeEvent);
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
virtual bool winEvent(MSG * message, long * result); virtual bool winEvent(MSG *message, long *result);
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
virtual bool macEvent(EventHandlerCallRef caller, EventRef event); virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)

View file

@ -393,7 +393,7 @@ private:
void touchPSState(); void touchPSState();
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
/// The bindable being edited /// The bindable being edited
NL3D::CPSLocatedBindable *_Bindable; NL3D::CPSLocatedBindable *_Bindable;

View file

@ -13,9 +13,10 @@
#include <nel/misc/file.h> #include <nel/misc/file.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/misc/command.h> #include <nel/misc/command.h>
#include "extension_system/iplugin_spec.h"
// Project includes // Project includes
#include "modules.h" #include "modules.h"
#include "extension_system/iplugin_spec.h"
// nel_qt log file name // nel_qt log file name
#define NLQT_LOG_FILE "nel_qt.log" #define NLQT_LOG_FILE "nel_qt.log"
@ -65,7 +66,7 @@ sint main(int argc, char **argv)
// use log.log if NEL_LOG_IN_FILE and NLQT_USE_LOG_LOG defined as 1 // use log.log if NEL_LOG_IN_FILE and NLQT_USE_LOG_LOG defined as 1
createDebug(NULL, NLQT_USE_LOG_LOG, false); createDebug(NULL, NLQT_USE_LOG_LOG, false);
#if NLQT_USE_LOG #if NLQT_USE_LOG
// create toverhex_client.log // create NLQT_LOG_FILE
// filedisplayer only deletes the 001 etc // filedisplayer only deletes the 001 etc
if (NLQT_ERASE_LOG && CFile::isExists(NLQT_LOG_FILE)) if (NLQT_ERASE_LOG && CFile::isExists(NLQT_LOG_FILE))
CFile::deleteFile(NLQT_LOG_FILE); CFile::deleteFile(NLQT_LOG_FILE);
@ -79,7 +80,7 @@ sint main(int argc, char **argv)
ErrorLog->addDisplayer(NLQT::s_FileDisplayer); ErrorLog->addDisplayer(NLQT::s_FileDisplayer);
#endif #endif
nlinfo("Welcome to NeL!"); nlinfo("Welcome to NeL Object Viewer Qt!");
NLMISC::CPath::remapExtension("tga", "png", true); NLMISC::CPath::remapExtension("tga", "png", true);
} }

View file

@ -56,10 +56,14 @@ namespace NLQT
CMainWindow::CMainWindow(QWidget *parent) CMainWindow::CMainWindow(QWidget *parent)
: QMainWindow(parent), : QMainWindow(parent),
_isGraphicsInitialized(false), _isGraphicsEnabled(false), _isGraphicsInitialized(false),
_isSoundInitialized(false), _isSoundEnabled(false), _isGraphicsEnabled(false),
_isLandscapeInitialized(false), _isLandscapeEnabled(false), _isSoundInitialized(false),
_GraphicsViewport(NULL), _lastDir(".") _isSoundEnabled(false),
_isLandscapeInitialized(false),
_isLandscapeEnabled(false),
_GraphicsViewport(NULL),
_lastDir(".")
{ {
nldebug("CMainWindow::CMainWindow:"); nldebug("CMainWindow::CMainWindow:");
setObjectName("CMainWindow"); setObjectName("CMainWindow");

View file

@ -57,9 +57,9 @@ private Q_SLOTS:
void editMorph(); void editMorph();
private: private:
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
NL3D::CPSShapeParticle *_ShapeParticle; NL3D::CPSShapeParticle *_ShapeParticle;
void updateForMorph(); void updateForMorph();

View file

@ -34,7 +34,9 @@ namespace NLQT
{ {
CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent) CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent)
: QDialog(parent), _Node(ownerNode), _CM(cm) : QDialog(parent),
_Node(ownerNode),
_CM(cm)
{ {
_ui.setupUi(this); _ui.setupUi(this);

View file

@ -76,7 +76,7 @@ private:
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
// the constraint mesh being edited // the constraint mesh being edited
NL3D::CPSConstraintMesh *_CM; NL3D::CPSConstraintMesh *_CM;
Ui::CMorphMeshDialog _ui; Ui::CMorphMeshDialog _ui;
}; /* class CMorphMeshDialog */ }; /* class CMorphMeshDialog */

View file

@ -31,7 +31,9 @@ namespace NLQT
{ {
CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent) CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent)
: QDialog(parent), _Node(ownerNode), _MTP(mtp) : QDialog(parent),
_Node(ownerNode),
_MTP(mtp)
{ {
_ui.setupUi(this); _ui.setupUi(this);

View file

@ -22,7 +22,6 @@
#include "ui_multi_tex_form.h" #include "ui_multi_tex_form.h"
// STL includes // STL includes
// Qt includes // Qt includes
@ -75,7 +74,7 @@ private:
virtual void set(NL3D::ITexture *); virtual void set(NL3D::ITexture *);
} _AlternateTexWrapper; } _AlternateTexWrapper;
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
NL3D::CPSMultiTexturedParticle *_MTP; NL3D::CPSMultiTexturedParticle *_MTP;

View file

@ -54,11 +54,13 @@ namespace NLQT
{ {
CObjectViewer::CObjectViewer() CObjectViewer::CObjectViewer()
: _Driver(NULL), _TextContext(NULL), : _Driver(NULL),
_phi(0), _psi(0),_dist(20), _TextContext(NULL),
_CameraFocal(75), _phi(0), _psi(0),_dist(20),
_CurrentInstance(""), _CameraFocal(75),
_BloomEffect(false), _Scene(0) _CurrentInstance(""),
_BloomEffect(false),
_Scene(0)
{ {
} }
@ -243,7 +245,7 @@ void CObjectViewer::saveScreenshot(const std::string &nameFile, bool jpg, bool p
bool CObjectViewer::loadMesh(const std::string &meshFileName, const std::string &skelFileName) bool CObjectViewer::loadMesh(const std::string &meshFileName, const std::string &skelFileName)
{ {
std::string fileName = CFile::getFilenameWithoutExtension(meshFileName); std::string fileName = CFile::getFilenameWithoutExtension(meshFileName);
if ( _Entities.count(fileName) != 0) if (_Entities.count(fileName) != 0)
return false; return false;
CPath::addSearchPath(CFile::getPath(meshFileName), false, false); CPath::addSearchPath(CFile::getPath(meshFileName), false, false);

View file

@ -145,7 +145,7 @@ public:
/// Get current instance from the scene /// Get current instance from the scene
/// @return name current instance, "" if no instance edited /// @return name current instance, "" if no instance edited
const std::string& getCurrentObject() std::string getCurrentObject() const
{ {
return _CurrentInstance; return _CurrentInstance;
} }

View file

@ -34,13 +34,20 @@
namespace NLQT namespace NLQT
{ {
CParticleEditor::CParticleEditor(void): CParticleEditor::CParticleEditor(void)
_ActiveNode(NULL), _State(State::Stopped), _Speed(1.0f), : _ActiveNode(NULL),
_AutoRepeat(false), _DisplayBBox(false), _State(State::Stopped),
_DisplayHelpers(false), _AutoUpdateBBox(false), _Speed(1.0f),
_EmptyBBox(true), _PW(NULL), _AutoRepeat(false),
_Driver(NULL), _Scene(NULL), _DisplayBBox(false),
_FontManager(NULL), _FontGen(NULL) _DisplayHelpers(false),
_AutoUpdateBBox(false),
_EmptyBBox(true),
_PW(NULL),
_Driver(NULL),
_Scene(NULL),
_FontManager(NULL),
_FontGen(NULL)
{ {
} }
@ -50,13 +57,13 @@ CParticleEditor::~CParticleEditor(void)
void CParticleEditor::init() void CParticleEditor::init()
{ {
NL3D::CDriverUser *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver()); NL3D::CDriverUser *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver());
_Driver = driver->getDriver(); _Driver = driver->getDriver();
NL3D::CSceneUser *scene = dynamic_cast<NL3D::CSceneUser*>(Modules::objView().getScene()); NL3D::CSceneUser *scene = dynamic_cast<NL3D::CSceneUser *>(Modules::objView().getScene());
_Scene = &scene->getScene(); _Scene = &scene->getScene();
NL3D::CTextContextUser *textContext = dynamic_cast<NL3D::CTextContextUser*>(Modules::objView().getTextContext()); NL3D::CTextContextUser *textContext = dynamic_cast<NL3D::CTextContextUser *>(Modules::objView().getTextContext());
_FontManager = textContext->getTextContext().getFontManager(); _FontManager = textContext->getTextContext().getFontManager();
_FontGen = textContext->getTextContext().getFontGenerator(); _FontGen = textContext->getTextContext().getFontGenerator();
NL3D::CParticleSystem::setSerializeIdentifierFlag(true); NL3D::CParticleSystem::setSerializeIdentifierFlag(true);
@ -125,7 +132,7 @@ void CParticleEditor::loadWorkspace(const std::string &fullPath)
} }
if (node->isLoaded() && !firstLoadedNode) if (node->isLoaded() && !firstLoadedNode)
firstLoadedNode = node; firstLoadedNode = node;
itr++; ++itr;
} }
closeWorkspace(); closeWorkspace();
_PW = newPW.release(); _PW = newPW.release();
@ -172,7 +179,7 @@ void CParticleEditor::saveWorkspaceContent()
if (node->isModified()) if (node->isModified())
node->savePS(); node->savePS();
node->setModified(false); node->setModified(false);
itr++; ++itr;
} }
} }
@ -242,7 +249,7 @@ void CParticleEditor::startMultiple()
CWorkspaceNode *node = (*itr); CWorkspaceNode *node = (*itr);
if (node->isLoaded()) if (node->isLoaded())
if (checkHasLoop(*node)) return; if (checkHasLoop(*node)) return;
itr++; ++itr;
} }
itr = _PW->getNodeList().begin(); itr = _PW->getNodeList().begin();
@ -257,7 +264,7 @@ void CParticleEditor::startMultiple()
_PlayingNodes.push_back(node); _PlayingNodes.push_back(node);
} }
itr++; ++itr;
} }
} }
break; break;
@ -405,7 +412,7 @@ void CParticleEditor::update()
} }
} }
} }
itr++; ++itr;
} }
if (fxStarted && allFXFinished) if (fxStarted && allFXFinished)
restartAllFX(); restartAllFX();
@ -440,7 +447,7 @@ void CParticleEditor::update()
node->getPSModel()->hide(); node->getPSModel()->hide();
} }
} }
itr++; ++itr;
} }
} }
@ -481,7 +488,7 @@ void CParticleEditor::setSpeed(float value)
CWorkspaceNode *node = (*itr); CWorkspaceNode *node = (*itr);
if (node->isLoaded()) if (node->isLoaded())
node->getPSModel()->setEllapsedTimeRatio(value); node->getPSModel()->setEllapsedTimeRatio(value);
itr++; ++itr;
} }
} }

View file

@ -234,25 +234,25 @@ private:
// Current state // Current state
int _State; int _State;
float _Speed; float _Speed;
bool _AutoRepeat; bool _AutoRepeat;
bool _DisplayBBox; bool _DisplayBBox;
bool _DisplayHelpers; bool _DisplayHelpers;
// The system bbox must be updated automatically // The system bbox must be updated automatically
bool _AutoUpdateBBox; bool _AutoUpdateBBox;
// The last computed bbox for the system // The last computed bbox for the system
bool _EmptyBBox; bool _EmptyBBox;
NLMISC::CAABBox _CurrBBox; NLMISC::CAABBox _CurrBBox;
CParticleWorkspace *_PW; CParticleWorkspace *_PW;
NL3D::IDriver *_Driver; NL3D::IDriver *_Driver;
NL3D::CScene *_Scene; NL3D::CScene *_Scene;
// Font manager // Font manager
NL3D::CFontManager *_FontManager; NL3D::CFontManager *_FontManager;
// Font generator // Font generator
NL3D::CFontGenerator *_FontGen; NL3D::CFontGenerator *_FontGen;

View file

@ -43,7 +43,7 @@ namespace NLQT
class CLocatedItem: public QListWidgetItem class CLocatedItem: public QListWidgetItem
{ {
public: public:
CLocatedItem ( const QString & text, QListWidget * parent = 0, int type = UserType ): CLocatedItem ( const QString & text, QListWidget *parent = 0, int type = UserType ):
QListWidgetItem(text, parent, type), _loc(NULL) {} QListWidgetItem(text, parent, type), _loc(NULL) {}
void setUserData(NL3D::CPSLocated *loc) void setUserData(NL3D::CPSLocated *loc)

View file

@ -35,7 +35,7 @@ CParticleLinkDialog::CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *par
{ {
_ui.setupUi(this); _ui.setupUi(this);
qobject_cast< QMainWindow* >(parent)->addDockWidget(Qt::RightDockWidgetArea, this); qobject_cast<QMainWindow *>(parent)->addDockWidget(Qt::RightDockWidgetArea, this);
_ui.treeView->setModel(model); _ui.treeView->setModel(model);
@ -59,7 +59,7 @@ void CParticleLinkDialog::setLink()
if (curObj.empty()) if (curObj.empty())
return; return;
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem*>(_ui.treeView->currentIndex().internalPointer()); CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem *>(_ui.treeView->currentIndex().internalPointer());
NL3D::CSkeletonModel *skel = Modules::objView().getEntity(curObj).getSkeleton().getObjectPtr(); NL3D::CSkeletonModel *skel = Modules::objView().getEntity(curObj).getSkeleton().getObjectPtr();
uint boneIndex = item->getId(); uint boneIndex = item->getId();
@ -85,7 +85,7 @@ void CParticleLinkDialog::resetModel()
_ui.unlinkPushButton->setEnabled(false); _ui.unlinkPushButton->setEnabled(false);
} }
void CParticleLinkDialog::clickedItem(const QModelIndex & index) void CParticleLinkDialog::clickedItem(const QModelIndex &index)
{ {
_ui.linkPushButton->setEnabled(true); _ui.linkPushButton->setEnabled(true);
_ui.unlinkPushButton->setEnabled(true); _ui.unlinkPushButton->setEnabled(true);

View file

@ -44,7 +44,7 @@ private Q_SLOTS:
void setLink(); void setLink();
void setUnlink(); void setUnlink();
void resetModel(); void resetModel();
void clickedItem(const QModelIndex & index); void clickedItem(const QModelIndex &index);
private: private:

View file

@ -56,14 +56,16 @@ CWorkspaceNode::~CWorkspaceNode()
void CWorkspaceNode::memorizeState() void CWorkspaceNode::memorizeState()
{ {
nlassert(_WS); nlassert(_WS);
if (!_PS) return; if (!_PS)
return;
_InitialPos.copySystemInitialPos(_PS); _InitialPos.copySystemInitialPos(_PS);
} }
void CWorkspaceNode::restoreState() void CWorkspaceNode::restoreState()
{ {
nlassert(_WS); nlassert(_WS);
if (!_PS) return; if (!_PS)
return;
_InitialPos.restoreSystem(); _InitialPos.restoreSystem();
} }
@ -78,7 +80,8 @@ void CWorkspaceNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel,
const std::string &parentBoneName) const std::string &parentBoneName)
{ {
nlassert(_WS); nlassert(_WS);
if (!_PSM) return; if (!_PSM)
return;
unstickPSFromSkeleton(); unstickPSFromSkeleton();
_ParentSkelName = parentSkelName; _ParentSkelName = parentSkelName;
_ParentBoneName = parentBoneName; _ParentBoneName = parentBoneName;
@ -308,7 +311,7 @@ CParticleWorkspace::CParticleWorkspace()
CParticleWorkspace::~CParticleWorkspace() CParticleWorkspace::~CParticleWorkspace()
{ {
for (size_t i = 0; i < _Nodes.size(); i++) for (size_t i = 0; i < _Nodes.size(); ++i)
delete _Nodes[i]; delete _Nodes[i];
_Nodes.clear(); _Nodes.clear();
} }

View file

@ -163,27 +163,27 @@ public:
void setTriggerAnim(const std::string &anim); void setTriggerAnim(const std::string &anim);
private: private:
std::string _TriggerAnim; std::string _TriggerAnim;
NL3D::CParticleSystem *_PS; NL3D::CParticleSystem *_PS;
NL3D::CParticleSystemModel *_PSM; NL3D::CParticleSystemModel *_PSM;
// Keep a shape bank per node because we want the whole path to identify the ps, not just its filename // Keep a shape bank per node because we want the whole path to identify the ps, not just its filename
// (shape bank keeps the filename only) // (shape bank keeps the filename only)
NL3D::CShapeBank *_ShapeBank; NL3D::CShapeBank *_ShapeBank;
// Relative path from which the ps was inserted // Relative path from which the ps was inserted
// relative path is also a unique identifier for this ps in the workspace // relative path is also a unique identifier for this ps in the workspace
std::string _RelativePath; std::string _RelativePath;
// initial pos of system. Allow to restore the initial instances of the system when doing start / stop // initial pos of system. Allow to restore the initial instances of the system when doing start / stop
CPSInitialPos _InitialPos; CPSInitialPos _InitialPos;
bool _Modified; bool _Modified;
CParticleWorkspace *_WS; CParticleWorkspace *_WS;
NLMISC::CRefPtr<NL3D::CSkeletonModel> _ParentSkel; NLMISC::CRefPtr<NL3D::CSkeletonModel> _ParentSkel;
bool _ResetAutoCount; bool _ResetAutoCount;
// //
std::string _ParentSkelName; std::string _ParentSkelName;
std::string _ParentBoneName; std::string _ParentBoneName;
private: private:
void setup(NL3D::CParticleSystemModel &psm); void setup(NL3D::CParticleSystemModel &psm);
public: public:
@ -339,13 +339,13 @@ public:
private: private:
// use smart ptr to avoir prb wih resize // use smart ptr to avoir prb wih resize
TNodeVect _Nodes; TNodeVect _Nodes;
// path + name of workspace // path + name of workspace
std::string _Filename; std::string _Filename;
bool _Modified; bool _Modified;
IModificationCallback *_ModificationCallback; IModificationCallback *_ModificationCallback;
// workspace user name // workspace user name
std::string _Name; std::string _Name;
/// serial the object /// serial the object
void serial(NLMISC::IStream &f) throw(NLMISC::EStream); void serial(NLMISC::IStream &f) throw(NLMISC::EStream);

View file

@ -68,25 +68,25 @@ public:
private: private:
void setupUi(); void setupUi();
QWidget *_dockWidgetContents; QWidget *_dockWidgetContents;
QGridLayout *_gridLayout; QGridLayout *_gridLayout;
QGridLayout *_pagesGridLayout; QGridLayout *_pagesGridLayout;
QScrollArea *_scrollArea; QScrollArea *_scrollArea;
QWidget *_scrollAreaWidgetContents; QWidget *_scrollAreaWidgetContents;
QStackedWidget *_stackedWidget; QStackedWidget *_stackedWidget;
CWorkspacePage *_wpPage; CWorkspacePage *_wpPage;
CParticleSystemPage *_psPage; CParticleSystemPage *_psPage;
CLocatedBindablePage *_locatedBindablePage; CLocatedBindablePage *_locatedBindablePage;
CLocatedPage *_locatedPage; CLocatedPage *_locatedPage;
CForcePage *_forcePage; CForcePage *_forcePage;
CLightPage *_lightPage; CLightPage *_lightPage;
CZonePage *_zonePage; CZonePage *_zonePage;
CSoundPage *_soundPage; CSoundPage *_soundPage;
CEmitterPage *_emitterPage; CEmitterPage *_emitterPage;
CPSMoverPage *_psMoverPage; CPSMoverPage *_psMoverPage;
CParticleTreeModel *_treeModel; CParticleTreeModel *_treeModel;
friend class CParticleWorkspaceDialog; friend class CParticleWorkspaceDialog;
}; /* class CPropertyDialog */ }; /* class CPropertyDialog */

View file

@ -117,7 +117,7 @@ private:
} }
/// the sound being edited /// the sound being edited
NL3D::CPSSound *_Sound; NL3D::CPSSound *_Sound;
CWorkspaceNode *_Node; CWorkspaceNode *_Node;

View file

@ -116,7 +116,7 @@ private:
if ((_Node) && (enabledModifiedFlag)) _Node->setModified(true); if ((_Node) && (enabledModifiedFlag)) _Node->setModified(true);
} }
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
struct CGlobalColorWrapper : public IPSSchemeWrapperRGBA struct CGlobalColorWrapper : public IPSSchemeWrapperRGBA
{ {

View file

@ -68,10 +68,10 @@ private Q_SLOTS:
private: private:
void updateTexture(); void updateTexture();
IPSWrapperTexture *_Wrapper ; IPSWrapperTexture *_Wrapper;
// the current texture // the current texture
NLMISC::CSmartPtr<NL3D::ITexture> _Texture ; NLMISC::CSmartPtr<NL3D::ITexture> _Texture;
Ui::CParticleTextureWidget _ui; Ui::CParticleTextureWidget _ui;
}; /* class CParticleTextureWidget */ }; /* class CParticleTextureWidget */

View file

@ -114,7 +114,7 @@ CParticleTreeItem *CParticleTreeItem::parent()
int CParticleTreeItem::row() const int CParticleTreeItem::row() const
{ {
if (_parentItem) if (_parentItem)
return _parentItem->_childItems.indexOf(const_cast<CParticleTreeItem*>(this)); return _parentItem->_childItems.indexOf(const_cast<CParticleTreeItem *>(this));
return 0; return 0;
} }
@ -188,7 +188,7 @@ QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
if (item->itemType() == ItemType::ParticleSystem) if (item->itemType() == ItemType::ParticleSystem)
{ {
if (item->getNode()->isModified()) if (item->getNode()->isModified())
@ -203,7 +203,7 @@ QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
} }
if (role == Qt::FontRole) if (role == Qt::FontRole)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
if (Modules::psEdit().getActiveNode() != NULL) if (Modules::psEdit().getActiveNode() != NULL)
{ {
if (item->data(0) == QString(Modules::psEdit().getActiveNode()->getFilename().c_str())) if (item->data(0) == QString(Modules::psEdit().getActiveNode()->getFilename().c_str()))
@ -224,7 +224,7 @@ Qt::ItemFlags CParticleTreeModel::flags(const QModelIndex &index) const
if (!index.isValid()) if (!index.isValid())
return itmFlags; return itmFlags;
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
switch (item->itemType()) switch (item->itemType())
{ {
case ItemType::Particle: case ItemType::Particle:
@ -247,7 +247,7 @@ Qt::ItemFlags CParticleTreeModel::flags(const QModelIndex &index) const
break; break;
} }
//CParticleWorkspaceDialog *pwsd = qobject_cast<CParticleWorkspaceDialog*>(QObject::parent()); //CParticleWorkspaceDialog *pwsd = qobject_cast<CParticleWorkspaceDialog *>(QObject::parent());
//pwsd->updateTreeView(); //pwsd->updateTreeView();
return itmFlags; return itmFlags;
@ -273,7 +273,7 @@ const
if (!parent.isValid()) if (!parent.isValid())
parentItem = _rootItem; parentItem = _rootItem;
else else
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer()); parentItem = static_cast<CParticleTreeItem *>(parent.internalPointer());
CParticleTreeItem *childItem = parentItem->child(row); CParticleTreeItem *childItem = parentItem->child(row);
if (childItem) if (childItem)
@ -287,7 +287,7 @@ QModelIndex CParticleTreeModel::parent(const QModelIndex &index) const
if (!index.isValid()) if (!index.isValid())
return QModelIndex(); return QModelIndex();
CParticleTreeItem *childItem = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *childItem = static_cast<CParticleTreeItem *>(index.internalPointer());
CParticleTreeItem *parentItem = childItem->parent(); CParticleTreeItem *parentItem = childItem->parent();
if (parentItem == _rootItem) if (parentItem == _rootItem)
@ -305,7 +305,7 @@ int CParticleTreeModel::rowCount(const QModelIndex &parent) const
if (!parent.isValid()) if (!parent.isValid())
parentItem = _rootItem; parentItem = _rootItem;
else else
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer()); parentItem = static_cast<CParticleTreeItem *>(parent.internalPointer());
return parentItem->childCount(); return parentItem->childCount();
} }
@ -314,7 +314,7 @@ bool CParticleTreeModel::setData(const QModelIndex &index, const QVariant &value
{ {
if (index.isValid() && role == Qt::EditRole) if (index.isValid() && role == Qt::EditRole)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
QList<QVariant> listData; QList<QVariant> listData;
listData << value; listData << value;
item->replace(listData); item->replace(listData);
@ -331,7 +331,7 @@ bool CParticleTreeModel::setData(const QModelIndex &index, const QVariant &value
QIcon CParticleTreeModel::getIcon(const QModelIndex &index) const QIcon CParticleTreeModel::getIcon(const QModelIndex &index) const
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
switch (item->itemType()) switch (item->itemType())
{ {
case ItemType::Root: case ItemType::Root:
@ -364,7 +364,7 @@ QIcon CParticleTreeModel::getIcon(const QModelIndex &index) const
bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QModelIndex &parent) bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QModelIndex &parent)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(parent.internalPointer());
beginInsertRows(parent, position, position); beginInsertRows(parent, position, position);
setupModelFromPS(node, item); setupModelFromPS(node, item);
@ -373,7 +373,7 @@ bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QM
if (node->isLoaded()) if (node->isLoaded())
{ {
QModelIndex indexPS = index(item->childCount() - 1, 0, parent); QModelIndex indexPS = index(item->childCount() - 1, 0, parent);
for (uint k = 0; k < node->getPSPointer()->getNbProcess(); k++) for (uint k = 0; k < node->getPSPointer()->getNbProcess(); ++k)
{ {
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(node->getPSPointer()->getProcess(k)); NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(node->getPSPointer()->getProcess(k));
insertRows(loc, k, indexPS); insertRows(loc, k, indexPS);
@ -384,7 +384,7 @@ bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QM
bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const QModelIndex &parent) bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const QModelIndex &parent)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(parent.internalPointer());
beginInsertRows(parent, position, position); beginInsertRows(parent, position, position);
createItemFromLocated(loc, item); createItemFromLocated(loc, item);
@ -403,7 +403,7 @@ bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const Q
bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent) bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent)
{ {
beginInsertRows(parent, position, position); beginInsertRows(parent, position, position);
createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem*>(parent.internalPointer())); createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem *>(parent.internalPointer()));
endInsertRows(); endInsertRows();
return true; return true;
} }
@ -411,14 +411,14 @@ bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int posi
bool CParticleTreeModel::insertRow(NL3D::CPSLocatedBindable *lb, int position, const QModelIndex &parent) bool CParticleTreeModel::insertRow(NL3D::CPSLocatedBindable *lb, int position, const QModelIndex &parent)
{ {
beginInsertRows(parent, position, position); beginInsertRows(parent, position, position);
createItemFromLocatedBindable(lb, static_cast<CParticleTreeItem*>(parent.internalPointer())); createItemFromLocatedBindable(lb, static_cast<CParticleTreeItem *>(parent.internalPointer()));
endInsertRows(); endInsertRows();
return true; return true;
} }
bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent) bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer())->child(position); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(parent.internalPointer())->child(position);
while (item->childCount() != 0) while (item->childCount() != 0)
removeRows(0, parent.child(position, 0)); removeRows(0, parent.child(position, 0));
@ -454,14 +454,14 @@ CWorkspaceNode *CParticleTreeModel::getOwnerNode(CParticleTreeItem *item) const
void CParticleTreeModel::rebuildLocatedInstance(const QModelIndex &parent) void CParticleTreeModel::rebuildLocatedInstance(const QModelIndex &parent)
{ {
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(parent.internalPointer());
int k = 0; int k = 0;
for (int i = 0; i < item->childCount(); i++) for (int i = 0; i < item->childCount(); ++i)
{ {
if (item->child(i)->itemType() == ItemType::LocatedInstance) if (item->child(i)->itemType() == ItemType::LocatedInstance)
{ {
item->child(i)->setLocatedInstanceIndex(k); item->child(i)->setLocatedInstanceIndex(k);
k++; ++k;
} }
} }
} }
@ -491,7 +491,7 @@ void CParticleTreeModel::setupModelFromWorkSpace()
QModelIndex rootIndex = index(0, 0); QModelIndex rootIndex = index(0, 0);
uint numNode = workspace->getNumNode(); uint numNode = workspace->getNumNode();
for (uint i = 0; i < numNode; i++) for (uint i = 0; i < numNode; ++i)
insertRows(workspace->getNode(i), i, rootIndex); insertRows(workspace->getNode(i), i, rootIndex);
} }

View file

@ -99,16 +99,16 @@ public:
private: private:
union union
{ {
CParticleWorkspace *_WS; CParticleWorkspace *_WS;
NL3D::CPSLocated *_Loc; NL3D::CPSLocated *_Loc;
NL3D::CPSLocatedBindable *_Bind; NL3D::CPSLocatedBindable *_Bind;
CWorkspaceNode *_PS; CWorkspaceNode *_PS;
}; };
// for the located instance type, this is the index of the instance // for the located instance type, this is the index of the instance
uint32 _LocatedInstanceIndex; uint32 _LocatedInstanceIndex;
QList<CParticleTreeItem*> _childItems; QList<CParticleTreeItem *> _childItems;
QList<QVariant> _itemData; QList<QVariant> _itemData;
int _itemIconType; int _itemIconType;
CParticleTreeItem *_parentItem; CParticleTreeItem *_parentItem;

View file

@ -123,7 +123,8 @@ struct Action
static std::map<std::string, uint> _PSElementIdentifiers; static std::map<std::string, uint> _PSElementIdentifiers;
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent) CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
: QDockWidget(parent), _currentItem(NULL) : QDockWidget(parent),
_currentItem(NULL)
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -218,7 +219,7 @@ void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index)
if (_currentItem != NULL) if (_currentItem != NULL)
_treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL); _treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL);
_currentItem = static_cast<CParticleTreeItem*>(index.internalPointer()); _currentItem = static_cast<CParticleTreeItem *>(index.internalPointer());
if (index.flags() != Qt::NoItemFlags) if (index.flags() != Qt::NoItemFlags)
_PropertyDialog->setCurrentEditedElement(_currentItem); _PropertyDialog->setCurrentEditedElement(_currentItem);
@ -303,7 +304,7 @@ void CParticleWorkspaceDialog::customContextMenu()
void CParticleWorkspaceDialog::setActiveNode() void CParticleWorkspaceDialog::setActiveNode()
{ {
QModelIndex index = _ui.treeView->currentIndex(); QModelIndex index = _ui.treeView->currentIndex();
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
nlassert(item->getNode()); nlassert(item->getNode());
Modules::psEdit().setActiveNode(item->getNode()); Modules::psEdit().setActiveNode(item->getNode());
Q_EMIT changeActiveNode(); Q_EMIT changeActiveNode();
@ -365,7 +366,7 @@ void CParticleWorkspaceDialog::removePS()
QModelIndex index = _ui.treeView->currentIndex(); QModelIndex index = _ui.treeView->currentIndex();
_ui.treeView->setCurrentIndex(index.parent()); _ui.treeView->setCurrentIndex(index.parent());
clickedItem(index.parent()); clickedItem(index.parent());
Modules::psEdit().getParticleWorkspace()->removeNode(static_cast<CParticleTreeItem*>(index.internalPointer())->getNode()); Modules::psEdit().getParticleWorkspace()->removeNode(static_cast<CParticleTreeItem *>(index.internalPointer())->getNode());
_treeModel->removeRows(index.row(), index.parent()); _treeModel->removeRows(index.row(), index.parent());
} }
@ -605,7 +606,7 @@ void CParticleWorkspaceDialog::deleteItem()
{ {
_treeModel->getOwnerNode(_currentItem)->setModified(true); _treeModel->getOwnerNode(_currentItem)->setModified(true);
QModelIndex index = _ui.treeView->currentIndex(); QModelIndex index = _ui.treeView->currentIndex();
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer()); CParticleTreeItem *item = static_cast<CParticleTreeItem *>(index.internalPointer());
CWorkspaceNode *ownerNode = _treeModel->getOwnerNode(item); CWorkspaceNode *ownerNode = _treeModel->getOwnerNode(item);
nlassert(ownerNode); nlassert(ownerNode);
_ui.treeView->setCurrentIndex(index.parent()); _ui.treeView->setCurrentIndex(index.parent());

View file

@ -123,7 +123,7 @@ private:
QAction *_lod2Action; QAction *_lod2Action;
QAction *_externIDAction; QAction *_externIDAction;
std::auto_ptr<NL3D::CPSLocated> _LocatedCopy; std::auto_ptr<NL3D::CPSLocated> _LocatedCopy;
std::auto_ptr<NL3D::CPSLocatedBindable> _LocatedBindableCopy; std::auto_ptr<NL3D::CPSLocatedBindable> _LocatedBindableCopy;
CParticleTreeItem *_currentItem; CParticleTreeItem *_currentItem;

View file

@ -141,7 +141,7 @@ void CWorkspacePage::insertPS()
else else
{ {
QModelIndex index = _treeModel->index(0, 0); QModelIndex index = _treeModel->index(0, 0);
_treeModel->insertRows(node, static_cast<CParticleTreeItem*>(index.internalPointer())->childCount(), index); _treeModel->insertRows(node, static_cast<CParticleTreeItem *>(index.internalPointer())->childCount(), index);
} }
} }
} }
@ -180,7 +180,7 @@ void CWorkspacePage::createPS()
return; return;
} }
QModelIndex index = _treeModel->index(0, 0); QModelIndex index = _treeModel->index(0, 0);
_treeModel->insertRows(node, static_cast<CParticleTreeItem*>(index.internalPointer())->childCount(), index); _treeModel->insertRows(node, static_cast<CParticleTreeItem *>(index.internalPointer())->childCount(), index);
} }
} }

View file

@ -36,7 +36,8 @@ namespace NLQT
/** /**
@class CWorkspacePage @class CWorkspacePage
@brief Page for QStackWidget, to particles workspace operation (new/load/save workspace, create/insert/remove all particles system to workspace) @brief Page for QStackWidget, to particles workspace operation (new/load/save workspace,
create/insert/remove all particles system to workspace)
*/ */
class CWorkspacePage: public QWidget class CWorkspacePage: public QWidget
{ {

View file

@ -130,7 +130,7 @@ void CZonePage::updateTargets()
}; };
// fill abox with the available targets // fill abox with the available targets
NL3D::CParticleSystem *ps = _LBTarget->getOwner()->getOwner(); NL3D::CParticleSystem *ps = _LBTarget->getOwner()->getOwner();
uint nbLocated = ps->getNbProcess(); uint nbLocated = ps->getNbProcess();

View file

@ -63,7 +63,7 @@ private:
NL3D::CPSTargetLocatedBindable *_LBTarget; NL3D::CPSTargetLocatedBindable *_LBTarget;
/// the collision zone being edited /// the collision zone being edited
NL3D::CPSZone *_Zone ; NL3D::CPSZone *_Zone ;
CWorkspaceNode *_Node; CWorkspaceNode *_Node;

View file

@ -19,7 +19,7 @@ bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorStr
_plugMan = pluginManager; _plugMan = pluginManager;
QString str; QString str;
QList<NLQT::IPluginSpec *> listPlug = pluginManager->plugins(); QList<NLQT::IPluginSpec *> listPlug = pluginManager->plugins();
Q_FOREACH (NLQT::IPluginSpec *plugSpec, listPlug) Q_FOREACH (NLQT::IPluginSpec *plugSpec, listPlug)
str += plugSpec->name(); str += plugSpec->name();
@ -32,6 +32,8 @@ bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorStr
void MyPlugin::extensionsInitialized() void MyPlugin::extensionsInitialized()
{ {
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help")); QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
nlassert(helpMenu);
helpMenu->addSeparator(); helpMenu->addSeparator();
QAction *newAction = helpMenu->addAction("MyPlugin"); QAction *newAction = helpMenu->addAction("MyPlugin");
@ -41,6 +43,8 @@ void MyPlugin::extensionsInitialized()
void MyPlugin::execMessageBox() void MyPlugin::execMessageBox()
{ {
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow")); QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
nlassert(wnd);
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(wnd->objectName() + QString(": width=%1,height=%2").arg(wnd->width()).arg(wnd->height())); msgBox.setText(wnd->objectName() + QString(": width=%1,height=%2").arg(wnd->width()).arg(wnd->height()));
msgBox.exec(); msgBox.exec();

View file

@ -57,7 +57,7 @@ CPSMoverPage::CPSMoverPage(QWidget *parent)
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector))); 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()));
} }

View file

@ -20,7 +20,6 @@
#ifndef PS_MOVER_PAGE_H #ifndef PS_MOVER_PAGE_H
#define PS_MOVER_PAGE_H #define PS_MOVER_PAGE_H
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include "ui_ps_mover_form.h" #include "ui_ps_mover_form.h"
@ -81,7 +80,7 @@ public:
void updatePosition(void) ; void updatePosition(void) ;
/// get the current moving interface, or NULL, if the selected object has no IPSMover interface /// get the current moving interface, or NULL, if the selected object has no IPSMover interface
NL3D::IPSMover *getMoverInterface(void) ; NL3D::IPSMover *getMoverInterface(void);
/// get the located being edited /// get the located being edited
NL3D::CPSLocated *getLocated(void) NL3D::CPSLocated *getLocated(void)
@ -90,17 +89,17 @@ public:
} }
const NL3D::CPSLocated *getLocated(void) const const NL3D::CPSLocated *getLocated(void) const
{ {
return _EditedLocated ; return _EditedLocated;
} }
/// get the index of the current edited item /// get the index of the current edited item
uint32 getLocatedIndex(void) const uint32 getLocatedIndex(void) const
{ {
return _EditedLocatedIndex ; return _EditedLocatedIndex;
} }
/// ghet the current located bindable being edited, or null /// ghet the current located bindable being edited, or null
NL3D::CPSLocatedBindable *getLocatedBindable(void) ; NL3D::CPSLocatedBindable *getLocatedBindable(void);
private Q_SLOTS: private Q_SLOTS:
void setXPosition(double value); void setXPosition(double value);
@ -185,11 +184,11 @@ private:
/// 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) ;
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
NL3D::CPSLocated *_EditedLocated ; NL3D::CPSLocated *_EditedLocated ;
uint32 _EditedLocatedIndex ; uint32 _EditedLocatedIndex ;
Ui::CPSMoverPage _ui; Ui::CPSMoverPage _ui;

View file

@ -26,7 +26,6 @@
// STL includes // STL includes
// NeL includes // NeL includes
#include <nel/misc/config_file.h>
#include <nel/misc/rgba.h> #include <nel/misc/rgba.h>
// Project includes // Project includes
@ -49,6 +48,7 @@ public:
private Q_SLOTS: private Q_SLOTS:
void apply(); void apply();
void setColor(); void setColor();
private: private:
NLMISC::CRGBA colorFog; NLMISC::CRGBA colorFog;

View file

@ -128,9 +128,9 @@ void CSkeletonScaleDialog::setCurrentShape(const QString &name)
_BkupBones = _Bones; _BkupBones = _Bones;
} }
void CSkeletonScaleDialog::setCurrentBone(const QModelIndex & index) void CSkeletonScaleDialog::setCurrentBone(const QModelIndex &index)
{ {
CSkeletonTreeItem *currentItem = static_cast<CSkeletonTreeItem*>(index.internalPointer()); CSkeletonTreeItem *currentItem = static_cast<CSkeletonTreeItem *>(index.internalPointer());
// bkup for undo // bkup for undo
static TBoneMirrorArray precState; static TBoneMirrorArray precState;
@ -208,7 +208,7 @@ void CSkeletonScaleDialog::clickMirrorSelected()
// for each bone selected // for each bone selected
bool change= false; bool change= false;
for(uint i=0; i<_Bones.size(); i++) for(uint i=0; i < _Bones.size(); ++i)
{ {
CBoneMirror &bone= _Bones[i]; CBoneMirror &bone= _Bones[i];
if(bone.Selected) if(bone.Selected)
@ -468,7 +468,7 @@ void CSkeletonScaleDialog::applyMirrorToSkeleton()
if(!_Skeleton.empty()) if(!_Skeleton.empty())
{ {
nlassert(_Skeleton.getNumBones() == _Bones.size()); nlassert(_Skeleton.getNumBones() == _Bones.size());
for(uint i = 0; i < _Bones.size(); i++) for(uint i = 0; i < _Bones.size(); ++i)
{ {
// unmul from precision // unmul from precision
NLMISC::CVector boneScale = _Bones[i].BoneScale / ssd_scale_precision; NLMISC::CVector boneScale = _Bones[i].BoneScale / ssd_scale_precision;
@ -484,7 +484,7 @@ void CSkeletonScaleDialog::applySkeletonToMirror()
if(!_Skeleton.empty()) if(!_Skeleton.empty())
{ {
nlassert(_Skeleton.getNumBones() == _Bones.size()); nlassert(_Skeleton.getNumBones() == _Bones.size());
for(uint i = 0; i < _Skeleton.getNumBones(); i++) for(uint i = 0; i < _Skeleton.getNumBones(); ++i)
{ {
// mul by precision, and round // mul by precision, and round
_Bones[i].SkinScale = _Skeleton.getBone(i).getSkinScale() * ssd_scale_precision; _Bones[i].SkinScale = _Skeleton.getBone(i).getSkinScale() * ssd_scale_precision;
@ -517,7 +517,7 @@ void CSkeletonScaleDialog::applySelectionToView()
{ {
_ui.treeView->blockSignals(true); _ui.treeView->blockSignals(true);
CSkeletonTreeModel *model = Modules::mainWin().getSkeletonModel(); CSkeletonTreeModel *model = Modules::mainWin().getSkeletonModel();
for(uint i = 0; i < _Bones.size(); i++) for(uint i = 0; i < _Bones.size(); ++i)
{ {
if (_Bones[i].Selected) if (_Bones[i].Selected)
_ui.treeView->setCurrentIndex(model->getIndexFromId(i, model->index(0, 0))); _ui.treeView->setCurrentIndex(model->getIndexFromId(i, model->index(0, 0)));
@ -527,7 +527,7 @@ void CSkeletonScaleDialog::applySelectionToView()
sint CSkeletonScaleDialog::getBoneForMirror(uint boneId, std::string &mirrorName) sint CSkeletonScaleDialog::getBoneForMirror(uint boneId, std::string &mirrorName)
{ {
sint side= 0; sint side= 0;
std::string::size_type pos; std::string::size_type pos;
nlassert(!_Skeleton.empty() && (boneId < _Skeleton.getNumBones())); nlassert(!_Skeleton.empty() && (boneId < _Skeleton.getNumBones()));
mirrorName= _Skeleton.getBone(boneId).getObjectPtr()->getBoneName(); mirrorName= _Skeleton.getBone(boneId).getObjectPtr()->getBoneName();
@ -561,7 +561,7 @@ bool CSkeletonScaleDialog::saveCurrentInStream(NLMISC::IStream &f)
// Retrieve boneBase definition from the current skeleton // Retrieve boneBase definition from the current skeleton
std::vector<NL3D::CBoneBase> boneBases; std::vector<NL3D::CBoneBase> boneBases;
(NLMISC::safe_cast<NL3D::CSkeletonShape*>((NL3D::IShape*)_Skeleton.getObjectPtr()->Shape))->retrieve(boneBases); (NLMISC::safe_cast<NL3D::CSkeletonShape *>((NL3D::IShape *)_Skeleton.getObjectPtr()->Shape))->retrieve(boneBases);
// Copies bone scales from the model // Copies bone scales from the model
nlassert(boneBases.size() == _Skeleton.getNumBones()); nlassert(boneBases.size() == _Skeleton.getNumBones());
@ -615,7 +615,7 @@ bool CSkeletonScaleDialog::saveSkelScaleInStream(NLMISC::IStream &f)
// Copies bone scales from the model // Copies bone scales from the model
std::vector<CBoneScaleInfo> boneScales; std::vector<CBoneScaleInfo> boneScales;
boneScales.resize(_Skeleton.getNumBones()); boneScales.resize(_Skeleton.getNumBones());
for(uint i = 0; i < boneScales.size(); i++) for(uint i = 0; i < boneScales.size(); ++i)
{ {
NL3D::CBone *bone= _Skeleton.getBone(i).getObjectPtr(); NL3D::CBone *bone= _Skeleton.getBone(i).getObjectPtr();
CBoneScaleInfo &boneScale= boneScales[i]; CBoneScaleInfo &boneScale= boneScales[i];
@ -651,7 +651,7 @@ bool CSkeletonScaleDialog::loadSkelScaleFromStream(NLMISC::IStream &f)
f.serialCont(boneScales); f.serialCont(boneScales);
// apply to the current skeleton // apply to the current skeleton
for(uint i = 0; i < boneScales.size(); i++) for(uint i = 0; i < boneScales.size(); ++i)
{ {
sint32 boneId = _Skeleton.getBoneIdByName(boneScales[i].Name); sint32 boneId = _Skeleton.getBoneIdByName(boneScales[i].Name);
if(boneId >= 0 && boneId < (sint32)_Skeleton.getNumBones()) if(boneId >= 0 && boneId < (sint32)_Skeleton.getNumBones())
@ -689,7 +689,7 @@ void CSkeletonScaleDialog::pushUndoState(const TBoneMirrorArray &precState, bool
// test if real change // test if real change
nlassert(precState.size() == _Bones.size()); nlassert(precState.size() == _Bones.size());
bool change = false; bool change = false;
for(uint i = 0; i < _Bones.size(); i++) for(uint i = 0; i < _Bones.size(); ++i)
{ {
if( _Bones[i].BoneScale!=precState[i].BoneScale || if( _Bones[i].BoneScale!=precState[i].BoneScale ||
_Bones[i].SkinScale!=precState[i].SkinScale || _Bones[i].SkinScale!=precState[i].SkinScale ||

View file

@ -76,7 +76,7 @@ public Q_SLOTS:
void setCurrentShape(const QString &name); void setCurrentShape(const QString &name);
private Q_SLOTS: private Q_SLOTS:
void setCurrentBone(const QModelIndex & index); void setCurrentBone(const QModelIndex &index);
void setBoneSliderX(int value); void setBoneSliderX(int value);
void setBoneSliderY(int value); void setBoneSliderY(int value);
void setBoneSliderZ(int value); void setBoneSliderZ(int value);

View file

@ -46,7 +46,7 @@ CSkeletonTreeModel::~CSkeletonTreeModel()
int CSkeletonTreeModel::columnCount(const QModelIndex &parent) const int CSkeletonTreeModel::columnCount(const QModelIndex &parent) const
{ {
if (parent.isValid()) if (parent.isValid())
return static_cast<CSkeletonTreeItem*>(parent.internalPointer())->columnCount(); return static_cast<CSkeletonTreeItem *>(parent.internalPointer())->columnCount();
else else
return _rootItem->columnCount(); return _rootItem->columnCount();
} }
@ -59,7 +59,7 @@ QVariant CSkeletonTreeModel::data(const QModelIndex &index, int role) const
if (role != Qt::DisplayRole) if (role != Qt::DisplayRole)
return QVariant(); return QVariant();
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem*>(index.internalPointer()); CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem *>(index.internalPointer());
return item->data(index.column()); return item->data(index.column());
} }
@ -92,7 +92,7 @@ const
if (!parent.isValid()) if (!parent.isValid())
parentItem = _rootItem; parentItem = _rootItem;
else else
parentItem = static_cast<CSkeletonTreeItem*>(parent.internalPointer()); parentItem = static_cast<CSkeletonTreeItem *>(parent.internalPointer());
CSkeletonTreeItem *childItem = parentItem->child(row); CSkeletonTreeItem *childItem = parentItem->child(row);
if (childItem) if (childItem)
@ -106,7 +106,7 @@ QModelIndex CSkeletonTreeModel::parent(const QModelIndex &index) const
if (!index.isValid()) if (!index.isValid())
return QModelIndex(); return QModelIndex();
CSkeletonTreeItem *childItem = static_cast<CSkeletonTreeItem*>(index.internalPointer()); CSkeletonTreeItem *childItem = static_cast<CSkeletonTreeItem *>(index.internalPointer());
CSkeletonTreeItem *parentItem = childItem->parent(); CSkeletonTreeItem *parentItem = childItem->parent();
if (parentItem == _rootItem) if (parentItem == _rootItem)
@ -124,7 +124,7 @@ int CSkeletonTreeModel::rowCount(const QModelIndex &parent) const
if (!parent.isValid()) if (!parent.isValid())
parentItem = _rootItem; parentItem = _rootItem;
else else
parentItem = static_cast<CSkeletonTreeItem*>(parent.internalPointer()); parentItem = static_cast<CSkeletonTreeItem *>(parent.internalPointer());
return parentItem->childCount(); return parentItem->childCount();
} }
@ -151,7 +151,7 @@ void CSkeletonTreeModel::rebuildModel()
CSkeletonTreeItem *parentItem = _rootItem; CSkeletonTreeItem *parentItem = _rootItem;
for (uint i = 0; i < skel.getNumBones(); i++) for (uint i = 0; i < skel.getNumBones(); ++i)
{ {
NL3D::UBone bone = skel.getBone(i); NL3D::UBone bone = skel.getBone(i);
sint32 parentId = bone.getObjectPtr()->getFatherId(); sint32 parentId = bone.getObjectPtr()->getFatherId();
@ -182,12 +182,12 @@ void CSkeletonTreeModel::resetTreeModel()
QModelIndex CSkeletonTreeModel::getIndexFromId(sint id, const QModelIndex &parent) QModelIndex CSkeletonTreeModel::getIndexFromId(sint id, const QModelIndex &parent)
{ {
QModelIndex currentIndex = parent; QModelIndex currentIndex = parent;
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem*>(parent.internalPointer()); CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem *>(parent.internalPointer());
if (item->getId() != id) if (item->getId() != id)
for (int i = 0; i < item->childCount(); i++) for (int i = 0; i < item->childCount(); ++i)
{ {
currentIndex = getIndexFromId(id, index(i, 0, parent)); currentIndex = getIndexFromId(id, index(i, 0, parent));
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem*>(currentIndex.internalPointer()); CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem *>(currentIndex.internalPointer());
if (item->getId() == id) if (item->getId() == id)
return currentIndex; return currentIndex;
} }

View file

@ -76,7 +76,7 @@ public:
int row() const int row() const
{ {
if (_parentItem) if (_parentItem)
return _parentItem->_childItems.indexOf(const_cast<CSkeletonTreeItem*>(this)); return _parentItem->_childItems.indexOf(const_cast<CSkeletonTreeItem *>(this));
return 0; return 0;
} }
@ -91,7 +91,7 @@ public:
private: private:
QList<CSkeletonTreeItem*> _childItems; QList<CSkeletonTreeItem *> _childItems;
QList<QVariant> _itemData; QList<QVariant> _itemData;
sint32 _id; sint32 _id;
CSkeletonTreeItem *_parentItem; CSkeletonTreeItem *_parentItem;

View file

@ -33,7 +33,9 @@ namespace NLQT
CSlotGroupBox::CSlotGroupBox(QWidget *parent) CSlotGroupBox::CSlotGroupBox(QWidget *parent)
: QGroupBox(parent), : QGroupBox(parent),
_animName("empty"), _skelName("empty"), _numSlot(0) _animName("empty"),
_skelName("empty"),
_numSlot(0)
{ {
_ui.setupUi(this); _ui.setupUi(this);
@ -239,7 +241,7 @@ CSlotManagerDialog::CSlotManagerDialog(QWidget *parent)
_tabWidget->setObjectName(QString::fromUtf8("_tabWidget")); _tabWidget->setObjectName(QString::fromUtf8("_tabWidget"));
_tabWidget->setTabPosition(QTabWidget::East); _tabWidget->setTabPosition(QTabWidget::East);
for (int i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++) for (int i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; ++i)
{ {
_tabs[i] = new QWidget(); _tabs[i] = new QWidget();
_tabs[i]->setObjectName(QString::fromUtf8("_tab%1").arg(i)); _tabs[i]->setObjectName(QString::fromUtf8("_tab%1").arg(i));
@ -276,7 +278,7 @@ CSlotManagerDialog::~CSlotManagerDialog()
void CSlotManagerDialog::updateUiSlots() void CSlotManagerDialog::updateUiSlots()
{ {
for (int i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++) for (int i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; ++i)
{ {
_slotGroupBoxs[i]->updateUi(); _slotGroupBoxs[i]->updateUi();
} }

View file

@ -34,8 +34,8 @@ namespace NLQT
CSoundSystem::CSoundSystem() CSoundSystem::CSoundSystem()
:_AudioMixer(NULL), :_AudioMixer(NULL),
_AnimManager(NULL), _AnimManager(NULL),
_Zero(NLMISC::CVector::Null) _Zero(NLMISC::CVector::Null)
{ {
} }

View file

@ -106,7 +106,7 @@ public:
} }
/// Returns a reference to the animation manager /// Returns a reference to the animation manager
NLSOUND::CSoundAnimManager* getSoundAnimManager() NLSOUND::CSoundAnimManager *getSoundAnimManager()
{ {
return _AnimManager; return _AnimManager;
} }
@ -121,13 +121,13 @@ public:
void update(); void update();
private: private:
NLSOUND::UAudioMixer *_AudioMixer; NLSOUND::UAudioMixer *_AudioMixer;
std::set<std::string> _SampleBanksFileName; std::set<std::string> _SampleBanksFileName;
NLSOUND::CSoundAnimManager *_AnimManager; NLSOUND::CSoundAnimManager *_AnimManager;
NLMISC::CVector _Zero; NLMISC::CVector _Zero;
std::string _SamplePath; std::string _SamplePath;
std::string _PackedSheetPath; std::string _PackedSheetPath;
NLMISC::CMatrix oldMatrix; NLMISC::CMatrix oldMatrix;
}; /* class CSoundSystem */ }; /* class CSoundSystem */
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -24,7 +24,9 @@ namespace NLQT
{ {
CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent) CSpinnerDialog::CSpinnerDialog(NL3D::CPSBasisSpinner *sf, CWorkspaceNode *ownerNode, QWidget *parent)
: QDialog(parent), _Node(ownerNode), _BasicSpinner(sf) : QDialog(parent),
_Node(ownerNode),
_BasicSpinner(sf)
{ {
nlassert(_BasicSpinner); nlassert(_BasicSpinner);

View file

@ -57,7 +57,7 @@ private Q_SLOTS:
private: private:
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
NL3D::CPSTailParticle *_TailParticle; NL3D::CPSTailParticle *_TailParticle;
Ui::CTailParticleWidget _ui; Ui::CTailParticleWidget _ui;
}; /* class CTailParticleWidget */ }; /* class CTailParticleWidget */

View file

@ -58,7 +58,7 @@ CGradientDialog::CGradientDialog(CWorkspaceNode *ownerNode,
sizePolicy.setHeightForWidth(_listWidget->sizePolicy().hasHeightForWidth()); sizePolicy.setHeightForWidth(_listWidget->sizePolicy().hasHeightForWidth());
_listWidget->setSizePolicy(sizePolicy); _listWidget->setSizePolicy(sizePolicy);
//_listWidget->setIconSize(QSize(16, 16)); //_listWidget->setIconSize(QSize(16, 16));
_listWidget->setMaximumSize(QSize(175, 16777215)); _listWidget->setMaximumSize(QSize(185, 16777215));
_gridLayout->addWidget(_listWidget, 0, 0, 9, 1); _gridLayout->addWidget(_listWidget, 0, 0, 9, 1);
_horizontalLayout = new QHBoxLayout(); _horizontalLayout = new QHBoxLayout();

View file

@ -114,19 +114,19 @@ private Q_SLOTS:
protected: protected:
// the minimum number of element in the gradient // the minimum number of element in the gradient
uint _MinSize; uint _MinSize;
// false to disable the dialog that control the number of stages between each value // false to disable the dialog that control the number of stages between each value
bool _CanTuneNbStages; bool _CanTuneNbStages;
IValueGradientClient *_ClientInterface; IValueGradientClient *_ClientInterface;
bool _DestroyClientInterface; bool _DestroyClientInterface;
// the current size of the gradient // the current size of the gradient
uint _Size; uint _Size;
CWorkspaceNode *_Node; CWorkspaceNode *_Node;
// a wrapper to tune the number of step // a wrapper to tune the number of step
struct CNbStepWrapper :public IPSWrapperUInt struct CNbStepWrapper :public IPSWrapperUInt

View file

@ -114,7 +114,7 @@ void CVegetableApperancePage::setNoiseValueColor(const NLMISC::CNoiseValue &valu
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
} }
void CVegetableApperancePage::browseColor(QListWidgetItem * item) void CVegetableApperancePage::browseColor(QListWidgetItem *item)
{ {
sint row = _ui.listWidget->currentRow(); sint row = _ui.listWidget->currentRow();
@ -208,7 +208,7 @@ void CVegetableApperancePage::getFromListColors()
{ {
int i = items.indexOf(item); int i = items.indexOf(item);
NL3D::CVegetable *otherVegetable = Modules::veget().getVegetable(i)->Vegetable; NL3D::CVegetable *otherVegetable = Modules::veget().getVegetable(i)->_vegetable;
_Vegetable->Color.Gradients = otherVegetable->Color.Gradients; _Vegetable->Color.Gradients = otherVegetable->Color.Gradients;

View file

@ -51,7 +51,7 @@ private Q_SLOTS:
void setNoiseValueBendPhase(const NLMISC::CNoiseValue &value); void setNoiseValueBendPhase(const NLMISC::CNoiseValue &value);
void setNoiseValueBendFactor(const NLMISC::CNoiseValue &value); void setNoiseValueBendFactor(const NLMISC::CNoiseValue &value);
void setNoiseValueColor(const 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();
void removeColor(); void removeColor();
@ -61,7 +61,7 @@ private:
void updateColorList(); void updateColorList();
// The vegetable to edit. // The vegetable to edit.
NL3D::CVegetable *_Vegetable; NL3D::CVegetable *_Vegetable;
Ui::CVegetableApperancePage _ui; Ui::CVegetableApperancePage _ui;

View file

@ -50,7 +50,6 @@ CVegetableDensityPage::CVegetableDensityPage(QWidget *parent)
_ui.maxDensityWidget->setRange(0, NL_VEGETABLE_EDIT_DEFAULT_MAX_DENSITY); _ui.maxDensityWidget->setRange(0, NL_VEGETABLE_EDIT_DEFAULT_MAX_DENSITY);
_ui.maxDensityWidget->enableLowerBound(0, false); _ui.maxDensityWidget->enableLowerBound(0, false);
connect(_ui.browseShapePushButton, SIGNAL(clicked()), this, SLOT(browseShapeVeget())); connect(_ui.browseShapePushButton, SIGNAL(clicked()), this, SLOT(browseShapeVeget()));
connect(_ui.distanceSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setDistanceOfCreat(int))); connect(_ui.distanceSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setDistanceOfCreat(int)));
connect(_ui.densityGroupBox, SIGNAL(noiseValueChanged(NLMISC::CNoiseValue)), this, SLOT(setDensity(NLMISC::CNoiseValue))); connect(_ui.densityGroupBox, SIGNAL(noiseValueChanged(NLMISC::CNoiseValue)), this, SLOT(setDensity(NLMISC::CNoiseValue)));

View file

@ -65,7 +65,7 @@ private:
void updateAngleMax(); void updateAngleMax();
// The vegetable to edit. // The vegetable to edit.
NL3D::CVegetable *_Vegetable; NL3D::CVegetable *_Vegetable;
float _PrecMaxDensityValue; float _PrecMaxDensityValue;

View file

@ -151,7 +151,7 @@ void CVegetableDialog::addVegetList()
// update view // update view
QListWidgetItem *item = new QListWidgetItem(_ui.listWidget); QListWidgetItem *item = new QListWidgetItem(_ui.listWidget);
item->setText(QString(Modules::veget().getVegetable(id)->VegetableName.c_str())); item->setText(QString(Modules::veget().getVegetable(id)->_vegetableName.c_str()));
// update 3D view // update 3D view
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
@ -167,7 +167,7 @@ void CVegetableDialog::removeVegetList()
QListWidgetItem *item = _ui.listWidget->takeItem(id); QListWidgetItem *item = _ui.listWidget->takeItem(id);
delete item; delete item;
id--; --id;
_ui.listWidget->setCurrentRow(id); _ui.listWidget->setCurrentRow(id);
@ -185,7 +185,7 @@ void CVegetableDialog::insVegetList()
// update view // update view
QListWidgetItem *item = new QListWidgetItem(); QListWidgetItem *item = new QListWidgetItem();
item->setText(QString(Modules::veget().getVegetable(id)->VegetableName.c_str())); item->setText(QString(Modules::veget().getVegetable(id)->_vegetableName.c_str()));
_ui.listWidget->insertItem(id, item); _ui.listWidget->insertItem(id, item);
// update 3D view // update 3D view
@ -239,7 +239,7 @@ void CVegetableDialog::loadVegetdesc()
// update view // update view
QListWidgetItem *item = new QListWidgetItem(_ui.listWidget); QListWidgetItem *item = new QListWidgetItem(_ui.listWidget);
item->setText(QString(Modules::veget().getVegetable(id)->VegetableName.c_str())); item->setText(QString(Modules::veget().getVegetable(id)->_vegetableName.c_str()));
// update 3D view // update 3D view
Modules::veget().refreshVegetableDisplay(); Modules::veget().refreshVegetableDisplay();
@ -261,7 +261,7 @@ void CVegetableDialog::saveVegetdesc()
CVegetableNode *vegetNode = Modules::veget().getVegetable(id); CVegetableNode *vegetNode = Modules::veget().getVegetable(id);
QString oldFileName = QString(vegetNode->VegetableName.c_str()) + ".vegetdesc"; QString oldFileName = QString(vegetNode->_vegetableName.c_str()) + ".vegetdesc";
// Then try to save it. // Then try to save it.
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Vegetable Descriptor"), QString fileName = QFileDialog::getSaveFileName(this, tr("Save Vegetable Descriptor"),
@ -277,7 +277,7 @@ void CVegetableDialog::saveVegetdesc()
try try
{ {
// save the vegetable // save the vegetable
f.serial(*vegetNode->Vegetable); f.serial(*vegetNode->_vegetable);
} }
catch(NLMISC::EStream &e) catch(NLMISC::EStream &e)
{ {
@ -299,7 +299,7 @@ void CVegetableDialog::setCurrentItem(int row)
{ {
NL3D::CVegetable *veget = NULL; NL3D::CVegetable *veget = NULL;
if (row != -1) if (row != -1)
veget = Modules::veget().getVegetable(row)->Vegetable; veget = Modules::veget().getVegetable(row)->_vegetable;
_ui.densityPage->setVegetableToEdit(veget); _ui.densityPage->setVegetableToEdit(veget);
_ui.appearancePage->setVegetableToEdit(veget); _ui.appearancePage->setVegetableToEdit(veget);
_ui.scalePage->setVegetableToEdit(veget); _ui.scalePage->setVegetableToEdit(veget);

View file

@ -60,10 +60,10 @@ void CVegetableEditor::init()
//H_AUTO2 //H_AUTO2
nldebug("CVegetableEditor::init"); nldebug("CVegetableEditor::init");
NL3D::CDriverUser *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver()); NL3D::CDriverUser *driver = dynamic_cast<NL3D::CDriverUser *>(Modules::objView().getDriver());
_Driver = driver->getDriver(); _Driver = driver->getDriver();
NL3D::CSceneUser *scene = dynamic_cast<NL3D::CSceneUser*>(Modules::objView().getScene()); NL3D::CSceneUser *scene = dynamic_cast<NL3D::CSceneUser *>(Modules::objView().getScene());
_Scene = &scene->getScene(); _Scene = &scene->getScene();
} }
@ -101,7 +101,7 @@ bool CVegetableEditor::createVegetableLandscape()
loadLandscapeSetup(); loadLandscapeSetup();
// create the landscape. // create the landscape.
_VegetableLandscape= static_cast<NL3D::CLandscapeModel*>(Modules::veget().getScene()->createModel(NL3D::LandscapeModelId)); _VegetableLandscape= static_cast<NL3D::CLandscapeModel *>(Modules::veget().getScene()->createModel(NL3D::LandscapeModelId));
// create progress dialog // create progress dialog
QProgressDialog progress("Loading TileBanks....", "Cancel", 0, 100); QProgressDialog progress("Loading TileBanks....", "Cancel", 0, 100);
@ -143,7 +143,7 @@ bool CVegetableEditor::createVegetableLandscape()
// count nbText to load. // count nbText to load.
sint ts; sint ts;
sint nbTextTotal = 0; sint nbTextTotal = 0;
for (ts=0; ts < _VegetableLandscape->Landscape.TileBank.getTileSetCount (); ts++) for (ts=0; ts < _VegetableLandscape->Landscape.TileBank.getTileSetCount (); ++ts)
{ {
NL3D::CTileSet *tileSet =_VegetableLandscape->Landscape.TileBank.getTileSet (ts); NL3D::CTileSet *tileSet =_VegetableLandscape->Landscape.TileBank.getTileSet (ts);
nbTextTotal += tileSet->getNumTile128(); nbTextTotal += tileSet->getNumTile128();
@ -153,7 +153,7 @@ bool CVegetableEditor::createVegetableLandscape()
// load. // load.
sint nbTextDone= 0; sint nbTextDone= 0;
for (ts=0; ts < _VegetableLandscape->Landscape.TileBank.getTileSetCount (); ts++) for (ts=0; ts < _VegetableLandscape->Landscape.TileBank.getTileSetCount (); ++ts)
{ {
NL3D::CTileSet *tileSet=_VegetableLandscape->Landscape.TileBank.getTileSet (ts); NL3D::CTileSet *tileSet=_VegetableLandscape->Landscape.TileBank.getTileSet (ts);
sint tl; sint tl;
@ -299,7 +299,7 @@ void CVegetableEditor::refreshVegetableLandscape(const NL3D::CTileVegetableDesc
_VegetableLandscape->Landscape.enableVegetable(false); _VegetableLandscape->Landscape.enableVegetable(false);
// Then change all the tileSet of all the TileBanks. // Then change all the tileSet of all the TileBanks.
for (sint ts=0; ts<_VegetableLandscape->Landscape.TileBank.getTileSetCount (); ts++) for (sint ts=0; ts<_VegetableLandscape->Landscape.TileBank.getTileSetCount (); ++ts)
{ {
NL3D::CTileSet *tileSet=_VegetableLandscape->Landscape.TileBank.getTileSet (ts); NL3D::CTileSet *tileSet=_VegetableLandscape->Landscape.TileBank.getTileSet (ts);
// change the vegetableTileDesc of this tileSet. // change the vegetableTileDesc of this tileSet.
@ -315,21 +315,30 @@ void CVegetableEditor::setVegetableWindPower(float w)
{ {
_VegetableWindPower= w; _VegetableWindPower= w;
if(_VegetableLandscape) if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin); _VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq,
_VegetableWindPower,
_VegetableWindBendMin);
} }
void CVegetableEditor::setVegetableWindBendStart(float w) void CVegetableEditor::setVegetableWindBendStart(float w)
{ {
_VegetableWindBendMin= w; _VegetableWindBendMin= w;
if(_VegetableLandscape) if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin); _VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq,
_VegetableWindPower,
_VegetableWindBendMin);
} }
void CVegetableEditor::setVegetableWindFrequency(float w) void CVegetableEditor::setVegetableWindFrequency(float w)
{ {
_VegetableWindFreq= w; _VegetableWindFreq= w;
if(_VegetableLandscape) if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin); _VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq,
_VegetableWindPower,
_VegetableWindBendMin);
} }
void CVegetableEditor::snapToGroundVegetableLandscape(bool enable) void CVegetableEditor::snapToGroundVegetableLandscape(bool enable)
@ -379,7 +388,7 @@ void CVegetableEditor::getListVegetables(std::vector<std::string> &listVeget)
{ {
listVeget.clear(); listVeget.clear();
for (size_t i = 0; i < _Vegetables.size(); i++) for (size_t i = 0; i < _Vegetables.size(); i++)
listVeget.push_back(_Vegetables[i].VegetableName); listVeget.push_back(_Vegetables[i]._vegetableName);
} }
bool CVegetableEditor::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, std::string fileName) bool CVegetableEditor::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, std::string fileName)
@ -416,16 +425,16 @@ void CVegetableEditor::buildVegetableSet(NL3D::CTileVegetableDesc &vegetSet, boo
// build the list. // build the list.
std::vector<NL3D::CVegetable> vegetables; std::vector<NL3D::CVegetable> vegetables;
for(uint i = 0; i < _Vegetables.size(); i++) for(uint i = 0; i < _Vegetables.size(); ++i)
{ {
// if don't want to keep <default> ShapeNames, skip them. // if don't want to keep <default> ShapeNames, skip them.
if(!keepDefaultShapeName && _Vegetables[i].Vegetable->ShapeName == "") if(!keepDefaultShapeName && _Vegetables[i]._vegetable->ShapeName == "")
continue; continue;
// if don't want to keep hiden vegetables, skip them. // if don't want to keep hiden vegetables, skip them.
if(!keepHiden && !_Vegetables[i].Visible) if(!keepHiden && !_Vegetables[i]._visible)
continue; continue;
vegetables.push_back(*_Vegetables[i].Vegetable); vegetables.push_back(*_Vegetables[i]._vegetable);
// get dst index. // get dst index.
uint dstId= (uint)vegetables.size()-1; uint dstId= (uint)vegetables.size()-1;
// transform degrees in radians. // transform degrees in radians.
@ -446,13 +455,13 @@ void CVegetableEditor::appendVegetableSet(NL3D::CTileVegetableDesc &vegetSet)
float radToDeg = (float)(180.f / NLMISC::Pi); float radToDeg = (float)(180.f / NLMISC::Pi);
// for all distances Types. // for all distances Types.
for(uint distType = 0; distType < NL3D_VEGETABLE_BLOCK_NUMDIST; distType++) for(uint distType = 0; distType < NL3D_VEGETABLE_BLOCK_NUMDIST; ++distType)
{ {
// retrieve list of vegetable // retrieve list of vegetable
const std::vector<NL3D::CVegetable> &vegetList = vegetSet.getVegetableList(distType); const std::vector<NL3D::CVegetable> &vegetList = vegetSet.getVegetableList(distType);
// for all of them // for all of them
for(uint i = 0; i < vegetList.size(); i++) for(uint i = 0; i < vegetList.size(); ++i)
{ {
// append the vegetable to the list. // append the vegetable to the list.
NL3D::CVegetable veget = vegetList[i]; NL3D::CVegetable veget = vegetList[i];

View file

@ -113,7 +113,6 @@ public:
~CVegetableEditor(void); ~CVegetableEditor(void);
void init(); void init();
void release(); void release();
/// @name Landscape control /// @name Landscape control
@ -228,47 +227,45 @@ public:
private: private:
void loadConfig(); void loadConfig();
void loadLandscapeSetup(); void loadLandscapeSetup();
void saveConfig(); void saveConfig();
NL3D::CLandscapeModel *_VegetableLandscape; NL3D::CLandscapeModel *_VegetableLandscape;
// File info to build it // File info to build it
std::string _VegetableLandscapeTileBank; std::string _VegetableLandscapeTileBank;
std::string _VegetableLandscapeTileFarBank; std::string _VegetableLandscapeTileFarBank;
std::vector<std::string> _VegetableLandscapeZoneNames; std::vector<std::string> _VegetableLandscapeZoneNames;
// Misc. // Misc.
float _VegetableLandscapeThreshold; float _VegetableLandscapeThreshold;
float _VegetableLandscapeTileNear; float _VegetableLandscapeTileNear;
float _VegetableLandscapeMultiply; float _VegetableLandscapeMultiply;
NLMISC::CRGBA _VegetableLandscapeAmbient; NLMISC::CRGBA _VegetableLandscapeAmbient;
NLMISC::CRGBA _VegetableLandscapeDiffuse; NLMISC::CRGBA _VegetableLandscapeDiffuse;
std::string _VegetableTexture; std::string _VegetableTexture;
NLMISC::CRGBA _VegetableAmbient; NLMISC::CRGBA _VegetableAmbient;
NLMISC::CRGBA _VegetableDiffuse; NLMISC::CRGBA _VegetableDiffuse;
NLMISC::CVector _VegetableLightDir; NLMISC::CVector _VegetableLightDir;
// Vegetable wind. // Vegetable wind.
NLMISC::CVector _VegetableWindDir; NLMISC::CVector _VegetableWindDir;
float _VegetableWindFreq; float _VegetableWindFreq;
float _VegetableWindPower; float _VegetableWindPower;
float _VegetableWindBendMin; float _VegetableWindBendMin;
bool _VegetableEnabled; bool _VegetableEnabled;
// Collision // Collision
bool _VegetableSnapToGround; bool _VegetableSnapToGround;
float _VegetableSnapHeight; float _VegetableSnapHeight;
NL3D::CVisualCollisionManager *_VegetableCollisionManager; NL3D::CVisualCollisionManager *_VegetableCollisionManager;
NL3D::CVisualCollisionEntity *_VegetableCollisionEntity; NL3D::CVisualCollisionEntity *_VegetableCollisionEntity;
// The vegetable List. // The vegetable List.
std::vector<CVegetableNode> _Vegetables; std::vector<CVegetableNode> _Vegetables;
NL3D::IDriver *_Driver; NL3D::IDriver *_Driver;
NL3D::CScene *_Scene; NL3D::CScene *_Scene;
}; /* class CVegetableEditor */ }; /* class CVegetableEditor */

View file

@ -23,9 +23,9 @@
// Project includes // Project includes
#include "modules.h" #include "modules.h"
#define NL_VEGETABLE_EDIT_WIND_MAX_POWER 10.f #define NL_VEGETABLE_EDIT_WIND_MAX_POWER 10.f
#define NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY 10.f #define NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY 10.f
#define NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART 1.f #define NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART 1.f
namespace NLQT namespace NLQT
{ {

View file

@ -54,7 +54,6 @@ private Q_SLOTS:
private: private:
Ui::CVegetableLandscapePage _ui; Ui::CVegetableLandscapePage _ui;
}; /* class CVegetableLandscapePage */ }; /* class CVegetableLandscapePage */
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -29,14 +29,14 @@ static const char *NL_DefaultVegetName= "<default>";
CVegetableNode::CVegetableNode(void) CVegetableNode::CVegetableNode(void)
{ {
Vegetable = NULL; _vegetable = NULL;
VegetableName = NL_DefaultVegetName; _vegetableName = NL_DefaultVegetName;
Visible = true; _visible = true;
} }
void CVegetableNode::initDefaultVegetable() void CVegetableNode::initDefaultVegetable()
{ {
Vegetable= new NL3D::CVegetable; _vegetable = new NL3D::CVegetable;
// update vegetableName according to Vegetable // update vegetableName according to Vegetable
updateVegetableName(); updateVegetableName();
@ -44,59 +44,59 @@ void CVegetableNode::initDefaultVegetable()
// General/Density. // General/Density.
// Density. // Density.
Vegetable->Density.Abs = NL_VEGETABLE_DENSITY_ABS_DEFAULT; _vegetable->Density.Abs = NL_VEGETABLE_DENSITY_ABS_DEFAULT;
Vegetable->Density.Rand = NL_VEGETABLE_DENSITY_RAND_DEFAULT; _vegetable->Density.Rand = NL_VEGETABLE_DENSITY_RAND_DEFAULT;
Vegetable->Density.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->Density.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// disable MaxDensity // disable MaxDensity
Vegetable->MaxDensity = -1; _vegetable->MaxDensity = -1;
// Leave ShapeName to "" // Leave ShapeName to ""
// Default DistType is always 0. // Default DistType is always 0.
Vegetable->DistType = 0; _vegetable->DistType = 0;
// Apperance // Apperance
// BendPhase // BendPhase
Vegetable->BendPhase.Abs = NL_VEGETABLE_BENDPHASE_ABS_DEFAULT; _vegetable->BendPhase.Abs = NL_VEGETABLE_BENDPHASE_ABS_DEFAULT;
Vegetable->BendPhase.Rand = NL_VEGETABLE_BENDPHASE_RAND_DEFAULT; _vegetable->BendPhase.Rand = NL_VEGETABLE_BENDPHASE_RAND_DEFAULT;
Vegetable->BendPhase.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->BendPhase.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// BendFactor // BendFactor
Vegetable->BendFactor.Abs = NL_VEGETABLE_BENDFACTOR_ABS_DEFAULT; _vegetable->BendFactor.Abs = NL_VEGETABLE_BENDFACTOR_ABS_DEFAULT;
Vegetable->BendFactor.Rand = NL_VEGETABLE_BENDFACTOR_RAND_DEFAULT; _vegetable->BendFactor.Rand = NL_VEGETABLE_BENDFACTOR_RAND_DEFAULT;
Vegetable->BendFactor.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->BendFactor.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// Color // Color
Vegetable->Color.NoiseValue.Abs = NL_VEGETABLE_COLOR_ABS_DEFAULT; _vegetable->Color.NoiseValue.Abs = NL_VEGETABLE_COLOR_ABS_DEFAULT;
Vegetable->Color.NoiseValue.Rand = NL_VEGETABLE_COLOR_RAND_DEFAULT; _vegetable->Color.NoiseValue.Rand = NL_VEGETABLE_COLOR_RAND_DEFAULT;
Vegetable->Color.NoiseValue.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->Color.NoiseValue.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// Scale // Scale
// ScaleXY // ScaleXY
Vegetable->Sxy.Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT; _vegetable->Sxy.Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT;
Vegetable->Sxy.Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT; _vegetable->Sxy.Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT;
Vegetable->Sxy.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->Sxy.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// ScaleZ. // ScaleZ.
Vegetable->Sz.Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT; _vegetable->Sz.Abs = NL_VEGETABLE_SCALE_ABS_DEFAULT;
Vegetable->Sz.Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT; _vegetable->Sz.Rand = NL_VEGETABLE_SCALE_RAND_DEFAULT;
Vegetable->Sz.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->Sz.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// Rotate // Rotate
// RotateX // RotateX
Vegetable->Rx.Abs = NL_VEGETABLE_ROTATEX_ABS_DEFAULT; _vegetable->Rx.Abs = NL_VEGETABLE_ROTATEX_ABS_DEFAULT;
Vegetable->Rx.Rand = NL_VEGETABLE_ROTATEX_RAND_DEFAULT; _vegetable->Rx.Rand = NL_VEGETABLE_ROTATEX_RAND_DEFAULT;
Vegetable->Rx.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->Rx.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// RotateY // RotateY
Vegetable->Ry.Abs = NL_VEGETABLE_ROTATEY_ABS_DEFAULT; _vegetable->Ry.Abs = NL_VEGETABLE_ROTATEY_ABS_DEFAULT;
Vegetable->Ry.Rand = NL_VEGETABLE_ROTATEY_RAND_DEFAULT; _vegetable->Ry.Rand = NL_VEGETABLE_ROTATEY_RAND_DEFAULT;
Vegetable->Ry.Frequency = NL_VEGETABLE_FREQ_DEFAULT; _vegetable->Ry.Frequency = NL_VEGETABLE_FREQ_DEFAULT;
// RotateZ // RotateZ
Vegetable->Rz.Abs = NL_VEGETABLE_ROTATEZ_ABS_DEFAULT; _vegetable->Rz.Abs = NL_VEGETABLE_ROTATEZ_ABS_DEFAULT;
Vegetable->Rz.Rand = NL_VEGETABLE_ROTATEZ_RAND_DEFAULT; _vegetable->Rz.Rand = NL_VEGETABLE_ROTATEZ_RAND_DEFAULT;
Vegetable->Rz.Frequency = NL_VEGETABLE_ROTATEZ_FREQ_DEFAULT; _vegetable->Rz.Frequency = NL_VEGETABLE_ROTATEZ_FREQ_DEFAULT;
} }
void CVegetableNode::initVegetable(const NL3D::CVegetable &vegetable) void CVegetableNode::initVegetable(const NL3D::CVegetable &vegetable)
{ {
Vegetable = new NL3D::CVegetable(vegetable); _vegetable = new NL3D::CVegetable(vegetable);
// update vegetableName according to Vegetable // update vegetableName according to Vegetable
updateVegetableName(); updateVegetableName();
} }
@ -105,27 +105,27 @@ void CVegetableNode::initVegetable(const NL3D::CVegetable &vegetable)
void CVegetableNode::updateVegetableName() void CVegetableNode::updateVegetableName()
{ {
// Build the vegetable Name according to the ShapeName // Build the vegetable Name according to the ShapeName
if(Vegetable->ShapeName == "") if(_vegetable->ShapeName == "")
{ {
VegetableName = NL_DefaultVegetName; _vegetableName = NL_DefaultVegetName;
} }
else else
{ {
std::string::size_type pos = Vegetable->ShapeName.find(".veget"); std::string::size_type pos = _vegetable->ShapeName.find(".veget");
VegetableName= Vegetable->ShapeName.substr(0, pos); _vegetableName = _vegetable->ShapeName.substr(0, pos);
// And (to be clearer) append distance of creation. // And (to be clearer) append distance of creation.
char str[256]; char str[256];
sprintf(str, " - %dm", (Vegetable->DistType + 1) * 10); sprintf(str, " - %dm", (_vegetable->DistType + 1) * 10);
VegetableName += str; _vegetableName += str;
// NB: if you add info with other parameters, you must use updateCurSelVegetableName() if they change // NB: if you add info with other parameters, you must use updateCurSelVegetableName() if they change
} }
} }
void CVegetableNode::deleteVegetable() void CVegetableNode::deleteVegetable()
{ {
delete Vegetable; delete _vegetable;
Vegetable = NULL; _vegetable = NULL;
VegetableName = NL_DefaultVegetName; _vegetableName = NL_DefaultVegetName;
} }
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -47,13 +47,13 @@ public:
void deleteVegetable(); void deleteVegetable();
// The vegetable // The vegetable
NL3D::CVegetable *Vegetable; NL3D::CVegetable *_vegetable;
// The name of this vegetable. // The name of this vegetable.
std::string VegetableName; std::string _vegetableName;
// Visibility. Editor feature only // Visibility. Editor feature only
bool Visible; bool _visible;
}; /* class CVegetableNode */ }; /* class CVegetableNode */

View file

@ -23,13 +23,14 @@
// NeL includes // NeL includes
#define NL_VEGETABLE_EDIT_SLIDER_NVS_SIZE_THRESHOLD 0.03f #define NL_VEGETABLE_EDIT_SLIDER_NVS_SIZE_THRESHOLD 0.03f
#define NL_VEGETABLE_EDIT_SLIDER_NVS_SCALE 3.0f #define NL_VEGETABLE_EDIT_SLIDER_NVS_SCALE 3.0f
namespace NLQT namespace NLQT
{ {
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent) CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
: QGroupBox(parent), _emit(true) : QGroupBox(parent),
_emit(true)
{ {
_ui.setupUi(this); _ui.setupUi(this);

View file

@ -40,8 +40,6 @@ public:
CVegetNoiseValueWidget(QWidget *parent = 0); CVegetNoiseValueWidget(QWidget *parent = 0);
~CVegetNoiseValueWidget(); ~CVegetNoiseValueWidget();
void setNoiseValue(const NLMISC::CNoiseValue &value, bool emit = true);
void setDefaultRangeAbs(float defRangeMin, float defRangeMax); void setDefaultRangeAbs(float defRangeMin, float defRangeMax);
void setDefaultRangeRand(float defRangeMin, float defRangeMax); void setDefaultRangeRand(float defRangeMin, float defRangeMax);
void setDefaultRangeFreq(float defRangeMin, float defRangeMax); void setDefaultRangeFreq(float defRangeMin, float defRangeMax);
@ -49,6 +47,9 @@ public:
Q_SIGNALS: Q_SIGNALS:
void noiseValueChanged(const NLMISC::CNoiseValue &value); void noiseValueChanged(const NLMISC::CNoiseValue &value);
public Q_SLOTS:
void setNoiseValue(const NLMISC::CNoiseValue &value, bool emit = true);
private Q_SLOTS: private Q_SLOTS:
void setSlider(int value); void setSlider(int value);
void sliderReleased(); void sliderReleased();

View file

@ -55,7 +55,7 @@ private Q_SLOTS:
private: private:
// The vegetable to edit. // The vegetable to edit.
NL3D::CVegetable *_Vegetable; NL3D::CVegetable *_Vegetable;
Ui::CVegetableRotatePage _ui; Ui::CVegetableRotatePage _ui;

View file

@ -55,7 +55,7 @@ private Q_SLOTS:
private: private:
// The vegetable to edit. // The vegetable to edit.
NL3D::CVegetable *_Vegetable; NL3D::CVegetable *_Vegetable;
Ui::CVegetableScalePage _ui; Ui::CVegetableScalePage _ui;