Changed: #1193 Code cleanup.

This commit is contained in:
timon 2010-11-26 13:54:06 +02:00
parent 092f9c54c8
commit 5f350f1f00
141 changed files with 4702 additions and 3665 deletions

View file

@ -29,10 +29,11 @@
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CAnimationDialog::CAnimationDialog(QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
_ui.setupUi(this);

View file

@ -33,7 +33,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CAnimationDialog
@ -45,7 +46,7 @@ Therefore, the class provides a slot that requires a total duration of the anima
*/
class CAnimationDialog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
/// Constructor, sets the default length of time from 0 to 99

View file

@ -29,10 +29,11 @@
#include "modules.h"
#include "entity.h"
namespace NLQT {
namespace NLQT
{
CAnimationSetDialog::CAnimationSetDialog(QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
ui.setupUi(this);
@ -57,7 +58,7 @@ CAnimationSetDialog::~CAnimationSetDialog()
void CAnimationSetDialog::setCurrentShape(const QString &name)
{
if (name.isEmpty())
return;
return;
Modules::objView().setCurrentObject(name.toStdString());
@ -71,7 +72,7 @@ void CAnimationSetDialog::setModeAnim()
{
std::string curObj = Modules::objView().getCurrentObject();
if (curObj.empty())
return;
return;
CEntity &entity = Modules::objView().getEntity(curObj);
if (ui.mixerRadioButton->isChecked())
@ -114,7 +115,7 @@ void CAnimationSetDialog::updateListAnim()
std::string curObj = Modules::objView().getCurrentObject();
if (curObj.empty())
return;
return;
CEntity &entity = Modules::objView().getEntity(curObj);
std::vector<std::string>& animationList = entity.getAnimationList();
@ -165,8 +166,8 @@ void CAnimationSetDialog::loadAnim()
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Open NeL anim file"), ".",
tr("NeL anim files (*.anim);;"));
tr("Open NeL anim file"), ".",
tr("NeL anim files (*.anim);;"));
setCursor(Qt::WaitCursor);
@ -188,11 +189,11 @@ void CAnimationSetDialog::loadAnim()
void CAnimationSetDialog::loadSwt()
{
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Open NeL anim file"), ".",
tr("NeL Skeleton Weight Template files (*.swt);;"));
tr("Open NeL anim file"), ".",
tr("NeL Skeleton Weight Template files (*.swt);;"));
setCursor(Qt::WaitCursor);

View file

@ -28,8 +28,9 @@
// Project includes
namespace NLQT {
/**
namespace NLQT
{
/**
@class CAnimationSetDialog
@brief Dialog - Animations control, loading animation, weight for skeleton and playlist composition.
@details Dialog loads animations files and weight for skeleton animation. Files can also be unloaded.
@ -39,10 +40,10 @@ Also, the dialogue has a control element to select the current shape (emit a sig
and switch of playlist/mixer (this functionality will soon be transferred to another specialized dialogue).
As each shape has its own list of loaded animations and playlist,when you switch your current shape,
the dialogue should be notified through the slot setCurrentShape ().
*/
*/
class CAnimationSetDialog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
CAnimationSetDialog(QWidget *parent = 0);

View file

@ -40,15 +40,16 @@
#include "spinner_dialog.h"
#include "follow_path_dialog.h"
namespace NLQT {
namespace NLQT
{
CAttribWidget::CAttribWidget(QWidget *parent)
: QGroupBox(parent),
_SrcInputEnabled(true),
_EnableConstantValue(true),
_DisableMemoryScheme(false),
_NbCycleEnabled(true),
_Node(NULL), _SchemeWidget(NULL)
: QGroupBox(parent),
_SrcInputEnabled(true),
_EnableConstantValue(true),
_DisableMemoryScheme(false),
_NbCycleEnabled(true),
_Node(NULL), _SchemeWidget(NULL)
{
_ui.setupUi(this);
_ui.constRangeUIntWidget->hide();
@ -210,7 +211,7 @@ void CAttribWidget::schemeValueUpdate()
if (k == -1) // unknow scheme ...
{
_ui.schemeComboBox->setCurrentIndex(k);
k = 0;
k = 0;
}
if (k != _ui.schemeComboBox->currentIndex())
@ -267,7 +268,7 @@ void CAttribWidget::enableMemoryScheme(bool enabled)
}
CAttribFloatWidget::CAttribFloatWidget(QWidget *parent)
: CAttribWidgetT<float>(parent)
: CAttribWidgetT<float>(parent)
{
_ui.schemeComboBox->addItem(tr("value blender"));
_ui.schemeComboBox->addItem(tr("values gradient"));
@ -282,9 +283,9 @@ CAttribFloatWidget::~CAttribFloatWidget()
void CAttribFloatWidget::setRange(float minValue, float maxValue)
{
_MinRange = minValue;
_MaxRange = maxValue;
_ui.constRangeFloatWidget->setRange(_MinRange, _MaxRange);
_MinRange = minValue;
_MaxRange = maxValue;
_ui.constRangeFloatWidget->setRange(_MinRange, _MaxRange);
}
void CAttribFloatWidget::setWrapper(IPSWrapper<float> *wrapper)
@ -322,8 +323,8 @@ QDialog *CAttribFloatWidget::editScheme(void)
CAttribFloatWidget *adf = new CAttribFloatWidget();
adf->setRange(_MinRange, _MaxRange);
CValueFromEmitterDialogT<float> *vfe = new CValueFromEmitterDialogT<float>( (NL3D::CPSFloatMemory *)(scheme),
adf,
this);
adf,
this);
vfe->init();
adf->setWorkspaceNode(_Node);
adf->updateUi();
@ -338,8 +339,8 @@ QDialog *CAttribFloatWidget::editScheme(void)
ad[k]->setRange(_MinRange, _MaxRange);
}
CBinOpDialogT<float> *bod = new CBinOpDialogT<float>( (NL3D::CPSFloatBinOp *)(scheme),
(CAttribWidgetT<float> **) ad,
this);
(CAttribWidgetT<float> **) ad,
this);
bod->init();
for (uint k = 0; k <2; ++k)
{
@ -363,35 +364,35 @@ void CAttribFloatWidget::setCurrentScheme(uint index)
switch (index)
{
case 0:
scheme = new NL3D::CPSFloatBlender(_MinRange, _MaxRange);
break;
case 1:
{
static const float values[2] = { 0.1f, 1.f };
scheme = new NL3D::CPSFloatGradient(values, 2, 16, 1.f);
}
break;
case 2:
{
NL3D::CPSFloatCurve *curve = new NL3D::CPSFloatCurve;
curve->_F.setNumSamples(128);
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(0, 0.5f));
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
scheme = curve;
}
break;
case 3:
scheme = new NL3D::CPSFloatMemory;
((NL3D::CPSAttribMakerMemory<float> *) scheme)->setScheme(new NL3D::CPSFloatBlender(_MinRange, _MaxRange));
break;
case 4 :
scheme = new NL3D::CPSFloatBinOp;
((NL3D::CPSFloatBinOp *) scheme)->setArg(0, new NL3D::CPSFloatBlender);
((NL3D::CPSFloatBinOp *) scheme)->setArg(1, new NL3D::CPSFloatBlender);
break;
default:
break;
case 0:
scheme = new NL3D::CPSFloatBlender(_MinRange, _MaxRange);
break;
case 1:
{
static const float values[2] = { 0.1f, 1.f };
scheme = new NL3D::CPSFloatGradient(values, 2, 16, 1.f);
}
break;
case 2:
{
NL3D::CPSFloatCurve *curve = new NL3D::CPSFloatCurve;
curve->_F.setNumSamples(128);
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(0, 0.5f));
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
scheme = curve;
}
break;
case 3:
scheme = new NL3D::CPSFloatMemory;
((NL3D::CPSAttribMakerMemory<float> *) scheme)->setScheme(new NL3D::CPSFloatBlender(_MinRange, _MaxRange));
break;
case 4 :
scheme = new NL3D::CPSFloatBinOp;
((NL3D::CPSFloatBinOp *) scheme)->setArg(0, new NL3D::CPSFloatBlender);
((NL3D::CPSFloatBinOp *) scheme)->setArg(1, new NL3D::CPSFloatBlender);
break;
default:
break;
}
if (scheme)
@ -429,7 +430,7 @@ void CAttribFloatWidget::cstValueUpdate()
}
CAttribUIntWidget::CAttribUIntWidget(QWidget *parent)
: CAttribWidgetT<uint32>(parent)
: CAttribWidgetT<uint32>(parent)
{
_ui.schemeComboBox->addItem(tr("value blender"));
_ui.schemeComboBox->addItem(tr("values gradient"));
@ -443,9 +444,9 @@ CAttribUIntWidget::~CAttribUIntWidget()
void CAttribUIntWidget::setRange(uint32 minValue, uint32 maxValue)
{
_MinRange = minValue;
_MaxRange = maxValue;
_ui.constRangeUIntWidget->setRange(_MinRange, _MaxRange);
_MinRange = minValue;
_MaxRange = maxValue;
_ui.constRangeUIntWidget->setRange(_MinRange, _MaxRange);
}
void CAttribUIntWidget::setWrapper(IPSWrapper<uint32> *wrapper)
@ -484,12 +485,12 @@ QDialog *CAttribUIntWidget::editScheme(void)
CAttribUIntWidget *adu = new CAttribUIntWidget();
adu->setRange(_MinRange, _MaxRange);
CValueFromEmitterDialogT<uint32> *vfe = new CValueFromEmitterDialogT<uint32>( (NL3D::CPSUIntMemory *)(scheme),
adu,
this);
vfe->init();
adu->setWorkspaceNode(_Node);
adu->updateUi();
return vfe;
adu,
this);
vfe->init();
adu->setWorkspaceNode(_Node);
adu->updateUi();
return vfe;
}
if (dynamic_cast<const NL3D::CPSUIntBinOp *>(scheme))
{
@ -500,8 +501,8 @@ QDialog *CAttribUIntWidget::editScheme(void)
ad[k]->setRange(_MinRange, _MaxRange);
}
CBinOpDialogT<uint32> *bod = new CBinOpDialogT<uint32>( (NL3D::CPSUIntBinOp *)(scheme),
(CAttribWidgetT<uint32> **) ad,
this);
(CAttribWidgetT<uint32> **) ad,
this);
bod->init();
for (uint k = 0; k <2; ++k)
{
@ -520,23 +521,23 @@ void CAttribUIntWidget::setCurrentScheme(uint index)
switch (index)
{
case 0 :
scheme = new NL3D::CPSUIntBlender(_MinRange, _MaxRange);
break;
case 1 :
scheme = new NL3D::CPSUIntGradient;
break;
case 2 :
scheme = new NL3D::CPSUIntMemory;
((NL3D::CPSAttribMakerMemory<uint32> *) scheme)->setScheme(new NL3D::CPSUIntBlender(_MinRange, _MaxRange) );
break;
case 3 :
scheme = new NL3D::CPSUIntBinOp;
((NL3D::CPSUIntBinOp *) scheme)->setArg(0, new NL3D::CPSUIntBlender);
((NL3D::CPSUIntBinOp *) scheme)->setArg(1, new NL3D::CPSUIntBlender);
break;
default:
break;
case 0 :
scheme = new NL3D::CPSUIntBlender(_MinRange, _MaxRange);
break;
case 1 :
scheme = new NL3D::CPSUIntGradient;
break;
case 2 :
scheme = new NL3D::CPSUIntMemory;
((NL3D::CPSAttribMakerMemory<uint32> *) scheme)->setScheme(new NL3D::CPSUIntBlender(_MinRange, _MaxRange) );
break;
case 3 :
scheme = new NL3D::CPSUIntBinOp;
((NL3D::CPSUIntBinOp *) scheme)->setArg(0, new NL3D::CPSUIntBlender);
((NL3D::CPSUIntBinOp *) scheme)->setArg(1, new NL3D::CPSUIntBlender);
break;
default:
break;
}
if (scheme)
{
@ -566,7 +567,7 @@ void CAttribUIntWidget::cstValueUpdate()
}
CAttribIntWidget::CAttribIntWidget(QWidget *parent)
: CAttribWidgetT<sint32>(parent)
: CAttribWidgetT<sint32>(parent)
{
_ui.schemeComboBox->addItem(tr("value exact blender"));
_ui.schemeComboBox->addItem(tr("values gradient"));
@ -580,9 +581,9 @@ CAttribIntWidget::~CAttribIntWidget()
void CAttribIntWidget::setRange(sint32 minValue, sint32 maxValue)
{
_MinRange = minValue;
_MaxRange = maxValue;
_ui.constRangeIntWidget->setRange(_MinRange, _MaxRange);
_MinRange = minValue;
_MaxRange = maxValue;
_ui.constRangeIntWidget->setRange(_MinRange, _MaxRange);
}
void CAttribIntWidget::setWrapper(IPSWrapper<sint32> *wrapper)
@ -620,7 +621,7 @@ QDialog *CAttribIntWidget::editScheme(void)
CAttribIntWidget *adi = new CAttribIntWidget();
adi->setRange(_MinRange, _MaxRange);
CValueFromEmitterDialogT<sint32> *vfe = new CValueFromEmitterDialogT<sint32>((NL3D::CPSIntMemory *) _SchemeWrapper->getScheme(),
adi, this);
adi, this);
vfe->init();
adi->setWorkspaceNode(_Node);
adi->updateUi();
@ -635,8 +636,8 @@ QDialog *CAttribIntWidget::editScheme(void)
ad[k]->setRange(_MinRange, _MaxRange);
}
CBinOpDialogT<sint32> *bod = new CBinOpDialogT<sint32>( (NL3D::CPSIntBinOp *)(scheme),
(CAttribWidgetT<sint32> **) ad,
this);
(CAttribWidgetT<sint32> **) ad,
this);
bod->init();
for (uint k = 0; k <2; ++k)
{
@ -655,23 +656,23 @@ void CAttribIntWidget::setCurrentScheme(uint index)
switch (index)
{
case 0 :
scheme = new NL3D::CPSIntBlender;
break;
case 1 :
scheme = new NL3D::CPSIntGradient;
break;
case 2 :
scheme = new NL3D::CPSIntMemory;
((NL3D::CPSAttribMakerMemory<sint32> *) scheme)->setScheme(new NL3D::CPSIntBlender(_MinRange, _MaxRange));
break;
case 3 :
scheme = new NL3D::CPSIntBinOp;
((NL3D::CPSIntBinOp *) scheme)->setArg(0, new NL3D::CPSIntBlender);
((NL3D::CPSIntBinOp *) scheme)->setArg(1, new NL3D::CPSIntBlender);
break;
default:
break;
case 0 :
scheme = new NL3D::CPSIntBlender;
break;
case 1 :
scheme = new NL3D::CPSIntGradient;
break;
case 2 :
scheme = new NL3D::CPSIntMemory;
((NL3D::CPSAttribMakerMemory<sint32> *) scheme)->setScheme(new NL3D::CPSIntBlender(_MinRange, _MaxRange));
break;
case 3 :
scheme = new NL3D::CPSIntBinOp;
((NL3D::CPSIntBinOp *) scheme)->setArg(0, new NL3D::CPSIntBlender);
((NL3D::CPSIntBinOp *) scheme)->setArg(1, new NL3D::CPSIntBlender);
break;
default:
break;
}
if (scheme)
{
@ -701,7 +702,7 @@ void CAttribIntWidget::cstValueUpdate()
}
CAttribRGBAWidget::CAttribRGBAWidget(QWidget *parent)
: CAttribWidgetT<NLMISC::CRGBA>(parent)
: CAttribWidgetT<NLMISC::CRGBA>(parent)
{
_ui.schemeComboBox->addItem(tr("color sampled blender"));
_ui.schemeComboBox->addItem(tr("color gradient"));
@ -748,8 +749,8 @@ QDialog *CAttribRGBAWidget::editScheme(void)
{
CAttribRGBAWidget *ad = new CAttribRGBAWidget();
CValueFromEmitterDialogT<NLMISC::CRGBA> *vfe = new CValueFromEmitterDialogT<NLMISC::CRGBA>( (NL3D::CPSColorMemory *)(scheme),
ad,
this);
ad,
this);
vfe->init();
ad->setWorkspaceNode(_Node);
ad->updateUi();
@ -763,8 +764,8 @@ QDialog *CAttribRGBAWidget::editScheme(void)
ad[k] = new CAttribRGBAWidget();
}
CBinOpDialogT<NLMISC::CRGBA> *bod = new CBinOpDialogT<NLMISC::CRGBA>( (NL3D::CPSColorBinOp *)(scheme),
(CAttribWidgetT<NLMISC::CRGBA> **) ad,
this);
(CAttribWidgetT<NLMISC::CRGBA> **) ad,
this);
bod->init();
for (uint k = 0; k <2; ++k)
{
@ -783,26 +784,26 @@ void CAttribRGBAWidget::setCurrentScheme(uint index)
switch (index)
{
case 0 :
scheme = new NL3D::CPSColorBlender;
break;
case 1 :
scheme = new NL3D::CPSColorGradient(NL3D::CPSColorGradient::_DefaultGradient, 2, 16, 1.f);
break;
case 2 :
scheme = new NL3D::CPSColorBlenderExact;
break;
case 3 :
scheme = new NL3D::CPSColorMemory;
((NL3D::CPSAttribMakerMemory<NLMISC::CRGBA> *) scheme)->setScheme(new NL3D::CPSColorBlender);
break;
case 4 :
scheme = new NL3D::CPSColorBinOp;
((NL3D::CPSColorBinOp *) scheme)->setArg(0, new NL3D::CPSColorBlender);
((NL3D::CPSColorBinOp *) scheme)->setArg(1, new NL3D::CPSColorBlender);
break;
default:
break;
case 0 :
scheme = new NL3D::CPSColorBlender;
break;
case 1 :
scheme = new NL3D::CPSColorGradient(NL3D::CPSColorGradient::_DefaultGradient, 2, 16, 1.f);
break;
case 2 :
scheme = new NL3D::CPSColorBlenderExact;
break;
case 3 :
scheme = new NL3D::CPSColorMemory;
((NL3D::CPSAttribMakerMemory<NLMISC::CRGBA> *) scheme)->setScheme(new NL3D::CPSColorBlender);
break;
case 4 :
scheme = new NL3D::CPSColorBinOp;
((NL3D::CPSColorBinOp *) scheme)->setArg(0, new NL3D::CPSColorBlender);
((NL3D::CPSColorBinOp *) scheme)->setArg(1, new NL3D::CPSColorBlender);
break;
default:
break;
}
if (scheme)
{
@ -833,7 +834,7 @@ void CAttribRGBAWidget::cstValueUpdate()
}
CAttribPlaneBasisWidget::CAttribPlaneBasisWidget(QWidget *parent)
: CAttribWidgetT<NL3D::CPlaneBasis>(parent)
: CAttribWidgetT<NL3D::CPlaneBasis>(parent)
{
_ui.schemeComboBox->addItem(tr("basis gradient"));
_ui.schemeComboBox->addItem(tr("follow path"));
@ -873,8 +874,8 @@ QDialog *CAttribPlaneBasisWidget::editScheme(void)
{
CAttribPlaneBasisWidget *ad = new CAttribPlaneBasisWidget();
CValueFromEmitterDialogT<NL3D::CPlaneBasis> *vfe = new CValueFromEmitterDialogT<NL3D::CPlaneBasis>
( (NL3D::CPSPlaneBasisMemory *)(scheme),
ad, this);
( (NL3D::CPSPlaneBasisMemory *)(scheme),
ad, this);
vfe->init();
ad->setWorkspaceNode(_Node);
ad->updateUi();
@ -888,8 +889,8 @@ QDialog *CAttribPlaneBasisWidget::editScheme(void)
ad[k] = new CAttribPlaneBasisWidget();
}
CBinOpDialogT<NL3D::CPlaneBasis> *bod = new CBinOpDialogT<NL3D::CPlaneBasis>( (NL3D::CPSPlaneBasisBinOp *)(scheme),
(CAttribWidgetT<NL3D::CPlaneBasis> **) ad,
this);
(CAttribWidgetT<NL3D::CPlaneBasis> **) ad,
this);
bod->init();
for (uint k = 0; k <2; ++k)
{
@ -913,31 +914,31 @@ void CAttribPlaneBasisWidget::setCurrentScheme(uint index)
switch (index)
{
case 0:
scheme = new NL3D::CPSPlaneBasisGradient;
break;
case 1:
scheme = new NL3D::CPSPlaneBasisFollowSpeed;
break;
case 2:
scheme = new NL3D::CPSBasisSpinner;
static_cast<NL3D::CPSBasisSpinner *>(scheme)->_F.setNumSamples(16);
break;
case 3:
scheme = new NL3D::CPSPlaneBasisMemory;
((NL3D::CPSAttribMakerMemory<NL3D::CPlaneBasis> *) scheme)->setScheme(new NL3D::CPSPlaneBasisFollowSpeed);
if (_Node)
{
_Node->setModified(true);
}
break;
case 4 :
scheme = new NL3D::CPSPlaneBasisBinOp;
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(0, new NL3D::CPSPlaneBasisFollowSpeed);
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(1, new NL3D::CPSPlaneBasisFollowSpeed);
break;
default:
break;
case 0:
scheme = new NL3D::CPSPlaneBasisGradient;
break;
case 1:
scheme = new NL3D::CPSPlaneBasisFollowSpeed;
break;
case 2:
scheme = new NL3D::CPSBasisSpinner;
static_cast<NL3D::CPSBasisSpinner *>(scheme)->_F.setNumSamples(16);
break;
case 3:
scheme = new NL3D::CPSPlaneBasisMemory;
((NL3D::CPSAttribMakerMemory<NL3D::CPlaneBasis> *) scheme)->setScheme(new NL3D::CPSPlaneBasisFollowSpeed);
if (_Node)
{
_Node->setModified(true);
}
break;
case 4 :
scheme = new NL3D::CPSPlaneBasisBinOp;
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(0, new NL3D::CPSPlaneBasisFollowSpeed);
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(1, new NL3D::CPSPlaneBasisFollowSpeed);
break;
default:
break;
}
if (scheme)

View file

@ -38,14 +38,15 @@
#include "ps_wrapper.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
/**
@class CAttribWidget
@brief Base attrib maker edition dialog.
*/
class CAttribWidget: public QGroupBox
{
Q_OBJECT
Q_OBJECT
public:
CAttribWidget(QWidget *parent = 0);
@ -70,9 +71,15 @@ public:
virtual void setSchemeNbCycles(float nbCycles) = 0;
/// Enable the srcInput
void enableSrcInput(bool enable = true) { _SrcInputEnabled = enable; }
void enableSrcInput(bool enable = true)
{
_SrcInputEnabled = enable;
}
bool isSrcInputEnabled() const { return _SrcInputEnabled; }
bool isSrcInputEnabled() const
{
return _SrcInputEnabled;
}
/// Disable the possibility to choose a scheme that has memory. (for example, a scheme for lifetime of a located has no sense
/// because located have already some memory to store it)
@ -80,11 +87,20 @@ public:
/// Tells wether memory schemes are enables
/// @see enableMemoryScheme()
bool isMemorySchemeEnabled() const { return !_DisableMemoryScheme; }
bool isMemorySchemeEnabled() const
{
return !_DisableMemoryScheme;
}
/// Enable Nb Cycle tuning
void enableNbCycles(bool enabled) { _NbCycleEnabled = enabled; }
bool isNbCycleEnabled() const { return _NbCycleEnabled; }
void enableNbCycles(bool enabled)
{
_NbCycleEnabled = enabled;
}
bool isNbCycleEnabled() const
{
return _NbCycleEnabled;
}
private Q_SLOTS:
virtual void clickedEdit();
@ -159,9 +175,15 @@ protected:
/// wrapper to tune the number of cycles
struct CNbCyclesWrapper : public IPSWrapperFloat
{
CAttribWidget *widget;
float get(void) const { return widget->getSchemeNbCycles(); }
void set(const float &v) { widget->setSchemeNbCycles(v); }
CAttribWidget *widget;
float get(void) const
{
return widget->getSchemeNbCycles();
}
void set(const float &v)
{
widget->setSchemeNbCycles(v);
}
} _NbCyclesWrapper;
CWorkspaceNode *_Node;
@ -179,12 +201,16 @@ template <typename T> class CAttribWidgetT : public CAttribWidget
{
public:
CAttribWidgetT(QWidget *parent = 0): CAttribWidget(parent),
_Wrapper(NULL),
_SchemeWrapper(NULL)
_Wrapper(NULL),
_SchemeWrapper(NULL)
{
}
virtual void setWrapper(IPSWrapper<T> *wrapper) = 0;
void setSchemeWrapper(IPSSchemeWrapper<T> *schemeWrapper) { nlassert(schemeWrapper); _SchemeWrapper = schemeWrapper; }
void setSchemeWrapper(IPSSchemeWrapper<T> *schemeWrapper)
{
nlassert(schemeWrapper);
_SchemeWrapper = schemeWrapper;
}
// Inherited from CAttribWidget
virtual QDialog *editScheme(void) = 0;
@ -196,22 +222,51 @@ public:
_Wrapper->setAndUpdateModifiedFlag(_Wrapper->get()); // reuse current color
}
virtual bool hasSchemeCustomInput(void) const { return _SchemeWrapper->getScheme()->hasCustomInput(); }
virtual NL3D::CPSInputType getSchemeInput(void) const { return _SchemeWrapper->getScheme()->getInput(); }
virtual void setSchemeInput(const NL3D::CPSInputType &input) { _SchemeWrapper->getScheme()->setInput(input); }
virtual bool hasSchemeCustomInput(void) const
{
return _SchemeWrapper->getScheme()->hasCustomInput();
}
virtual NL3D::CPSInputType getSchemeInput(void) const
{
return _SchemeWrapper->getScheme()->getInput();
}
virtual void setSchemeInput(const NL3D::CPSInputType &input)
{
_SchemeWrapper->getScheme()->setInput(input);
}
virtual void setWorkspaceNode(CWorkspaceNode *node)
{
_Node = node; if (_Wrapper != NULL) _Wrapper->OwnerNode = _Node; if (_SchemeWrapper != NULL) _SchemeWrapper->OwnerNode = _Node;
_Node = node;
if (_Wrapper != NULL) _Wrapper->OwnerNode = _Node;
if (_SchemeWrapper != NULL) _SchemeWrapper->OwnerNode = _Node;
};
virtual float getSchemeNbCycles(void) const { return _SchemeWrapper->getScheme()->getNbCycles(); }
virtual void setSchemeNbCycles(float nbCycles) { _SchemeWrapper->getScheme()->setNbCycles(nbCycles); }
virtual float getSchemeNbCycles(void) const
{
return _SchemeWrapper->getScheme()->getNbCycles();
}
virtual void setSchemeNbCycles(float nbCycles)
{
_SchemeWrapper->getScheme()->setNbCycles(nbCycles);
}
virtual bool isSchemeClamped(void) const { return _SchemeWrapper->getScheme()->getClamping(); }
virtual void clampScheme(bool clamped = true) { _SchemeWrapper->getScheme()->setClamping(clamped); }
virtual bool isClampingSupported(void) const { return _SchemeWrapper->getScheme()->isClampingSupported(); };
virtual NL3D::CPSAttribMakerBase *getCurrentSchemePtr(void) const { return _SchemeWrapper->getScheme(); }
virtual bool isSchemeClamped(void) const
{
return _SchemeWrapper->getScheme()->getClamping();
}
virtual void clampScheme(bool clamped = true)
{
_SchemeWrapper->getScheme()->setClamping(clamped);
}
virtual bool isClampingSupported(void) const
{
return _SchemeWrapper->getScheme()->isClampingSupported();
};
virtual NL3D::CPSAttribMakerBase *getCurrentSchemePtr(void) const
{
return _SchemeWrapper->getScheme();
}
virtual void setCurrentSchemePtr(NL3D::CPSAttribMakerBase *s)
{
_SchemeWrapper->setSchemeAndUpdateModifiedFlag(NLMISC::safe_cast<NL3D::CPSAttribMaker<T> *>(s));
@ -237,7 +292,7 @@ public:
*/
class CAttribFloatWidget: public CAttribWidgetT<float>
{
Q_OBJECT
Q_OBJECT
public:
CAttribFloatWidget(QWidget *parent = 0);
@ -263,7 +318,7 @@ private:
*/
class CAttribUIntWidget: public CAttribWidgetT<uint32>
{
Q_OBJECT
Q_OBJECT
public:
CAttribUIntWidget(QWidget *parent = 0);
@ -289,7 +344,7 @@ private:
*/
class CAttribIntWidget: public CAttribWidgetT<sint32>
{
Q_OBJECT
Q_OBJECT
public:
CAttribIntWidget(QWidget *parent = 0);
@ -315,7 +370,7 @@ private:
*/
class CAttribRGBAWidget: public CAttribWidgetT<NLMISC::CRGBA>
{
Q_OBJECT
Q_OBJECT
public:
CAttribRGBAWidget(QWidget *parent = 0);
@ -339,7 +394,7 @@ private:
*/
class CAttribPlaneBasisWidget: public CAttribWidgetT<NL3D::CPlaneBasis>
{
Q_OBJECT
Q_OBJECT
public:
CAttribPlaneBasisWidget(QWidget *parent = 0);

View file

@ -28,10 +28,11 @@
// Project includes
namespace NLQT {
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);

View file

@ -32,11 +32,12 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
class CAutoLODDialog: public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent = 0);
@ -54,15 +55,27 @@ private:
struct CDistRatioWrapper : IPSWrapperFloat
{
NL3D::CParticleSystem *PS;
virtual float get() const { return PS->getAutoLODStartDistPercent(); }
virtual void set(const float &v) { PS->setupAutoLOD(v, PS->getAutoLODDegradationExponent()); }
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); }
virtual float get() const
{
return PS->getMaxDistLODBias();
}
virtual void set(const float &v)
{
PS->setMaxDistLODBias(v);
}
} _MaxDistLODBiasWrapper;
Ui::CAutoLODDialog _ui;

View file

@ -26,15 +26,16 @@
#include "nel/misc/matrix.h"
#include "nel/misc/vector.h"
namespace NLQT {
namespace NLQT
{
// build an euler matrix
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)
@ -53,7 +54,9 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
mat.getRot(v[0], v[1], v[2]);
for (uint l = 0; l < 3; ++l)
{
m[0][l] = v[l].x; m[1][l] = v[l].y; m[2][l] = v[l].z;
m[0][l] = v[l].x;
m[1][l] = v[l].y;
m[2][l] = v[l].z;
}
// there are eight triplet that may satisfy the equation
@ -110,8 +113,8 @@ 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);
@ -132,7 +135,7 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
}
CBasicEditWidget::CBasicEditWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL)
: QWidget(parent), _Wrapper(NULL)
{
_ui.setupUi(this);
@ -178,9 +181,9 @@ void CBasicEditWidget::updateGraphics()
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
, 2.f * (float) NLMISC::Pi * _ui.phiSpinBox->value() / 360.f
);
, 2.f * (float) NLMISC::Pi * _ui.thetaSpinBox->value() / 360.f
, 2.f * (float) NLMISC::Pi * _ui.phiSpinBox->value() / 360.f
);
NLMISC::CMatrix mat = BuildEulerMatrix(angles.x, angles.y, angles.z);
NL3D::CPlaneBasis pb;
pb.X = mat.getI();

View file

@ -31,11 +31,12 @@
// Project includes
namespace NLQT {
namespace NLQT
{
class CBasicEditWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CBasicEditWidget(QWidget *parent = 0);

View file

@ -20,7 +20,8 @@
#include "stdpch.h"
#include "bin_op_dialog.h"
namespace NLQT {
namespace NLQT
{
CBinOpDialog::CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent)
: QDialog(parent)

View file

@ -38,11 +38,12 @@
#include "ps_wrapper.h"
#include "attrib_widget.h"
namespace NLQT {
namespace NLQT
{
class CBinOpDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
@ -140,15 +141,28 @@ protected:
{
NL3D::CPSAttribMakerBinOp<T> *S ;
uint Index ;
virtual NL3D::CPSAttribMaker<T> *getScheme(void) const { return S->getArg(Index) ; }
virtual void setScheme(NL3D::CPSAttribMaker<T> *s) { S->setArg(Index, s) ; } ;
virtual NL3D::CPSAttribMaker<T> *getScheme(void) const
{
return S->getArg(Index) ;
}
virtual void setScheme(NL3D::CPSAttribMaker<T> *s)
{
S->setArg(Index, s) ;
} ;
} _SchemeWrapper[2] ;
/// a dummy wrapper for constant value. This shouldn't be called , however
struct CDummyWrapper : public IPSWrapper<T>
{
T get(void) const { nlassert(false) ; return T() ; }
void set(const T &) { nlassert(false) ; }
T get(void) const
{
nlassert(false) ;
return T() ;
}
void set(const T &)
{
nlassert(false) ;
}
} _DummyWrapper ;

View file

@ -20,7 +20,8 @@
#include "stdpch.h"
#include "callback.h"
namespace NLQT {
namespace NLQT
{
} /* namespace NLQT */

View file

@ -34,7 +34,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
#define NLQT_CALLBACK_TEMPLATE \
/** \

View file

@ -27,10 +27,11 @@
// Nel includes
#include <nel/misc/rgba.h>
namespace NLQT {
namespace NLQT
{
CColorEditWidget::CColorEditWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL), _emit(true)
: QWidget(parent), _Wrapper(NULL), _emit(true)
{
_ui.setupUi(this);
@ -156,9 +157,9 @@ void CColorEditWidget::setAlpha(int a)
void CColorEditWidget::browseColor()
{
QColor color = QColorDialog::getColor(QColor(_ui.rSpinBox->value(),
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
_ui.gSpinBox->value(),
_ui.bSpinBox->value(),
_ui.aSpinBox->value()));
if (!color.isValid()) return;
setColor(color);

View file

@ -27,7 +27,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CColorEditWidget
@ -52,7 +53,7 @@ to set the current values, need call class methods updateUi();
*/
class CColorEditWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
/// Constructor, sets the default color (255, 255, 255, 255)

View file

@ -31,7 +31,8 @@
using namespace std;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CConfiguration::CConfiguration()
{
@ -70,7 +71,7 @@ void CConfiguration::release()
Modules::config().dropCallback("SearchPaths");
// save and release the config file
// save and release the config file
if (ConfigFile.exists("SaveConfig") && ConfigFile.getVarPtr("SaveConfig")->asBool())
{
ConfigFile.save();
@ -101,7 +102,7 @@ void CConfiguration::configRemapExtensions()
var = ConfigFile.getVarPtr("RemapExtensions");
uint varsize = var->size();
for (uint i = 0; i < varsize; i += 2)
CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
}
void CConfiguration::setAndCallback(const std::string &varName, CConfigCallback configCallback)
@ -216,7 +217,7 @@ void CConfiguration::cfcbSearchPaths(NLMISC::CConfigFile::CVar &var)
{
uint varsize = var.size();
for (uint i = 0; i < varsize; ++i)
CPath::addSearchPath(var.asString(i), true, false);
CPath::addSearchPath(var.asString(i), true, false);
}
} /* namespace NLQT */

View file

@ -35,7 +35,8 @@
#define NLQT_CONFIG_FILE "object_viewer.cfg"
namespace NLQT {
namespace NLQT
{
typedef CCallback<void, NLMISC::CConfigFile::CVar &> CConfigCallback;
@ -73,7 +74,10 @@ public:
NLMISC::CRGBA getValue(const std::string &varName, const NLMISC::CRGBA &defaultValue);
NLMISC::CRGBA getValue(const NLMISC::CConfigFile::CVar &var, const NLMISC::CRGBA &defaultValue);
inline NLMISC::CConfigFile &getConfigFile() { return ConfigFile; }
inline NLMISC::CConfigFile &getConfigFile()
{
return ConfigFile;
}
private:
static void cbConfigCallback(NLMISC::CConfigFile::CVar &var);

View file

@ -23,10 +23,11 @@
// NeL includes
#include "nel/3d/ps_mesh.h"
namespace NLQT {
namespace NLQT
{
CConstraintMeshWidget::CConstraintMeshWidget(QWidget *parent )
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -135,24 +136,24 @@ void CConstraintMeshWidget::setTexAnimType(int index)
{
switch(index)
{
case 0: // no anim
_CM->setTexAnimType(NL3D::CPSConstraintMesh::NoAnim);
_ui.stageSpinBox->hide();
_ui.stageLabel->hide();
_ui.tabWidget->hide();
_ui.reinitCheckBox->hide();
case 0: // no anim
_CM->setTexAnimType(NL3D::CPSConstraintMesh::NoAnim);
_ui.stageSpinBox->hide();
_ui.stageLabel->hide();
_ui.tabWidget->hide();
_ui.reinitCheckBox->hide();
break;
case 1: // global anim
_CM->setTexAnimType(NL3D::CPSConstraintMesh::GlobalAnim);
_ui.stageSpinBox->show();
_ui.stageLabel->show();
_ui.tabWidget->show();
_ui.reinitCheckBox->show();
_ui.stageSpinBox->setValue(0);
_ui.reinitCheckBox->setChecked(_CM->isGlobalAnimTimeResetOnNewElementForced());
case 1: // global anim
_CM->setTexAnimType(NL3D::CPSConstraintMesh::GlobalAnim);
_ui.stageSpinBox->show();
_ui.stageLabel->show();
_ui.tabWidget->show();
_ui.reinitCheckBox->show();
_ui.stageSpinBox->setValue(0);
_ui.reinitCheckBox->setChecked(_CM->isGlobalAnimTimeResetOnNewElementForced());
break;
default:
nlstop;
default:
nlstop;
break;
}
}

View file

@ -31,11 +31,13 @@
// Project includes
#include "particle_node.h"
namespace NL3D {
class CPSConstraintMesh;
namespace NL3D
{
class CPSConstraintMesh;
}
namespace NLQT {
namespace NLQT
{
/**
@class CConstraintMeshWidget
@ -43,7 +45,7 @@ namespace NLQT {
*/
class CConstraintMeshWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CConstraintMeshWidget(QWidget *parent = 0);

View file

@ -23,7 +23,8 @@
// Project includes
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent)
: QDialog(parent) , _Curve(curve), _scale(1.0), _pos(0.0), _Node(ownerNode)
@ -91,7 +92,7 @@ void CurveEditDialog::curveChanged(const QPolygonF &points)
_Curve->addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
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)));
(_ui.curveWidget->height() - points.at(i).y() + _pos) / (_ui.curveWidget->height() * _scale)));
}
void CurveEditDialog::setScale(int value)
@ -147,7 +148,7 @@ void CurveEditDialog::buildPoints()
QPolygonF points;
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()));
_pos + _ui.curveWidget->height() - (_scale * _Curve->getControlPoint(i).Value * _ui.curveWidget->height()));
_hoverPoints->setPoints(points);
//_hoverPoints->setPointLock(0, HoverPoints::LockToLeft);

View file

@ -36,7 +36,8 @@
#include "hoverpoints.h"
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CurveEditDialog
@brief Dialogue editing graphics curve.
@ -45,7 +46,7 @@ The choice of the interpolation algorithm.
*/
class CurveEditDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent = 0);

View file

@ -26,10 +26,11 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CDayNightDialog::CDayNightDialog(QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
_ui.setupUi(this);

View file

@ -28,7 +28,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CDayNightDialog
@ -37,7 +38,7 @@ namespace NLQT {
*/
class CDayNightDialog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
CDayNightDialog(QWidget *parent = 0);

View file

@ -26,10 +26,11 @@
// NeL includes
#include <nel/misc/vector.h>
namespace NLQT {
namespace NLQT
{
CDirectionWidget::CDirectionWidget(QWidget *parent)
: QWidget(parent), _globalName("")
: QWidget(parent), _globalName("")
{
_ui.setupUi(this);
@ -100,8 +101,8 @@ void CDirectionWidget::setGlobalDirection()
{
bool ok;
QString text = QInputDialog::getText(this, tr("Enter Name"),
"", QLineEdit::Normal,
QString(_globalName), &ok);
"", QLineEdit::Normal,
QString(_globalName), &ok);
if (ok)
setGlobalName(text);

View file

@ -29,7 +29,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CDirectionWidget
@ -38,7 +39,7 @@ namespace NLQT {
*/
class CDirectionWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CDirectionWidget(QWidget *parent = 0);

View file

@ -111,9 +111,9 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in)
/** Duplicate the system, and detach.
* We can't duplicate the object direclty (it may be referencing other objects in the system, so these objects will be copied too...)
*/
std::auto_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner()));
// scene pointer is not serialised, but 'detach' may need the scene to be specified
newPS->setScene(in->getOwner()->getScene());
std::auto_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner()));
// scene pointer is not serialised, but 'detach' may need the scene to be specified
newPS->setScene(in->getOwner()->getScene());
return newPS->detach(index);
}
}

View file

@ -23,8 +23,8 @@
namespace NL3D
{
class CParticleSystemProcess;
class CPSLocatedBindable;
class CParticleSystemProcess;
class CPSLocatedBindable;
}

View file

@ -28,12 +28,13 @@
using namespace NL3D;
using namespace NLMISC;
namespace NLQT {
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);
@ -142,7 +143,7 @@ void CEditRangeUIntWidget::updateUi()
}
CEditRangeIntWidget::CEditRangeIntWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL)
: QWidget(parent), _Wrapper(NULL)
{
_ui.setupUi(this);
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinimum(int)));
@ -332,7 +333,7 @@ void CEditRangeFloatWidget::disableLowerBound(void)
void CEditRangeFloatWidget::changeRange()
{
if ((_ui.startSpinBox->value() < _ui.currentSpinBox->value()) &&
(_ui.endSpinBox->value() > _ui.currentSpinBox->value()))
(_ui.endSpinBox->value() > _ui.currentSpinBox->value()))
setValue(_ui.currentSpinBox->value(), false);
}

