Changed: #1193 Code cleanup.

This commit is contained in:
dnk-88 2010-12-04 14:03:31 +02:00
parent 623ec55753
commit 5dc9ff7b51
84 changed files with 510 additions and 453 deletions

View file

@ -88,7 +88,7 @@ void CAnimationSetDialog::updateListObject()
std::vector<std::string> 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()));
if (listObjects.empty())

View file

@ -49,7 +49,8 @@ CAttribWidget::CAttribWidget(QWidget *parent)
_EnableConstantValue(true),
_DisableMemoryScheme(false),
_NbCycleEnabled(true),
_Node(NULL), _SchemeWidget(NULL)
_Node(NULL),
_SchemeWidget(NULL)
{
_ui.setupUi(this);
_ui.constRangeUIntWidget->hide();

View file

@ -32,30 +32,25 @@ namespace NLQT
{
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
: QDialog(parent), _Node(ownerNode), _PS(ps)
: QDialog(parent),
_Node(ownerNode),
_PS(ps)
{
_ui.setupUi(this);
setFixedHeight(sizeHint().height());
_DistRatioWrapper.PS = _PS;
_MaxDistLODBiasWrapper.PS = _PS;
_DistRatioWrapper.OwnerNode = _Node;
_MaxDistLODBiasWrapper.OwnerNode = _Node;
// Edit the distance at which LOD starts
_ui.startPercentDistWidget->setRange(0.f, 0.99f);
_ui.startPercentDistWidget->enableUpperBound(1.f, true);
_ui.startPercentDistWidget->enableLowerBound(0.f, false);
_ui.startPercentDistWidget->setWrapper(&_DistRatioWrapper);
_ui.startPercentDistWidget->updateUi();
_ui.startPercentDistWidget->setValue(_PS->getAutoLODStartDistPercent());
// 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->enableUpperBound(1.f, false);
_ui.maxDistBiasWidget->enableLowerBound(0.f, false);
_ui.maxDistBiasWidget->setWrapper(&_MaxDistLODBiasWrapper);
_ui.maxDistBiasWidget->updateUi();
_ui.maxDistBiasWidget->setValue(_PS->getMaxDistLODBias());
if (_PS->isSharingEnabled())
{
@ -86,4 +81,16 @@ void CAutoLODDialog::setSkipParticles(bool 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 */

View file

@ -47,37 +47,13 @@ private Q_SLOTS:
void setDegradationExponent(int value);
void setSkipParticles(bool state);
void setDistRatio(float value);
void setMaxDistLODBias(float value);
private:
CWorkspaceNode *_Node;
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;
}; /* class CAutoLODDialog */

View file

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

View file

@ -31,7 +31,9 @@ namespace NLQT
{
CColorEditWidget::CColorEditWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL), _emit(true)
: QWidget(parent),
_Wrapper(NULL),
_emit(true)
{
_ui.setupUi(this);
@ -77,15 +79,23 @@ void CColorEditWidget::updateUi()
_ui.gSpinBox->setValue(_Wrapper->get().G);
_ui.bSpinBox->setValue(_Wrapper->get().B);
_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)
{
_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)
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)
return;
@ -102,10 +112,16 @@ void CColorEditWidget::setRed(int r)
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)
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;
@ -120,10 +136,16 @@ void CColorEditWidget::setGreen(int g)
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)
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;
@ -138,10 +160,16 @@ void CColorEditWidget::setBlue(int b)
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)
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;

View file

@ -201,7 +201,8 @@ CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaul
{
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);
}
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

@ -27,7 +27,11 @@ namespace NLQT
{
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);
@ -90,7 +94,7 @@ void CurveEditDialog::curveChanged(const QPolygonF &points)
_Curve->removeCtrlPoint(0);
else if (_Curve->getNumCtrlPoints() < uint(points.size()))
_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(),
(_ui.curveWidget->height() - points.at(i).y() + _pos) / (_ui.curveWidget->height() * _scale)));
}
@ -146,7 +150,7 @@ void CurveEditDialog::setNumSamples(uint32 value)
void CurveEditDialog::buildPoints()
{
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()),
_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();
/// the scheme being edited
NL3D::CPSFloatCurveFunctor *_Curve;
private Q_SLOTS:
void setSmoothing(bool state);
void setDisplayInterpolation(bool state);
@ -74,8 +71,10 @@ protected:
CWorkspaceNode *_Node;
HoverPoints *_hoverPoints;
/// the scheme being edited
NL3D::CPSFloatCurveFunctor *_Curve;
HoverPoints *_hoverPoints;
Ui::CurveEditDialog _ui;
}; /* CurveEditDialog */

View file

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

View file

@ -58,7 +58,6 @@ CEmitterPage::CEmitterPage(QWidget *parent)
// SPEED_INHERITANCE_FACTOR
_ui.speedInherFactorWidget->setRange(-1.f, 1.f);
//_ui.speedInherFactorWidget->setWrapper(&_SpeedInheritanceFactorWrapper);
// DELAYED_EMISSION
_ui.delayedEmissionWidget->setRange(0.f, 10.f);

View file

