Changed: #1193 Code cleanup.

This commit is contained in:
timon 2010-11-26 13:54:06 +02:00
parent 6934b285e2
commit ffb5b2678b
141 changed files with 4702 additions and 3665 deletions

View file

@ -29,7 +29,8 @@
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CAnimationDialog::CAnimationDialog(QWidget *parent)
: QDockWidget(parent)

View file

@ -33,7 +33,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CAnimationDialog

View file

@ -29,7 +29,8 @@
#include "modules.h"
#include "entity.h"
namespace NLQT {
namespace NLQT
{
CAnimationSetDialog::CAnimationSetDialog(QWidget *parent)
: QDockWidget(parent)

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,7 +40,7 @@ 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

View file

@ -40,7 +40,8 @@
#include "spinner_dialog.h"
#include "follow_path_dialog.h"
namespace NLQT {
namespace NLQT
{
CAttribWidget::CAttribWidget(QWidget *parent)
: QGroupBox(parent),

View file

@ -38,7 +38,8 @@
#include "ps_wrapper.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
/**
@class CAttribWidget
@brief Base attrib maker edition dialog.
@ -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();
@ -160,8 +176,14 @@ protected:
struct CNbCyclesWrapper : public IPSWrapperFloat
{
CAttribWidget *widget;
float get(void) const { return widget->getSchemeNbCycles(); }
void set(const float &v) { widget->setSchemeNbCycles(v); }
float get(void) const
{
return widget->getSchemeNbCycles();
}
void set(const float &v)
{
widget->setSchemeNbCycles(v);
}
} _NbCyclesWrapper;
CWorkspaceNode *_Node;
@ -184,7 +206,11 @@ public:
{
}
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));

View file

@ -28,7 +28,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
: QDialog(parent), _Node(ownerNode), _PS(ps)

View file

@ -32,7 +32,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
class CAutoLODDialog: public QDialog
{
@ -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,7 +26,8 @@
#include "nel/misc/matrix.h"
#include "nel/misc/vector.h"
namespace NLQT {
namespace NLQT
{
// build an euler matrix
@ -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

View file

@ -31,7 +31,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
class CBasicEditWidget: public QWidget
{

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,7 +38,8 @@
#include "ps_wrapper.h"
#include "attrib_widget.h"
namespace NLQT {
namespace NLQT
{
class CBinOpDialog : public QDialog
{
@ -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,7 +27,8 @@
// Nel includes
#include <nel/misc/rgba.h>
namespace NLQT {
namespace NLQT
{
CColorEditWidget::CColorEditWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL), _emit(true)

View file

@ -27,7 +27,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CColorEditWidget

View file

@ -31,7 +31,8 @@
using namespace std;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CConfiguration::CConfiguration()
{

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,7 +23,8 @@
// NeL includes
#include "nel/3d/ps_mesh.h"
namespace NLQT {
namespace NLQT
{
CConstraintMeshWidget::CConstraintMeshWidget(QWidget *parent )
: QWidget(parent)

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

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)

View file

@ -36,7 +36,8 @@
#include "hoverpoints.h"
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CurveEditDialog
@brief Dialogue editing graphics curve.

View file

@ -26,7 +26,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CDayNightDialog::CDayNightDialog(QWidget *parent)
: QDockWidget(parent)

View file

@ -28,7 +28,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CDayNightDialog

View file

@ -26,7 +26,8 @@
// NeL includes
#include <nel/misc/vector.h>
namespace NLQT {
namespace NLQT
{
CDirectionWidget::CDirectionWidget(QWidget *parent)
: QWidget(parent), _globalName("")

View file

@ -29,7 +29,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CDirectionWidget

View file

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

View file

@ -28,7 +28,8 @@
using namespace NL3D;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
const int max_range = 9999;

View file

@ -28,7 +28,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CEditRangeUIntWidget

View file

@ -21,7 +21,7 @@
#include "emitter_page.h"
// Qt includes
#include <QtGui/QMessageBox>
#include <QtGui/QMessageBox>
// NeL includes
@ -29,7 +29,8 @@
#include "edit_range_widget.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CEmitterPage::CEmitterPage(QWidget *parent)

View file

@ -33,7 +33,8 @@
#include "particle_node.h"
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CEmitterPage
@ -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)
{

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,53 +147,98 @@ 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

View file

@ -26,7 +26,8 @@
// 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)

View file

@ -29,10 +29,11 @@
namespace NL3D
{
class CPSPlaneBasisFollowSpeed;
class CPSPlaneBasisFollowSpeed;
}
namespace NLQT {
namespace NLQT
{
class CWorkspaceNode;

View file

@ -24,7 +24,8 @@
#include "modules.h"
#include <nel/3d/u_scene.h>
namespace NLQT {
namespace NLQT
{
CGlobalWindDialog::CGlobalWindDialog(QWidget *parent)
: QDockWidget(parent)

View file

@ -28,7 +28,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
class CGlobalWindDialog: public QDockWidget
{
@ -44,7 +45,7 @@ private Q_SLOTS:
private:
/// wrappers to tune the direction of wind
/* struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
/* struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
{
NLMISC::CVector get(void) const;
void set(const NLMISC::CVector &d);

View file

@ -27,7 +27,8 @@
// STL includes
namespace NLQT {
namespace NLQT
{
const int directionSize = 35;

View file

@ -30,7 +30,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
struct Mode
{

View file

@ -43,7 +43,8 @@
using namespace std;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CGraphicsViewport::CGraphicsViewport(QWidget *parent)
: QNLWidget(parent)

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

@ -72,7 +72,8 @@ HoverPoints::HoverPoints(QWidget *widget, PointShape shape)
void HoverPoints::setEnabled(bool enabled)
{
if (m_enabled != enabled) {
if (m_enabled != enabled)
{
m_enabled = enabled;
m_widget->update();
}
@ -81,8 +82,10 @@ void HoverPoints::setEnabled(bool enabled)
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:
{
@ -92,34 +95,43 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
QPointF clickPos = me->pos();
int index = -1;
for (int i=0; i<m_points.size(); ++i) {
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)) {
if (path.contains(clickPos))
{
index = i;
break;
}
}
if (me->button() == Qt::LeftButton) {
if (index == -1) {
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) {
if (m_sortType == XSort)
{
for (int i=0; i<m_points.size(); ++i)
if (m_points.at(i).x() > clickPos.x()) {
if (m_points.at(i).x() > clickPos.x())
{
pos = i;
break;
}
} else if (m_sortType == YSort) {
}
else if (m_sortType == YSort)
{
for (int i=0; i<m_points.size(); ++i)
if (m_points.at(i).y() > clickPos.y()) {
if (m_points.at(i).y() > clickPos.y())
{
pos = i;
break;
}
@ -130,16 +142,22 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
m_currentIndex = pos;
firePointChange();
} else {
}
else
{
m_currentIndex = index;
}
return true;
} else if (me->button() == Qt::RightButton) {
if (index >= 0 && m_editable) {
}
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) {
if (m_locks[index] == 0)
{
m_locks.remove(index);
m_points.remove(index);
}
@ -169,9 +187,11 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
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) {
Q_FOREACH (const QTouchEvent::TouchPoint &touchPoint, points)
{
const int id = touchPoint.id();
switch (touchPoint.state()) {
switch (touchPoint.state())
{
case Qt::TouchPointPressed:
{
// find the point, move it
@ -180,22 +200,28 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
qreal distance = -1;
const int pointsCount = m_points.size();
const int activePointCount = activePoints.size();
if (pointsCount == 2 && activePointCount == 1) { // only two points
if (pointsCount == 2 && activePointCount == 1) // only two points
{
activePoint = activePoints.contains(0) ? 1 : 0;
} else {
for (int i=0; i<pointsCount; ++i) {
}
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) {
if ((distance < 0 && d < 12 * pointSize) || d < distance)
{
distance = d;
activePoint = i;
}
}
}
if (activePoint != -1) {
if (activePoint != -1)
{
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
movePoint(activePoint, touchPoint.pos());
}
@ -221,16 +247,20 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
break;
}
}
if (m_fingerPointMapping.isEmpty()) {
if (m_fingerPointMapping.isEmpty())
{
event->ignore();
return false;
} else {
}
else
{
return true;
}
}
break;
case QEvent::TouchEnd:
if (m_fingerPointMapping.isEmpty()) {
if (m_fingerPointMapping.isEmpty())
{
event->ignore();
return false;
}
@ -244,7 +274,8 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
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) {
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);
}
@ -283,13 +314,16 @@ void HoverPoints::paintPoints()
p.setBrush(QBrush());
if (m_connectionPen.style() != Qt::NoPen && m_connectionType != NoConnection) {
if (m_connectionPen.style() != Qt::NoPen && m_connectionType != NoConnection)
{
p.setPen(m_connectionPen);
if (m_connectionType == CurveConnection) {
if (m_connectionType == CurveConnection)
{
QPainterPath path;
path.moveTo(m_points.at(0));
for (int i=1; i<m_points.size(); ++i) {
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();
@ -299,7 +333,9 @@ void HoverPoints::paintPoints()
p2.x(), p2.y());
}
p.drawPath(path);
} else {
}
else
{
p.drawPolyline(m_points);
}
}
@ -307,7 +343,8 @@ void HoverPoints::paintPoints()
p.setPen(m_pointPen);
p.setBrush(m_pointBrush);
for (int i=0; i<m_points.size(); ++i) {
for (int i=0; i<m_points.size(); ++i)
{
QRectF bounds = pointBoundingRect(i);
if (m_shape == CircleShape)
p.drawEllipse(bounds);
@ -328,9 +365,9 @@ static QPointF bound_point(const QPointF &point, const QRectF &bounds, int lock)
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);
/* if (p.y() < top || (lock & HoverPoints::LockToTop)) p.setY(top);
else if (p.y() > bottom || (lock & HoverPoints::LockToBottom)) p.setY(bottom);
*/
*/
return p;
}
@ -344,7 +381,8 @@ void HoverPoints::setPoints(const QPolygonF &points)
m_points << bound_point(points.at(i), boundingRect(), 0);
m_locks.clear();
if (m_points.size() > 0) {
if (m_points.size() > 0)
{
m_locks.resize(m_points.size());
m_locks.fill(0);
@ -382,10 +420,12 @@ inline static bool y_less_than(const QPointF &p1, const QPointF &p2)
void HoverPoints::firePointChange()
{
if (m_sortType != NoSort) {
if (m_sortType != NoSort)
{
QPointF oldCurrent;
if (m_currentIndex != -1) {
if (m_currentIndex != -1)
{
oldCurrent = m_points[m_currentIndex];
}
@ -395,9 +435,12 @@ void HoverPoints::firePointChange()
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) {
if (m_currentIndex != -1)
{
for (int i=0; i<m_points.size(); ++i)
{
if (m_points[i] == oldCurrent)
{
m_currentIndex = i;
break;
}

View file

@ -50,25 +50,29 @@ class HoverPoints : public QObject
{
Q_OBJECT
public:
enum PointShape {
enum PointShape
{
CircleShape,
RectangleShape
};
enum LockType {
enum LockType
{
LockToLeft = 0x01,
LockToRight = 0x02,
LockToTop = 0x04,
LockToBottom = 0x08
};
enum SortType {
enum SortType
{
NoSort,
XSort,
YSort
};
enum ConnectionType {
enum ConnectionType
{
NoConnection,
LineConnection,
CurveConnection
@ -81,32 +85,77 @@ public:
void paintPoints();
inline QRectF boundingRect() const;
void setBoundingRect(const QRectF &boundingRect) { m_bounds = boundingRect; }
void setBoundingRect(const QRectF &boundingRect)
{
m_bounds = boundingRect;
}
QPolygonF points() const { return m_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 setDisabled(bool disabled)
{
setEnabled(!disabled);
}
Q_SIGNALS:
void pointsChanged(const QPolygonF &points);

View file

@ -29,7 +29,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
: QWidget(parent)

View file

@ -37,7 +37,8 @@
#include "ps_wrapper.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedBindablePage
@ -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,7 +30,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CLocatedPage::CLocatedPage(QWidget *parent)
: QWidget(parent)

View file

@ -33,10 +33,11 @@
namespace NL3D
{
class CPSLocated;
class CPSLocated;
}
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedPage
@ -71,19 +72,37 @@ private:
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); }
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(); }
float get(void) const
{
return Located->getInitialLife();
}
void set(const float &v);
virtual scheme_type *getScheme(void) const { return Located->getLifeScheme(); }
virtual scheme_type *getScheme(void) const
{
return Located->getLifeScheme();
}
virtual void setScheme(scheme_type *s);
} _LifeWrapper;
@ -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;

View file

@ -49,7 +49,8 @@
using namespace std;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CMainWindow::CMainWindow(QWidget *parent)
: QMainWindow(parent),
@ -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,7 +34,8 @@
#include "mesh_widget.h"
#include "morph_mesh_dialog.h"
namespace NLQT {
namespace NLQT
{
CMeshWidget::CMeshWidget(QWidget *parent)
: QGroupBox(parent)
@ -185,9 +186,12 @@ 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");
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;
};

View file

@ -33,10 +33,11 @@
namespace NL3D
{
struct CPSShapeParticle;
struct CPSShapeParticle;
}
namespace NLQT {
namespace NLQT
{
class CMeshWidget: public QGroupBox
{
@ -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,7 +30,8 @@
// 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)

View file

@ -33,10 +33,11 @@
namespace NL3D
{
class CPSConstraintMesh;
class CPSConstraintMesh;
}
namespace NLQT {
namespace NLQT
{
class CMorphMeshDialog: public QDialog
{

View file

@ -27,7 +27,8 @@
// 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)

View file

@ -34,10 +34,11 @@
namespace NL3D
{
class CPSMultiTexturedParticle;
class CPSMultiTexturedParticle;
}
namespace NLQT {
namespace NLQT
{
class CWorkspaceNode;
@ -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,7 +50,8 @@ using namespace std;
using namespace NLMISC;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CObjectViewer::CObjectViewer()
: _Driver(NULL), _TextContext(NULL),

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,7 +32,8 @@
#include "particle_link_skeleton_dialog.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CParticleControlDialog::CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent)
: QDockWidget(parent)

View file

@ -25,7 +25,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
class CSkeletonTreeModel;
class CParticleLinkDialog;

View file

@ -31,7 +31,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CParticleEditor::CParticleEditor(void):
_ActiveNode(NULL), _State(State::Stopped), _Speed(1.0f),

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,14 +21,15 @@
#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)

View file

@ -33,7 +33,8 @@
#include "particle_node.h"
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedItem
@ -45,8 +46,14 @@ public:
CLocatedItem ( const QString & text, QListWidget * parent = 0, int type = UserType ):
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:
@ -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,7 +27,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CLightPage::CLightPage(QWidget *parent)
: QWidget(parent)

View file

@ -32,7 +32,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLightPage
@ -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,7 +27,8 @@
#include "modules.h"
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
CParticleLinkDialog::CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent)
: QDockWidget(parent)

View file

@ -29,7 +29,8 @@
// Project includes
#include "skeleton_tree_model.h"
namespace NLQT {
namespace NLQT
{
class CParticleLinkDialog: public QDockWidget
{

View file

@ -34,7 +34,8 @@
using namespace NLMISC;
using namespace NL3D;
namespace NLQT {
namespace NLQT
{
CWorkspaceNode::CWorkspaceNode()
{
@ -492,7 +493,7 @@ bool CParticleWorkspace::isContentModified() const
void CParticleWorkspace::restickAllObjects()
{
/* for(uint k = 0; k < _Nodes.size(); ++k)
/* for(uint k = 0; k < _Nodes.size(); ++k)
{
std::string parentSkelName = _Nodes[k]->getParentSkelName();
std::string parentBoneName = _Nodes[k]->getParentBoneName();

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)

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,7 +32,8 @@
#include "modules.h"
#include "sound_system.h"
namespace NLQT {
namespace NLQT
{
CSoundPage::CSoundPage(QWidget *parent)
: QWidget(parent)

View file

@ -35,10 +35,11 @@
namespace NLSOUND
{
class UAudioMixer;
class UAudioMixer;
}
namespace NLQT {
namespace NLQT
{
/**
@class CSoundPage
@ -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,7 +38,8 @@
using namespace NL3D;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
static void chooseGlobalUserParam(uint userParam, NL3D::CParticleSystem *ps, QWidget *parent)
{

View file

@ -33,7 +33,8 @@
// 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
@ -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,7 +31,8 @@
#include "value_gradient_dialog.h"
#include "multi_tex_dialog.h"
namespace NLQT {
namespace NLQT
{
CParticleTextureAnimWidget::CParticleTextureAnimWidget(QWidget *parent)
: QWidget(parent)

View file

@ -34,11 +34,12 @@
namespace NL3D
{
class CPSTexturedParticle;
class CPSMultiTexturedParticle;
class CPSTexturedParticle;
class CPSMultiTexturedParticle;
}
namespace NLQT {
namespace NLQT
{
class CParticleTextureAnimWidget: public QWidget
{
@ -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,7 +30,8 @@
#include "nel/3d/ps_particle_basic.h"
#include "nel/misc/path.h"
namespace NLQT {
namespace NLQT
{
CParticleTextureWidget::CParticleTextureWidget(QWidget *parent)
: QWidget(parent), _Wrapper(NULL)

View file

@ -34,7 +34,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
class CParticleTextureWidget: public QWidget
{
@ -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,7 +28,8 @@
// 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)
@ -262,7 +263,7 @@ QVariant CParticleTreeModel::headerData(int section, Qt::Orientation orientation
}
QModelIndex CParticleTreeModel::index(int row, int column, const QModelIndex &parent)
const
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();

View file

@ -34,7 +34,8 @@
// Projects includes
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
struct ItemType
{

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"),

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,7 +30,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CWorkspacePage::CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent)
: QWidget(parent)

View file

@ -31,7 +31,8 @@
// Project includes
#include "particle_tree_model.h"
namespace NLQT {
namespace NLQT
{
/**
@class CWorkspacePage

View file

@ -28,7 +28,8 @@
#include "particle_force_page.h"
#include "modules.h"
namespace NLQT {
namespace NLQT
{
CZonePage::CZonePage(QWidget *parent)
: QWidget(parent)

View file

@ -31,7 +31,8 @@
// Project includes
#include "particle_node.h"
namespace NLQT {
namespace NLQT
{
class CZonePage: public QWidget
{
@ -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)

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,7 +27,8 @@
// Project includes
#include "modules.h"
namespace NLQT {
namespace NLQT
{
const float epsilon = 10E-3f;
@ -118,7 +119,7 @@ void CPSMoverPage::hideAdditionalWidget()
void CPSMoverPage::updateListener(void)
{
/* if(_ParticleDlg->MainFrame->isMoveElement())
/* if(_ParticleDlg->MainFrame->isMoveElement())
{
const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
NLMISC::CMatrix m;

View file

@ -35,7 +35,8 @@
// Project includes
#include "ps_wrapper.h"
namespace NLQT {
namespace NLQT
{
/**
@class CLocatedBindableItem
@ -47,8 +48,14 @@ public:
CLocatedBindableItem ( const QString & text, QListWidget * parent = 0, int type = UserType ):
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:
@ -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,7 +34,8 @@
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CSettingsDialog::CSettingsDialog(QWidget *parent)
: QDialog(parent)

View file

@ -30,7 +30,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CSettingsDialog

View file

@ -34,7 +34,8 @@
using namespace NL3D;
using namespace NLMISC;
namespace NLQT {
namespace NLQT
{
CSetupFog::CSetupFog(QWidget *parent)
: QDockWidget(parent)

View file

@ -31,7 +31,8 @@
// Project includes
namespace NLQT {
namespace NLQT
{
/**
@class CSetupFog

View file

@ -34,7 +34,8 @@
#include "modules.h"
#include "skeleton_tree_model.h"
namespace NLQT {
namespace NLQT
{
const int ssd_scale_precision = 1000;
@ -207,7 +208,7 @@ void CSkeletonScaleDialog::clickMirrorSelected()
// for each bone selected
bool change= false;
for(uint i=0;i<_Bones.size();i++)
for(uint i=0; i<_Bones.size(); i++)
{
CBoneMirror &bone= _Bones[i];
if(bone.Selected)
@ -432,12 +433,24 @@ void CSkeletonScaleDialog::applyScaleSlider(int scale, int idSelect)
{
switch(idSelect)
{
case SidBoneX: _Bones[i].BoneScale.x = _BkupBones[i].BoneScale.x * factor; break;
case SidBoneY: _Bones[i].BoneScale.y = _BkupBones[i].BoneScale.y * factor; break;
case SidBoneZ: _Bones[i].BoneScale.z = _BkupBones[i].BoneScale.z * factor; break;
case SidSkinX: _Bones[i].SkinScale.x = _BkupBones[i].SkinScale.x * factor; break;
case SidSkinY: _Bones[i].SkinScale.y = _BkupBones[i].SkinScale.y * factor; break;
case SidSkinZ: _Bones[i].SkinScale.z = _BkupBones[i].SkinScale.z * factor; break;
case SidBoneX:
_Bones[i].BoneScale.x = _BkupBones[i].BoneScale.x * factor;
break;
case SidBoneY:
_Bones[i].BoneScale.y = _BkupBones[i].BoneScale.y * factor;
break;
case SidBoneZ:
_Bones[i].BoneScale.z = _BkupBones[i].BoneScale.z * factor;
break;
case SidSkinX:
_Bones[i].SkinScale.x = _BkupBones[i].SkinScale.x * factor;
break;
case SidSkinY:
_Bones[i].SkinScale.y = _BkupBones[i].SkinScale.y * factor;
break;
case SidSkinZ:
_Bones[i].SkinScale.z = _BkupBones[i].SkinScale.z * factor;
break;
};
roundClampScale(_Bones[i].BoneScale);
roundClampScale(_Bones[i].SkinScale);

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