View file

@ -28,7 +28,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CEditRangeUIntWidget
@ -56,7 +57,7 @@ to set the current values,it is need to call class methods updateUi();
class CEditRangeUIntWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
/// Constructor, sets 0 default current value
@ -99,7 +100,7 @@ Q_SIGNALS:
void valueChanged(uint32 value);
public Q_SLOTS:
/// Set current value
/// Set current value
/// @param value - current value
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
void setValue(uint32 value, bool emit = true);
@ -143,7 +144,7 @@ to set the current values,it is need to call class methods updateUi();
class CEditRangeIntWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
/// Constructor, sets 0 default current value
@ -230,7 +231,7 @@ to set the current values,it is need to call class methods updateUi();
class CEditRangeFloatWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
/// Constructor, sets 0 default current value
CEditRangeFloatWidget(QWidget *parent = 0);

View file

@ -21,7 +21,7 @@
#include "emitter_page.h"
// Qt includes
#include <QtGui/QMessageBox>
#include <QtGui/QMessageBox>
// NeL includes
@ -29,11 +29,12 @@
#include "edit_range_widget.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CEmitterPage::CEmitterPage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -194,15 +195,15 @@ void CEmitterPage::setEmittedType(int index)
if (_Emitter->getOwner()->getOwner()->getBehaviourType() == NL3D::CParticleSystem::SpellFX || _Emitter->getOwner()->getOwner()->getBypassMaxNumIntegrationSteps())
{
QMessageBox::critical(this, tr("NeL Particle Editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX',"
"and thus, should have a finite duration. This operation create a loop in the system, and so is forbidden."),
QMessageBox::Ok);
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX',"
"and thus, should have a finite duration. This operation create a loop in the system, and so is forbidden."),
QMessageBox::Ok);
}
else
{
QMessageBox::critical(this, tr("NeL Particle Editor"),
tr("Loops with emitters are forbidden."),
QMessageBox::Ok);
tr("Loops with emitters are forbidden."),
QMessageBox::Ok);
}
updateEmittedType();
}
@ -217,9 +218,9 @@ void CEmitterPage::setTypeOfEmission(int index)
if (!_Emitter->setEmissionType((NL3D::CPSEmitter::TEmissionType) index))
{
QMessageBox::critical(this, tr("NeL Particle Editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
_ui.typeEmissionComboBox->setCurrentIndex(int(_Emitter->getEmissionType()));
}
@ -250,28 +251,28 @@ void CEmitterPage::setDirectionMode(int index)
nlassert(_Emitter);
switch(index)
{
case Default:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(false);
case Default:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(false);
break;
case AlignOnEmitterDirection:
_Emitter->enableSpeedBasisEmission(true);
_Emitter->enableUserMatrixModeForEmissionDirection(false);
case AlignOnEmitterDirection:
_Emitter->enableSpeedBasisEmission(true);
_Emitter->enableUserMatrixModeForEmissionDirection(false);
break;
case InWorld:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(true);
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSIdentityMatrix);
case InWorld:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(true);
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSIdentityMatrix);
break;
case LocalToSystem:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(true);
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSFXWorldMatrix);
case LocalToSystem:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(true);
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSFXWorldMatrix);
break;
case LocalToFatherSkeleton:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(true);
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSUserMatrix);
case LocalToFatherSkeleton:
_Emitter->enableSpeedBasisEmission(false);
_Emitter->enableUserMatrixModeForEmissionDirection(true);
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSUserMatrix);
break;
}
updateModifiedFlag();
@ -302,9 +303,9 @@ void CEmitterPage::setMaxEmissionCount(uint32 value)
{
QMessageBox::critical(this, tr("NeL Particle Editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
_ui.maxEmissionCountWidget->setValue((uint32)_Emitter->getMaxEmissionCount(), false);
updateModifiedFlag();

View file

@ -33,7 +33,8 @@
#include "particle_node.h"
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CEmitterPage
@ -41,7 +42,7 @@ namespace NLQT {
*/
class CEmitterPage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
/// This enum match the option in the combo box that allow to choose how the direction of emission is computed.
@ -80,9 +81,15 @@ private:
{
CWorkspaceNode *Node;
NL3D::CPSEmitter *E;
float get(void) const { return E->getPeriod(); }
float get(void) const
{
return E->getPeriod();
}
void set(const float &v);
scheme_type *getScheme(void) const { return E->getPeriodScheme(); }
scheme_type *getScheme(void) const
{
return E->getPeriodScheme();
}
void setScheme(scheme_type *s);
} _PeriodWrapper;
@ -91,9 +98,15 @@ private:
{
CWorkspaceNode *Node;
NL3D::CPSEmitter *E;
uint32 get(void) const { return E->getGenNb(); }
uint32 get(void) const
{
return E->getGenNb();
}
void set(const uint32 &v);
scheme_type *getScheme(void) const { return E->getGenNbScheme(); }
scheme_type *getScheme(void) const
{
return E->getGenNbScheme();
}
void setScheme(scheme_type *s);
} _GenNbWrapper;
@ -101,10 +114,22 @@ private:
struct CModulateStrenghtWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSModulatedEmitter *E;
float get(void) const { return E->getEmitteeSpeed(); }
void set(const float &v) { E->setEmitteeSpeed(v); }
scheme_type *getScheme(void) const { return E->getEmitteeSpeedScheme(); }
void setScheme(scheme_type *s) { E->setEmitteeSpeedScheme(s); }
float get(void) const
{
return E->getEmitteeSpeed();
}
void set(const float &v)
{
E->setEmitteeSpeed(v);
}
scheme_type *getScheme(void) const
{
return E->getEmitteeSpeedScheme();
}
void setScheme(scheme_type *s)
{
E->setEmitteeSpeedScheme(s);
}
} _ModulatedStrenghtWrapper;
// the emitter being edited
@ -117,7 +142,10 @@ private:
void updatePeriodWidget();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
CWorkspaceNode *_Node;

View file

@ -40,7 +40,8 @@
using namespace NLMISC;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
{
@ -63,10 +64,10 @@ CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
}
CEntity::CEntity(void):
_Name("<Unknown>"), _FileNameShape(""),
_FileNameSkeleton(""), _inPlace(false), _incPos(false),
_Instance(NULL), _Skeleton(NULL),
_PlayList(NULL), _AnimationSet(NULL)
_Name("<Unknown>"), _FileNameShape(""),
_FileNameSkeleton(""), _inPlace(false), _incPos(false),
_Instance(NULL), _Skeleton(NULL),
_PlayList(NULL), _AnimationSet(NULL)
{
_CharacterScalePos = 1;
}
@ -124,7 +125,7 @@ void CEntity::addAnimToPlayList(std::string &name)
void CEntity::removeAnimToPlayList(uint row)
{
if (row < _PlayListAnimation.size())
_PlayListAnimation.erase(_PlayListAnimation.begin() + row);
_PlayListAnimation.erase(_PlayListAnimation.begin() + row);
_AnimationStatus.EndAnim = this->getPlayListLength();
}
@ -132,7 +133,7 @@ void CEntity::removeAnimToPlayList(uint row)
void CEntity::swapAnimToPlayList(uint row1, uint row2)
{
if ((row1 < _PlayListAnimation.size()) && (row2 < _PlayListAnimation.size()))
std::swap(_PlayListAnimation[row1], _PlayListAnimation[row2]);
std::swap(_PlayListAnimation[row1], _PlayListAnimation[row2]);
}
void CEntity::playbackAnim(bool play)
@ -175,12 +176,12 @@ void CEntity::update(NL3D::TAnimationTime time)
this->resetChannel();
switch (_AnimationStatus.Mode)
{
case Mode::PlayList:
animatePlayList(time);
break;
case Mode::Mixer:
animateChannelMixer();
break;
case Mode::PlayList:
animatePlayList(time);
break;
case Mode::Mixer:
animateChannelMixer();
break;
}
}
@ -188,11 +189,11 @@ void CEntity::update(NL3D::TAnimationTime time)
void CEntity::resetChannel()
{
for(uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++)
_PlayList->setAnimation(i, UPlayList::empty);
_PlayList->setAnimation(i, UPlayList::empty);
}
void CEntity::addTransformation (CMatrix &current, UAnimation *anim, float begin, float end, UTrack *posTrack, UTrack *rotquatTrack,
UTrack *nextPosTrack, UTrack *nextRotquatTrack, bool removeLast)
UTrack *nextPosTrack, UTrack *nextRotquatTrack, bool removeLast)
{
// In place ?
if (_inPlace)
@ -413,15 +414,15 @@ void CEntity::animateChannelMixer()
// Switch between wrap modes
switch (_SlotInfo[i].ClampMode)
{
case 0:
_PlayList->setWrapMode (i, UPlayList::Clamp);
break;
case 1:
_PlayList->setWrapMode (i, UPlayList::Repeat);
break;
case 2:
_PlayList->setWrapMode (i, UPlayList::Disable);
break;
case 0:
_PlayList->setWrapMode (i, UPlayList::Clamp);
break;
case 1:
_PlayList->setWrapMode (i, UPlayList::Repeat);
break;
case 2:
_PlayList->setWrapMode (i, UPlayList::Disable);
break;
}
}
}