@ -43,6 +43,22 @@ using namespace NL3D;
namespace NLQT
{
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)
@ -63,11 +79,16 @@ CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
return *this;
}
CEntity::CEntity(void):
_Name("<Unknown>"), _FileNameShape(""),
_FileNameSkeleton(""), _inPlace(false), _incPos(false),
_Instance(NULL), _Skeleton(NULL),
_PlayList(NULL), _AnimationSet(NULL)
CEntity::CEntity(void)
: _Name("<Unknown>"),
_FileNameShape(""),
_FileNameSkeleton(""),
_inPlace(false),
_incPos(false),
_Instance(NULL),
_Skeleton(NULL),
_PlayList(NULL),
_AnimationSet(NULL)
{
_CharacterScalePos = 1;
}
@ -188,7 +209,7 @@ void CEntity::update(NL3D::TAnimationTime time)
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);
}
@ -386,7 +407,7 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
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)
{

View file

@ -48,13 +48,7 @@ namespace NLQT
class CSlotInfo
{
public:
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();
std::string Animation;
std::string Skeleton;
@ -104,8 +98,8 @@ public:
float SpeedAnim;
int Mode;
SAnimationStatus():
LoopAnim(false), PlayAnim(false),
SAnimationStatus()
: LoopAnim(false), PlayAnim(false),
CurrentTimeAnim(0), StartAnim(0),
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
};

View file

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

View file

@ -32,8 +32,6 @@ CGlobalWindDialog::CGlobalWindDialog(QWidget *parent)
{
_ui.setupUi(this);
//_ui.directionWidget->setWrapper(&_DirectionWrapper);
connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setWndPower(int)));
connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(updateWnd(bool)));
}
@ -55,17 +53,6 @@ void CGlobalWindDialog::updateWnd(bool visible)
return;
_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 */

View file

@ -44,12 +44,6 @@ private Q_SLOTS:
void updateWnd(bool visible);
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;

View file

@ -117,7 +117,7 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
}
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)),
int((height() / 2.0) * (1 - _verts[k - 1].y)),

View file

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

View file

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

View file

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

View file

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

View file

@ -22,7 +22,6 @@
#include "ui_multi_tex_form.h"
// STL includes
// Qt includes

View file

@ -54,11 +54,13 @@ namespace NLQT
{
CObjectViewer::CObjectViewer()
: _Driver(NULL), _TextContext(NULL),
: _Driver(NULL),
_TextContext(NULL),
_phi(0), _psi(0),_dist(20),
_CameraFocal(75),
_CurrentInstance(""),
_BloomEffect(false), _Scene(0)
_BloomEffect(false),
_Scene(0)
{
}

View file

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

View file

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

View file

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

View file

@ -373,7 +373,7 @@ bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QM
if (node->isLoaded())
{
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));
insertRows(loc, k, indexPS);
@ -456,12 +456,12 @@ void CParticleTreeModel::rebuildLocatedInstance(const QModelIndex &parent)
{
CParticleTreeItem *item = static_cast<CParticleTreeItem *>(parent.internalPointer());
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)
{
item->child(i)->setLocatedInstanceIndex(k);
k++;
++k;
}
}
}
@ -491,7 +491,7 @@ void CParticleTreeModel::setupModelFromWorkSpace()
QModelIndex rootIndex = index(0, 0);
uint numNode = workspace->getNumNode();
for (uint i = 0; i < numNode; i++)
for (uint i = 0; i < numNode; ++i)
insertRows(workspace->getNode(i), i, rootIndex);
}

View file