View file

@ -36,12 +36,14 @@
#include <nel/3d/u_skeleton.h>
#include <nel/3d/channel_mixer.h>
namespace NL3D {
class UPlayList;
class UAnimationSet;
namespace NL3D
{
class UPlayList;
class UAnimationSet;
}
namespace NLQT {
namespace NLQT
{
class CSlotInfo
{
@ -145,56 +147,101 @@ public:
float getAnimLength(std::string name);
/// Get slot infomation
void setSlotInfo(uint num, CSlotInfo& slotInfo) { _SlotInfo[num] = slotInfo; }
void setSlotInfo(uint num, CSlotInfo& slotInfo)
{
_SlotInfo[num] = slotInfo;
}
/// Set use mode playlist or mixer
void setMode(int mode) { _AnimationStatus.Mode = mode; }
void setMode(int mode)
{
_AnimationStatus.Mode = mode;
}
/// Set in place mode animation
void setInPlace(bool enabled) { _inPlace = enabled; }
void setInPlace(bool enabled)
{
_inPlace = enabled;
}
/// Get in place mode
bool getInPlace() { return _inPlace; }
bool getInPlace()
{
return _inPlace;
}
/// Set inc position
void setIncPos(bool enabled) { _incPos = enabled; }
void setIncPos(bool enabled)
{
_incPos = enabled;
}
/// Get inc position
bool getIncPos() { return _incPos; }
bool getIncPos()
{
return _incPos;
}
/// Get information about the current status of playing a playlist
/// @return struct containing current information playback
SAnimationStatus getStatus() { return _AnimationStatus; }
SAnimationStatus getStatus()
{
return _AnimationStatus;
}
/// Get name entity
/// @return name entity
std::string getName() { return _Name; }
std::string getName()
{
return _Name;
}
/// Get file name shape
/// @return file name shape
std::string getFileNameShape() { return _FileNameShape; }
std::string getFileNameShape()
{
return _FileNameShape;
}
/// Get file name skeleton
/// @return file name skeleton
std::string getFileNameSkeleton() { return _FileNameSkeleton; }
std::string getFileNameSkeleton()
{
return _FileNameSkeleton;
}
/// Get slot information
CSlotInfo getSlotInfo(uint num) { return _SlotInfo[num]; }
CSlotInfo getSlotInfo(uint num)
{
return _SlotInfo[num];
}
/// Get list loaded animations files
std::vector<std::string>& getAnimationList() { return _AnimationList; }
std::vector<std::string>& getAnimationList()
{
return _AnimationList;
}
/// Get playlist animations
std::vector<std::string>& getPlayListAnimation() { return _PlayListAnimation; }
std::vector<std::string>& getPlayListAnimation()
{
return _PlayListAnimation;
}
/// Get list loaded skeleton weight template files
std::vector<std::string>& getSWTList() { return _SWTList; }
std::vector<std::string>& getSWTList()
{
return _SWTList;
}
/// Get game interface for manipulating Skeleton.
NL3D::USkeleton getSkeleton() const { return _Skeleton; }
NL3D::USkeleton getSkeleton() const
{
return _Skeleton;
}
private:
/// Constructor
/// Constructor
CEntity(void);
/// Update the animate from the playlist or channel mixer
@ -209,10 +256,10 @@ private:
/// Update the animate from the mixer
void animateChannelMixer();
void addTransformation (NLMISC::CMatrix &current, NL3D::UAnimation *anim,
float begin, float end,
NL3D::UTrack *posTrack, NL3D::UTrack *rotquatTrack,
NL3D::UTrack *nextPosTrack, NL3D::UTrack *nextRotquatTrack,
bool removeLast);
float begin, float end,
NL3D::UTrack *posTrack, NL3D::UTrack *rotquatTrack,
NL3D::UTrack *nextPosTrack, NL3D::UTrack *nextRotquatTrack,
bool removeLast);
// The name of the entity
std::string _Name;

View file

@ -26,38 +26,39 @@
// Project includes
#include "particle_node.h"
namespace NLQT {
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);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
setSizePolicy(sizePolicy);
setMinimumSize(QSize(0, 90));
setMaximumSize(QSize(16777215, 90));
gridLayout = new QGridLayout(this);
label = new QLabel(this);
gridLayout->addWidget(label, 0, 0, 1, 1);
comboBox = new QComboBox(this);
gridLayout->addWidget(comboBox, 1, 0, 1, 2);
horizontalSpacer = new QSpacerItem(207, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout->addItem(horizontalSpacer, 2, 0, 1, 1);
pushButton = new QPushButton(this);
gridLayout->addWidget(pushButton, 2, 1, 1, 1);
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
setSizePolicy(sizePolicy);
setMinimumSize(QSize(0, 90));
setMaximumSize(QSize(16777215, 90));
gridLayout = new QGridLayout(this);
label = new QLabel(this);
gridLayout->addWidget(label, 0, 0, 1, 1);
comboBox = new QComboBox(this);
gridLayout->addWidget(comboBox, 1, 0, 1, 2);
horizontalSpacer = new QSpacerItem(207, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
gridLayout->addItem(horizontalSpacer, 2, 0, 1, 1);
pushButton = new QPushButton(this);
gridLayout->addWidget(pushButton, 2, 1, 1, 1);
setWindowTitle(tr("Follow path param"));
label->setText(tr("Projection plane:"));
comboBox->clear();
comboBox->insertItems(0, QStringList()
<< tr("No projection")
<< tr("XY plane")
<< tr("XZ plane")
<< tr("YZ plane"));
pushButton->setText(("Ok"));
<< tr("No projection")
<< tr("XY plane")
<< tr("XZ plane")
<< tr("YZ plane"));
pushButton->setText(("Ok"));
comboBox->setCurrentIndex(_FollowPath->getProjectionPlane());

View file

@ -29,16 +29,17 @@
namespace NL3D
{
class CPSPlaneBasisFollowSpeed;
class CPSPlaneBasisFollowSpeed;
}
namespace NLQT {
namespace NLQT
{
class CWorkspaceNode;
class CFollowPathDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent = 0);

View file

@ -24,10 +24,11 @@
#include "modules.h"
#include <nel/3d/u_scene.h>
namespace NLQT {
namespace NLQT
{
CGlobalWindDialog::CGlobalWindDialog(QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
_ui.setupUi(this);

View file

@ -28,11 +28,12 @@
// Project includes
namespace NLQT {
namespace NLQT
{
class CGlobalWindDialog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
CGlobalWindDialog(QWidget *parent = 0);
@ -44,11 +45,11 @@ private Q_SLOTS:
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;*/
/* struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
{
NLMISC::CVector get(void) const;
void set(const NLMISC::CVector &d);
} _DirectionWrapper;*/
Ui::CGlobalWindDialog _ui;

View file

@ -27,12 +27,13 @@
// STL includes
namespace NLQT {
namespace NLQT
{
const int directionSize = 35;
CGraphicsInfoWidget::CGraphicsInfoWidget(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_color = Qt::white;
_mode = Mode::Color;
@ -94,7 +95,7 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
painter.drawLine(width() / 2, height() / 2,
int((width() / 2) + _x * 0.9f * directionSize), int((height() / 2) - _y * 0.9f * directionSize));
int((width() / 2) + _x * 0.9f * directionSize), int((height() / 2) - _y * 0.9f * directionSize));
}
if (_mode == Mode::PlaneBasic)
{
@ -109,9 +110,9 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
for(uint k = 0; k < _verts.size() / 2; ++k)
{
painter.drawLine(int((width() / 2.0) * (1 + _verts[2 * k].x)),
int((height() / 2.0) * (1 - _verts[2 * k].y)),
int((width() / 2.0) * (1 + _verts[2 * k + 1].x)),
int((height() / 2.0) * (1 - _verts[2 * k + 1].y)));
int((height() / 2.0) * (1 - _verts[2 * k].y)),
int((width() / 2.0) * (1 + _verts[2 * k + 1].x)),
int((height() / 2.0) * (1 - _verts[2 * k + 1].y)));
}
}
else
@ -119,14 +120,14 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
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)),
int((width() / 2.0) * (1 + _verts[ k].x)),
int((height() / 2.0) * (1 - _verts[k].y)));
int((height() / 2.0) * (1 - _verts[k - 1].y)),
int((width() / 2.0) * (1 + _verts[ k].x)),
int((height() / 2.0) * (1 - _verts[k].y)));
}
painter.drawLine(int((width() / 2.0) * (1 + _verts[0].x)),
int((height() / 2.0) * (1 - _verts[0].y)),
int((width() / 2.0) * (1 + _verts[_verts.size() - 1].x)),
int((height() / 2.0) * (1 - _verts[_verts.size() - 1].y)));
int((height() / 2.0) * (1 - _verts[0].y)),
int((width() / 2.0) * (1 + _verts[_verts.size() - 1].x)),
int((height() / 2.0) * (1 - _verts[_verts.size() - 1].y)));
}
}
}

View file

@ -30,7 +30,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
struct Mode
{
@ -45,7 +46,7 @@ struct Mode
class CGraphicsInfoWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CGraphicsInfoWidget(QWidget *parent = 0);

View file

@ -43,7 +43,8 @@
using namespace std;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CGraphicsViewport::CGraphicsViewport(QWidget *parent)
: QNLWidget(parent)
@ -89,7 +90,7 @@ QAction *CGraphicsViewport::createSaveScreenshotAction(QObject *parent)
QAction *CGraphicsViewport::createSetBackgroundColor(QObject *parent)
{
QAction *action = new QAction(parent);
QAction *action = new QAction(parent);
connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));
return action;
}
@ -102,8 +103,8 @@ void CGraphicsViewport::saveScreenshot()
void CGraphicsViewport::setBackgroundColor()
{
QColor color = QColorDialog::getColor(QColor(Modules::objView().getBackgroundColor().R,
Modules::objView().getBackgroundColor().G,
Modules::objView().getBackgroundColor().B));
Modules::objView().getBackgroundColor().G,
Modules::objView().getBackgroundColor().B));
if (color.isValid())
Modules::objView().setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
}

View file

@ -44,7 +44,8 @@ typedef QGLWidget QNLWidget;
class QAction;
namespace NLQT {
namespace NLQT
{
/**
@class CGraphicsViewport
@ -58,7 +59,10 @@ public:
CGraphicsViewport(QWidget *parent);
virtual ~CGraphicsViewport();
virtual QPaintEngine* paintEngine() const { return NULL; }
virtual QPaintEngine* paintEngine() const
{
return NULL;
}
void init();
void release();

View file

@ -45,364 +45,407 @@
#define printf
HoverPoints::HoverPoints(QWidget *widget, PointShape shape)
: QObject(widget)
: QObject(widget)
{
m_widget = widget;
widget->installEventFilter(this);
widget->setAttribute(Qt::WA_AcceptTouchEvents);
m_widget = widget;
widget->installEventFilter(this);
widget->setAttribute(Qt::WA_AcceptTouchEvents);
m_connectionType = CurveConnection;
m_sortType = NoSort;
m_shape = shape;
m_pointPen = QPen(QColor(255, 255, 255, 191), 1);
m_connectionPen = QPen(QColor(255, 255, 255, 127), 2);
m_pointBrush = QBrush(QColor(191, 191, 191, 127));
m_pointSize = QSize(11, 11);
m_currentIndex = -1;
m_editable = true;
m_enabled = true;
m_minCountPoints = 2;
m_connectionType = CurveConnection;
m_sortType = NoSort;
m_shape = shape;
m_pointPen = QPen(QColor(255, 255, 255, 191), 1);
m_connectionPen = QPen(QColor(255, 255, 255, 127), 2);
m_pointBrush = QBrush(QColor(191, 191, 191, 127));
m_pointSize = QSize(11, 11);
m_currentIndex = -1;
m_editable = true;
m_enabled = true;
m_minCountPoints = 2;
createGradient();
createGradient();
connect(this, SIGNAL(pointsChanged(QPolygonF)),
m_widget, SLOT(update()));
connect(this, SIGNAL(pointsChanged(QPolygonF)),
m_widget, SLOT(update()));
}
void HoverPoints::setEnabled(bool enabled)
{
if (m_enabled != enabled) {
m_enabled = enabled;
m_widget->update();
}
if (m_enabled != enabled)
{
m_enabled = enabled;
m_widget->update();
}
}
bool HoverPoints::eventFilter(QObject *object, QEvent *event)
{
if (object == m_widget && m_enabled) {
switch (event->type()) {
if (object == m_widget && m_enabled)
{
switch (event->type())
{
case QEvent::MouseButtonPress:
{
if (!m_fingerPointMapping.isEmpty())
return true;
QMouseEvent *me = (QMouseEvent *) event;
case QEvent::MouseButtonPress:
{
if (!m_fingerPointMapping.isEmpty())
return true;
QMouseEvent *me = (QMouseEvent *) event;
QPointF clickPos = me->pos();
int index = -1;
for (int i=0; i<m_points.size(); ++i) {
QPainterPath path;
if (m_shape == CircleShape)
path.addEllipse(pointBoundingRect(i));
else
path.addRect(pointBoundingRect(i));
QPointF clickPos = me->pos();
int index = -1;
for (int i=0; i<m_points.size(); ++i)
{
QPainterPath path;
if (m_shape == CircleShape)
path.addEllipse(pointBoundingRect(i));
else
path.addRect(pointBoundingRect(i));
if (path.contains(clickPos)) {
index = i;
break;
}
}
if (path.contains(clickPos))
{
index = i;
break;
}
}
if (me->button() == Qt::LeftButton) {
if (index == -1) {
if (!m_editable)
return false;
int pos = 0;
// Insert sort for x or y
if (m_sortType == XSort) {
for (int i=0; i<m_points.size(); ++i)
if (m_points.at(i).x() > clickPos.x()) {
pos = i;
break;
}
} else if (m_sortType == YSort) {
for (int i=0; i<m_points.size(); ++i)
if (m_points.at(i).y() > clickPos.y()) {
pos = i;
break;
}
}
if (me->button() == Qt::LeftButton)
{
if (index == -1)
{
if (!m_editable)
return false;
int pos = 0;
// Insert sort for x or y
if (m_sortType == XSort)
{
for (int i=0; i<m_points.size(); ++i)
if (m_points.at(i).x() > clickPos.x())
{
pos = i;
break;
}
}
else if (m_sortType == YSort)
{
for (int i=0; i<m_points.size(); ++i)
if (m_points.at(i).y() > clickPos.y())
{
pos = i;
break;
}
}
m_points.insert(pos, clickPos);
m_points.insert(pos, clickPos);
m_locks.insert(pos, 0);
m_currentIndex = pos;
firePointChange();
} else {
}
else
{
m_currentIndex = index;
}
return true;
}
return true;
} else if (me->button() == Qt::RightButton) {
if (index >= 0 && m_editable) {
if ((m_points.size() - 1) < m_minCountPoints)
return true;
if (m_locks[index] == 0) {
m_locks.remove(index);
m_points.remove(index);
}
firePointChange();
return true;
}
}
}
else if (me->button() == Qt::RightButton)
{
if (index >= 0 && m_editable)
{
if ((m_points.size() - 1) < m_minCountPoints)
return true;
if (m_locks[index] == 0)
{
m_locks.remove(index);
m_points.remove(index);
}
firePointChange();
return true;
}
}
}
break;
}
break;
case QEvent::MouseButtonRelease:
if (!m_fingerPointMapping.isEmpty())
return true;
m_currentIndex = -1;
break;
case QEvent::MouseButtonRelease:
if (!m_fingerPointMapping.isEmpty())
return true;
m_currentIndex = -1;
break;
case QEvent::MouseMove:
if (!m_fingerPointMapping.isEmpty())
return true;
if (m_currentIndex >= 0)
movePoint(m_currentIndex, ((QMouseEvent *)event)->pos());
break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
{
const QTouchEvent *const touchEvent = static_cast<const QTouchEvent*>(event);
const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
const qreal pointSize = qMax(m_pointSize.width(), m_pointSize.height());
Q_FOREACH (const QTouchEvent::TouchPoint &touchPoint, points) {
const int id = touchPoint.id();
switch (touchPoint.state()) {
case Qt::TouchPointPressed:
{
// find the point, move it
QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
int activePoint = -1;
qreal distance = -1;
const int pointsCount = m_points.size();
const int activePointCount = activePoints.size();
if (pointsCount == 2 && activePointCount == 1) { // only two points
activePoint = activePoints.contains(0) ? 1 : 0;
} else {
for (int i=0; i<pointsCount; ++i) {
if (activePoints.contains(i))
continue;
case QEvent::MouseMove:
if (!m_fingerPointMapping.isEmpty())
return true;
if (m_currentIndex >= 0)
movePoint(m_currentIndex, ((QMouseEvent *)event)->pos());
break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
{
const QTouchEvent *const touchEvent = static_cast<const QTouchEvent*>(event);
const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
const qreal pointSize = qMax(m_pointSize.width(), m_pointSize.height());
Q_FOREACH (const QTouchEvent::TouchPoint &touchPoint, points)
{
const int id = touchPoint.id();
switch (touchPoint.state())
{
case Qt::TouchPointPressed:
{
// find the point, move it
QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
int activePoint = -1;
qreal distance = -1;
const int pointsCount = m_points.size();
const int activePointCount = activePoints.size();
if (pointsCount == 2 && activePointCount == 1) // only two points
{
activePoint = activePoints.contains(0) ? 1 : 0;
}
else
{
for (int i=0; i<pointsCount; ++i)
{
if (activePoints.contains(i))
continue;
qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
if ((distance < 0 && d < 12 * pointSize) || d < distance) {
distance = d;
activePoint = i;
}
qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
if ((distance < 0 && d < 12 * pointSize) || d < distance)
{
distance = d;
activePoint = i;
}
}
}
if (activePoint != -1) {
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
movePoint(activePoint, touchPoint.pos());
}
}
break;
case Qt::TouchPointReleased:
{
// move the point and release
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
movePoint(it.value(), touchPoint.pos());
m_fingerPointMapping.erase(it);
}
break;
case Qt::TouchPointMoved:
{
// move the point
const int pointIdx = m_fingerPointMapping.value(id, -1);
if (pointIdx >= 0) // do we track this point?
movePoint(pointIdx, touchPoint.pos());
}
break;
default:
break;
}
}
if (m_fingerPointMapping.isEmpty()) {
event->ignore();
return false;
} else {
return true;
}
}
break;
case QEvent::TouchEnd:
if (m_fingerPointMapping.isEmpty()) {
event->ignore();
return false;
}
return true;
break;
}
}
if (activePoint != -1)
{
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
movePoint(activePoint, touchPoint.pos());
}
}
break;
case Qt::TouchPointReleased:
{
// move the point and release
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
movePoint(it.value(), touchPoint.pos());
m_fingerPointMapping.erase(it);
}
break;
case Qt::TouchPointMoved:
{
// move the point
const int pointIdx = m_fingerPointMapping.value(id, -1);
if (pointIdx >= 0) // do we track this point?
movePoint(pointIdx, touchPoint.pos());
}
break;
default:
break;
}
}
if (m_fingerPointMapping.isEmpty())
{
event->ignore();
return false;
}
else
{
return true;
}
}
break;
case QEvent::TouchEnd:
if (m_fingerPointMapping.isEmpty())
{
event->ignore();
return false;
}
return true;
break;
case QEvent::Resize:
{
QResizeEvent *e = (QResizeEvent *) event;
if (e->oldSize().width() == 0 || e->oldSize().height() == 0)
break;
qreal stretch_x = e->size().width() / qreal(e->oldSize().width());
qreal stretch_y = e->size().height() / qreal(e->oldSize().height());
for (int i=0; i<m_points.size(); ++i) {
QPointF p = m_points[i];
movePoint(i, QPointF(p.x() * stretch_x, p.y() * stretch_y), false);
}
case QEvent::Resize:
{
QResizeEvent *e = (QResizeEvent *) event;
if (e->oldSize().width() == 0 || e->oldSize().height() == 0)
break;
qreal stretch_x = e->size().width() / qreal(e->oldSize().width());
qreal stretch_y = e->size().height() / qreal(e->oldSize().height());
for (int i=0; i<m_points.size(); ++i)
{
QPointF p = m_points[i];
movePoint(i, QPointF(p.x() * stretch_x, p.y() * stretch_y), false);
}
firePointChange();
break;
}
firePointChange();
break;
}
case QEvent::Paint:
{
QWidget *that_widget = m_widget;
m_widget = 0;
QApplication::sendEvent(object, event);
m_widget = that_widget;
paintPoints();
return true;
}
default:
break;
}
}
case QEvent::Paint:
{
QWidget *that_widget = m_widget;
m_widget = 0;
QApplication::sendEvent(object, event);
m_widget = that_widget;
paintPoints();
return true;
}
default:
break;
}
}
return false;
return false;
}
void HoverPoints::paintPoints()
{
QPainter p;
p.begin(m_widget);
p.setRenderHint(QPainter::Antialiasing);
QPainter p;
p.begin(m_widget);
p.setRenderHint(QPainter::Antialiasing);
p.setBrush(m_gradient);
//p.setBrush(QColor(230,230,230));
p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
p.drawRoundedRect(QRect(1, 1, m_widget->width() - 2, m_widget->height() - 2), 4.0, 4.0);
p.setBrush(m_gradient);
//p.setBrush(QColor(230,230,230));
p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
p.drawRoundedRect(QRect(1, 1, m_widget->width() - 2, m_widget->height() - 2), 4.0, 4.0);
p.setBrush(QBrush());
p.setBrush(QBrush());
if (m_connectionPen.style() != Qt::NoPen && m_connectionType != NoConnection) {
p.setPen(m_connectionPen);
if (m_connectionPen.style() != Qt::NoPen && m_connectionType != NoConnection)
{
p.setPen(m_connectionPen);
if (m_connectionType == CurveConnection) {
QPainterPath path;
path.moveTo(m_points.at(0));
for (int i=1; i<m_points.size(); ++i) {
QPointF p1 = m_points.at(i-1);
QPointF p2 = m_points.at(i);
qreal distance = p2.x() - p1.x();
if (m_connectionType == CurveConnection)
{
QPainterPath path;
path.moveTo(m_points.at(0));
for (int i=1; i<m_points.size(); ++i)
{
QPointF p1 = m_points.at(i-1);
QPointF p2 = m_points.at(i);
qreal distance = p2.x() - p1.x();
path.cubicTo(p1.x() + distance / 2, p1.y(),
p1.x() + distance / 2, p2.y(),
p2.x(), p2.y());
}
p.drawPath(path);
} else {
p.drawPolyline(m_points);
}
}
path.cubicTo(p1.x() + distance / 2, p1.y(),
p1.x() + distance / 2, p2.y(),
p2.x(), p2.y());
}
p.drawPath(path);
}
else
{
p.drawPolyline(m_points);
}
}
p.setPen(m_pointPen);
p.setBrush(m_pointBrush);
p.setPen(m_pointPen);
p.setBrush(m_pointBrush);
for (int i=0; i<m_points.size(); ++i) {
QRectF bounds = pointBoundingRect(i);
if (m_shape == CircleShape)
p.drawEllipse(bounds);
else
p.drawRect(bounds);
}
for (int i=0; i<m_points.size(); ++i)
{
QRectF bounds = pointBoundingRect(i);
if (m_shape == CircleShape)
p.drawEllipse(bounds);
else
p.drawRect(bounds);
}
}
static QPointF bound_point(const QPointF &point, const QRectF &bounds, int lock)
{
QPointF p = point;
QPointF p = point;
qreal left = bounds.left();
qreal right = bounds.right();
qreal top = bounds.top();
qreal bottom = bounds.bottom();
qreal left = bounds.left();
qreal right = bounds.right();
qreal top = bounds.top();
qreal bottom = bounds.bottom();
if (p.x() < left || (lock & HoverPoints::LockToLeft)) p.setX(left);
else if (p.x() > right || (lock & HoverPoints::LockToRight)) p.setX(right);
if (p.x() < left || (lock & HoverPoints::LockToLeft)) p.setX(left);
else if (p.x() > right || (lock & HoverPoints::LockToRight)) p.setX(right);
/* if (p.y() < top || (lock & HoverPoints::LockToTop)) p.setY(top);
else if (p.y() > bottom || (lock & HoverPoints::LockToBottom)) p.setY(bottom);
*/
/* if (p.y() < top || (lock & HoverPoints::LockToTop)) p.setY(top);
else if (p.y() > bottom || (lock & HoverPoints::LockToBottom)) p.setY(bottom);
*/
return p;
return p;
}
void HoverPoints::setPoints(const QPolygonF &points)
{
if (points.size() != m_points.size())
m_fingerPointMapping.clear();
m_points.clear();
for (int i=0; i<points.size(); ++i)
m_points << bound_point(points.at(i), boundingRect(), 0);
if (points.size() != m_points.size())
m_fingerPointMapping.clear();
m_points.clear();
for (int i=0; i<points.size(); ++i)
m_points << bound_point(points.at(i), boundingRect(), 0);
m_locks.clear();
if (m_points.size() > 0) {
m_locks.resize(m_points.size());
m_locks.clear();
if (m_points.size() > 0)
{
m_locks.resize(m_points.size());
m_locks.fill(0);
}
m_locks.fill(0);
}
}
void HoverPoints::movePoint(int index, const QPointF &point, bool emitUpdate)
{
m_points[index] = bound_point(point, boundingRect(), m_locks.at(index));
if (emitUpdate)
firePointChange();
m_points[index] = bound_point(point, boundingRect(), m_locks.at(index));
if (emitUpdate)
firePointChange();
}
void HoverPoints::createGradient()
{
m_gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
m_gradient.setCenter(0.45, 0.50);
m_gradient.setFocalPoint(0.40, 0.45);
m_gradient.setColorAt(0.0, QColor(175, 216, 252));
m_gradient.setColorAt(0.4, QColor(151, 183, 220));
m_gradient.setColorAt(0.8, QColor(86, 126, 191));
m_gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
m_gradient.setCenter(0.45, 0.50);
m_gradient.setFocalPoint(0.40, 0.45);
m_gradient.setColorAt(0.0, QColor(175, 216, 252));
m_gradient.setColorAt(0.4, QColor(151, 183, 220));
m_gradient.setColorAt(0.8, QColor(86, 126, 191));
}
inline static bool x_less_than(const QPointF &p1, const QPointF &p2)
{
return p1.x() < p2.x();
return p1.x() < p2.x();
}
inline static bool y_less_than(const QPointF &p1, const QPointF &p2)
{
return p1.y() < p2.y();
return p1.y() < p2.y();
}
void HoverPoints::firePointChange()
{
if (m_sortType != NoSort) {
if (m_sortType != NoSort)
{
QPointF oldCurrent;
if (m_currentIndex != -1) {
oldCurrent = m_points[m_currentIndex];
}
QPointF oldCurrent;
if (m_currentIndex != -1)
{
oldCurrent = m_points[m_currentIndex];
}
if (m_sortType == XSort)
qSort(m_points.begin(), m_points.end(), x_less_than);
else if (m_sortType == YSort)
qSort(m_points.begin(), m_points.end(), y_less_than);
if (m_sortType == XSort)
qSort(m_points.begin(), m_points.end(), x_less_than);
else if (m_sortType == YSort)
qSort(m_points.begin(), m_points.end(), y_less_than);
// Compensate for changed order...
if (m_currentIndex != -1) {
for (int i=0; i<m_points.size(); ++i) {
if (m_points[i] == oldCurrent) {
m_currentIndex = i;
break;
}
}
}
}
Q_EMIT pointsChanged(m_points);
// Compensate for changed order...
if (m_currentIndex != -1)
{
for (int i=0; i<m_points.size(); ++i)
{
if (m_points[i] == oldCurrent)
{
m_currentIndex = i;
break;
}
}
}
}
Q_EMIT pointsChanged(m_points);
}

View file

@ -48,118 +48,167 @@ QT_FORWARD_DECLARE_CLASS(QBypassWidget)
class HoverPoints : public QObject
{
Q_OBJECT
Q_OBJECT
public:
enum PointShape {
CircleShape,
RectangleShape
};
enum PointShape
{
CircleShape,
RectangleShape
};
enum LockType {
LockToLeft = 0x01,
LockToRight = 0x02,
LockToTop = 0x04,
LockToBottom = 0x08
};
enum LockType
{
LockToLeft = 0x01,
LockToRight = 0x02,
LockToTop = 0x04,
LockToBottom = 0x08
};
enum SortType {
NoSort,
XSort,
YSort
};
enum SortType
{
NoSort,
XSort,
YSort
};
enum ConnectionType {
NoConnection,
LineConnection,
CurveConnection
};
enum ConnectionType
{
NoConnection,
LineConnection,
CurveConnection
};
HoverPoints(QWidget *widget, PointShape shape);
HoverPoints(QWidget *widget, PointShape shape);
bool eventFilter(QObject *object, QEvent *event);
bool eventFilter(QObject *object, QEvent *event);
void paintPoints();
void paintPoints();
inline QRectF boundingRect() const;
void setBoundingRect(const QRectF &boundingRect) { m_bounds = boundingRect; }
inline QRectF boundingRect() const;
void setBoundingRect(const QRectF &boundingRect)
{
m_bounds = boundingRect;
}
QPolygonF points() const { return m_points; }
void setPoints(const QPolygonF &points);
QPolygonF points() const
{
return m_points;
}
void setPoints(const QPolygonF &points);
QSizeF pointSize() const { return m_pointSize; }
void setPointSize(const QSizeF &size) { m_pointSize = size; }
QSizeF pointSize() const
{
return m_pointSize;
}
void setPointSize(const QSizeF &size)
{
m_pointSize = size;
}
SortType sortType() const { return m_sortType; }
void setSortType(SortType sortType) { m_sortType = sortType; }
SortType sortType() const
{
return m_sortType;
}
void setSortType(SortType sortType)
{
m_sortType = sortType;
}
ConnectionType connectionType() const { return m_connectionType; }
void setConnectionType(ConnectionType connectionType) { m_connectionType = connectionType; }
ConnectionType connectionType() const
{
return m_connectionType;
}
void setConnectionType(ConnectionType connectionType)
{
m_connectionType = connectionType;
}
void setConnectionPen(const QPen &pen) { m_connectionPen = pen; }
void setShapePen(const QPen &pen) { m_pointPen = pen; }
void setShapeBrush(const QBrush &brush) { m_pointBrush = brush; }
void setConnectionPen(const QPen &pen)
{
m_connectionPen = pen;
}
void setShapePen(const QPen &pen)
{
m_pointPen = pen;
}
void setShapeBrush(const QBrush &brush)
{
m_pointBrush = brush;
}
void setPointLock(int pos, LockType lock) { m_locks[pos] = lock; }
void setPointLock(int pos, LockType lock)
{
m_locks[pos] = lock;
}
void setEditable(bool editable) { m_editable = editable; }
bool editable() const { return m_editable; }
void setEditable(bool editable)
{
m_editable = editable;
}
bool editable() const
{
return m_editable;
}
public Q_SLOTS:
void setEnabled(bool enabled);
void setDisabled(bool disabled) { setEnabled(!disabled); }
void setEnabled(bool enabled);
void setDisabled(bool disabled)
{
setEnabled(!disabled);
}
Q_SIGNALS:
void pointsChanged(const QPolygonF &points);
void pointsChanged(const QPolygonF &points);
public:
void firePointChange();
void firePointChange();
private:
inline QRectF pointBoundingRect(int i) const;
void movePoint(int i, const QPointF &newPos, bool emitChange = true);
void createGradient();
inline QRectF pointBoundingRect(int i) const;
void movePoint(int i, const QPointF &newPos, bool emitChange = true);
void createGradient();
QWidget *m_widget;
QWidget *m_widget;
QPolygonF m_points;
QRectF m_bounds;
PointShape m_shape;
SortType m_sortType;
ConnectionType m_connectionType;
QPolygonF m_points;
QRectF m_bounds;
PointShape m_shape;
SortType m_sortType;
ConnectionType m_connectionType;
QVector<uint> m_locks;
QVector<uint> m_locks;
QSizeF m_pointSize;
int m_currentIndex;
int m_minCountPoints;
bool m_editable;
bool m_enabled;
QSizeF m_pointSize;
int m_currentIndex;
int m_minCountPoints;
bool m_editable;
bool m_enabled;
QHash<int, int> m_fingerPointMapping;
QHash<int, int> m_fingerPointMapping;
QPen m_pointPen;
QBrush m_pointBrush;
QPen m_connectionPen;
QRadialGradient m_gradient;
QPen m_pointPen;
QBrush m_pointBrush;
QPen m_connectionPen;
QRadialGradient m_gradient;
};
inline QRectF HoverPoints::pointBoundingRect(int i) const
{
QPointF p = m_points.at(i);
qreal w = m_pointSize.width();
qreal h = m_pointSize.height();
qreal x = p.x() - w / 2;
qreal y = p.y() - h / 2;
return QRectF(x, y, w, h);
QPointF p = m_points.at(i);
qreal w = m_pointSize.width();
qreal h = m_pointSize.height();
qreal x = p.x() - w / 2;
qreal y = p.y() - h / 2;
return QRectF(x, y, w, h);
}
inline QRectF HoverPoints::boundingRect() const
{
if (m_bounds.isEmpty())
return m_widget->rect();
else
return m_bounds;
if (m_bounds.isEmpty())
return m_widget->rect();
else
return m_bounds;
}
#endif // HOVERPOINTS_H

View file

@ -29,10 +29,11 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -384,8 +385,8 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
if (dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable))
{
_ui.texAnimWidget->setCurrentTextureAnim(dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable),
dynamic_cast<NL3D::CPSMultiTexturedParticle *>(_Bindable),
_Node);
dynamic_cast<NL3D::CPSMultiTexturedParticle *>(_Bindable),
_Node);
_ui.texAnimWidget->show();
_ui.tabWidget->addTab(_ui.texturePage, tr("Texture param"));

View file

@ -37,7 +37,8 @@
#include "ps_wrapper.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedBindablePage
@ -45,7 +46,7 @@ namespace NLQT {
*/
class CLocatedBindablePage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CLocatedBindablePage(QWidget *parent = 0);
@ -80,166 +81,313 @@ private:
struct CSizeWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSSizedParticle *S;
float get(void) const { return S->getSize(); }
void set(const float &v) { S->setSize(v); }
scheme_type *getScheme(void) const { return S->getSizeScheme(); }
void setScheme(scheme_type *s) { S->setSizeScheme(s); }
float get(void) const
{
return S->getSize();
}
void set(const float &v)
{
S->setSize(v);
}
scheme_type *getScheme(void) const
{
return S->getSizeScheme();
}
void setScheme(scheme_type *s)
{
S->setSizeScheme(s);
}
} _SizeWrapper;
/// Color
struct CColorWrapper : public IPSWrapperRGBA, IPSSchemeWrapperRGBA
{
NL3D::CPSColoredParticle *S;
NLMISC::CRGBA get(void) const { return S->getColor(); }
void set(const NLMISC::CRGBA &v) { S->setColor(v); }
scheme_type *getScheme(void) const { return S->getColorScheme(); }
void setScheme(scheme_type *s) { S->setColorScheme(s); }
NLMISC::CRGBA get(void) const
{
return S->getColor();
}
void set(const NLMISC::CRGBA &v)
{
S->setColor(v);
}
scheme_type *getScheme(void) const
{
return S->getColorScheme();
}
void setScheme(scheme_type *s)
{
S->setColorScheme(s);
}
} _ColorWrapper;
/// Angle 2D
struct CAngle2DWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSRotated2DParticle *S;
float get(void) const { return S->getAngle2D(); }
void set(const float &v) { S->setAngle2D(v); }
scheme_type *getScheme(void) const { return S->getAngle2DScheme(); }
void setScheme(scheme_type *s) { S->setAngle2DScheme(s); }
float get(void) const
{
return S->getAngle2D();
}
void set(const float &v)
{
S->setAngle2D(v);
}
scheme_type *getScheme(void) const
{
return S->getAngle2DScheme();
}
void setScheme(scheme_type *s)
{
S->setAngle2DScheme(s);
}
} _Angle2DWrapper;
/// Plane basis
struct CPlaneBasisWrapper : public IPSWrapper<NL3D::CPlaneBasis>, IPSSchemeWrapper<NL3D::CPlaneBasis>
{
NL3D::CPSRotated3DPlaneParticle *S;
NL3D::CPlaneBasis get(void) const { return S->getPlaneBasis(); }
void set(const NL3D::CPlaneBasis &p) { S->setPlaneBasis(p); }
scheme_type *getScheme(void) const { return S->getPlaneBasisScheme(); }
void setScheme(scheme_type *s) { S->setPlaneBasisScheme(s); }
NL3D::CPlaneBasis get(void) const
{
return S->getPlaneBasis();
}
void set(const NL3D::CPlaneBasis &p)
{
S->setPlaneBasis(p);
}
scheme_type *getScheme(void) const
{
return S->getPlaneBasisScheme();
}
void setScheme(scheme_type *s)
{
S->setPlaneBasisScheme(s);
}
} _PlaneBasisWrapper;
/// Motion blur coeff
struct CMotionBlurCoeffWrapper : public IPSWrapperFloat
{
NL3D::CPSFaceLookAt *P;
float get(void) const { return P->getMotionBlurCoeff(); }
void set(const float &v) { P->setMotionBlurCoeff(v); }
float get(void) const
{
return P->getMotionBlurCoeff();
}
void set(const float &v)
{
P->setMotionBlurCoeff(v);
}
} _MotionBlurCoeffWrapper;
struct CMotionBlurThresholdWrapper : public IPSWrapperFloat
{
NL3D::CPSFaceLookAt *P;
float get(void) const { return P->getMotionBlurThreshold(); }
void set(const float &v) { P->setMotionBlurThreshold(v); }
float get(void) const
{
return P->getMotionBlurThreshold();
}
void set(const float &v)
{
P->setMotionBlurThreshold(v);
}
} _MotionBlurThresholdWrapper;
/// Fanlight
struct CFanLightWrapper : public IPSWrapperUInt
{
NL3D::CPSFanLight *P;
uint32 get(void) const { return P->getNbFans(); }
void set(const uint32 &v) { P->setNbFans(v); }
uint32 get(void) const
{
return P->getNbFans();
}
void set(const uint32 &v)
{
P->setNbFans(v);
}
} _FanLightWrapper;
struct CFanLightSmoothnessWrapper : public IPSWrapperUInt
{
NL3D::CPSFanLight *P;
uint32 get(void) const { return P->getPhaseSmoothness(); }
void set(const uint32 &v) { P->setPhaseSmoothness(v); }
uint32 get(void) const
{
return P->getPhaseSmoothness();
}
void set(const uint32 &v)
{
P->setPhaseSmoothness(v);
}
} _FanLightSmoothnessWrapper;
struct CFanLightPhase : public IPSWrapperFloat
{
NL3D::CPSFanLight *P;
float get(void) const { return P->getPhaseSpeed(); }
void set(const float &v) { P->setPhaseSpeed(v); }
float get(void) const
{
return P->getPhaseSpeed();
}
void set(const float &v)
{
P->setPhaseSpeed(v);
}
} _FanLightPhaseWrapper;
struct CFanLightIntensityWrapper : public IPSWrapperFloat
{
NL3D::CPSFanLight *P;
float get(void) const { return P->getMoveIntensity(); }
void set(const float &v) { P->setMoveIntensity(v); }
float get(void) const
{
return P->getMoveIntensity();
}
void set(const float &v)
{
P->setMoveIntensity(v);
}
} _FanLightIntensityWrapper;
/// Ribbon / tail dot
struct CTailParticleWrapper : public IPSWrapperUInt
{
NL3D::CPSTailParticle *P;
uint32 get(void) const { return P->getTailNbSeg(); }
void set(const uint32 &v) { P->setTailNbSeg(v); }
uint32 get(void) const
{
return P->getTailNbSeg();
}
void set(const uint32 &v)
{
P->setTailNbSeg(v);
}
} _TailParticleWrapper;
/// Duration of segment for a ribbon
struct CSegDurationWrapper : public IPSWrapperFloat
{
NL3D::CPSRibbonBase *R;
float get(void) const { return R->getSegDuration(); }
void set(const float &v) { R->setSegDuration(v); }
float get(void) const
{
return R->getSegDuration();
}
void set(const float &v)
{
R->setSegDuration(v);
}
} _SegDurationWrapper;
/// Shockwave
struct CRadiusCutWrapper : public IPSWrapperFloat
{
NL3D::CPSShockWave *S;
float get(void) const { return S->getRadiusCut(); }
void set(const float &v) { S->setRadiusCut(v); }
float get(void) const
{
return S->getRadiusCut();
}
void set(const float &v)
{
S->setRadiusCut(v);
}
} _RadiusCutWrapper;
struct CShockWaveNbSegWrapper : public IPSWrapperUInt
{
NL3D::CPSShockWave *S;
uint32 get(void) const { return S->getNbSegs(); }
void set(const uint32 &v) { S->setNbSegs(v); }
uint32 get(void) const
{
return S->getNbSegs();
}
void set(const uint32 &v)
{
S->setNbSegs(v);
}
} _ShockWaveNbSegWrapper;
struct CShockWaveUFactorWrapper : public IPSWrapperFloat
{
NL3D::CPSShockWave *S;
float get(void) const { return S->getUFactor(); }
void set(const float &v) { S->setUFactor(v); }
float get(void) const
{
return S->getUFactor();
}
void set(const float &v)
{
S->setUFactor(v);
}
} _ShockWaveUFactorWrapper;
/// Unanimated texture
struct CTextureNoAnimWrapper : public IPSWrapperTexture
{
NL3D::CPSTexturedParticleNoAnim *TP;
virtual NL3D::ITexture *get(void) { return TP->getTexture(); }
virtual void set(NL3D::ITexture *t) { TP->setTexture(t); }
virtual NL3D::ITexture *get(void)
{
return TP->getTexture();
}
virtual void set(NL3D::ITexture *t)
{
TP->setTexture(t);
}
} _TextureNoAnimWrapper;
/// u / v factors for ribbon
struct CRibbonUFactorWrapper : public IPSWrapperFloat
{
NL3D::CPSRibbon *R;
float get(void) const { return R->getUFactor(); }
void set(const float &u) { R->setTexFactor(u, R->getVFactor()); }
float get(void) const
{
return R->getUFactor();
}
void set(const float &u)
{
R->setTexFactor(u, R->getVFactor());
}
} _RibbonUFactorWrapper;
struct CRibbonVFactorWrapper : public IPSWrapperFloat
{
NL3D::CPSRibbon *R;
float get(void) const { return R->getVFactor(); }
void set(const float &v) { R->setTexFactor(R->getUFactor(), v); }
float get(void) const
{
return R->getVFactor();
}
void set(const float &v)
{
R->setTexFactor(R->getUFactor(), v);
}
} _RibbonVFactorWrapper;
struct CRibbonLengthWrapper : IPSWrapperFloat
{
NL3D::CPSRibbonBase *R;
float get() const { return R->getRibbonLength(); }
void set(const float &v) { R->setRibbonLength(v); }
float get() const
{
return R->getRibbonLength();
}
void set(const float &v)
{
R->setRibbonLength(v);
}
} _RibbonLengthWrapper;
struct CLODDegradationWrapper : IPSWrapperFloat
{
NL3D::CPSRibbonBase *R;
float get() const { return R->getLODDegradation(); }
void set(const float &v) { R->setLODDegradation(v); }
float get() const
{
return R->getLODDegradation();
}
void set(const float &v)
{
R->setLODDegradation(v);
}
} _LODDegradationWrapper;
void updateValidWidgetForAlignOnMotion(bool align);
void updateSizeControl();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
void hideAllWidget();

View file