@ -123,7 +123,8 @@ struct Action
static std::map<std::string, uint> _PSElementIdentifiers;
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
: QDockWidget(parent), _currentItem(NULL)
: QDockWidget(parent),
_currentItem(NULL)
{
_ui.setupUi(this);

View file

@ -36,7 +36,8 @@ namespace NLQT
/**
@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
{

View file

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

View file

@ -20,7 +20,6 @@
#ifndef PS_MOVER_PAGE_H
#define PS_MOVER_PAGE_H
#include <nel/misc/types_nl.h>
#include "ui_ps_mover_form.h"

View file

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

View file

@ -208,7 +208,7 @@ void CSkeletonScaleDialog::clickMirrorSelected()
// for each bone selected
bool change= false;
for(uint i=0; i<_Bones.size(); i++)
for(uint i=0; i < _Bones.size(); ++i)
{
CBoneMirror &bone= _Bones[i];
if(bone.Selected)
@ -468,7 +468,7 @@ void CSkeletonScaleDialog::applyMirrorToSkeleton()
if(!_Skeleton.empty())
{
nlassert(_Skeleton.getNumBones() == _Bones.size());
for(uint i = 0; i < _Bones.size(); i++)
for(uint i = 0; i < _Bones.size(); ++i)
{
// unmul from precision
NLMISC::CVector boneScale = _Bones[i].BoneScale / ssd_scale_precision;
@ -484,7 +484,7 @@ void CSkeletonScaleDialog::applySkeletonToMirror()
if(!_Skeleton.empty())
{
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
_Bones[i].SkinScale = _Skeleton.getBone(i).getSkinScale() * ssd_scale_precision;
@ -517,7 +517,7 @@ void CSkeletonScaleDialog::applySelectionToView()
{
_ui.treeView->blockSignals(true);
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)
_ui.treeView->setCurrentIndex(model->getIndexFromId(i, model->index(0, 0)));
@ -615,7 +615,7 @@ bool CSkeletonScaleDialog::saveSkelScaleInStream(NLMISC::IStream &f)
// Copies bone scales from the model
std::vector<CBoneScaleInfo> boneScales;
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();
CBoneScaleInfo &boneScale= boneScales[i];
@ -651,7 +651,7 @@ bool CSkeletonScaleDialog::loadSkelScaleFromStream(NLMISC::IStream &f)
f.serialCont(boneScales);
// 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);
if(boneId >= 0 && boneId < (sint32)_Skeleton.getNumBones())
@ -689,7 +689,7 @@ void CSkeletonScaleDialog::pushUndoState(const TBoneMirrorArray &precState, bool
// test if real change
nlassert(precState.size() == _Bones.size());
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 ||
_Bones[i].SkinScale!=precState[i].SkinScale ||

View file

@ -151,7 +151,7 @@ void CSkeletonTreeModel::rebuildModel()
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);
sint32 parentId = bone.getObjectPtr()->getFatherId();
@ -184,7 +184,7 @@ QModelIndex CSkeletonTreeModel::getIndexFromId(sint id, const QModelIndex &paren
QModelIndex currentIndex = parent;
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem *>(parent.internalPointer());
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));
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem *>(currentIndex.internalPointer());

View file

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

View file

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

View file

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

View file

@ -208,7 +208,7 @@ void CVegetableApperancePage::getFromListColors()
{
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;

View file

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

View file

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

View file

@ -143,7 +143,7 @@ bool CVegetableEditor::createVegetableLandscape()
// count nbText to load.
sint ts;
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);
nbTextTotal += tileSet->getNumTile128();
@ -153,7 +153,7 @@ bool CVegetableEditor::createVegetableLandscape()
// load.
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);
sint tl;
@ -299,7 +299,7 @@ void CVegetableEditor::refreshVegetableLandscape(const NL3D::CTileVegetableDesc
_VegetableLandscape->Landscape.enableVegetable(false);
// 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);
// change the vegetableTileDesc of this tileSet.
@ -315,21 +315,30 @@ void CVegetableEditor::setVegetableWindPower(float w)
{
_VegetableWindPower= w;
if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin);
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq,
_VegetableWindPower,
_VegetableWindBendMin);
}
void CVegetableEditor::setVegetableWindBendStart(float w)
{
_VegetableWindBendMin= w;
if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin);
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq,
_VegetableWindPower,
_VegetableWindBendMin);
}
void CVegetableEditor::setVegetableWindFrequency(float w)
{
_VegetableWindFreq= w;
if(_VegetableLandscape)
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin);
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir,
_VegetableWindFreq,
_VegetableWindPower,
_VegetableWindBendMin);
}
void CVegetableEditor::snapToGroundVegetableLandscape(bool enable)
@ -379,7 +388,7 @@ void CVegetableEditor::getListVegetables(std::vector<std::string> &listVeget)
{
listVeget.clear();
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)
@ -416,16 +425,16 @@ void CVegetableEditor::buildVegetableSet(NL3D::CTileVegetableDesc &vegetSet, boo
// build the list.
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(!keepDefaultShapeName && _Vegetables[i].Vegetable->ShapeName == "")
if(!keepDefaultShapeName && _Vegetables[i]._vegetable->ShapeName == "")
continue;
// if don't want to keep hiden vegetables, skip them.
if(!keepHiden && !_Vegetables[i].Visible)
if(!keepHiden && !_Vegetables[i]._visible)
continue;
vegetables.push_back(*_Vegetables[i].Vegetable);
vegetables.push_back(*_Vegetables[i]._vegetable);
// get dst index.
uint dstId= (uint)vegetables.size()-1;
// transform degrees in radians.
@ -446,13 +455,13 @@ void CVegetableEditor::appendVegetableSet(NL3D::CTileVegetableDesc &vegetSet)
float radToDeg = (float)(180.f / NLMISC::Pi);
// 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
const std::vector<NL3D::CVegetable> &vegetList = vegetSet.getVegetableList(distType);
// 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.
NL3D::CVegetable veget = vegetList[i];

View file

@ -113,7 +113,6 @@ public:
~CVegetableEditor(void);
void init();
void release();
/// @name Landscape control
@ -228,9 +227,7 @@ public:
private:
void loadConfig();
void loadLandscapeSetup();
void saveConfig();
NL3D::CLandscapeModel *_VegetableLandscape;

View file

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

View file

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

View file

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

View file

@ -29,7 +29,8 @@ namespace NLQT
{
CVegetNoiseValueWidget::CVegetNoiseValueWidget(QWidget *parent)
: QGroupBox(parent), _emit(true)
: QGroupBox(parent),
_emit(true)
{
_ui.setupUi(this);

View file

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