@ -30,10 +30,11 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CLocatedPage::CLocatedPage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -89,10 +90,10 @@ void CLocatedPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
_ui.massWidget->setWorkspaceNode(_Node);
_ui.massWidget->updateUi();
if (_Located->getOwner())
_ui.maxNumParticleWidget->setEnabled(!_Located->getOwner()->getAutoCountFlag());
if (_Located->getOwner())
_ui.maxNumParticleWidget->setEnabled(!_Located->getOwner()->getAutoCountFlag());
_ui.maxNumParticleWidget->setValue(_Located->getMaxSize(), false);
_ui.maxNumParticleWidget->setValue(_Located->getMaxSize(), false);
_ui.coordSystemComboBox->setCurrentIndex(int(_Located->getMatrixMode()));
_ui.limitedLifeTimeCheckBox->setChecked(!_Located->getLastForever());
@ -131,9 +132,9 @@ void CLocatedPage::setLimitedLifeTime(bool state)
if (forceApplied)
{
int ret = QMessageBox::critical(this, tr("NeL particle system editor"),
tr("The object has force(s) applied on it. If it last forever, "
"its motion can become instable after a while. Continue anyway ? (clue : you've been warned ..)"),
QMessageBox::Ok | QMessageBox::Cancel);
tr("The object has force(s) applied on it. If it last forever, "
"its motion can become instable after a while. Continue anyway ? (clue : you've been warned ..)"),
QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Cancel)
{
@ -148,9 +149,9 @@ void CLocatedPage::setLimitedLifeTime(bool state)
else
{
QMessageBox::critical(this, tr("NeL particle system editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
_ui.limitedLifeTimeCheckBox->setChecked(true);
}
}
@ -184,10 +185,10 @@ void CLocatedPage::setParametricMotion(bool state)
void CLocatedPage::editTriggerOnDeath()
{
bool ok;
bool ok;
int i = QInputDialog::getInt(this, tr("Set the extern ID"),
tr("0 means no extern access."),
_Located->getTriggerEmitterID(), 0, 9999, 1, &ok);
tr("0 means no extern access."),
_Located->getTriggerEmitterID(), 0, 9999, 1, &ok);
if (ok)
{
_Located->setTriggerEmitterID(uint32(i));
@ -246,7 +247,7 @@ void CLocatedPage::updateIntegrable(void)
void CLocatedPage::updateTriggerOnDeath(void)
{
nlassert(_Located);
nlassert(_Located);
bool enable = !_Located->getLastForever();
_ui.trigerOnDeathCheckBox->setEnabled(enable);
_ui.editPushButton->setEnabled(enable && _Located->isTriggerOnDeathEnabled());

View file

@ -33,10 +33,11 @@
namespace NL3D
{
class CPSLocated;
class CPSLocated;
}
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedPage
@ -44,7 +45,7 @@ namespace NLQT {
*/
class CLocatedPage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CLocatedPage(QWidget *parent = 0);
@ -70,21 +71,39 @@ private:
/// wrapper to tune the mass of particles
struct CMassWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSLocated *Located;
float get(void) const { return Located->getInitialMass(); }
void set(const float &v) { Located->setInitialMass(v); }
virtual scheme_type *getScheme(void) const { return Located->getMassScheme(); }
virtual void setScheme(scheme_type *s) { Located->setMassScheme(s); }
NL3D::CPSLocated *Located;
float get(void) const
{
return Located->getInitialMass();
}
void set(const float &v)
{
Located->setInitialMass(v);
}
virtual scheme_type *getScheme(void) const
{
return Located->getMassScheme();
}
virtual void setScheme(scheme_type *s)
{
Located->setMassScheme(s);
}
} _MassWrapper;
struct CLifeWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSLocated *Located;
CWorkspaceNode *Node;
float get(void) const { return Located->getInitialLife(); }
void set(const float &v);
virtual scheme_type *getScheme(void) const { return Located->getLifeScheme(); }
virtual void setScheme(scheme_type *s);
NL3D::CPSLocated *Located;
CWorkspaceNode *Node;
float get(void) const
{
return Located->getInitialLife();
}
void set(const float &v);
virtual scheme_type *getScheme(void) const
{
return Located->getLifeScheme();
}
virtual void setScheme(scheme_type *s);
} _LifeWrapper;
/// the located this dialog is editing
@ -98,7 +117,10 @@ private:
/// update the 'trigger on death' control
void updateTriggerOnDeath(void);
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
Ui::CLocatedPage _ui;
}; /* class CLocatedPage */

View file

@ -32,9 +32,11 @@
using namespace std;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
namespace {
namespace
{
CFileDisplayer *s_FileDisplayer = NULL;
@ -57,7 +59,7 @@ CFileDisplayer *s_FileDisplayer = NULL;
sint main(int argc, char **argv)
{
// go nel!
// go nel!
{
// use log.log if NEL_LOG_IN_FILE and NLQT_USE_LOG_LOG defined as 1
createDebug(NULL, NLQT_USE_LOG_LOG, false);

View file

@ -49,14 +49,15 @@
using namespace std;
using namespace NLMISC;
namespace NLQT {
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:");
@ -107,7 +108,7 @@ CMainWindow::CMainWindow(QWidget *parent)
CMainWindow::~CMainWindow()
{
nldebug("CMainWindow::~CMainWindow:");
nldebug("CMainWindow::~CMainWindow:");
// save state & geometry of window and widgets
QSettings settings("object_viewer_qt.ini", QSettings::IniFormat);
@ -159,10 +160,10 @@ int CMainWindow::getFrameRate()
void CMainWindow::open()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Open NeL data file"), _lastDir,
tr("All NeL files (*.shape *.ps);;"
"NeL shape files (*.shape);;"
"NeL particle system files (*.ps)"));
tr("Open NeL data file"), _lastDir,
tr("All NeL files (*.shape *.ps);;"
"NeL shape files (*.shape);;"
"NeL particle system files (*.ps)"));
setCursor(Qt::WaitCursor);
if (!fileNames.isEmpty())
@ -171,11 +172,11 @@ void CMainWindow::open()
_lastDir = QFileInfo(list.front()).absolutePath();
QString skelFileName = QFileDialog::getOpenFileName(this,
tr("Open skeleton file"), _lastDir,
tr("NeL skeleton file (*.skel)"));
tr("Open skeleton file"), _lastDir,
tr("NeL skeleton file (*.skel)"));
Q_FOREACH(QString fileName, list)
loadFile(fileName, skelFileName);
loadFile(fileName, skelFileName);
_AnimationSetDialog->updateListObject();
_AnimationSetDialog->updateListAnim();
@ -203,14 +204,14 @@ void CMainWindow::settings()
void CMainWindow::about()
{
QMessageBox::about(this, tr("About Object Viewer Qt"),
tr("<h2>Object Viewer Qt 8-)</h2>"
"<p> Authors: dnk-88, sfb, Kaetemi, kervala <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
tr("<h2>Object Viewer Qt 8-)</h2>"
"<p> Authors: dnk-88, sfb, Kaetemi, kervala <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
}
void CMainWindow::updateStatusBar()
{
if (_isGraphicsInitialized)
statusBar()->showMessage(QString(Modules::objView().getDriver()->getVideocardInformation()));
statusBar()->showMessage(QString(Modules::objView().getDriver()->getVideocardInformation()));
}
void CMainWindow::updateInitialization(bool visible)
@ -298,7 +299,8 @@ void CMainWindow::updateInitialization(bool visible)
}
}
} while (!done);
}
while (!done);
}
void CMainWindow::createActions()

View file

@ -30,11 +30,13 @@
// Project includes
namespace NLMISC {
class CConfigFile;
namespace NLMISC
{
class CConfigFile;
}
namespace NLQT {
namespace NLQT
{
class CGraphicsViewport;
class CAnimationDialog;
@ -63,7 +65,9 @@ public:
int getFrameRate();
CSkeletonTreeModel *getSkeletonModel() const
{ return _SkeletonTreeModel; }
{
return _SkeletonTreeModel;
}
private Q_SLOTS:
void open();

View file

@ -34,10 +34,11 @@
#include "mesh_widget.h"
#include "morph_mesh_dialog.h"
namespace NLQT {
namespace NLQT
{
CMeshWidget::CMeshWidget(QWidget *parent)
: QGroupBox(parent)
: QGroupBox(parent)
{
_ui.setupUi(this);
@ -79,8 +80,8 @@ void CMeshWidget::setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParti
void CMeshWidget::browseShape()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open NeL data file"), ".",
tr("NeL shape file (*.shape)"));
tr("Open NeL data file"), ".",
tr("NeL shape file (*.shape)"));
setCursor(Qt::WaitCursor);
if (!fileName.isEmpty())
@ -137,7 +138,7 @@ void CMeshWidget::editMorph()
void CMeshWidget::updateForMorph()
{
NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle);
NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle);
if (cm)
{
bool enable = cm->getNumShapes() > 1;
@ -185,10 +186,13 @@ QString CMeshWidget::getShapeErrorString(sint errorCode)
{
switch(errorCode)
{
case NL3D::CPSConstraintMesh::ShapeFileIsNotAMesh: return tr("Not a mesh");
case NL3D::CPSConstraintMesh::ShapeFileNotLoaded: return tr("Shape not loaded");
case NL3D::CPSConstraintMesh::ShapeHasTooMuchVertices: return tr("Too much vertices");
default:
case NL3D::CPSConstraintMesh::ShapeFileIsNotAMesh:
return tr("Not a mesh");
case NL3D::CPSConstraintMesh::ShapeFileNotLoaded:
return tr("Shape not loaded");
case NL3D::CPSConstraintMesh::ShapeHasTooMuchVertices:
return tr("Too much vertices");
default:
break;
};
return QString();

View file

@ -33,14 +33,15 @@
namespace NL3D
{
struct CPSShapeParticle;
struct CPSShapeParticle;
}
namespace NLQT {
namespace NLQT
{
class CMeshWidget: public QGroupBox
{
Q_OBJECT
Q_OBJECT
public:
CMeshWidget(QWidget *parent = 0);
@ -64,7 +65,10 @@ private:
void updateMeshErrorString();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
void touchPSState();

View file

@ -41,12 +41,18 @@ void Modules::init()
void Modules::release()
{
delete _mainWindow; _mainWindow = NULL;
delete _particleEditor; _particleEditor = NULL;
delete _vegetableEditor; _vegetableEditor = NULL;
delete _soundSystem; _soundSystem = NULL;
delete _objectViewer; _objectViewer = NULL;
delete _mainWindow;
_mainWindow = NULL;
delete _particleEditor;
_particleEditor = NULL;
delete _vegetableEditor;
_vegetableEditor = NULL;
delete _soundSystem;
_soundSystem = NULL;
delete _objectViewer;
_objectViewer = NULL;
config().release();
delete _configuration; _configuration = NULL;
delete _configuration;
_configuration = NULL;
}

View file

@ -37,12 +37,30 @@ public:
static void init();
static void release();
static NLQT::CConfiguration &config() { return *_configuration; }
static NLQT::CObjectViewer &objView() { return *_objectViewer; }
static NLQT::CMainWindow &mainWin() { return *_mainWindow; }
static NLQT::CParticleEditor &psEdit() { return *_particleEditor; }
static NLQT::CSoundSystem &sound() { return *_soundSystem; }
static NLQT::CVegetableEditor &veget() { return *_vegetableEditor; }
static NLQT::CConfiguration &config()
{
return *_configuration;
}
static NLQT::CObjectViewer &objView()
{
return *_objectViewer;
}
static NLQT::CMainWindow &mainWin()
{
return *_mainWindow;
}
static NLQT::CParticleEditor &psEdit()
{
return *_particleEditor;
}
static NLQT::CSoundSystem &sound()
{
return *_soundSystem;
}
static NLQT::CVegetableEditor &veget()
{
return *_vegetableEditor;
}
private:
static NLQT::CConfiguration *_configuration;
static NLQT::CObjectViewer *_objectViewer;

View file

@ -30,10 +30,11 @@
// Projects includes
#include "mesh_widget.h"
namespace NLQT {
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);
@ -97,8 +98,8 @@ QString CMorphMeshDialog::getShapeDescStr(uint shapeIndex, sint numVerts) const
void CMorphMeshDialog::add()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open NeL data file"), ".",
tr("NeL shape files (*.shape)"));
tr("Open NeL data file"), ".",
tr("NeL shape files (*.shape)"));
setCursor(Qt::WaitCursor);
if (!fileName.isEmpty())
@ -139,8 +140,8 @@ void CMorphMeshDialog::remove()
void CMorphMeshDialog::insert()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open NeL data file"), ".",
tr("NeL shape files (*.shape)"));
tr("Open NeL data file"), ".",
tr("NeL shape files (*.shape)"));
setCursor(Qt::WaitCursor);
if (!fileName.isEmpty())
@ -162,8 +163,8 @@ void CMorphMeshDialog::insert()
void CMorphMeshDialog::change()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open NeL data file"), ".",
tr("NeL shape files (*.shape)"));
tr("Open NeL data file"), ".",
tr("NeL shape files (*.shape)"));
setCursor(Qt::WaitCursor);
if (!fileName.isEmpty())
@ -193,7 +194,7 @@ void CMorphMeshDialog::up()
void CMorphMeshDialog::down()
{
sint row = _ui.listWidget->currentRow();
sint row = _ui.listWidget->currentRow();
if (row == (sint) (_CM->getNumShapes() - 1)) return;
std::vector<std::string> shapeNames;
shapeNames.resize(_CM->getNumShapes());

View file

@ -33,14 +33,15 @@
namespace NL3D
{
class CPSConstraintMesh;
class CPSConstraintMesh;
}
namespace NLQT {
namespace NLQT
{
class CMorphMeshDialog: public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent = 0);

View file

@ -27,10 +27,11 @@
// Project includes
#include "particle_node.h"
namespace NLQT {
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);
@ -146,7 +147,7 @@ void CMultiTexDialog::setMainOp(int index)
void CMultiTexDialog::setForceBasicCaps(bool state)
{
NL3D::CPSMultiTexturedParticle::forceBasicCaps(state);
NL3D::CPSMultiTexturedParticle::forceBasicCaps(state);
}
void CMultiTexDialog::setUseParticleDate(bool state)

View file

@ -34,16 +34,17 @@
namespace NL3D
{
class CPSMultiTexturedParticle;
class CPSMultiTexturedParticle;
}
namespace NLQT {
namespace NLQT
{
class CWorkspaceNode;
class CMultiTexDialog: public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent = 0);
@ -79,7 +80,10 @@ private:
NL3D::CPSMultiTexturedParticle *_MTP;
void readValues();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
Ui::CMultiTexDialog _ui;
}; /* class CMultiTexDialog */

View file

@ -50,14 +50,15 @@ using namespace std;
using namespace NLMISC;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CObjectViewer::CObjectViewer()
: _Driver(NULL), _TextContext(NULL),
_phi(0), _psi(0),_dist(20),
_CameraFocal(75),
_CurrentInstance(""),
_BloomEffect(false), _Scene(0)
_phi(0), _psi(0),_dist(20),
_CameraFocal(75),
_CurrentInstance(""),
_BloomEffect(false), _Scene(0)
{
}
@ -182,7 +183,7 @@ void CObjectViewer::renderDriver()
// Render the scene.
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
{
NL3D::CBloomEffect::instance().initBloom();
NL3D::CBloomEffect::instance().initBloom();
}
_Driver->clearBuffers(_BackgroundColor);
}
@ -194,8 +195,8 @@ void CObjectViewer::renderScene()
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
{
NL3D::CBloomEffect::instance().endBloom();
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
NL3D::CBloomEffect::instance().endBloom();
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
}
}
@ -446,7 +447,7 @@ void CObjectViewer::cfcbFontName(NLMISC::CConfigFile::CVar &var)
void CObjectViewer::cfcbBloomEffect(NLMISC::CConfigFile::CVar &var)
{
_BloomEffect = var.asBool();
_BloomEffect = var.asBool();
}
} /* namespace NLQT */

View file

@ -34,19 +34,21 @@
// Project includes
#include "entity.h"
namespace NL3D {
class UDriver;
class UScene;
class ULight;
class UInstance;
class UCamera;
class USkeleton;
class UTextContext;
class UPlayListManager;
class U3dMouseListener;
namespace NL3D
{
class UDriver;
class UScene;
class ULight;
class UInstance;
class UCamera;
class USkeleton;
class UTextContext;
class UPlayListManager;
class U3dMouseListener;
}
namespace NLQT {
namespace NLQT
{
/**
@class CObjectViewer
@ -132,7 +134,10 @@ public:
/// @param h - height window.
void setSizeViewport(uint16 w, uint16 h);
void setBloomEffect(bool enabled) { _BloomEffect = enabled; }
void setBloomEffect(bool enabled)
{
_BloomEffect = enabled;
}
/// Select instance from the scene
/// @param name - name instance, "" if no instance edited
@ -140,7 +145,10 @@ public:
/// Get current instance from the scene
/// @return name current instance, "" if no instance edited
const std::string& getCurrentObject() { return _CurrentInstance; }
const std::string& getCurrentObject()
{
return _CurrentInstance;
}
/// Get entity from the scene
/// @return ref Entity
@ -152,33 +160,57 @@ public:
/// Get value background color.
/// @return background color.
inline NLMISC::CRGBA getBackgroundColor() const { return _BackgroundColor; }
inline NLMISC::CRGBA getBackgroundColor() const
{
return _BackgroundColor;
}
/// Get type driver.
/// @return true if have used Direct3D driver, false OpenGL driver.
inline bool getDirect3D() const { return _Direct3D; }
inline bool getDirect3D() const
{
return _Direct3D;
}
inline bool getBloomEffect() const { return _BloomEffect; }
inline bool getBloomEffect() const
{
return _BloomEffect;
}
/// Get a game interface for window driver.
/// @return pointer to the driver.
inline NL3D::UDriver *getDriver() const { return _Driver; }
inline NL3D::UDriver *getDriver() const
{
return _Driver;
}
/// Get a game interface for scene.
/// @return pointer to the scene.
inline NL3D::UScene *getScene() const { return _Scene; }
inline NL3D::UScene *getScene() const
{
return _Scene;
}
/// Get a manager of playlist
/// @return pointer to the UPlayListManager
inline NL3D::UPlayListManager *getPlayListManager() const { return _PlayListManager; }
inline NL3D::UPlayListManager *getPlayListManager() const
{
return _PlayListManager;
}
/// Get a game interface to render string
/// @return pointer to the UPlayListManager
inline NL3D::UTextContext *getTextContext() const { return _TextContext; }
inline NL3D::UTextContext *getTextContext() const
{
return _TextContext;
}
/// Get a 3d mouse listener
/// @return pointer to the U3dMouseListener
inline NL3D::U3dMouseListener *get3dMouseListener() const { return _MouseListener; }
inline NL3D::U3dMouseListener *get3dMouseListener() const
{
return _MouseListener;
}
private:
void loadConfig();

View file

@ -32,10 +32,11 @@
#include "particle_link_skeleton_dialog.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CParticleControlDialog::CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
_ui.setupUi(this);

View file

@ -25,14 +25,15 @@
// Project includes
namespace NLQT {
namespace NLQT
{
class CSkeletonTreeModel;
class CParticleLinkDialog;
class CParticleControlDialog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent = 0);
~CParticleControlDialog();

View file

@ -31,15 +31,16 @@
// Project includes
#include "modules.h"
namespace NLQT {
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)
_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)
{
}
@ -194,21 +195,21 @@ void CParticleEditor::start()
nlassert(_PlayingNodes.empty());
_PlayingNodes.push_back(_ActiveNode);
}
break;
break;
case State::RunningSingle:
// no-op
return;
break;
return;
break;
case State::RunningMultiple:
stop();
start();
break;
break;
case State::PausedSingle:
if (_ActiveNode)
{
unpause(*_ActiveNode);
}
break;
break;
case State::PausedMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
{
@ -219,10 +220,10 @@ void CParticleEditor::start()
}
stop();
start();
break;
break;
default:
nlassert(0);
break;
break;
}
_State = State::RunningSingle;
}
@ -232,54 +233,54 @@ void CParticleEditor::startMultiple()
switch(_State)
{
case State::Stopped:
{
if (!_PW) return;
nlassert(_PlayingNodes.empty());
TPWNodeItr itr = _PW->getNodeList().begin();
while(itr != _PW->getNodeList().end())
{
if (!_PW) return;
nlassert(_PlayingNodes.empty());
TPWNodeItr itr = _PW->getNodeList().begin();
while(itr != _PW->getNodeList().end())
CWorkspaceNode *node = (*itr);
if (node->isLoaded())
if (checkHasLoop(*node)) return;
itr++;
}
itr = _PW->getNodeList().begin();
while(itr != _PW->getNodeList().end())
{
CWorkspaceNode *node = (*itr);
if (node->isLoaded())
{
CWorkspaceNode *node = (*itr);
if (node->isLoaded())
if (checkHasLoop(*node)) return;
itr++;
// really start the node only if there's no trigger anim
if (node->getTriggerAnim().empty())
play(*node);
_PlayingNodes.push_back(node);
}
itr = _PW->getNodeList().begin();
while(itr != _PW->getNodeList().end())
itr++;
}
}
break;
case State::PausedSingle:
case State::RunningSingle:
stop();
startMultiple();
break;
case State::RunningMultiple:
// no-op
return;
break;
case State::PausedMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
{
if (_PlayingNodes[k])
{
CWorkspaceNode *node = (*itr);
if (node->isLoaded())
{
// really start the node only if there's no trigger anim
if (node->getTriggerAnim().empty())
play(*node);
_PlayingNodes.push_back(node);
}
itr++;
unpause(*_PlayingNodes[k]);
}
}
break;
case State::PausedSingle:
case State::RunningSingle:
stop();
startMultiple();
break;
case State::RunningMultiple:
// no-op
return;
break;
case State::PausedMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
{
if (_PlayingNodes[k])
{
unpause(*_PlayingNodes[k]);
}
}
break;
default:
nlassert(0);
default:
nlassert(0);
break;
}
_State = State::RunningMultiple;
@ -290,31 +291,31 @@ void CParticleEditor::pause()
switch(_State)
{
case State::Stopped:
// no-op
return;
case State::RunningSingle:
if (_ActiveNode)
{
pause(*_ActiveNode);
}
_State = State::PausedSingle;
// no-op
return;
case State::RunningSingle:
if (_ActiveNode)
{
pause(*_ActiveNode);
}
_State = State::PausedSingle;
break;
case State::RunningMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
case State::RunningMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
{
if (_PlayingNodes[k])
{
if (_PlayingNodes[k])
{
pause(*_PlayingNodes[k]);
}
pause(*_PlayingNodes[k]);
}
_State = State::PausedMultiple;
}
_State = State::PausedMultiple;
break;
case State::PausedSingle:
case State::PausedMultiple:
// no-op
return;
default:
nlassert(0);
case State::PausedSingle:
case State::PausedMultiple:
// no-op
return;
default:
nlassert(0);
break;
}
}
@ -323,24 +324,24 @@ void CParticleEditor::stop()
{
switch(_State)
{
case State::Stopped:
// no-op
return;
case State::RunningSingle:
case State::RunningMultiple:
case State::PausedSingle:
case State::PausedMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
case State::Stopped:
// no-op
return;
case State::RunningSingle:
case State::RunningMultiple:
case State::PausedSingle:
case State::PausedMultiple:
for(uint k = 0; k < _PlayingNodes.size(); ++k)
{
if (_PlayingNodes[k])
{
if (_PlayingNodes[k])
{
stop(*_PlayingNodes[k]);
}
stop(*_PlayingNodes[k]);
}
_PlayingNodes.clear();
}
_PlayingNodes.clear();
break;
default:
nlassert(0);
default:
nlassert(0);
break;
}
_State = State::Stopped;

View file

@ -34,17 +34,19 @@
// Projects includes
#include "particle_node.h"
namespace NL3D {
class CParticleSystem;
class CParticleSystemModel;
class CShapeBank;
class CScene;
class IDriver;
class CFontManager;
class CFontGenerator;
namespace NL3D
{
class CParticleSystem;
class CParticleSystemModel;
class CShapeBank;
class CScene;
class IDriver;
class CFontManager;
class CFontGenerator;
}
namespace NLQT {
namespace NLQT
{
/**
@class CParticleEditor
@brief The main class of the particles editor.
@ -84,10 +86,16 @@ public:
void setActiveNode(CWorkspaceNode *node);
/// Get the node of the workspace that is currently active
CWorkspaceNode *getActiveNode() const { return _ActiveNode; }
CWorkspaceNode *getActiveNode() const
{
return _ActiveNode;
}
/// Get the particle system model that is currently active
NL3D::CParticleSystemModel *getActivePSM() const { return _ActiveNode ? _ActiveNode->getPSModel() : NULL; }
NL3D::CParticleSystemModel *getActivePSM() const
{
return _ActiveNode ? _ActiveNode->getPSModel() : NULL;
}
/// Get a model from a ps pointer. The ps must belong to the workspace
NL3D::CParticleSystemModel *getModelFromPS(NL3D::CParticleSystem *ps) const;
@ -126,14 +134,26 @@ public:
void setDisplayBBox(bool enable);
void setDisplayHelpers(bool enable) { _DisplayHelpers = enable; }
void setDisplayHelpers(bool enable)
{
_DisplayHelpers = enable;
}
void setAutoRepeat(bool enable) { _AutoRepeat = enable; }
void setAutoRepeat(bool enable)
{
_AutoRepeat = enable;
}
/// Auto bbox for fx
void setAutoBBox(bool enable) { _AutoUpdateBBox = enable; }
void setAutoBBox(bool enable)
{
_AutoUpdateBBox = enable;
}
bool getAutoBBox() const { return _AutoUpdateBBox; }
bool getAutoBBox() const
{
return _AutoUpdateBBox;
}
/// Enable / disbale auto-count
void enableAutoCount(bool enable);
@ -142,13 +162,22 @@ public:
void resetAutoCount(CWorkspaceNode *node, bool reset = true);
/// Reset the auto compute bbox
void resetAutoBBox() { _EmptyBBox = true; }
void resetAutoBBox()
{
_EmptyBBox = true;
}
/// Get current state
int getState() const { return _State; }
int getState() const
{
return _State;
}
/// Return true if one or several system are being played
bool isRunning() const { return _State == State::RunningSingle || _State == State::RunningMultiple; }
bool isRunning() const
{
return _State == State::RunningSingle || _State == State::RunningMultiple;
}
/// Return true if a system is paused.
/// Must call only if running
@ -157,17 +186,32 @@ public:
return _State == State::PausedSingle || _State == State::PausedMultiple;
}
CParticleWorkspace *getParticleWorkspace() const { return _PW; }
CParticleWorkspace *getParticleWorkspace() const
{
return _PW;
}
NL3D::IDriver *getDriver() const { return _Driver; }
NL3D::IDriver *getDriver() const
{
return _Driver;
}
NL3D::CScene *getScene() const { return _Scene; }
NL3D::CScene *getScene() const
{
return _Scene;
}
/// Get the fontManager
NL3D::CFontManager *getFontManager() const {return _FontManager;}
NL3D::CFontManager *getFontManager() const
{
return _FontManager;
}
/// Get the fontGenerator
NL3D::CFontGenerator *getFontGenerator () const { return _FontGen; }
NL3D::CFontGenerator *getFontGenerator () const
{
return _FontGen;
}
private:
// Check if a node is inserted in the running list (it may be paused)

View file

@ -21,17 +21,18 @@
#include "particle_force_page.h"
// Qt includes
#include <QtGui/QMessageBox>
#include <QtGui/QMessageBox>
// NeL includes
#include <nel/3d/particle_system.h>
// Project includes
namespace NLQT {
namespace NLQT
{
CForcePage::CForcePage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -126,9 +127,9 @@ void CForcePage::addTarget()
if (loc->getLastForever())
{
int ret = QMessageBox::warning(this, tr("NeL particle system editor"),
tr("The target object last forever. Applying a force on such an object may result in instability in the system after a while. "
"Continue ? (clue : you've been warned..)"),
QMessageBox::Ok | QMessageBox::Cancel);
tr("The target object last forever. Applying a force on such an object may result in instability in the system after a while. "
"Continue ? (clue : you've been warned..)"),
QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Cancel)
return;
@ -225,7 +226,7 @@ void CForcePage::updateTargets()
for(k = 0; k < nbTarg; ++k)
{
CLocatedItem *item = new CLocatedItem(QString(_LBTarget->getTarget(k)->getName().c_str()),
_ui.targetsListWidget);
_ui.targetsListWidget);
item->setUserData(_LBTarget->getTarget(k));
targetSet.insert(_LBTarget->getTarget(k));
};
@ -245,7 +246,7 @@ void CForcePage::updateTargets()
if (targetSet.find(loc) == targetSet.end())
{
CLocatedItem *item = new CLocatedItem(QString(loc->getName().c_str()),
_ui.avaibleTargetsListWidget);
_ui.avaibleTargetsListWidget);
item->setUserData(loc);
}
}

View file

@ -33,7 +33,8 @@
#include "particle_node.h"
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedItem
@ -43,10 +44,16 @@ class CLocatedItem: public QListWidgetItem
{
public:
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) { _loc = loc;}
NL3D::CPSLocated *getUserData() const { return _loc;}
void setUserData(NL3D::CPSLocated *loc)
{
_loc = loc;
}
NL3D::CPSLocated *getUserData() const
{
return _loc;
}
private:
@ -59,7 +66,7 @@ private:
*/
class CForcePage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CForcePage(QWidget *parent = 0);
@ -84,17 +91,32 @@ private:
struct CForceIntensityWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSForceIntensity *F;
float get(void) const { return F->getIntensity(); }
void set(const float &value) {F->setIntensity(value); }
scheme_type *getScheme(void) const { return F->getIntensityScheme(); }
void setScheme(scheme_type *s) {F->setIntensityScheme(s); }
float get(void) const
{
return F->getIntensity();
}
void set(const float &value)
{
F->setIntensity(value);
}
scheme_type *getScheme(void) const
{
return F->getIntensityScheme();
}
void setScheme(scheme_type *s)
{
F->setIntensityScheme(s);
}
} _ForceIntensityWrapper;
void hideAdditionalWidget();
void updateTargets();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
// the target we're focusing on
NL3D::CPSTargetLocatedBindable *_LBTarget;

View file

@ -27,10 +27,11 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CLightPage::CLightPage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);

View file

@ -32,7 +32,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLightPage
@ -40,7 +41,7 @@ namespace NLQT {
*/
class CLightPage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CLightPage(QWidget *parent = 0);
@ -56,30 +57,66 @@ private:
struct CColorWrapper : public IPSWrapperRGBA, IPSSchemeWrapperRGBA
{
NL3D::CPSLight *L;
NLMISC::CRGBA get(void) const { return L->getColor(); }
void set(const NLMISC::CRGBA &v) { L->setColor(v); }
scheme_type *getScheme(void) const { return L->getColorScheme(); }
void setScheme(scheme_type *s) { L->setColorScheme(s); }
NLMISC::CRGBA get(void) const
{
return L->getColor();
}
void set(const NLMISC::CRGBA &v)
{
L->setColor(v);
}
scheme_type *getScheme(void) const
{
return L->getColorScheme();
}
void setScheme(scheme_type *s)
{
L->setColorScheme(s);
}
} _ColorWrapper;
/// wrapper to set start atten radius
struct CAttenStartWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSLight *L;
float get(void) const { return L->getAttenStart(); }
void set(const float &v) { L->setAttenStart(v); }
scheme_type *getScheme(void) const { return L->getAttenStartScheme(); }
void setScheme(scheme_type *s) { L->setAttenStartScheme(s); }
float get(void) const
{
return L->getAttenStart();
}
void set(const float &v)
{
L->setAttenStart(v);
}
scheme_type *getScheme(void) const
{
return L->getAttenStartScheme();
}
void setScheme(scheme_type *s)
{
L->setAttenStartScheme(s);
}
} _AttenStartWrapper;
/// wrapper to set end atten radius
struct CAttenEndWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSLight *L;
float get(void) const { return L->getAttenEnd(); }
void set(const float &v) { L->setAttenEnd(v); }
scheme_type *getScheme(void) const { return L->getAttenEndScheme(); }
void setScheme(scheme_type *s) { L->setAttenEndScheme(s); }
float get(void) const
{
return L->getAttenEnd();
}
void set(const float &v)
{
L->setAttenEnd(v);
}
scheme_type *getScheme(void) const
{
return L->getAttenEndScheme();
}
void setScheme(scheme_type *s)
{
L->setAttenEndScheme(s);
}
} _AttenEndWrapper;
NL3D::CPSLight *_Light;

View file

@ -27,10 +27,11 @@
#include "modules.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
CParticleLinkDialog::CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
_ui.setupUi(this);

View file

@ -29,11 +29,12 @@
// Project includes
#include "skeleton_tree_model.h"
namespace NLQT {
namespace NLQT
{
class CParticleLinkDialog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent = 0);

View file

@ -34,7 +34,8 @@
using namespace NLMISC;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CWorkspaceNode::CWorkspaceNode()
{
@ -72,9 +73,9 @@ bool CWorkspaceNode::isStateMemorized() const
}
void CWorkspaceNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel,
uint bone,
const std::string &parentSkelName,
const std::string &parentBoneName)
uint bone,
const std::string &parentSkelName,
const std::string &parentBoneName)
{
nlassert(_WS);
if (!_PSM) return;
@ -222,17 +223,17 @@ void CWorkspaceNode::serial(NLMISC::IStream &f)
{
nlassert(_WS);
f.xmlPush("PROJECT_FILE");
sint version = f.serialVersion(2);
f.xmlSerial(_RelativePath, "RELATIVE_PATH");
if (version >= 1)
{
f.xmlSerial(_TriggerAnim, "TRIGGER_ANIMATION");
}
if (version >= 2)
{
f.xmlSerial(_ParentSkelName, "PARENT_SKEL_NAME");
f.xmlSerial(_ParentBoneName, "PARENT_BONE_NAME");
}
sint version = f.serialVersion(2);
f.xmlSerial(_RelativePath, "RELATIVE_PATH");
if (version >= 1)
{
f.xmlSerial(_TriggerAnim, "TRIGGER_ANIMATION");
}
if (version >= 2)
{
f.xmlSerial(_ParentSkelName, "PARENT_SKEL_NAME");
f.xmlSerial(_ParentBoneName, "PARENT_BONE_NAME");
}
f.xmlPop();
}
@ -346,7 +347,7 @@ CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullP
std::string relativePath;
// if (!PathRelativePathTo(resultPath, dosPath.c_str(), FILE_ATTRIBUTE_DIRECTORY, filenameWithFullPath.c_str(), 0))
// {
relativePath = filenameWithFullPath;
relativePath = filenameWithFullPath;
// }
// else
// {
@ -492,32 +493,32 @@ bool CParticleWorkspace::isContentModified() const
void CParticleWorkspace::restickAllObjects()
{
/* for(uint k = 0; k < _Nodes.size(); ++k)
{
std::string parentSkelName = _Nodes[k]->getParentSkelName();
std::string parentBoneName = _Nodes[k]->getParentBoneName();
//
_Nodes[k]->unstickPSFromSkeleton();
if (!parentSkelName.empty())
// find instance to stick to in the scene
for(uint l = 0; l < ov->getNumInstance(); ++l)
/* for(uint k = 0; k < _Nodes.size(); ++k)
{
CInstanceInfo *ii = ov->getInstance(l);
if (ii->TransformShape && ii->Saved.ShapeFilename == parentSkelName)
std::string parentSkelName = _Nodes[k]->getParentSkelName();
std::string parentBoneName = _Nodes[k]->getParentBoneName();
//
_Nodes[k]->unstickPSFromSkeleton();
if (!parentSkelName.empty())
// find instance to stick to in the scene
for(uint l = 0; l < ov->getNumInstance(); ++l)
{
NL3D::CSkeletonModel *skel = dynamic_cast<NL3D::CSkeletonModel *>(ii->TransformShape);
if (skel)
CInstanceInfo *ii = ov->getInstance(l);
if (ii->TransformShape && ii->Saved.ShapeFilename == parentSkelName)
{
sint boneID = skel->getBoneIdByName(parentBoneName);
if (boneID != -1)
NL3D::CSkeletonModel *skel = dynamic_cast<NL3D::CSkeletonModel *>(ii->TransformShape);
if (skel)
{
_Nodes[k]->stickPSToSkeleton(skel, (uint) boneID, parentSkelName, parentBoneName);
break;
sint boneID = skel->getBoneIdByName(parentBoneName);
if (boneID != -1)
{
_Nodes[k]->stickPSToSkeleton(skel, (uint) boneID, parentSkelName, parentBoneName);
break;
}
}
}
}
}
}*/
}*/
}
} /* namespace NLQT */

View file

@ -32,13 +32,15 @@
#include "ps_initial_pos.h"
namespace NL3D {
class CParticleSystem;
class CParticleSystemModel;
class CShapeBank;
namespace NL3D
{
class CParticleSystem;
class CParticleSystemModel;
class CShapeBank;
}
namespace NLQT {
namespace NLQT
{
class CParticleWorkspace;
@ -62,11 +64,17 @@ public:
void setRelativePath(const std::string &relativePath);
const std::string &getRelativePath() const { return _RelativePath; }
const std::string &getRelativePath() const
{
return _RelativePath;
}
std::string getFullPath() const;
std::string getFilename() const { return NLMISC::CFile::getFilename(_RelativePath); }
std::string getFilename() const
{
return NLMISC::CFile::getFilename(_RelativePath);
}
/// Serial node information into workspace stream. This does not save the particle system shape, only a reference to its file
void serial(NLMISC::IStream &f);
@ -89,17 +97,32 @@ public:
/// Helper flag to know if a ps has been modified
/// @{
bool isModified() const { return _Modified; }
bool isModified() const
{
return _Modified;
}
void setModified(bool modified);
/// @}
NL3D::CParticleSystem *getPSPointer() const { return _PS; }
NL3D::CParticleSystemModel *getPSModel() const { return _PSM; }
NL3D::CParticleSystem *getPSPointer() const
{
return _PS;
}
NL3D::CParticleSystemModel *getPSModel() const
{
return _PSM;
}
/// See if this node ps has been loaded
bool isLoaded() const { return _PS != NULL; }
bool isLoaded() const
{
return _PS != NULL;
}
/// Get the workspace in which this node is inserted
CParticleWorkspace *getWorkspace() const { return _WS; }
CParticleWorkspace *getWorkspace() const
{
return _WS;
}
/// Memorize current position of object in the system. Useful to play the system because instances can be created / deleted
void memorizeState();
@ -117,13 +140,25 @@ public:
void removeLocatedBindable(NL3D::CPSLocatedBindable *lb);
/// Returns the skeleton to which the ps is currently sticked
NL3D::CSkeletonModel *getParentSkel() const { return _ParentSkel; }
NL3D::CSkeletonModel *getParentSkel() const
{
return _ParentSkel;
}
const std::string &getParentSkelName() const { return _ParentSkelName; }
const std::string &getParentSkelName() const
{
return _ParentSkelName;
}
const std::string &getParentBoneName() const { return _ParentBoneName; }
const std::string &getParentBoneName() const
{
return _ParentBoneName;
}
std::string getTriggerAnim() { return _TriggerAnim; }
std::string getTriggerAnim()
{
return _TriggerAnim;
}
void setTriggerAnim(const std::string &anim);
@ -152,8 +187,14 @@ private:
private:
void setup(NL3D::CParticleSystemModel &psm);
public:
bool getResetAutoCountFlag() const { return _ResetAutoCount; }
void setResetAutoCountFlag(bool reset) { _ResetAutoCount = reset; }
bool getResetAutoCountFlag() const
{
return _ResetAutoCount;
}
void setResetAutoCountFlag(bool reset)
{
_ResetAutoCount = reset;
}
/// Stick to a skeleton
void stickPSToSkeleton(NL3D::CSkeletonModel *skel,
@ -209,18 +250,27 @@ public:
/// Set a new file name for the workspace
void setFileName(const std::string &fileName);
std::string getName() const { return _Name; }
std::string getName() const
{
return _Name;
}
/// Get the path in which workpsace is located with a trailing slash
std::string getPath() const;
std::string getFilename() const;
/// Get Number of nodes in the workspace
uint getNumNode() const { return (uint)_Nodes.size(); }
uint getNumNode() const
{
return (uint)_Nodes.size();
}
/// Get a node in workspace
/// Can keep pointer safely as long as the node is not deleted
CWorkspaceNode *getNode(uint index) const { return _Nodes[index]; }
CWorkspaceNode *getNode(uint index) const
{
return _Nodes[index];
}
/// Get a node from a pointer on a particle system
CWorkspaceNode *getNodeFromPS(NL3D::CParticleSystem *ps) const;
@ -253,21 +303,39 @@ public:
void load() throw(NLMISC::EStream);
/// Test whether the structure of the workspace has been modified (does not test if ps inside the workspace have been modified)
bool isModified() const { return _Modified; }
bool isModified() const
{
return _Modified;
}
/// Test whether the content of the workspace has ben modified
bool isContentModified() const;
void touch() { setModifiedFlag(true); }
void clearModifiedFlag() { setModifiedFlag(false); }
void touch()
{
setModifiedFlag(true);
}
void clearModifiedFlag()
{
setModifiedFlag(false);
}
/// Set a callback to know when a node is modified
void setModificationCallback(IModificationCallback *cb) { _ModificationCallback = cb; }
IModificationCallback *getModificationCallback() const { return _ModificationCallback; }
void setModificationCallback(IModificationCallback *cb)
{
_ModificationCallback = cb;
}
IModificationCallback *getModificationCallback() const
{
return _ModificationCallback;
}
/// Restick all objects, useful after loading
void restickAllObjects();
TNodeVect& getNodeList() { return _Nodes; }
TNodeVect& getNodeList()
{
return _Nodes;
}
private:
// use smart ptr to avoir prb wih resize

View file

@ -25,7 +25,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CPropertyDialog::CPropertyDialog(CParticleTreeModel *treeModel, QWidget *parent)
: QDockWidget(parent)
@ -44,7 +45,7 @@ void CPropertyDialog::setupUi()
QIcon icon;
icon.addFile(QString::fromUtf8(":/images/pqrticles.png"), QSize(), QIcon::Normal, QIcon::Off);
setWindowIcon(icon);
setWindowIcon(icon);
_dockWidgetContents = new QWidget();
_gridLayout = new QGridLayout(_dockWidgetContents);
@ -128,8 +129,8 @@ void CPropertyDialog::setCurrentEditedElement(CParticleTreeItem *editedItem)
_psMoverPage->setEditedItem(_treeModel->getOwnerNode(editedItem) ,editedItem->getLoc(), editedItem->getLocatedInstanceIndex());
_stackedWidget->setCurrentWidget(_psMoverPage);
_treeModel->getOwnerNode(editedItem)->getPSPointer()->setCurrentEditedElement(editedItem->getLoc(),
editedItem->getLocatedInstanceIndex(),
_psMoverPage->getLocatedBindable());
editedItem->getLocatedInstanceIndex(),
_psMoverPage->getLocatedBindable());
break;
default:
_stackedWidget->setCurrentWidget(_wpPage);

View file

@ -44,7 +44,8 @@
#include "particle_tree_model.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
class CPropertyDialog: public QDockWidget
{
@ -55,8 +56,14 @@ public:
void setCurrentEditedElement(CParticleTreeItem *editedItem);
CLocatedPage *getLocatedPage() const { return _locatedPage; };
CPSMoverPage *getMoverPage() const { return _psMoverPage; };
CLocatedPage *getLocatedPage() const
{
return _locatedPage;
};
CPSMoverPage *getMoverPage() const
{
return _psMoverPage;
};
private:
void setupUi();

View file

@ -32,10 +32,11 @@
#include "modules.h"
#include "sound_system.h"
namespace NLQT {
namespace NLQT
{
CSoundPage::CSoundPage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -107,11 +108,11 @@ void CSoundPage::browse()
QStringList items;
items << tr("");
for(size_t i = 0; i < names.size(); ++i)
items << QString(names[i]->c_str());
items << QString(names[i]->c_str());
bool ok;
QString item = QInputDialog::getItem(this, tr("Select your sound"),
tr("Sound:"), items, 0, false, &ok);
tr("Sound:"), items, 0, false, &ok);
if (ok)
{
_ui.soundNameLineEdit->setText(item);

View file

@ -35,10 +35,11 @@
namespace NLSOUND
{
class UAudioMixer;
class UAudioMixer;
}
namespace NLQT {
namespace NLQT
{
/**
@class CSoundPage
@ -46,7 +47,7 @@ namespace NLQT {
*/
class CSoundPage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CSoundPage(QWidget *parent = 0);
@ -70,23 +71,50 @@ private:
struct CGainWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSSound *S;
float get(void) const { return S->getGain(); }
void set(const float &v) { S->setGain(v); }
scheme_type *getScheme(void) const { return S->getGainScheme(); }
void setScheme(scheme_type *s) { S->setGainScheme(s); }
float get(void) const
{
return S->getGain();
}
void set(const float &v)
{
S->setGain(v);
}
scheme_type *getScheme(void) const
{
return S->getGainScheme();
}
void setScheme(scheme_type *s)
{
S->setGainScheme(s);
}
} _GainWrapper;
/// wrapper to set the pitch of sounds
struct CPitchWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
{
NL3D::CPSSound *S;
float get(void) const { return S->getPitch(); }
void set(const float &v) { S->setPitch(v); }
scheme_type *getScheme(void) const { return S->getPitchScheme(); }
void setScheme(scheme_type *s) { S->setPitchScheme(s); }
float get(void) const
{
return S->getPitch();
}
void set(const float &v)
{
S->setPitch(v);
}
scheme_type *getScheme(void) const
{
return S->getPitchScheme();
}
void setScheme(scheme_type *s)
{
S->setPitchScheme(s);
}
} _PitchWrapper;
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
/// the sound being edited
NL3D::CPSSound *_Sound;

View file

@ -38,22 +38,23 @@
using namespace NL3D;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
static void chooseGlobalUserParam(uint userParam, NL3D::CParticleSystem *ps, QWidget *parent)
{
nlassert(ps);
bool ok;
QString text = QInputDialog::getText(parent, "Choose Global User Param",
"User name:", QLineEdit::Normal,
QString(ps->getGlobalValueName(userParam).c_str()), &ok);
"User name:", QLineEdit::Normal,
QString(ps->getGlobalValueName(userParam).c_str()), &ok);
if (ok)
ps->bindGlobalValueToUserParam(text.toStdString(), userParam);
ps->bindGlobalValueToUserParam(text.toStdString(), userParam);
}
CParticleSystemPage::CParticleSystemPage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -269,8 +270,8 @@ void CParticleSystemPage::setLoadBalancing(bool state)
{
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, tr("Are you sure?"),
tr("Load balancing on/off"),
QMessageBox::Yes | QMessageBox::No);
tr("Load balancing on/off"),
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes)
_Node->getPSPointer()->enableLoadBalancing(false);
else
@ -322,19 +323,19 @@ void CParticleSystemPage::setGloabal1()
void CParticleSystemPage::setGloabal2()
{
chooseGlobalUserParam(1, _Node->getPSPointer(), this);
chooseGlobalUserParam(1, _Node->getPSPointer(), this);
updateModifiedFlag();
}
void CParticleSystemPage::setGloabal3()
{
chooseGlobalUserParam(2, _Node->getPSPointer(), this);
chooseGlobalUserParam(2, _Node->getPSPointer(), this);
updateModifiedFlag();
}
void CParticleSystemPage::setGloabal4()
{
chooseGlobalUserParam(3, _Node->getPSPointer(), this);
chooseGlobalUserParam(3, _Node->getPSPointer(), this);
updateModifiedFlag();
}
@ -366,7 +367,7 @@ void CParticleSystemPage::resetBbox()
void CParticleSystemPage::incBbox()
{
NLMISC::CAABBox b;
NLMISC::CAABBox b;
_Node->getPSPointer()->computeBBox(b);
b.setHalfSize(1.1f * b.getHalfSize());
_Node->getPSPointer()->setPrecomputedBBox(b);
@ -444,7 +445,7 @@ void CParticleSystemPage::setPresetBehaviour(int index)
updateLifeMgtPresets();
if (index == _Node->getPSPointer()->getBehaviourType()) return;
if (index == NL3D::CParticleSystem::SpellFX ||
index == NL3D::CParticleSystem::SpawnedEnvironmentFX)
index == NL3D::CParticleSystem::SpawnedEnvironmentFX)
{
NL3D::CPSLocatedBindable *lb;
if (!_Node->getPSPointer()->canFinish(&lb))
@ -455,13 +456,13 @@ void CParticleSystemPage::setPresetBehaviour(int index)
if (!lb)
{
errorMessage->showMessage(tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."));
"and thus, should have a finite duration. Please remove that flag first."));
errorMessage->exec();
}
else
{
errorMessage->showMessage(tr("The system must have a finite duration for this setting! Please check that the following object "
"doesn't live forever or doesn't create a loop in the system :") + QString(lb->getName().c_str()));
"doesn't live forever or doesn't create a loop in the system :") + QString(lb->getName().c_str()));
errorMessage->exec();
}
delete errorMessage;

View file

@ -33,14 +33,15 @@
// Project includes
#include "edit_range_widget.h"
namespace NLQT {
namespace NLQT
{
/**
@class CParticleSystemPage
@brief Page for QStackWidget, to edit workspace node in a particle system
*/
class CParticleSystemPage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CParticleSystemPage(QWidget *parent = 0);
@ -110,7 +111,10 @@ private:
bool enabledModifiedFlag;
void updateModifiedFlag() { if ((_Node) && (enabledModifiedFlag)) _Node->setModified(true); }
void updateModifiedFlag()
{
if ((_Node) && (enabledModifiedFlag)) _Node->setModified(true);
}
CWorkspaceNode *_Node;

View file

@ -31,10 +31,11 @@
#include "value_gradient_dialog.h"
#include "multi_tex_dialog.h"
namespace NLQT {
namespace NLQT
{
CParticleTextureAnimWidget::CParticleTextureAnimWidget(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -80,7 +81,7 @@ void CParticleTextureAnimWidget::setCurrentTextureAnim(NL3D::CPSTexturedParticle
void CParticleTextureAnimWidget::setEnabledTexAnim(bool state)
{
if (state)
if (state)
{
if (_MTP)
_ui.multitexturingCheckBox->setChecked(false);

View file

@ -34,15 +34,16 @@
namespace NL3D
{
class CPSTexturedParticle;
class CPSMultiTexturedParticle;
class CPSTexturedParticle;
class CPSMultiTexturedParticle;
}
namespace NLQT {
namespace NLQT
{
class CParticleTextureAnimWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CParticleTextureAnimWidget(QWidget *parent = 0);
@ -63,21 +64,42 @@ private:
struct CTextureWrapper : public IPSWrapperTexture
{
NL3D::CPSTexturedParticle *P;
NL3D::ITexture *get(void) { return P->getTexture(); }
void set(NL3D::ITexture *t) { P->setTexture(t); }
NL3D::ITexture *get(void)
{
return P->getTexture();
}
void set(NL3D::ITexture *t)
{
P->setTexture(t);
}
} _TextureWrapper;
/// Wrapper for texture anim sequence
struct CTextureIndexWrapper : public IPSWrapper<sint32>, IPSSchemeWrapper<sint32>
{
NL3D::CPSTexturedParticle *P;
sint32 get(void) const { return P->getTextureIndex(); }
void set(const sint32 &v) { P->setTextureIndex(v); }
scheme_type *getScheme(void) const { return P->getTextureIndexScheme(); }
void setScheme(scheme_type *s) { P->setTextureIndexScheme(s); }
sint32 get(void) const
{
return P->getTextureIndex();
}
void set(const sint32 &v)
{
P->setTextureIndex(v);
}
scheme_type *getScheme(void) const
{
return P->getTextureIndexScheme();
}
void setScheme(scheme_type *s)
{
P->setTextureIndexScheme(s);
}
} _TextureIndexWrapper;
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
NL3D::CPSTexturedParticle *_EditedParticle;

View file

@ -30,10 +30,11 @@
#include "nel/3d/ps_particle_basic.h"
#include "nel/misc/path.h"
namespace NLQT {
namespace NLQT
{
CParticleTextureWidget::CParticleTextureWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL)
: QWidget(parent), _Wrapper(NULL)
{
_ui.setupUi(this);
@ -68,8 +69,8 @@ void CParticleTextureWidget::chooseTexture()
}
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open texture file"), texName.c_str(),
tr("Image file (*.tga *.png)"));
tr("Open texture file"), texName.c_str(),
tr("Image file (*.tga *.png)"));
setCursor(Qt::WaitCursor);
if (!fileName.isEmpty())

View file

@ -34,11 +34,12 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
class CParticleTextureWidget: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CParticleTextureWidget(QWidget *parent = 0);
@ -47,9 +48,15 @@ public:
void updateUi();
// set a wrapper to get the datas, called before setCurrentTextureNoAnim
void setWrapper(IPSWrapperTexture *wrapper) { _Wrapper = wrapper ; }
void setWrapper(IPSWrapperTexture *wrapper)
{
_Wrapper = wrapper ;
}
void enableRemoveButton(bool enabled) { _ui.removePushButton->setVisible(enabled); }
void enableRemoveButton(bool enabled)
{
_ui.removePushButton->setVisible(enabled);
}
Q_SIGNALS:
void textureChanged(const QString &texName);

View file

@ -28,30 +28,31 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CParticleTreeItem::CParticleTreeItem(const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
{
}
CParticleTreeItem::CParticleTreeItem(CParticleWorkspace *ws, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
{
nlassert(ws);
_WS = ws;
}
CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocated *loc, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
{
nlassert(loc);
_Loc = loc;
}
CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocated *loc, uint32 index, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
{
nlassert(loc);
_Loc = loc;
@ -59,15 +60,15 @@ CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocated *loc, uint32 index, const
}
CParticleTreeItem::CParticleTreeItem(CWorkspaceNode *node, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
{
_PS = node;
}
CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocatedBindable *lb, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
_itemData(data), _itemIconType(typeItem), _parentItem(parent)
{
_Bind = lb;
_Bind = lb;
}
CParticleTreeItem::~CParticleTreeItem()
@ -113,7 +114,7 @@ CParticleTreeItem *CParticleTreeItem::parent()
int CParticleTreeItem::row() const
{
if (_parentItem)
return _parentItem->_childItems.indexOf(const_cast<CParticleTreeItem*>(this));
return _parentItem->_childItems.indexOf(const_cast<CParticleTreeItem*>(this));
return 0;
}
@ -160,7 +161,7 @@ void CParticleTreeItem::setLocatedInstanceIndex(uint32 index)
}
CParticleTreeModel::CParticleTreeModel(QObject *parent)
: QAbstractItemModel(parent)
: QAbstractItemModel(parent)
{
QList<QVariant> rootData;
rootData << "Name";
@ -175,15 +176,15 @@ CParticleTreeModel::~CParticleTreeModel()
int CParticleTreeModel::columnCount(const QModelIndex &parent) const
{
if (parent.isValid())
return static_cast<CParticleTreeItem*>(parent.internalPointer())->columnCount();
return static_cast<CParticleTreeItem*>(parent.internalPointer())->columnCount();
else
return _rootItem->columnCount();
return _rootItem->columnCount();
}
QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
return QVariant();
if (role == Qt::DisplayRole)
{
@ -211,7 +212,7 @@ QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
return QFont("SansSerif", 9, QFont::Normal);
}
if (role == Qt::DecorationRole)
return qVariantFromValue(getIcon(index));
return qVariantFromValue(getIcon(index));
return QVariant();
}
@ -221,29 +222,29 @@ Qt::ItemFlags CParticleTreeModel::flags(const QModelIndex &index) const
Qt::ItemFlags itmFlags = Qt::NoItemFlags;
if (!index.isValid())
return itmFlags;
return itmFlags;
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
switch (item->itemType())
{
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Force:
case ItemType::Light:
case ItemType::Sound:
case ItemType::Located:
case ItemType::CollisionZone:
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
break;
case ItemType::LocatedInstance:
if (Modules::psEdit().isRunning())
itmFlags = Qt::NoItemFlags;
else
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
break;
default:
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Force:
case ItemType::Light:
case ItemType::Sound:
case ItemType::Located:
case ItemType::CollisionZone:
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
break;
case ItemType::LocatedInstance:
if (Modules::psEdit().isRunning())
itmFlags = Qt::NoItemFlags;
else
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
break;
break;
default:
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
break;
}
//CParticleWorkspaceDialog *pwsd = qobject_cast<CParticleWorkspaceDialog*>(QObject::parent());
@ -253,44 +254,44 @@ Qt::ItemFlags CParticleTreeModel::flags(const QModelIndex &index) const
}
QVariant CParticleTreeModel::headerData(int section, Qt::Orientation orientation,
int role) const
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return _rootItem->data(section);
return _rootItem->data(section);
return QVariant();
}
QModelIndex CParticleTreeModel::index(int row, int column, const QModelIndex &parent)
const
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
return QModelIndex();
CParticleTreeItem *parentItem;
if (!parent.isValid())
parentItem = _rootItem;
parentItem = _rootItem;
else
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
CParticleTreeItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
return createIndex(row, column, childItem);
else
return QModelIndex();
return QModelIndex();
}
QModelIndex CParticleTreeModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
return QModelIndex();
CParticleTreeItem *childItem = static_cast<CParticleTreeItem*>(index.internalPointer());
CParticleTreeItem *parentItem = childItem->parent();
if (parentItem == _rootItem)
return QModelIndex();
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
}
@ -299,12 +300,12 @@ int CParticleTreeModel::rowCount(const QModelIndex &parent) const
{
CParticleTreeItem *parentItem;
if (parent.column() > 0)
return 0;
return 0;
if (!parent.isValid())
parentItem = _rootItem;
parentItem = _rootItem;
else
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
return parentItem->childCount();
}
@ -333,30 +334,30 @@ QIcon CParticleTreeModel::getIcon(const QModelIndex &index) const
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
switch (item->itemType())
{
case ItemType::Root:
break;
case ItemType::Workspace:
return QIcon(":/images/Workspace.bmp");
case ItemType::ParticleSystem:
return QIcon(":/images/ParticleSystem.bmp");
case ItemType::Particle:
return QIcon(":/images/Particle.bmp");
case ItemType::Emitter:
return QIcon(":/images/Emitter.bmp");
case ItemType::Force:
return QIcon(":/images/Force.bmp");
case ItemType::Light:
return QIcon(":/images/Light.bmp");
case ItemType::Sound:
return QIcon(":/images/Sound.bmp");
case ItemType::Located:
return QIcon(":/images/Located.bmp");
case ItemType::CollisionZone:
return QIcon(":/images/CollisionZone.bmp");
case ItemType::LocatedInstance:
return QIcon(":/images/LocatedInstance.bmp");
case ItemType::ParticleSystemNotLoaded:
return QIcon(":/images/ParticleSystemNotLoaded.bmp");
case ItemType::Root:
break;
case ItemType::Workspace:
return QIcon(":/images/Workspace.bmp");
case ItemType::ParticleSystem:
return QIcon(":/images/ParticleSystem.bmp");
case ItemType::Particle:
return QIcon(":/images/Particle.bmp");
case ItemType::Emitter:
return QIcon(":/images/Emitter.bmp");
case ItemType::Force:
return QIcon(":/images/Force.bmp");
case ItemType::Light:
return QIcon(":/images/Light.bmp");
case ItemType::Sound:
return QIcon(":/images/Sound.bmp");
case ItemType::Located:
return QIcon(":/images/Located.bmp");
case ItemType::CollisionZone:
return QIcon(":/images/CollisionZone.bmp");
case ItemType::LocatedInstance:
return QIcon(":/images/LocatedInstance.bmp");
case ItemType::ParticleSystemNotLoaded:
return QIcon(":/images/ParticleSystemNotLoaded.bmp");
}
return QIcon();
}
@ -366,7 +367,7 @@ bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QM
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer());
beginInsertRows(parent, position, position);
setupModelFromPS(node, item);
setupModelFromPS(node, item);
endInsertRows();
if (node->isLoaded())
@ -386,7 +387,7 @@ bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const Q
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer());
beginInsertRows(parent, position, position);
createItemFromLocated(loc, item);
createItemFromLocated(loc, item);
endInsertRows();
QModelIndex indexLocated = index(item->childCount() - 1, 0, parent);
@ -402,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)
{
beginInsertRows(parent, position, position);
createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem*>(parent.internalPointer()));
createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem*>(parent.internalPointer()));
endInsertRows();
return true;
}
@ -422,7 +423,7 @@ bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent)
removeRows(0, parent.child(position, 0));
beginRemoveRows(parent, position, position);
static_cast<CParticleTreeItem*>(parent.internalPointer())->deleteChild(position);
static_cast<CParticleTreeItem*>(parent.internalPointer())->deleteChild(position);
endRemoveRows();
return false;
}
@ -432,21 +433,21 @@ CWorkspaceNode *CParticleTreeModel::getOwnerNode(CParticleTreeItem *item) const
CWorkspaceNode *node = NULL;
switch (item->itemType())
{
case ItemType::ParticleSystem:
node = item->getNode();
break;
case ItemType::Located:
node = item->parent()->getNode();
break;
case ItemType::LocatedInstance:
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Force:
case ItemType::Light:
case ItemType::Sound:
case ItemType::CollisionZone:
node = item->parent()->parent()->getNode();
break;
case ItemType::ParticleSystem:
node = item->getNode();
break;
case ItemType::Located:
node = item->parent()->getNode();
break;
case ItemType::LocatedInstance:
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Force:
case ItemType::Light:
case ItemType::Sound:
case ItemType::CollisionZone:
node = item->parent()->parent()->getNode();
break;
}
return node;
}

View file

@ -34,7 +34,8 @@
// Projects includes
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
struct ItemType
{
@ -128,9 +129,9 @@ public:
QVariant data(const QModelIndex &index, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;

View file

@ -42,9 +42,11 @@
#include "dup_ps.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
static const char * const LocatedBindable[] = {
static const char * const LocatedBindable[] =
{
QT_TR_NOOP("Point"),
QT_TR_NOOP("LookAt"),
QT_TR_NOOP("FanLight"),
@ -121,7 +123,7 @@ struct Action
static std::map<std::string, uint> _PSElementIdentifiers;
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
: QDockWidget(parent), _currentItem(NULL)
: QDockWidget(parent), _currentItem(NULL)
{
_ui.setupUi(this);
@ -222,7 +224,7 @@ void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index)
_PropertyDialog->setCurrentEditedElement(_currentItem);
if ((_currentItem->itemType() == ItemType::Workspace) ||
(_currentItem->itemType() == ItemType::ParticleSystemNotLoaded))
(_currentItem->itemType() == ItemType::ParticleSystemNotLoaded))
_currentItem = NULL;
}
@ -234,56 +236,56 @@ void CParticleWorkspaceDialog::customContextMenu()
QMenu *popurMenu = new QMenu(this);
switch (_currentItem->itemType())
{
case ItemType::ParticleSystem:
popurMenu->addAction(_setActivePSAction);
popurMenu->addAction(_savePSAction);
popurMenu->addAction(_saveAsPSAction);
popurMenu->addAction(_clearContentAction);
popurMenu->addAction(_removeFromWSAction);
popurMenu->addAction(_mergeAction);
popurMenu->addSeparator();
popurMenu->addAction(_newLocatedAction);
popurMenu->addAction(_pasteLocatedAction);
popurMenu->addSeparator();
buildMenu(popurMenu);
popurMenu->addSeparator();
popurMenu->addAction(_forceZBiasAction);
break;
case ItemType::Located:
popurMenu->addAction(_instanciateAction);
popurMenu->addSeparator();
buildMenu(popurMenu);
popurMenu->addSeparator();
popurMenu->addAction(_copyLocatedAction);
popurMenu->addAction(_pasteBindableAction);
popurMenu->addAction(_deleteAction);
break;
case ItemType::Force:
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Light:
case ItemType::CollisionZone:
case ItemType::Sound:
popurMenu->addAction(_copyBindableAction);
popurMenu->addAction(_deleteAction);
popurMenu->addSeparator();
popurMenu->addAction(_allLODAction);
popurMenu->addAction(_lod1Action);
popurMenu->addAction(_lod2Action);
popurMenu->addSeparator();
popurMenu->addAction(_externIDAction);
case ItemType::ParticleSystem:
popurMenu->addAction(_setActivePSAction);
popurMenu->addAction(_savePSAction);
popurMenu->addAction(_saveAsPSAction);
popurMenu->addAction(_clearContentAction);
popurMenu->addAction(_removeFromWSAction);
popurMenu->addAction(_mergeAction);
popurMenu->addSeparator();
popurMenu->addAction(_newLocatedAction);
popurMenu->addAction(_pasteLocatedAction);
popurMenu->addSeparator();
buildMenu(popurMenu);
popurMenu->addSeparator();
popurMenu->addAction(_forceZBiasAction);
break;
case ItemType::Located:
popurMenu->addAction(_instanciateAction);
popurMenu->addSeparator();
buildMenu(popurMenu);
popurMenu->addSeparator();
popurMenu->addAction(_copyLocatedAction);
popurMenu->addAction(_pasteBindableAction);
popurMenu->addAction(_deleteAction);
break;
case ItemType::Force:
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Light:
case ItemType::CollisionZone:
case ItemType::Sound:
popurMenu->addAction(_copyBindableAction);
popurMenu->addAction(_deleteAction);
popurMenu->addSeparator();
popurMenu->addAction(_allLODAction);
popurMenu->addAction(_lod1Action);
popurMenu->addAction(_lod2Action);
popurMenu->addSeparator();
popurMenu->addAction(_externIDAction);
// check the menu to tell which lod is used for this located bindable
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1n2) _allLODAction->setChecked(true);
else _allLODAction->setChecked(false);
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1) _lod1Action->setChecked(true);
else _lod1Action->setChecked(false);
if (_currentItem->getBind()->getLOD() == NL3D::PSLod2) _lod2Action->setChecked(true);
else _lod2Action->setChecked(false);
break;
case ItemType::LocatedInstance:
popurMenu->addAction(_deleteAction);
break;
// check the menu to tell which lod is used for this located bindable
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1n2) _allLODAction->setChecked(true);
else _allLODAction->setChecked(false);
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1) _lod1Action->setChecked(true);
else _lod1Action->setChecked(false);
if (_currentItem->getBind()->getLOD() == NL3D::PSLod2) _lod2Action->setChecked(true);
else _lod2Action->setChecked(false);
break;
case ItemType::LocatedInstance:
popurMenu->addAction(_deleteAction);
break;
}
bool stopped = Modules::psEdit().getState() == CParticleEditor::State::Stopped ? true : false;
@ -320,18 +322,18 @@ void CParticleWorkspaceDialog::saveAsPS()
if (node->getPSPointer()->getAutoCountFlag())
{
QMessageBox::critical(this, tr("NeL particle system editor"),
QString(node->getFilename().c_str()) + tr(" uses auto count feature, and it has been modified. "
"You should run the system entirely at least once at full detail before saving so that the editor can compute the number of particles in the system. "
"If user params are used to modify system aspect, you should run the system for extreme cases before saving. "),
QMessageBox::Ok);
QString(node->getFilename().c_str()) + tr(" uses auto count feature, and it has been modified. "
"You should run the system entirely at least once at full detail before saving so that the editor can compute the number of particles in the system. "
"If user params are used to modify system aspect, you should run the system for extreme cases before saving. "),
QMessageBox::Ok);
}
else
{
Modules::psEdit().stop();
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as ps file"),
".",
tr("ps files (*.ps)"));
".",
tr("ps files (*.ps)"));
// after check
if (!fileName.isEmpty())
node->savePSAs(fileName.toStdString());
@ -341,7 +343,7 @@ void CParticleWorkspaceDialog::saveAsPS()
void CParticleWorkspaceDialog::clearContent()
{
int ret = QMessageBox::question(this, tr("NeL particle system editor"),
tr("Clear content ?"), QMessageBox::Yes | QMessageBox::No);
tr("Clear content ?"), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes)
{
@ -392,9 +394,9 @@ void CParticleWorkspaceDialog::pasteLocated()
{
delete copy;
QMessageBox::critical(this, tr("NeL particle system editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
}
}
@ -403,101 +405,101 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
NL3D::CPSLocatedBindable *toCreate = NULL;
switch (id)
{
case Action::ParticlePoint:
toCreate = new NL3D::CPSDot;
break;
case Action::ParticleLookAt:
toCreate = new NL3D::CPSFaceLookAt;
break;
case Action::ParticleFanLight:
toCreate = new NL3D::CPSFanLight;
break;
case Action::ParticleRibbon:
toCreate = new NL3D::CPSRibbon;
break;
case Action::ParticleTailDot:
toCreate = new NL3D::CPSTailDot;
break;
case Action::ParticleMesh:
toCreate = new NL3D::CPSMesh;
break;
case Action::ParticleConstraintMesh:
toCreate = new NL3D::CPSConstraintMesh;
break;
case Action::ParticleFace:
toCreate = new NL3D::CPSFace;
break;
case Action::ParticleShockWave:
toCreate = new NL3D::CPSShockWave;
break;
case Action::ParticleRibbonLookAt:
toCreate = new NL3D::CPSRibbonLookAt;
break;
case Action::ForceGravity:
toCreate = new NL3D::CPSGravity;
break;
case Action::ForceDirectional:
toCreate = new NL3D::CPSDirectionnalForce;
break;
case Action::ForceSpring:
toCreate = new NL3D::CPSSpring;
break;
case Action::ForceFlyidFriction:
toCreate = new NL3D::CPSFluidFriction;
break;
case Action::ForceCentralGravity:
toCreate = new NL3D::CPSCentralGravity;
break;
case Action::ForceCylindricVortex:
toCreate = new NL3D::CPSCylindricVortex;
break;
case Action::ForceBrownianMove:
toCreate = new NL3D::CPSBrownianForce;
break;
case Action::ForceMagnetic:
toCreate = new NL3D::CPSMagneticForce;
break;
case Action::ZonePlane:
toCreate = new NL3D::CPSZonePlane;
break;
case Action::ZoneSphere:
toCreate = new NL3D::CPSZoneSphere;
break;
case Action::ZoneRectangle:
toCreate = new NL3D::CPSZoneRectangle;
break;
case Action::ZoneDisc:
toCreate = new NL3D::CPSZoneDisc;
break;
case Action::ZoneCylinder:
toCreate = new NL3D::CPSZoneCylinder;
break;
case Action::EmitterDirectional:
toCreate = new NL3D::CPSEmitterDirectionnal;
break;
case Action::EmitterOmniDirectional:
toCreate = new NL3D::CPSEmitterOmni;
break;
case Action::EmitterRectangle:
toCreate = new NL3D::CPSEmitterRectangle;
break;
case Action::EmitterConic:
toCreate = new NL3D::CPSEmitterConic;
break;
case Action::EmitterSpherical:
toCreate = new NL3D::CPSSphericalEmitter;
break;
case Action::EmitterRadial:
toCreate = new NL3D::CPSRadialEmitter;
break;
case Action::Sound:
toCreate = new NL3D::CPSSound;
if (!Modules::psEdit().isRunning())
(static_cast<NL3D::CPSSound *>(toCreate))->stopSound();
break;
case Action::Light:
toCreate = new NL3D::CPSLight;
break;
case Action::ParticlePoint:
toCreate = new NL3D::CPSDot;
break;
case Action::ParticleLookAt:
toCreate = new NL3D::CPSFaceLookAt;
break;
case Action::ParticleFanLight:
toCreate = new NL3D::CPSFanLight;
break;
case Action::ParticleRibbon:
toCreate = new NL3D::CPSRibbon;
break;
case Action::ParticleTailDot:
toCreate = new NL3D::CPSTailDot;
break;
case Action::ParticleMesh:
toCreate = new NL3D::CPSMesh;
break;
case Action::ParticleConstraintMesh:
toCreate = new NL3D::CPSConstraintMesh;
break;
case Action::ParticleFace:
toCreate = new NL3D::CPSFace;
break;
case Action::ParticleShockWave:
toCreate = new NL3D::CPSShockWave;
break;
case Action::ParticleRibbonLookAt:
toCreate = new NL3D::CPSRibbonLookAt;
break;
case Action::ForceGravity:
toCreate = new NL3D::CPSGravity;
break;
case Action::ForceDirectional:
toCreate = new NL3D::CPSDirectionnalForce;
break;
case Action::ForceSpring:
toCreate = new NL3D::CPSSpring;
break;
case Action::ForceFlyidFriction:
toCreate = new NL3D::CPSFluidFriction;
break;
case Action::ForceCentralGravity:
toCreate = new NL3D::CPSCentralGravity;
break;
case Action::ForceCylindricVortex:
toCreate = new NL3D::CPSCylindricVortex;
break;
case Action::ForceBrownianMove:
toCreate = new NL3D::CPSBrownianForce;
break;
case Action::ForceMagnetic:
toCreate = new NL3D::CPSMagneticForce;
break;
case Action::ZonePlane:
toCreate = new NL3D::CPSZonePlane;
break;
case Action::ZoneSphere:
toCreate = new NL3D::CPSZoneSphere;
break;
case Action::ZoneRectangle:
toCreate = new NL3D::CPSZoneRectangle;
break;
case Action::ZoneDisc:
toCreate = new NL3D::CPSZoneDisc;
break;
case Action::ZoneCylinder:
toCreate = new NL3D::CPSZoneCylinder;
break;
case Action::EmitterDirectional:
toCreate = new NL3D::CPSEmitterDirectionnal;
break;
case Action::EmitterOmniDirectional:
toCreate = new NL3D::CPSEmitterOmni;
break;
case Action::EmitterRectangle:
toCreate = new NL3D::CPSEmitterRectangle;
break;
case Action::EmitterConic:
toCreate = new NL3D::CPSEmitterConic;
break;
case Action::EmitterSpherical:
toCreate = new NL3D::CPSSphericalEmitter;
break;
case Action::EmitterRadial:
toCreate = new NL3D::CPSRadialEmitter;
break;
case Action::Sound:
toCreate = new NL3D::CPSSound;
if (!Modules::psEdit().isRunning())
(static_cast<NL3D::CPSSound *>(toCreate))->stopSound();
break;
case Action::Light:
toCreate = new NL3D::CPSLight;
break;
}
_treeModel->getOwnerNode(_currentItem)->setModified(true);
@ -510,7 +512,7 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
if (_treeModel->getOwnerNode(_currentItem)->getPSPointer()->getBypassMaxNumIntegrationSteps())
{
if (toCreate->getType() == NL3D::PSParticle || toCreate->getType() == NL3D::PSEmitter)
loc->setInitialLife(1.f);
loc->setInitialLife(1.f);
// object must have finite duration with that flag
}
}
@ -520,9 +522,9 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
if (!loc->bind(toCreate))
{
QMessageBox::critical(this, tr("NeL particle system editor"),
tr("The system is flagged with 'No max Nb steps', or uses the preset 'Spell FX'."
"System must have finite duration. Can't add object. To solve this, set a limited life time for the father."),
QMessageBox::Ok);
tr("The system is flagged with 'No max Nb steps', or uses the preset 'Spell FX'."
"System must have finite duration. Can't add object. To solve this, set a limited life time for the father."),
QMessageBox::Ok);
delete toCreate;
return;
}
@ -593,9 +595,9 @@ void CParticleWorkspaceDialog::pasteBindable()
{
delete copy;
QMessageBox::critical(this, tr("NeL particle system editor"),
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
"and thus, should have a finite duration. Please remove that flag first."),
QMessageBox::Ok);
}
}
@ -610,50 +612,50 @@ void CParticleWorkspaceDialog::deleteItem()
clickedItem(index.parent());
switch(item->itemType())
{
case ItemType::Located:
{
NL3D::CPSLocated *loc = item->getLoc();
touchPSState(item);
ownerNode->setModified(true);
// if the system is running, we must destroy initial infos about the located,
// as they won't need to be restored when the stop button will be pressed
ownerNode->removeLocated(loc);
case ItemType::Located:
{
NL3D::CPSLocated *loc = item->getLoc();
touchPSState(item);
ownerNode->setModified(true);
// if the system is running, we must destroy initial infos about the located,
// as they won't need to be restored when the stop button will be pressed
ownerNode->removeLocated(loc);
Modules::psEdit().resetAutoCount(ownerNode);
Modules::psEdit().resetAutoCount(ownerNode);
ownerNode->getPSPointer()->remove(loc);
_treeModel->removeRows(index.row(), index.parent());
}
break;
case ItemType::LocatedInstance:
{
Modules::psEdit().resetAutoCount(ownerNode);
NL3D::CPSEmitter::setBypassEmitOnDeath(true);
item->getLoc()->deleteElement(item->getLocatedInstanceIndex());
NL3D::CPSEmitter::setBypassEmitOnDeath(false);
_treeModel->removeRows(index.row(), index.parent());
_treeModel->rebuildLocatedInstance(_ui.treeView->currentIndex());
}
break;
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Force:
case ItemType::Light:
case ItemType::Sound:
case ItemType::CollisionZone:
{
NL3D::CPSLocatedBindable *lb = item->getBind();
touchPSState(item);
// if the system is running, we must destroy initial infos
// that what saved about the located bindable, when the start button was pressed, as they won't need
// to be restored
ownerNode->removeLocatedBindable(lb);
ownerNode->setModified(true);
Modules::psEdit().resetAutoCount(ownerNode);
lb->getOwner()->remove(lb);
_treeModel->removeRows(index.row(), index.parent());
}
break;
ownerNode->getPSPointer()->remove(loc);
_treeModel->removeRows(index.row(), index.parent());
}
break;
case ItemType::LocatedInstance:
{
Modules::psEdit().resetAutoCount(ownerNode);
NL3D::CPSEmitter::setBypassEmitOnDeath(true);
item->getLoc()->deleteElement(item->getLocatedInstanceIndex());
NL3D::CPSEmitter::setBypassEmitOnDeath(false);
_treeModel->removeRows(index.row(), index.parent());
_treeModel->rebuildLocatedInstance(_ui.treeView->currentIndex());
}
break;
case ItemType::Particle:
case ItemType::Emitter:
case ItemType::Force:
case ItemType::Light:
case ItemType::Sound:
case ItemType::CollisionZone:
{
NL3D::CPSLocatedBindable *lb = item->getBind();
touchPSState(item);
// if the system is running, we must destroy initial infos
// that what saved about the located bindable, when the start button was pressed, as they won't need
// to be restored
ownerNode->removeLocatedBindable(lb);
ownerNode->setModified(true);
Modules::psEdit().resetAutoCount(ownerNode);
lb->getOwner()->remove(lb);
_treeModel->removeRows(index.row(), index.parent());
}
break;
}
}
@ -667,7 +669,7 @@ void CParticleWorkspaceDialog::setInstanciate()
_currentItem->getLoc()->resize(_currentItem->getLoc()->getMaxSize() + 1);
sint32 objIndex = _currentItem->getLoc()->newElement(NLMISC::CVector::Null, NLMISC::CVector::Null,
NULL, 0, _currentItem->getLoc()->getMatrixMode(), 0.f);
NULL, 0, _currentItem->getLoc()->getMatrixMode(), 0.f);
_treeModel->insertRow(_currentItem->getLoc(), objIndex, _currentItem->childCount(), _ui.treeView->currentIndex());
}
@ -694,8 +696,8 @@ void CParticleWorkspaceDialog::setExternID()
{
bool ok;
int i = QInputDialog::getInt(this, tr("Set the extern ID"),
tr("0 means no extern access."),
_currentItem->getBind()->getExternID(), 0, 9999, 1, &ok);
tr("0 means no extern access."),
_currentItem->getBind()->getExternID(), 0, 9999, 1, &ok);
if (ok)
{
_currentItem->getBind()->setExternID(uint32(i));

View file

@ -34,7 +34,8 @@
#include "particle_tree_model.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
/**
@class ParticleWorkspaceDialog
@ -48,7 +49,10 @@ public:
~CParticleWorkspaceDialog();
void touchPSState(CParticleTreeItem *item);
CPropertyDialog *getPropertyDialog() const { return _PropertyDialog; }
CPropertyDialog *getPropertyDialog() const
{
return _PropertyDialog;
}
Q_SIGNALS:
/// Emits change active particle system node.

View file

@ -30,10 +30,11 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CWorkspacePage::CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -57,8 +58,8 @@ void CWorkspacePage::newWP()
//checkModifiedWorkSpace();
// ask name of the new workspace to create
QString fileName = QFileDialog::getSaveFileName(this, tr("Create new pws file"),
".",
tr("pws files (*.pws)"));
".",
tr("pws files (*.pws)"));
if (!fileName.isEmpty())
{
Modules::psEdit().createNewWorkspace(fileName.toStdString());
@ -75,8 +76,8 @@ void CWorkspacePage::loadWP()
{
//checkModifiedWorkSpace();
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open NeL data file"), ".",
tr("Particle Workspace file (*.pws);;"));
tr("Open NeL data file"), ".",
tr("Particle Workspace file (*.pws);;"));
setCursor(Qt::WaitCursor);
if (!fileName.isEmpty())
@ -102,8 +103,8 @@ void CWorkspacePage::saveWP()
void CWorkspacePage::saveAsWP()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as pws file"),
".",
tr("pws files (*.pws)"));
".",
tr("pws files (*.pws)"));
if (!fileName.isEmpty())
{
Modules::psEdit().getParticleWorkspace()->setFileName(fileName.toStdString());
@ -116,8 +117,8 @@ void CWorkspacePage::saveAsWP()
void CWorkspacePage::insertPS()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open NeL data file"), ".",
tr("Particle System file (*.ps);;"));
tr("Open NeL data file"), ".",
tr("Particle System file (*.ps);;"));
if (!fileName.isEmpty())
{
@ -132,8 +133,8 @@ void CWorkspacePage::insertPS()
catch(NLMISC::EStream &e)
{
QMessageBox::critical(this, tr("NeL particle system editor"),
QString(e.what()),
QMessageBox::Ok);
QString(e.what()),
QMessageBox::Ok);
}
if (!node->isLoaded())
Modules::psEdit().getParticleWorkspace()->removeNode(Modules::psEdit().getParticleWorkspace()->getNumNode() - 1);
@ -149,8 +150,8 @@ void CWorkspacePage::insertPS()
void CWorkspacePage::createPS()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Create new particle system file"),
".",
tr("ps files (*.ps)"));
".",
tr("ps files (*.ps)"));
if (!fileName.isEmpty())
{
@ -158,8 +159,8 @@ void CWorkspacePage::createPS()
if (Modules::psEdit().getParticleWorkspace()->containsFile(NLMISC::CFile::getFilename(fileName.toStdString())))
{
QMessageBox::critical(this, tr("NeL particle system editor"),
tr("Failed to create new particle system"),
QMessageBox::Ok);
tr("Failed to create new particle system"),
QMessageBox::Ok);
return;
}
CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString()));
@ -174,9 +175,9 @@ void CWorkspacePage::createPS()
catch (NLMISC::Exception &e)
{
QMessageBox::critical(this, tr("NeL particle system editor"),
QString(e.what()),
QMessageBox::Ok);
return;
QString(e.what()),
QMessageBox::Ok);
return;
}
QModelIndex index = _treeModel->index(0, 0);
_treeModel->insertRows(node, static_cast<CParticleTreeItem*>(index.internalPointer())->childCount(), index);

View file

@ -31,7 +31,8 @@
// Project includes
#include "particle_tree_model.h"
namespace NLQT {
namespace NLQT
{
/**
@class CWorkspacePage
@ -39,7 +40,7 @@ namespace NLQT {
*/
class CWorkspacePage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent = 0);

View file

@ -28,10 +28,11 @@
#include "particle_force_page.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CZonePage::CZonePage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -50,7 +51,7 @@ CZonePage::~CZonePage()
void CZonePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
{
_Node = ownerNode;
_Node = ownerNode;
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
_Zone = dynamic_cast<NL3D::CPSZone *>(_LBTarget);
@ -107,7 +108,7 @@ void CZonePage::setBounce(int index)
void CZonePage::setBounceFactor(float value)
{
_Zone->setBounceFactor(value);
updateModifiedFlag();
updateModifiedFlag();
}
void CZonePage::updateTargets()
@ -123,7 +124,7 @@ void CZonePage::updateTargets()
for(k = 0; k < nbTarg; ++k)
{
CLocatedItem *item = new CLocatedItem(QString(_LBTarget->getTarget(k)->getName().c_str()),
_ui.targetsListWidget);
_ui.targetsListWidget);
item->setUserData(_LBTarget->getTarget(k));
targetSet.insert(_LBTarget->getTarget(k));
};
@ -143,7 +144,7 @@ void CZonePage::updateTargets()
if (targetSet.find(loc) == targetSet.end())
{
CLocatedItem *item = new CLocatedItem(QString(loc->getName().c_str()),
_ui.avaibleTargetsListWidget);
_ui.avaibleTargetsListWidget);
item->setUserData(loc);
}
}

View file

@ -31,11 +31,12 @@
// Project includes
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
class CZonePage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CZonePage(QWidget *parent = 0);
@ -53,7 +54,10 @@ private Q_SLOTS:
private:
void updateTargets();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
/// the target we're focusing on
NL3D::CPSTargetLocatedBindable *_LBTarget;

View file

@ -23,7 +23,8 @@
#include "nel/3d/ps_edit.h"
#include "nel/3d/ps_emitter.h"
namespace NLQT {
namespace NLQT
{
void CPSInitialPos::reset()
{
@ -87,19 +88,28 @@ struct CRemoveLocatedPred
// private : predicate to remove located from a CPSInitialPos::TInitialLocatedSizeVect vector
struct CRemoveLocatedFromLocatedSizePred : public CRemoveLocatedPred
{
bool operator()(const std::pair<NL3D::CPSLocated *, uint32> &value) { return Loc == value.first; }
bool operator()(const std::pair<NL3D::CPSLocated *, uint32> &value)
{
return Loc == value.first;
}
};
// private : predicate to remove located from a PSInitialPos::CInitPSInstanceInfo vector
struct CRemoveLocatedFromInitPSInstanceInfoVectPred : public CRemoveLocatedPred
{
bool operator()(const CPSInitialPos::CInitPSInstanceInfo &value) { return value.Loc == Loc; }
bool operator()(const CPSInitialPos::CInitPSInstanceInfo &value)
{
return value.Loc == Loc;
}
};
// private : predicate to remove located from a PSInitialPos::CRotScaleInfo vector
struct CRemoveLocatedFromRotScaleInfoVectPred : public CRemoveLocatedPred
{
bool operator()(const CPSInitialPos::CRotScaleInfo &value) { return value.Loc == Loc; }
bool operator()(const CPSInitialPos::CRotScaleInfo &value)
{
return value.Loc == Loc;
}
};
// private : predicate to remove located bindable pointers in a TRotScaleInfoVect vect
@ -107,7 +117,10 @@ struct CRemoveLocatedBindableFromRotScaleInfoVectPred
{
// the located bindable taht has been removed
NL3D::CPSLocatedBindable *LB;
bool operator()(const CPSInitialPos::CRotScaleInfo &value) { return value.LB == LB; }
bool operator()(const CPSInitialPos::CRotScaleInfo &value)
{
return value.LB == LB;
}
};
void CPSInitialPos::removeLocated(NL3D::CPSLocated *loc)
@ -118,7 +131,7 @@ void CPSInitialPos::removeLocated(NL3D::CPSLocated *loc)
CRemoveLocatedFromLocatedSizePred p;
p.Loc = loc;
_InitialSizeVect.erase(std::remove_if(_InitialSizeVect.begin(), _InitialSizeVect.end(), p)
, _InitialSizeVect.end() );
, _InitialSizeVect.end() );
CRemoveLocatedFromInitPSInstanceInfoVectPred p2;
p2.Loc = loc;
@ -128,7 +141,7 @@ void CPSInitialPos::removeLocated(NL3D::CPSLocated *loc)
CRemoveLocatedFromRotScaleInfoVectPred p3;
p3.Loc = loc;
_RotScaleInfoVect.erase(std::remove_if(_RotScaleInfoVect.begin(), _RotScaleInfoVect.end(), p3)
, _RotScaleInfoVect.end());
, _RotScaleInfoVect.end());
}
@ -162,7 +175,7 @@ void CPSInitialPos::restoreSystem()
// recreate the initial number of instances
for (TInitialLocatedSizeVect ::iterator itSize = _InitialSizeVect.begin(); itSize != _InitialSizeVect.end(); ++itSize)
{
// nlassert(itSize->first->getSize() == 0)
// nlassert(itSize->first->getSize() == 0)
for (uint l = 0; l < itSize->second; ++l)
{
itSize->first->newElement(NLMISC::CVector::Null, NLMISC::CVector::Null, NULL, 0, itSize->first->getMatrixMode(), 0.f);

View file

@ -24,13 +24,14 @@
namespace NL3D
{
class CParticleSystem;
class CPSLocated;
class CPSLocatedBindable;
struct IPSMover;
class CParticleSystem;
class CPSLocated;
class CPSLocatedBindable;
struct IPSMover;
}
namespace NLQT {
namespace NLQT
{
/**
@class CPSInitialPos
This class helps to copy the position of initial instances in a particle
@ -77,9 +78,18 @@ public:
NLMISC::CMatrix Rot;
NLMISC::CVector Scale;
};
NL3D::CParticleSystem *getPS() { return _PS; }
const NL3D::CParticleSystem *getPS() const { return _PS; }
bool isStateMemorized() const { return _PS != NULL; }
NL3D::CParticleSystem *getPS()
{
return _PS;
}
const NL3D::CParticleSystem *getPS() const
{
return _PS;
}
bool isStateMemorized() const
{
return _PS != NULL;
}
private:
typedef std::vector<CInitPSInstanceInfo> TInitInfoVect;

View file

@ -27,12 +27,13 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
const float epsilon = 10E-3f;
CPSMoverPage::CPSMoverPage(QWidget *parent)
: QWidget(parent)
: QWidget(parent)
{
_ui.setupUi(this);
@ -57,7 +58,7 @@ CPSMoverPage::CPSMoverPage(QWidget *parent)
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector)));
connect(_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(changeSubComponent()));
this, SLOT(changeSubComponent()));
}
CPSMoverPage::~CPSMoverPage()
@ -84,7 +85,7 @@ void CPSMoverPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k)))
{
CLocatedBindableItem *item = new CLocatedBindableItem(QString(_EditedLocated->getBoundObject(k)->getName().c_str()),
_ui.listWidget);
_ui.listWidget);
item->setUserData(_EditedLocated->getBoundObject(k));
++nbCandidates;
}
@ -118,15 +119,15 @@ void CPSMoverPage::hideAdditionalWidget()
void CPSMoverPage::updateListener(void)
{
/* if(_ParticleDlg->MainFrame->isMoveElement())
{
const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
NLMISC::CMatrix m;
m = _MouseListener->getModelMatrix();
m.setPos(pos);
_MouseListener->setModelMatrix(m);
_Node->setModified(true);
}*/
/* if(_ParticleDlg->MainFrame->isMoveElement())
{
const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
NLMISC::CMatrix m;
m = _MouseListener->getModelMatrix();
m.setPos(pos);
_MouseListener->setModelMatrix(m);
_Node->setModified(true);
}*/
}
void CPSMoverPage::setXPosition(double value)

View file

@ -35,7 +35,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedBindableItem
@ -45,10 +46,16 @@ class CLocatedBindableItem: public QListWidgetItem
{
public:
CLocatedBindableItem ( const QString & text, QListWidget * parent = 0, int type = UserType ):
QListWidgetItem(text, parent, type), _lb(NULL) {}
QListWidgetItem(text, parent, type), _lb(NULL) {}
void setUserData(NL3D::CPSLocatedBindable *loc) { _lb = loc;}
NL3D::CPSLocatedBindable *getUserData() const { return _lb;}
void setUserData(NL3D::CPSLocatedBindable *loc)
{
_lb = loc;
}
NL3D::CPSLocatedBindable *getUserData() const
{
return _lb;
}
private:
@ -61,7 +68,7 @@ private:
*/
class CPSMoverPage: public QWidget
{
Q_OBJECT
Q_OBJECT
public:
CPSMoverPage(QWidget *parent = 0);
@ -77,11 +84,20 @@ public:
NL3D::IPSMover *getMoverInterface(void) ;
/// get the located being edited
NL3D::CPSLocated *getLocated(void) { return _EditedLocated ; }
const NL3D::CPSLocated *getLocated(void) const { return _EditedLocated ; }
NL3D::CPSLocated *getLocated(void)
{
return _EditedLocated ;
}
const NL3D::CPSLocated *getLocated(void) const
{
return _EditedLocated ;
}
/// get the index of the current edited item
uint32 getLocatedIndex(void) const { return _EditedLocatedIndex ; }
uint32 getLocatedIndex(void) const
{
return _EditedLocatedIndex ;
}
/// ghet the current located bindable being edited, or null
NL3D::CPSLocatedBindable *getLocatedBindable(void) ;
@ -101,8 +117,14 @@ private:
{
uint32 Index ;
NL3D::IPSMover *M ;
float get(void) const { return M->getScale(Index).x ; }
void set(const float &v) { M->setScale(Index, v) ; }
float get(void) const
{
return M->getScale(Index).x ;
}
void set(const float &v)
{
M->setScale(Index, v) ;
}
} _UniformScaleWrapper ;
/// wrapper to scale the X coordinate
@ -110,7 +132,10 @@ private:
{
uint32 Index ;
NL3D::IPSMover *M ;
float get(void) const { return M->getScale(Index).x ; }
float get(void) const
{
return M->getScale(Index).x ;
}
void set(const float &s)
{
NLMISC::CVector v = M->getScale(Index) ;
@ -123,7 +148,10 @@ private:
{
uint32 Index ;
NL3D::IPSMover *M ;
float get(void) const { return M->getScale(Index).y ; }
float get(void) const
{
return M->getScale(Index).y ;
}
void set(const float &s)
{
NLMISC::CVector v = M->getScale(Index) ;
@ -136,7 +164,10 @@ private:
{
uint32 Index ;
NL3D::IPSMover *M ;
float get(void) const { return M->getScale(Index).z ; }
float get(void) const
{
return M->getScale(Index).z ;
}
void set(const float &s)
{
NLMISC::CVector v = M->getScale(Index) ;
@ -146,7 +177,10 @@ private:
void hideAdditionalWidget();
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
void updateModifiedFlag()
{
if (_Node) _Node->setModified(true);
}
/// update the mouse listener position when the user entered a value with the keyboard
void updateListener(void) ;

View file

@ -30,7 +30,8 @@
//
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
/// Wrapper to read/write a value of type T
template <class T> class IPSWrapper

View file

@ -34,10 +34,11 @@
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CSettingsDialog::CSettingsDialog(QWidget *parent)
: QDialog(parent)
: QDialog(parent)
{
ui.setupUi(this);
@ -120,9 +121,9 @@ void CSettingsDialog::applyPressed()
// settings take after restart the program
QMessageBox::warning(this, tr("Settings"),
tr("Graphics and sound settings "
"take after restart the program"),
QMessageBox::Ok);
tr("Graphics and sound settings "
"take after restart the program"),
QMessageBox::Ok);
saveGraphicsSettings();
saveSoundSettings();
@ -139,8 +140,8 @@ void CSettingsDialog::applyPressed()
void CSettingsDialog::setTileBank()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile bank"),
ui.tileBankLineEdit->text(),
tr("Tile Bank file (*.smallbank *.bank);;"));
ui.tileBankLineEdit->text(),
tr("Tile Bank file (*.smallbank *.bank);;"));
if (!fileName.isEmpty())
{
ui.tileBankLineEdit->setText(fileName);
@ -149,9 +150,9 @@ void CSettingsDialog::setTileBank()
void CSettingsDialog::setTileFarBank()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile far bank"),
ui.tileFarBankLineEdit->text(),
tr("Tile Far Bank file (*.farbank);;"));
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile far bank"),
ui.tileFarBankLineEdit->text(),
tr("Tile Far Bank file (*.farbank);;"));
if (!fileName.isEmpty())
{
ui.tileFarBankLineEdit->setText(fileName);
@ -161,8 +162,8 @@ void CSettingsDialog::setTileFarBank()
void CSettingsDialog::setTextureVegetable()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Set MicroVegetable texture"),
ui.vegetTextureLineEdit->text(),
tr("Texture file (*.tga *.png *.jpg *.dds);;"));
ui.vegetTextureLineEdit->text(),
tr("Texture file (*.tga *.png *.jpg *.dds);;"));
if (!fileName.isEmpty())
{
ui.vegetTextureLineEdit->setText(fileName);
@ -172,8 +173,8 @@ void CSettingsDialog::setTextureVegetable()
void CSettingsDialog::addZone()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Add zone files"), ".",
tr("Zonel files (*.zonel);;"));
tr("Add zone files"), ".",
tr("Zonel files (*.zonel);;"));
if (!fileNames.isEmpty())
{

View file

@ -30,7 +30,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CSettingsDialog
@ -38,7 +39,7 @@ namespace NLQT {
*/
class CSettingsDialog: public QDialog
{
Q_OBJECT
Q_OBJECT
public:
CSettingsDialog(QWidget *parent = 0);

View file

@ -34,10 +34,11 @@
using namespace NL3D;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CSetupFog::CSetupFog(QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent)
{
ui.setupUi(this);
@ -64,16 +65,16 @@ CSetupFog::~CSetupFog()
void CSetupFog::apply()
{
Modules::objView().getDriver()->setupFog(ui.startDoubleSpinBox->value(),
ui.endDoubleSpinBox->value(),
colorFog);
ui.endDoubleSpinBox->value(),
colorFog);
Modules::objView().getDriver()->enableFog(ui.enableFogCheckBox->isChecked());
}
void CSetupFog::setColor()
{
QColor color = QColorDialog::getColor(QColor(colorFog.R,
colorFog.G,
colorFog.B));
colorFog.G,
colorFog.B));
colorFog.set(color.red(), color.green(), color.blue());
}

View file

@ -31,7 +31,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CSetupFog
@ -39,7 +40,7 @@ namespace NLQT {
*/
class CSetupFog: public QDockWidget
{
Q_OBJECT
Q_OBJECT
public:
CSetupFog(QWidget *parent = 0);

Some files were not shown because too many files have changed in this diff Show more