mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-20 06:06:13 +00:00
Changed: #1193 Code cleanup.
This commit is contained in:
parent
50266d831a
commit
dd548ff0a4
141 changed files with 4702 additions and 3665 deletions
|
@ -29,10 +29,11 @@
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CAnimationDialog::CAnimationDialog(QWidget *parent)
|
CAnimationDialog::CAnimationDialog(QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -45,13 +46,13 @@ CAnimationDialog::CAnimationDialog(QWidget *parent)
|
||||||
connect(_ui.horizontalSlider, SIGNAL(sliderMoved(int)), this, SLOT(changeFrame(int)));
|
connect(_ui.horizontalSlider, SIGNAL(sliderMoved(int)), this, SLOT(changeFrame(int)));
|
||||||
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeStartAnim(int)));
|
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeStartAnim(int)));
|
||||||
connect(_ui.endSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeEndAnim(int)));
|
connect(_ui.endSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeEndAnim(int)));
|
||||||
|
|
||||||
// init QTimeLine
|
// init QTimeLine
|
||||||
_timeLine = new QTimeLine(_ui.endSpinBox->value() * _frameRate, this);
|
_timeLine = new QTimeLine(_ui.endSpinBox->value() * _frameRate, this);
|
||||||
_timeLine->setCurveShape(QTimeLine::LinearCurve);
|
_timeLine->setCurveShape(QTimeLine::LinearCurve);
|
||||||
_timeLine->setUpdateInterval(25);
|
_timeLine->setUpdateInterval(25);
|
||||||
_timeLine->setFrameRange(_ui.startSpinBox->value(), _ui.endSpinBox->value());
|
_timeLine->setFrameRange(_ui.startSpinBox->value(), _ui.endSpinBox->value());
|
||||||
|
|
||||||
connect(_timeLine, SIGNAL(frameChanged(int)), this, SLOT(updateAnim(int)));
|
connect(_timeLine, SIGNAL(frameChanged(int)), this, SLOT(updateAnim(int)));
|
||||||
connect(_timeLine, SIGNAL(finished()), this, SLOT(finish()));
|
connect(_timeLine, SIGNAL(finished()), this, SLOT(finish()));
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ CAnimationDialog::CAnimationDialog(QWidget *parent)
|
||||||
CAnimationDialog::~CAnimationDialog()
|
CAnimationDialog::~CAnimationDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NL3D::TAnimationTime CAnimationDialog::getTime ()
|
NL3D::TAnimationTime CAnimationDialog::getTime ()
|
||||||
{
|
{
|
||||||
return float(_timeLine->currentFrame()) / _frameRate;
|
return float(_timeLine->currentFrame()) / _frameRate;
|
||||||
|
@ -74,7 +75,7 @@ NL3D::TAnimationTime CAnimationDialog::getTime ()
|
||||||
void CAnimationDialog::changeAnimLength()
|
void CAnimationDialog::changeAnimLength()
|
||||||
{
|
{
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
float animLength = entity.getPlayListLength();
|
float animLength = entity.getPlayListLength();
|
||||||
|
@ -85,7 +86,7 @@ void CAnimationDialog::changeAnimLength()
|
||||||
|
|
||||||
void CAnimationDialog::setCurrentShape(const QString &name)
|
void CAnimationDialog::setCurrentShape(const QString &name)
|
||||||
{
|
{
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(name.toStdString());
|
CEntity &entity = Modules::objView().getEntity(name.toStdString());
|
||||||
|
|
||||||
|
@ -108,8 +109,8 @@ void CAnimationDialog::play()
|
||||||
}
|
}
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
entity.playbackAnim(true);
|
entity.playbackAnim(true);
|
||||||
|
|
||||||
if (_timeLine->state() == QTimeLine::Running)
|
if (_timeLine->state() == QTimeLine::Running)
|
||||||
_timeLine->setPaused(true);
|
_timeLine->setPaused(true);
|
||||||
else if (_timeLine->currentFrame() == _timeLine->endFrame()) _timeLine->start();
|
else if (_timeLine->currentFrame() == _timeLine->endFrame()) _timeLine->start();
|
||||||
else
|
else
|
||||||
|
@ -123,7 +124,7 @@ void CAnimationDialog::stop()
|
||||||
_ui.playPushButton->setChecked(false);
|
_ui.playPushButton->setChecked(false);
|
||||||
|
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
entity.playbackAnim(false);
|
entity.playbackAnim(false);
|
||||||
|
@ -136,7 +137,7 @@ void CAnimationDialog::end()
|
||||||
|
|
||||||
void CAnimationDialog::changeFrame(int frame)
|
void CAnimationDialog::changeFrame(int frame)
|
||||||
{
|
{
|
||||||
if (_timeLine->state() == QTimeLine::Running)
|
if (_timeLine->state() == QTimeLine::Running)
|
||||||
{
|
{
|
||||||
_timeLine->setPaused(true);
|
_timeLine->setPaused(true);
|
||||||
_timeLine->setCurrentTime((float(frame) / _frameRate) * 1000);
|
_timeLine->setCurrentTime((float(frame) / _frameRate) * 1000);
|
||||||
|
@ -153,7 +154,7 @@ void CAnimationDialog::changeStartAnim(int start)
|
||||||
|
|
||||||
void CAnimationDialog::changeEndAnim(int end)
|
void CAnimationDialog::changeEndAnim(int end)
|
||||||
{
|
{
|
||||||
_ui.horizontalSlider->setMaximum(end);
|
_ui.horizontalSlider->setMaximum(end);
|
||||||
_timeLine->setDuration((float(end - _ui.startSpinBox->value()) / _frameRate) * 1000);
|
_timeLine->setDuration((float(end - _ui.startSpinBox->value()) / _frameRate) * 1000);
|
||||||
_timeLine->setFrameRange(_ui.startSpinBox->value(), end);
|
_timeLine->setFrameRange(_ui.startSpinBox->value(), end);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +167,7 @@ void CAnimationDialog::updateAnim(int frame)
|
||||||
void CAnimationDialog::setInPlace(bool state)
|
void CAnimationDialog::setInPlace(bool state)
|
||||||
{
|
{
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
entity.setInPlace(state);
|
entity.setInPlace(state);
|
||||||
|
@ -175,7 +176,7 @@ void CAnimationDialog::setInPlace(bool state)
|
||||||
void CAnimationDialog::setIncPos(bool state)
|
void CAnimationDialog::setIncPos(bool state)
|
||||||
{
|
{
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
entity.setIncPos(state);
|
entity.setIncPos(state);
|
||||||
|
|
|
@ -33,35 +33,36 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CAnimationDialog
|
@class CAnimationDialog
|
||||||
@brief Animation model control dialog.
|
@brief Animation model control dialog.
|
||||||
@details The dialogue doesn't affect on the model itself, but only calculates the current time of animations
|
@details The dialogue doesn't affect on the model itself, but only calculates the current time of animations
|
||||||
that can be obtained through a class method getTime().
|
that can be obtained through a class method getTime().
|
||||||
The user can influence on the duration of the animation, but he doesn't know the total time for all the animations in the playlist.
|
The user can influence on the duration of the animation, but he doesn't know the total time for all the animations in the playlist.
|
||||||
Therefore, the class provides a slot that requires a total duration of the animated object animations and set it.
|
Therefore, the class provides a slot that requires a total duration of the animated object animations and set it.
|
||||||
*/
|
*/
|
||||||
class CAnimationDialog: public QDockWidget
|
class CAnimationDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructor, sets the default length of time from 0 to 99
|
/// Constructor, sets the default length of time from 0 to 99
|
||||||
CAnimationDialog(QWidget *parent = 0);
|
CAnimationDialog(QWidget *parent = 0);
|
||||||
~CAnimationDialog();
|
~CAnimationDialog();
|
||||||
|
|
||||||
/// Get the current time animations
|
/// Get the current time animations
|
||||||
/// @return Returns the current time animations, which can then be use in class CObjectViewer
|
/// @return Returns the current time animations, which can then be use in class CObjectViewer
|
||||||
NL3D::TAnimationTime getTime ();
|
NL3D::TAnimationTime getTime ();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// Find the total time of the playlist and sets its
|
/// Find the total time of the playlist and sets its
|
||||||
void changeAnimLength();
|
void changeAnimLength();
|
||||||
|
|
||||||
/// Updates animation status for the selected current object
|
/// Updates animation status for the selected current object
|
||||||
/// @param name - the name of the selected object
|
/// @param name - the name of the selected object
|
||||||
void setCurrentShape(const QString &name);
|
void setCurrentShape(const QString &name);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
@ -78,11 +79,11 @@ private Q_SLOTS:
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const int _frameRate = 50;
|
static const int _frameRate = 50;
|
||||||
QTimeLine *_timeLine;
|
QTimeLine *_timeLine;
|
||||||
Ui::CAnimationDialog _ui;
|
Ui::CAnimationDialog _ui;
|
||||||
|
|
||||||
friend class CMainWindow;
|
friend class CMainWindow;
|
||||||
}; /* CAnimationDialog */
|
}; /* CAnimationDialog */
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,11 @@
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CAnimationSetDialog::CAnimationSetDialog(QWidget *parent)
|
CAnimationSetDialog::CAnimationSetDialog(QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ CAnimationSetDialog::CAnimationSetDialog(QWidget *parent)
|
||||||
|
|
||||||
connect(ui.listRadioButton, SIGNAL(clicked(bool)), this, SLOT(setModeAnim()));
|
connect(ui.listRadioButton, SIGNAL(clicked(bool)), this, SLOT(setModeAnim()));
|
||||||
connect(ui.mixerRadioButton, SIGNAL(clicked(bool)), this, SLOT(setModeAnim()));
|
connect(ui.mixerRadioButton, SIGNAL(clicked(bool)), this, SLOT(setModeAnim()));
|
||||||
|
|
||||||
connect(ui.objectsComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setCurrentShape(QString)));
|
connect(ui.objectsComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setCurrentShape(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,22 +57,22 @@ CAnimationSetDialog::~CAnimationSetDialog()
|
||||||
|
|
||||||
void CAnimationSetDialog::setCurrentShape(const QString &name)
|
void CAnimationSetDialog::setCurrentShape(const QString &name)
|
||||||
{
|
{
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Modules::objView().setCurrentObject(name.toStdString());
|
Modules::objView().setCurrentObject(name.toStdString());
|
||||||
|
|
||||||
updateListAnim();
|
updateListAnim();
|
||||||
|
|
||||||
Q_EMIT changeCurrentShape(name);
|
Q_EMIT changeCurrentShape(name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimationSetDialog::setModeAnim()
|
void CAnimationSetDialog::setModeAnim()
|
||||||
{
|
{
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
|
|
||||||
if (ui.mixerRadioButton->isChecked())
|
if (ui.mixerRadioButton->isChecked())
|
||||||
|
@ -89,11 +90,11 @@ void CAnimationSetDialog::updateListObject()
|
||||||
|
|
||||||
for (size_t i = 0; i < listObjects.size(); i++)
|
for (size_t i = 0; i < listObjects.size(); i++)
|
||||||
ui.objectsComboBox->addItem(QString(listObjects[i].c_str()));
|
ui.objectsComboBox->addItem(QString(listObjects[i].c_str()));
|
||||||
|
|
||||||
if (listObjects.empty())
|
if (listObjects.empty())
|
||||||
{
|
{
|
||||||
ui.addAnimPushButton->setEnabled(false);
|
ui.addAnimPushButton->setEnabled(false);
|
||||||
ui.addSwtPushButton->setEnabled(false);
|
ui.addSwtPushButton->setEnabled(false);
|
||||||
ui.resetPushButton->setEnabled(false);
|
ui.resetPushButton->setEnabled(false);
|
||||||
ui.setLengthPushButton->setEnabled(false);
|
ui.setLengthPushButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -111,52 +112,52 @@ void CAnimationSetDialog::updateListAnim()
|
||||||
ui.animTreeWidget->clear();
|
ui.animTreeWidget->clear();
|
||||||
ui.animPlaylistWidget->clear();
|
ui.animPlaylistWidget->clear();
|
||||||
ui.skeletonTreeWidget->clear();
|
ui.skeletonTreeWidget->clear();
|
||||||
|
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
CEntity &entity = Modules::objView().getEntity(curObj);
|
CEntity &entity = Modules::objView().getEntity(curObj);
|
||||||
|
|
||||||
std::vector<std::string>& animationList = entity.getAnimationList();
|
std::vector<std::string>& animationList = entity.getAnimationList();
|
||||||
std::vector<std::string>& swtList = entity.getSWTList();
|
std::vector<std::string>& swtList = entity.getSWTList();
|
||||||
std::vector<std::string>& playListAnimation = entity.getPlayListAnimation();
|
std::vector<std::string>& playListAnimation = entity.getPlayListAnimation();
|
||||||
|
|
||||||
// update animation list widget
|
// update animation list widget
|
||||||
for(size_t i = 0; i < animationList.size(); ++i)
|
for(size_t i = 0; i < animationList.size(); ++i)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui.animTreeWidget);
|
QTreeWidgetItem *item = new QTreeWidgetItem(ui.animTreeWidget);
|
||||||
item->setText(0,QString(animationList[i].c_str()));
|
item->setText(0,QString(animationList[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update skeleton weight template list widget
|
// update skeleton weight template list widget
|
||||||
for(size_t i = 0; i < swtList.size(); ++i)
|
for(size_t i = 0; i < swtList.size(); ++i)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui.skeletonTreeWidget);
|
QTreeWidgetItem *item = new QTreeWidgetItem(ui.skeletonTreeWidget);
|
||||||
item->setText(0,QString(swtList[i].c_str()));
|
item->setText(0,QString(swtList[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// update PlayList animation widget
|
// update PlayList animation widget
|
||||||
for(size_t i = 0; i < playListAnimation.size(); ++i)
|
for(size_t i = 0; i < playListAnimation.size(); ++i)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = new QListWidgetItem(ui.animPlaylistWidget);
|
QListWidgetItem *item = new QListWidgetItem(ui.animPlaylistWidget);
|
||||||
item->setText(QString(playListAnimation[i].c_str()));
|
item->setText(QString(playListAnimation[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animationList.empty())
|
if (animationList.empty())
|
||||||
{
|
{
|
||||||
// lock buttons
|
// lock buttons
|
||||||
ui.addToolButton->setEnabled(false);
|
ui.addToolButton->setEnabled(false);
|
||||||
ui.removeToolButton->setEnabled(false);
|
ui.removeToolButton->setEnabled(false);
|
||||||
ui.upToolButton->setEnabled(false);
|
ui.upToolButton->setEnabled(false);
|
||||||
ui.downToolButton->setEnabled(false);
|
ui.downToolButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// unlock buttons
|
// unlock buttons
|
||||||
ui.addToolButton->setEnabled(true);
|
ui.addToolButton->setEnabled(true);
|
||||||
ui.removeToolButton->setEnabled(true);
|
ui.removeToolButton->setEnabled(true);
|
||||||
ui.upToolButton->setEnabled(true);
|
ui.upToolButton->setEnabled(true);
|
||||||
ui.downToolButton->setEnabled(true);
|
ui.downToolButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,16 +166,16 @@ void CAnimationSetDialog::loadAnim()
|
||||||
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
||||||
|
|
||||||
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
||||||
tr("Open NeL anim file"), ".",
|
tr("Open NeL anim file"), ".",
|
||||||
tr("NeL anim files (*.anim);;"));
|
tr("NeL anim files (*.anim);;"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
if (!fileNames.isEmpty())
|
if (!fileNames.isEmpty())
|
||||||
{
|
{
|
||||||
QStringList list = fileNames;
|
QStringList list = fileNames;
|
||||||
QStringList::Iterator it = list.begin();
|
QStringList::Iterator it = list.begin();
|
||||||
while(it != list.end())
|
while(it != list.end())
|
||||||
{
|
{
|
||||||
std::string animName = it->toStdString();
|
std::string animName = it->toStdString();
|
||||||
entity.loadAnimation(animName);
|
entity.loadAnimation(animName);
|
||||||
|
@ -188,19 +189,19 @@ void CAnimationSetDialog::loadAnim()
|
||||||
|
|
||||||
void CAnimationSetDialog::loadSwt()
|
void CAnimationSetDialog::loadSwt()
|
||||||
{
|
{
|
||||||
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
||||||
|
|
||||||
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
||||||
tr("Open NeL anim file"), ".",
|
tr("Open NeL anim file"), ".",
|
||||||
tr("NeL Skeleton Weight Template files (*.swt);;"));
|
tr("NeL Skeleton Weight Template files (*.swt);;"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
if (!fileNames.isEmpty())
|
if (!fileNames.isEmpty())
|
||||||
{
|
{
|
||||||
QStringList list = fileNames;
|
QStringList list = fileNames;
|
||||||
QStringList::Iterator it = list.begin();
|
QStringList::Iterator it = list.begin();
|
||||||
while(it != list.end())
|
while(it != list.end())
|
||||||
{
|
{
|
||||||
std::string swtName = it->toStdString();
|
std::string swtName = it->toStdString();
|
||||||
entity.loadSWT(swtName);
|
entity.loadSWT(swtName);
|
||||||
|
@ -216,7 +217,7 @@ void CAnimationSetDialog::resetAnim()
|
||||||
{
|
{
|
||||||
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
||||||
entity.reset();
|
entity.reset();
|
||||||
|
|
||||||
updateListAnim();
|
updateListAnim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,8 +243,8 @@ void CAnimationSetDialog::removeAnim()
|
||||||
{
|
{
|
||||||
int row = ui.animPlaylistWidget->row(item);
|
int row = ui.animPlaylistWidget->row(item);
|
||||||
QListWidgetItem *removeItem = ui.animPlaylistWidget->takeItem(row);
|
QListWidgetItem *removeItem = ui.animPlaylistWidget->takeItem(row);
|
||||||
if (!removeItem)
|
if (!removeItem)
|
||||||
delete removeItem;
|
delete removeItem;
|
||||||
entity.removeAnimToPlayList(row);
|
entity.removeAnimToPlayList(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +259,7 @@ void CAnimationSetDialog::upAnim()
|
||||||
|
|
||||||
int frontRow = ui.animPlaylistWidget->row(list.front());
|
int frontRow = ui.animPlaylistWidget->row(list.front());
|
||||||
int backRow = ui.animPlaylistWidget->row(list.back());
|
int backRow = ui.animPlaylistWidget->row(list.back());
|
||||||
|
|
||||||
if (frontRow == 0)
|
if (frontRow == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -270,7 +271,7 @@ void CAnimationSetDialog::upAnim()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimationSetDialog::downAnim()
|
void CAnimationSetDialog::downAnim()
|
||||||
{
|
{
|
||||||
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
CEntity &entity = Modules::objView().getEntity(Modules::objView().getCurrentObject());
|
||||||
QList<QListWidgetItem*> list = ui.animPlaylistWidget->selectedItems();
|
QList<QListWidgetItem*> list = ui.animPlaylistWidget->selectedItems();
|
||||||
|
|
||||||
|
@ -279,7 +280,7 @@ void CAnimationSetDialog::downAnim()
|
||||||
|
|
||||||
int frontRow = ui.animPlaylistWidget->row(list.front());
|
int frontRow = ui.animPlaylistWidget->row(list.front());
|
||||||
int backRow = ui.animPlaylistWidget->row(list.back());
|
int backRow = ui.animPlaylistWidget->row(list.back());
|
||||||
|
|
||||||
if (backRow == (ui.animPlaylistWidget->count() - 1))
|
if (backRow == (ui.animPlaylistWidget->count() - 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -289,5 +290,5 @@ void CAnimationSetDialog::downAnim()
|
||||||
for (int i = backRow; i >= frontRow; --i)
|
for (int i = backRow; i >= frontRow; --i)
|
||||||
entity.swapAnimToPlayList(i, i + 1);
|
entity.swapAnimToPlayList(i, i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -28,40 +28,41 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
/**
|
{
|
||||||
|
/**
|
||||||
@class CAnimationSetDialog
|
@class CAnimationSetDialog
|
||||||
@brief Dialog - Animations control, loading animation, weight for skeleton and playlist composition.
|
@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.
|
@details Dialog loads animations files and weight for skeleton animation. Files can also be unloaded.
|
||||||
For loading / unloading and animation control dialog uses the functionality of CEntity class.
|
For loading / unloading and animation control dialog uses the functionality of CEntity class.
|
||||||
But the main opportunity for dialogue is to generating animations playlists.
|
But the main opportunity for dialogue is to generating animations playlists.
|
||||||
Also, the dialogue has a control element to select the current shape (emit a signal changeCurrentShape())
|
Also, the dialogue has a control element to select the current shape (emit a signal changeCurrentShape())
|
||||||
and switch of playlist/mixer (this functionality will soon be transferred to another specialized dialogue).
|
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,
|
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 ().
|
the dialogue should be notified through the slot setCurrentShape ().
|
||||||
*/
|
*/
|
||||||
class CAnimationSetDialog: public QDockWidget
|
class CAnimationSetDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAnimationSetDialog(QWidget *parent = 0);
|
CAnimationSetDialog(QWidget *parent = 0);
|
||||||
~CAnimationSetDialog();
|
~CAnimationSetDialog();
|
||||||
|
|
||||||
/// Update the objects list (this function should be moved to another dialogue)
|
/// Update the objects list (this function should be moved to another dialogue)
|
||||||
void updateListObject();
|
void updateListObject();
|
||||||
|
|
||||||
/// Update the list of loaded animation files
|
/// Update the list of loaded animation files
|
||||||
void updateListAnim();
|
void updateListAnim();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/// Signal emitted when changing the current animation object.
|
/// Signal emitted when changing the current animation object.
|
||||||
void changeCurrentShape(const QString &name);
|
void changeCurrentShape(const QString &name);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
||||||
/// Updates and displays the list of loaded animations and playlist for the selected current object
|
/// Updates and displays the list of loaded animations and playlist for the selected current object
|
||||||
/// @param name - the name of the selected object
|
/// @param name - the name of the selected object
|
||||||
void setCurrentShape(const QString &name);
|
void setCurrentShape(const QString &name);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
@ -73,11 +74,11 @@ private Q_SLOTS:
|
||||||
void removeAnim();
|
void removeAnim();
|
||||||
void upAnim();
|
void upAnim();
|
||||||
void downAnim();
|
void downAnim();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::CAnimationSetDialog ui;
|
Ui::CAnimationSetDialog ui;
|
||||||
|
|
||||||
friend class CMainWindow;
|
friend class CMainWindow;
|
||||||
}; /* CAnimationDialog */
|
}; /* CAnimationDialog */
|
||||||
|
|
||||||
|
|
|
@ -40,15 +40,16 @@
|
||||||
#include "spinner_dialog.h"
|
#include "spinner_dialog.h"
|
||||||
#include "follow_path_dialog.h"
|
#include "follow_path_dialog.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CAttribWidget::CAttribWidget(QWidget *parent)
|
CAttribWidget::CAttribWidget(QWidget *parent)
|
||||||
: QGroupBox(parent),
|
: QGroupBox(parent),
|
||||||
_SrcInputEnabled(true),
|
_SrcInputEnabled(true),
|
||||||
_EnableConstantValue(true),
|
_EnableConstantValue(true),
|
||||||
_DisableMemoryScheme(false),
|
_DisableMemoryScheme(false),
|
||||||
_NbCycleEnabled(true),
|
_NbCycleEnabled(true),
|
||||||
_Node(NULL), _SchemeWidget(NULL)
|
_Node(NULL), _SchemeWidget(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
_ui.constRangeUIntWidget->hide();
|
_ui.constRangeUIntWidget->hide();
|
||||||
|
@ -87,21 +88,21 @@ void CAttribWidget::updateUi()
|
||||||
{
|
{
|
||||||
if (!_EnableConstantValue)
|
if (!_EnableConstantValue)
|
||||||
_ui.comboBox->hide();
|
_ui.comboBox->hide();
|
||||||
else
|
else
|
||||||
_ui.comboBox->show();
|
_ui.comboBox->show();
|
||||||
|
|
||||||
if (useScheme())
|
if (useScheme())
|
||||||
{
|
{
|
||||||
if (_ui.comboBox->currentIndex() == 1)
|
if (_ui.comboBox->currentIndex() == 1)
|
||||||
schemeValueUpdate();
|
schemeValueUpdate();
|
||||||
else
|
else
|
||||||
_ui.comboBox->setCurrentIndex(1);
|
_ui.comboBox->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
nlassert(_EnableConstantValue);
|
nlassert(_EnableConstantValue);
|
||||||
if (_ui.comboBox->currentIndex() == 0)
|
if (_ui.comboBox->currentIndex() == 0)
|
||||||
cstValueUpdate();
|
cstValueUpdate();
|
||||||
else
|
else
|
||||||
_ui.comboBox->setCurrentIndex(0);
|
_ui.comboBox->setCurrentIndex(0);
|
||||||
|
@ -122,14 +123,14 @@ void CAttribWidget::clickedEdit()
|
||||||
|
|
||||||
void CAttribWidget::setClamp(bool state)
|
void CAttribWidget::setClamp(bool state)
|
||||||
{
|
{
|
||||||
// avoid performance warning
|
// avoid performance warning
|
||||||
if (state != isSchemeClamped())
|
if (state != isSchemeClamped())
|
||||||
clampScheme(state);
|
clampScheme(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribWidget::changeCurrentScheme(int index)
|
void CAttribWidget::changeCurrentScheme(int index)
|
||||||
{
|
{
|
||||||
if (getCurrentScheme() != index)
|
if (getCurrentScheme() != index)
|
||||||
setCurrentScheme(uint(index));
|
setCurrentScheme(uint(index));
|
||||||
schemeValueUpdate();
|
schemeValueUpdate();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +138,7 @@ void CAttribWidget::changeCurrentScheme(int index)
|
||||||
void CAttribWidget::setCurrentSrc(int index)
|
void CAttribWidget::setCurrentSrc(int index)
|
||||||
{
|
{
|
||||||
NL3D::CPSInputType it;
|
NL3D::CPSInputType it;
|
||||||
it.InputType = (NL3D::CPSInputType::TInputType) index;
|
it.InputType = (NL3D::CPSInputType::TInputType) index;
|
||||||
if (it.InputType != getSchemeInput().InputType)
|
if (it.InputType != getSchemeInput().InputType)
|
||||||
{
|
{
|
||||||
if (it.InputType == NL3D::CPSInputType::attrUserParam)
|
if (it.InputType == NL3D::CPSInputType::attrUserParam)
|
||||||
|
@ -154,7 +155,7 @@ void CAttribWidget::setUserIndex()
|
||||||
bool ok;
|
bool ok;
|
||||||
int i = QInputDialog::getInt(this, tr("Set user param"), tr(""), getSchemeInput().UserParamNum + 1, 1, 4, 1, &ok);
|
int i = QInputDialog::getInt(this, tr("Set user param"), tr(""), getSchemeInput().UserParamNum + 1, 1, 4, 1, &ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
NL3D::CPSInputType it = getSchemeInput();
|
NL3D::CPSInputType it = getSchemeInput();
|
||||||
it.UserParamNum = i - 1;
|
it.UserParamNum = i - 1;
|
||||||
setSchemeInput(it);
|
setSchemeInput(it);
|
||||||
|
@ -172,7 +173,7 @@ void CAttribWidget::changeUseScheme(int index)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (useScheme())
|
if (useScheme())
|
||||||
changeCurrentScheme(getCurrentScheme()); // update ui
|
changeCurrentScheme(getCurrentScheme()); // update ui
|
||||||
else
|
else
|
||||||
changeCurrentScheme(0); // change scheme
|
changeCurrentScheme(0); // change scheme
|
||||||
|
@ -210,7 +211,7 @@ void CAttribWidget::schemeValueUpdate()
|
||||||
if (k == -1) // unknow scheme ...
|
if (k == -1) // unknow scheme ...
|
||||||
{
|
{
|
||||||
_ui.schemeComboBox->setCurrentIndex(k);
|
_ui.schemeComboBox->setCurrentIndex(k);
|
||||||
k = 0;
|
k = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k != _ui.schemeComboBox->currentIndex())
|
if (k != _ui.schemeComboBox->currentIndex())
|
||||||
|
@ -231,7 +232,7 @@ void CAttribWidget::schemeValueUpdate()
|
||||||
_ui.srcLabel->setEnabled(false);
|
_ui.srcLabel->setEnabled(false);
|
||||||
_ui.srcComboBox->setEnabled(false);
|
_ui.srcComboBox->setEnabled(false);
|
||||||
inputValueUpdate();
|
inputValueUpdate();
|
||||||
|
|
||||||
_ui.clampCheckBox->setEnabled(false);
|
_ui.clampCheckBox->setEnabled(false);
|
||||||
_ui.inMultiplierWidget->setEnabled(false);
|
_ui.inMultiplierWidget->setEnabled(false);
|
||||||
_ui.inputLabel->setEnabled(false);
|
_ui.inputLabel->setEnabled(false);
|
||||||
|
@ -251,7 +252,7 @@ void CAttribWidget::schemeValueUpdate()
|
||||||
_ui.inMultiplierWidget->hide();
|
_ui.inMultiplierWidget->hide();
|
||||||
_ui.clampCheckBox->hide();
|
_ui.clampCheckBox->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isClampingSupported())
|
if (isClampingSupported())
|
||||||
_ui.clampCheckBox->setChecked(isSchemeClamped());
|
_ui.clampCheckBox->setChecked(isSchemeClamped());
|
||||||
}
|
}
|
||||||
|
@ -267,7 +268,7 @@ void CAttribWidget::enableMemoryScheme(bool enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
CAttribFloatWidget::CAttribFloatWidget(QWidget *parent)
|
CAttribFloatWidget::CAttribFloatWidget(QWidget *parent)
|
||||||
: CAttribWidgetT<float>(parent)
|
: CAttribWidgetT<float>(parent)
|
||||||
{
|
{
|
||||||
_ui.schemeComboBox->addItem(tr("value blender"));
|
_ui.schemeComboBox->addItem(tr("value blender"));
|
||||||
_ui.schemeComboBox->addItem(tr("values gradient"));
|
_ui.schemeComboBox->addItem(tr("values gradient"));
|
||||||
|
@ -280,16 +281,16 @@ CAttribFloatWidget::~CAttribFloatWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribFloatWidget::setRange(float minValue, float maxValue)
|
void CAttribFloatWidget::setRange(float minValue, float maxValue)
|
||||||
{
|
{
|
||||||
_MinRange = minValue;
|
_MinRange = minValue;
|
||||||
_MaxRange = maxValue;
|
_MaxRange = maxValue;
|
||||||
_ui.constRangeFloatWidget->setRange(_MinRange, _MaxRange);
|
_ui.constRangeFloatWidget->setRange(_MinRange, _MaxRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribFloatWidget::setWrapper(IPSWrapper<float> *wrapper)
|
void CAttribFloatWidget::setWrapper(IPSWrapper<float> *wrapper)
|
||||||
{
|
{
|
||||||
nlassert(wrapper);
|
nlassert(wrapper);
|
||||||
_Wrapper = wrapper;
|
_Wrapper = wrapper;
|
||||||
_ui.constRangeFloatWidget->setWrapper(_Wrapper);
|
_ui.constRangeFloatWidget->setWrapper(_Wrapper);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +299,7 @@ QDialog *CAttribFloatWidget::editScheme(void)
|
||||||
{
|
{
|
||||||
NL3D::CPSAttribMaker<float> *scheme = _SchemeWrapper->getScheme();
|
NL3D::CPSAttribMaker<float> *scheme = _SchemeWrapper->getScheme();
|
||||||
|
|
||||||
if (dynamic_cast<NL3D::CPSFloatBlender *>(scheme))
|
if (dynamic_cast<NL3D::CPSFloatBlender *>(scheme))
|
||||||
{
|
{
|
||||||
CFloatBlenderDialogClient *myInterface = new CFloatBlenderDialogClient();
|
CFloatBlenderDialogClient *myInterface = new CFloatBlenderDialogClient();
|
||||||
myInterface->MinRange = _MinRange;
|
myInterface->MinRange = _MinRange;
|
||||||
|
@ -307,7 +308,7 @@ QDialog *CAttribFloatWidget::editScheme(void)
|
||||||
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
||||||
return vb;
|
return vb;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSFloatGradient *>(scheme))
|
if (dynamic_cast<NL3D::CPSFloatGradient *>(scheme))
|
||||||
{
|
{
|
||||||
CFloatGradientWrapper *wrapper = new CFloatGradientWrapper;
|
CFloatGradientWrapper *wrapper = new CFloatGradientWrapper;
|
||||||
wrapper->MinRange = _MinRange;
|
wrapper->MinRange = _MinRange;
|
||||||
|
@ -317,19 +318,19 @@ QDialog *CAttribFloatWidget::editScheme(void)
|
||||||
wrapper->DefaultValue = 0.f;
|
wrapper->DefaultValue = 0.f;
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSFloatMemory *>(scheme))
|
if (dynamic_cast<NL3D::CPSFloatMemory *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribFloatWidget *adf = new CAttribFloatWidget();
|
CAttribFloatWidget *adf = new CAttribFloatWidget();
|
||||||
adf->setRange(_MinRange, _MaxRange);
|
adf->setRange(_MinRange, _MaxRange);
|
||||||
CValueFromEmitterDialogT<float> *vfe = new CValueFromEmitterDialogT<float>( (NL3D::CPSFloatMemory *)(scheme),
|
CValueFromEmitterDialogT<float> *vfe = new CValueFromEmitterDialogT<float>( (NL3D::CPSFloatMemory *)(scheme),
|
||||||
adf,
|
adf,
|
||||||
this);
|
this);
|
||||||
vfe->init();
|
vfe->init();
|
||||||
adf->setWorkspaceNode(_Node);
|
adf->setWorkspaceNode(_Node);
|
||||||
adf->updateUi();
|
adf->updateUi();
|
||||||
return vfe;
|
return vfe;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSFloatBinOp *>(scheme))
|
if (dynamic_cast<NL3D::CPSFloatBinOp *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribFloatWidget *ad[2] = { NULL, NULL};
|
CAttribFloatWidget *ad[2] = { NULL, NULL};
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
|
@ -338,8 +339,8 @@ QDialog *CAttribFloatWidget::editScheme(void)
|
||||||
ad[k]->setRange(_MinRange, _MaxRange);
|
ad[k]->setRange(_MinRange, _MaxRange);
|
||||||
}
|
}
|
||||||
CBinOpDialogT<float> *bod = new CBinOpDialogT<float>( (NL3D::CPSFloatBinOp *)(scheme),
|
CBinOpDialogT<float> *bod = new CBinOpDialogT<float>( (NL3D::CPSFloatBinOp *)(scheme),
|
||||||
(CAttribWidgetT<float> **) ad,
|
(CAttribWidgetT<float> **) ad,
|
||||||
this);
|
this);
|
||||||
bod->init();
|
bod->init();
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
{
|
{
|
||||||
|
@ -348,7 +349,7 @@ QDialog *CAttribFloatWidget::editScheme(void)
|
||||||
}
|
}
|
||||||
return bod;
|
return bod;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSFloatCurve *>(scheme))
|
if (dynamic_cast<NL3D::CPSFloatCurve *>(scheme))
|
||||||
{
|
{
|
||||||
CurveEditDialog *curve = new CurveEditDialog(&(dynamic_cast<NL3D::CPSFloatCurve *>(scheme)->_F), _Node, this);
|
CurveEditDialog *curve = new CurveEditDialog(&(dynamic_cast<NL3D::CPSFloatCurve *>(scheme)->_F), _Node, this);
|
||||||
return curve;
|
return curve;
|
||||||
|
@ -363,35 +364,35 @@ void CAttribFloatWidget::setCurrentScheme(uint index)
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
scheme = new NL3D::CPSFloatBlender(_MinRange, _MaxRange);
|
scheme = new NL3D::CPSFloatBlender(_MinRange, _MaxRange);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
static const float values[2] = { 0.1f, 1.f };
|
static const float values[2] = { 0.1f, 1.f };
|
||||||
scheme = new NL3D::CPSFloatGradient(values, 2, 16, 1.f);
|
scheme = new NL3D::CPSFloatGradient(values, 2, 16, 1.f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
NL3D::CPSFloatCurve *curve = new NL3D::CPSFloatCurve;
|
NL3D::CPSFloatCurve *curve = new NL3D::CPSFloatCurve;
|
||||||
curve->_F.setNumSamples(128);
|
curve->_F.setNumSamples(128);
|
||||||
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(0, 0.5f));
|
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(0, 0.5f));
|
||||||
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
|
curve->_F.addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
|
||||||
scheme = curve;
|
scheme = curve;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
scheme = new NL3D::CPSFloatMemory;
|
scheme = new NL3D::CPSFloatMemory;
|
||||||
((NL3D::CPSAttribMakerMemory<float> *) scheme)->setScheme(new NL3D::CPSFloatBlender(_MinRange, _MaxRange));
|
((NL3D::CPSAttribMakerMemory<float> *) scheme)->setScheme(new NL3D::CPSFloatBlender(_MinRange, _MaxRange));
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
scheme = new NL3D::CPSFloatBinOp;
|
scheme = new NL3D::CPSFloatBinOp;
|
||||||
((NL3D::CPSFloatBinOp *) scheme)->setArg(0, new NL3D::CPSFloatBlender);
|
((NL3D::CPSFloatBinOp *) scheme)->setArg(0, new NL3D::CPSFloatBlender);
|
||||||
((NL3D::CPSFloatBinOp *) scheme)->setArg(1, new NL3D::CPSFloatBlender);
|
((NL3D::CPSFloatBinOp *) scheme)->setArg(1, new NL3D::CPSFloatBlender);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheme)
|
if (scheme)
|
||||||
|
@ -404,15 +405,15 @@ sint CAttribFloatWidget::getCurrentScheme(void) const
|
||||||
{
|
{
|
||||||
const NL3D::CPSAttribMaker<float> *scheme = _SchemeWrapper->getScheme();
|
const NL3D::CPSAttribMaker<float> *scheme = _SchemeWrapper->getScheme();
|
||||||
|
|
||||||
if (dynamic_cast<const NL3D::CPSFloatBlender *>(scheme))
|
if (dynamic_cast<const NL3D::CPSFloatBlender *>(scheme))
|
||||||
return 0;
|
return 0;
|
||||||
if (dynamic_cast<const NL3D::CPSFloatGradient *>(scheme))
|
if (dynamic_cast<const NL3D::CPSFloatGradient *>(scheme))
|
||||||
return 1;
|
return 1;
|
||||||
if (dynamic_cast<const NL3D::CPSFloatCurve *>(scheme))
|
if (dynamic_cast<const NL3D::CPSFloatCurve *>(scheme))
|
||||||
return 2;
|
return 2;
|
||||||
if (dynamic_cast<const NL3D::CPSFloatMemory *>(scheme))
|
if (dynamic_cast<const NL3D::CPSFloatMemory *>(scheme))
|
||||||
return 3;
|
return 3;
|
||||||
if (dynamic_cast<const NL3D::CPSFloatBinOp *>(scheme))
|
if (dynamic_cast<const NL3D::CPSFloatBinOp *>(scheme))
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -429,7 +430,7 @@ void CAttribFloatWidget::cstValueUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
CAttribUIntWidget::CAttribUIntWidget(QWidget *parent)
|
CAttribUIntWidget::CAttribUIntWidget(QWidget *parent)
|
||||||
: CAttribWidgetT<uint32>(parent)
|
: CAttribWidgetT<uint32>(parent)
|
||||||
{
|
{
|
||||||
_ui.schemeComboBox->addItem(tr("value blender"));
|
_ui.schemeComboBox->addItem(tr("value blender"));
|
||||||
_ui.schemeComboBox->addItem(tr("values gradient"));
|
_ui.schemeComboBox->addItem(tr("values gradient"));
|
||||||
|
@ -441,25 +442,25 @@ CAttribUIntWidget::~CAttribUIntWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribUIntWidget::setRange(uint32 minValue, uint32 maxValue)
|
void CAttribUIntWidget::setRange(uint32 minValue, uint32 maxValue)
|
||||||
{
|
{
|
||||||
_MinRange = minValue;
|
_MinRange = minValue;
|
||||||
_MaxRange = maxValue;
|
_MaxRange = maxValue;
|
||||||
_ui.constRangeUIntWidget->setRange(_MinRange, _MaxRange);
|
_ui.constRangeUIntWidget->setRange(_MinRange, _MaxRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribUIntWidget::setWrapper(IPSWrapper<uint32> *wrapper)
|
void CAttribUIntWidget::setWrapper(IPSWrapper<uint32> *wrapper)
|
||||||
{
|
{
|
||||||
nlassert(wrapper);
|
nlassert(wrapper);
|
||||||
_Wrapper = wrapper;
|
_Wrapper = wrapper;
|
||||||
_ui.constRangeUIntWidget->setWrapper(_Wrapper);
|
_ui.constRangeUIntWidget->setWrapper(_Wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog *CAttribUIntWidget::editScheme(void)
|
QDialog *CAttribUIntWidget::editScheme(void)
|
||||||
{
|
{
|
||||||
const NL3D::CPSAttribMaker<uint32> *scheme = _SchemeWrapper->getScheme();
|
const NL3D::CPSAttribMaker<uint32> *scheme = _SchemeWrapper->getScheme();
|
||||||
|
|
||||||
if (dynamic_cast<const NL3D::CPSUIntBlender *>(scheme))
|
if (dynamic_cast<const NL3D::CPSUIntBlender *>(scheme))
|
||||||
{
|
{
|
||||||
CUIntBlenderDialogClient *myInterface = new CUIntBlenderDialogClient();
|
CUIntBlenderDialogClient *myInterface = new CUIntBlenderDialogClient();
|
||||||
myInterface->MinRange = _MinRange;
|
myInterface->MinRange = _MinRange;
|
||||||
|
@ -468,7 +469,7 @@ QDialog *CAttribUIntWidget::editScheme(void)
|
||||||
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
||||||
return vb;
|
return vb;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSUIntGradient *>(scheme))
|
if (dynamic_cast<const NL3D::CPSUIntGradient *>(scheme))
|
||||||
{
|
{
|
||||||
CUIntGradientWrapper *wrapper = new CUIntGradientWrapper;
|
CUIntGradientWrapper *wrapper = new CUIntGradientWrapper;
|
||||||
wrapper->MinRange = _MinRange;
|
wrapper->MinRange = _MinRange;
|
||||||
|
@ -479,19 +480,19 @@ QDialog *CAttribUIntWidget::editScheme(void)
|
||||||
return gd;
|
return gd;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSUIntMemory *>(scheme))
|
if (dynamic_cast<const NL3D::CPSUIntMemory *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribUIntWidget *adu = new CAttribUIntWidget();
|
CAttribUIntWidget *adu = new CAttribUIntWidget();
|
||||||
adu->setRange(_MinRange, _MaxRange);
|
adu->setRange(_MinRange, _MaxRange);
|
||||||
CValueFromEmitterDialogT<uint32> *vfe = new CValueFromEmitterDialogT<uint32>( (NL3D::CPSUIntMemory *)(scheme),
|
CValueFromEmitterDialogT<uint32> *vfe = new CValueFromEmitterDialogT<uint32>( (NL3D::CPSUIntMemory *)(scheme),
|
||||||
adu,
|
adu,
|
||||||
this);
|
this);
|
||||||
vfe->init();
|
vfe->init();
|
||||||
adu->setWorkspaceNode(_Node);
|
adu->setWorkspaceNode(_Node);
|
||||||
adu->updateUi();
|
adu->updateUi();
|
||||||
return vfe;
|
return vfe;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSUIntBinOp *>(scheme))
|
if (dynamic_cast<const NL3D::CPSUIntBinOp *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribUIntWidget *ad[2] = { NULL, NULL};
|
CAttribUIntWidget *ad[2] = { NULL, NULL};
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
|
@ -500,8 +501,8 @@ QDialog *CAttribUIntWidget::editScheme(void)
|
||||||
ad[k]->setRange(_MinRange, _MaxRange);
|
ad[k]->setRange(_MinRange, _MaxRange);
|
||||||
}
|
}
|
||||||
CBinOpDialogT<uint32> *bod = new CBinOpDialogT<uint32>( (NL3D::CPSUIntBinOp *)(scheme),
|
CBinOpDialogT<uint32> *bod = new CBinOpDialogT<uint32>( (NL3D::CPSUIntBinOp *)(scheme),
|
||||||
(CAttribWidgetT<uint32> **) ad,
|
(CAttribWidgetT<uint32> **) ad,
|
||||||
this);
|
this);
|
||||||
bod->init();
|
bod->init();
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
{
|
{
|
||||||
|
@ -520,23 +521,23 @@ void CAttribUIntWidget::setCurrentScheme(uint index)
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
scheme = new NL3D::CPSUIntBlender(_MinRange, _MaxRange);
|
scheme = new NL3D::CPSUIntBlender(_MinRange, _MaxRange);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
scheme = new NL3D::CPSUIntGradient;
|
scheme = new NL3D::CPSUIntGradient;
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
scheme = new NL3D::CPSUIntMemory;
|
scheme = new NL3D::CPSUIntMemory;
|
||||||
((NL3D::CPSAttribMakerMemory<uint32> *) scheme)->setScheme(new NL3D::CPSUIntBlender(_MinRange, _MaxRange) );
|
((NL3D::CPSAttribMakerMemory<uint32> *) scheme)->setScheme(new NL3D::CPSUIntBlender(_MinRange, _MaxRange) );
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
scheme = new NL3D::CPSUIntBinOp;
|
scheme = new NL3D::CPSUIntBinOp;
|
||||||
((NL3D::CPSUIntBinOp *) scheme)->setArg(0, new NL3D::CPSUIntBlender);
|
((NL3D::CPSUIntBinOp *) scheme)->setArg(0, new NL3D::CPSUIntBlender);
|
||||||
((NL3D::CPSUIntBinOp *) scheme)->setArg(1, new NL3D::CPSUIntBlender);
|
((NL3D::CPSUIntBinOp *) scheme)->setArg(1, new NL3D::CPSUIntBlender);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (scheme)
|
if (scheme)
|
||||||
{
|
{
|
||||||
|
@ -566,7 +567,7 @@ void CAttribUIntWidget::cstValueUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
CAttribIntWidget::CAttribIntWidget(QWidget *parent)
|
CAttribIntWidget::CAttribIntWidget(QWidget *parent)
|
||||||
: CAttribWidgetT<sint32>(parent)
|
: CAttribWidgetT<sint32>(parent)
|
||||||
{
|
{
|
||||||
_ui.schemeComboBox->addItem(tr("value exact blender"));
|
_ui.schemeComboBox->addItem(tr("value exact blender"));
|
||||||
_ui.schemeComboBox->addItem(tr("values gradient"));
|
_ui.schemeComboBox->addItem(tr("values gradient"));
|
||||||
|
@ -578,16 +579,16 @@ CAttribIntWidget::~CAttribIntWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribIntWidget::setRange(sint32 minValue, sint32 maxValue)
|
void CAttribIntWidget::setRange(sint32 minValue, sint32 maxValue)
|
||||||
{
|
{
|
||||||
_MinRange = minValue;
|
_MinRange = minValue;
|
||||||
_MaxRange = maxValue;
|
_MaxRange = maxValue;
|
||||||
_ui.constRangeIntWidget->setRange(_MinRange, _MaxRange);
|
_ui.constRangeIntWidget->setRange(_MinRange, _MaxRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribIntWidget::setWrapper(IPSWrapper<sint32> *wrapper)
|
void CAttribIntWidget::setWrapper(IPSWrapper<sint32> *wrapper)
|
||||||
{
|
{
|
||||||
nlassert(wrapper);
|
nlassert(wrapper);
|
||||||
_Wrapper = wrapper;
|
_Wrapper = wrapper;
|
||||||
_ui.constRangeIntWidget->setWrapper(_Wrapper);
|
_ui.constRangeIntWidget->setWrapper(_Wrapper);
|
||||||
}
|
}
|
||||||
|
@ -596,8 +597,8 @@ QDialog *CAttribIntWidget::editScheme(void)
|
||||||
{
|
{
|
||||||
const NL3D::CPSAttribMaker<sint32> *scheme = _SchemeWrapper->getScheme();
|
const NL3D::CPSAttribMaker<sint32> *scheme = _SchemeWrapper->getScheme();
|
||||||
|
|
||||||
if (dynamic_cast<const NL3D::CPSIntBlender *>(scheme))
|
if (dynamic_cast<const NL3D::CPSIntBlender *>(scheme))
|
||||||
{
|
{
|
||||||
CIntBlenderDialogClient *myInterface = new CIntBlenderDialogClient();
|
CIntBlenderDialogClient *myInterface = new CIntBlenderDialogClient();
|
||||||
myInterface->MinRange = _MinRange;
|
myInterface->MinRange = _MinRange;
|
||||||
myInterface->MaxRange = _MaxRange;
|
myInterface->MaxRange = _MaxRange;
|
||||||
|
@ -605,7 +606,7 @@ QDialog *CAttribIntWidget::editScheme(void)
|
||||||
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
||||||
return vb;
|
return vb;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSIntGradient *>(scheme))
|
if (dynamic_cast<const NL3D::CPSIntGradient *>(scheme))
|
||||||
{
|
{
|
||||||
CIntGradientWrapper *wrapper = new CIntGradientWrapper;
|
CIntGradientWrapper *wrapper = new CIntGradientWrapper;
|
||||||
wrapper->MinRange = _MinRange;
|
wrapper->MinRange = _MinRange;
|
||||||
|
@ -615,18 +616,18 @@ QDialog *CAttribIntWidget::editScheme(void)
|
||||||
wrapper->DefaultValue = 0;
|
wrapper->DefaultValue = 0;
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSIntMemory *>(scheme))
|
if (dynamic_cast<const NL3D::CPSIntMemory *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribIntWidget *adi = new CAttribIntWidget();
|
CAttribIntWidget *adi = new CAttribIntWidget();
|
||||||
adi->setRange(_MinRange, _MaxRange);
|
adi->setRange(_MinRange, _MaxRange);
|
||||||
CValueFromEmitterDialogT<sint32> *vfe = new CValueFromEmitterDialogT<sint32>((NL3D::CPSIntMemory *) _SchemeWrapper->getScheme(),
|
CValueFromEmitterDialogT<sint32> *vfe = new CValueFromEmitterDialogT<sint32>((NL3D::CPSIntMemory *) _SchemeWrapper->getScheme(),
|
||||||
adi, this);
|
adi, this);
|
||||||
vfe->init();
|
vfe->init();
|
||||||
adi->setWorkspaceNode(_Node);
|
adi->setWorkspaceNode(_Node);
|
||||||
adi->updateUi();
|
adi->updateUi();
|
||||||
return vfe;
|
return vfe;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSIntBinOp *>(scheme))
|
if (dynamic_cast<const NL3D::CPSIntBinOp *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribIntWidget *ad[2] = { NULL, NULL};
|
CAttribIntWidget *ad[2] = { NULL, NULL};
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
|
@ -635,8 +636,8 @@ QDialog *CAttribIntWidget::editScheme(void)
|
||||||
ad[k]->setRange(_MinRange, _MaxRange);
|
ad[k]->setRange(_MinRange, _MaxRange);
|
||||||
}
|
}
|
||||||
CBinOpDialogT<sint32> *bod = new CBinOpDialogT<sint32>( (NL3D::CPSIntBinOp *)(scheme),
|
CBinOpDialogT<sint32> *bod = new CBinOpDialogT<sint32>( (NL3D::CPSIntBinOp *)(scheme),
|
||||||
(CAttribWidgetT<sint32> **) ad,
|
(CAttribWidgetT<sint32> **) ad,
|
||||||
this);
|
this);
|
||||||
bod->init();
|
bod->init();
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
{
|
{
|
||||||
|
@ -655,23 +656,23 @@ void CAttribIntWidget::setCurrentScheme(uint index)
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
scheme = new NL3D::CPSIntBlender;
|
scheme = new NL3D::CPSIntBlender;
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
scheme = new NL3D::CPSIntGradient;
|
scheme = new NL3D::CPSIntGradient;
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
scheme = new NL3D::CPSIntMemory;
|
scheme = new NL3D::CPSIntMemory;
|
||||||
((NL3D::CPSAttribMakerMemory<sint32> *) scheme)->setScheme(new NL3D::CPSIntBlender(_MinRange, _MaxRange));
|
((NL3D::CPSAttribMakerMemory<sint32> *) scheme)->setScheme(new NL3D::CPSIntBlender(_MinRange, _MaxRange));
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
scheme = new NL3D::CPSIntBinOp;
|
scheme = new NL3D::CPSIntBinOp;
|
||||||
((NL3D::CPSIntBinOp *) scheme)->setArg(0, new NL3D::CPSIntBlender);
|
((NL3D::CPSIntBinOp *) scheme)->setArg(0, new NL3D::CPSIntBlender);
|
||||||
((NL3D::CPSIntBinOp *) scheme)->setArg(1, new NL3D::CPSIntBlender);
|
((NL3D::CPSIntBinOp *) scheme)->setArg(1, new NL3D::CPSIntBlender);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (scheme)
|
if (scheme)
|
||||||
{
|
{
|
||||||
|
@ -701,7 +702,7 @@ void CAttribIntWidget::cstValueUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
CAttribRGBAWidget::CAttribRGBAWidget(QWidget *parent)
|
CAttribRGBAWidget::CAttribRGBAWidget(QWidget *parent)
|
||||||
: CAttribWidgetT<NLMISC::CRGBA>(parent)
|
: CAttribWidgetT<NLMISC::CRGBA>(parent)
|
||||||
{
|
{
|
||||||
_ui.schemeComboBox->addItem(tr("color sampled blender"));
|
_ui.schemeComboBox->addItem(tr("color sampled blender"));
|
||||||
_ui.schemeComboBox->addItem(tr("color gradient"));
|
_ui.schemeComboBox->addItem(tr("color gradient"));
|
||||||
|
@ -715,24 +716,24 @@ CAttribRGBAWidget::~CAttribRGBAWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribRGBAWidget::setWrapper(IPSWrapper<NLMISC::CRGBA> *wrapper)
|
void CAttribRGBAWidget::setWrapper(IPSWrapper<NLMISC::CRGBA> *wrapper)
|
||||||
{
|
{
|
||||||
nlassert(wrapper);
|
nlassert(wrapper);
|
||||||
_Wrapper = wrapper;
|
_Wrapper = wrapper;
|
||||||
_ui.constRGBAWidget->setWrapper(_Wrapper);
|
_ui.constRGBAWidget->setWrapper(_Wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDialog *CAttribRGBAWidget::editScheme(void)
|
QDialog *CAttribRGBAWidget::editScheme(void)
|
||||||
{
|
{
|
||||||
const NL3D::CPSAttribMaker<NLMISC::CRGBA> *scheme = _SchemeWrapper->getScheme();
|
const NL3D::CPSAttribMaker<NLMISC::CRGBA> *scheme = _SchemeWrapper->getScheme();
|
||||||
|
|
||||||
if (dynamic_cast<const NL3D::CPSColorBlender *>(scheme))
|
if (dynamic_cast<const NL3D::CPSColorBlender *>(scheme))
|
||||||
{
|
{
|
||||||
CRGBABlenderDialogClient *myInterface = new CRGBABlenderDialogClient();
|
CRGBABlenderDialogClient *myInterface = new CRGBABlenderDialogClient();
|
||||||
myInterface->SchemeFunc = & ((NL3D::CPSValueBlenderSample<NLMISC::CRGBA, 64> *) scheme)->_F;
|
myInterface->SchemeFunc = & ((NL3D::CPSValueBlenderSample<NLMISC::CRGBA, 64> *) scheme)->_F;
|
||||||
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
CValueBlenderDialog *vb = new CValueBlenderDialog(myInterface, _Node, true, this);
|
||||||
return vb;
|
return vb;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSColorGradient *>(scheme))
|
if (dynamic_cast<const NL3D::CPSColorGradient *>(scheme))
|
||||||
{
|
{
|
||||||
CColorGradientWrapper *wrapper = new CColorGradientWrapper;
|
CColorGradientWrapper *wrapper = new CColorGradientWrapper;
|
||||||
wrapper->Scheme = &(((NL3D::CPSColorGradient *) (_SchemeWrapper->getScheme()) )->_F);
|
wrapper->Scheme = &(((NL3D::CPSColorGradient *) (_SchemeWrapper->getScheme()) )->_F);
|
||||||
|
@ -740,22 +741,22 @@ QDialog *CAttribRGBAWidget::editScheme(void)
|
||||||
wrapper->DefaultValue = NLMISC::CRGBA::White;
|
wrapper->DefaultValue = NLMISC::CRGBA::White;
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSColorBlenderExact *>(scheme))
|
if (dynamic_cast<const NL3D::CPSColorBlenderExact *>(scheme))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSColorMemory *>(scheme))
|
if (dynamic_cast<const NL3D::CPSColorMemory *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribRGBAWidget *ad = new CAttribRGBAWidget();
|
CAttribRGBAWidget *ad = new CAttribRGBAWidget();
|
||||||
CValueFromEmitterDialogT<NLMISC::CRGBA> *vfe = new CValueFromEmitterDialogT<NLMISC::CRGBA>( (NL3D::CPSColorMemory *)(scheme),
|
CValueFromEmitterDialogT<NLMISC::CRGBA> *vfe = new CValueFromEmitterDialogT<NLMISC::CRGBA>( (NL3D::CPSColorMemory *)(scheme),
|
||||||
ad,
|
ad,
|
||||||
this);
|
this);
|
||||||
vfe->init();
|
vfe->init();
|
||||||
ad->setWorkspaceNode(_Node);
|
ad->setWorkspaceNode(_Node);
|
||||||
ad->updateUi();
|
ad->updateUi();
|
||||||
return vfe;
|
return vfe;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<const NL3D::CPSColorBinOp *>(scheme))
|
if (dynamic_cast<const NL3D::CPSColorBinOp *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribRGBAWidget *ad[2] = { NULL, NULL};
|
CAttribRGBAWidget *ad[2] = { NULL, NULL};
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
|
@ -763,8 +764,8 @@ QDialog *CAttribRGBAWidget::editScheme(void)
|
||||||
ad[k] = new CAttribRGBAWidget();
|
ad[k] = new CAttribRGBAWidget();
|
||||||
}
|
}
|
||||||
CBinOpDialogT<NLMISC::CRGBA> *bod = new CBinOpDialogT<NLMISC::CRGBA>( (NL3D::CPSColorBinOp *)(scheme),
|
CBinOpDialogT<NLMISC::CRGBA> *bod = new CBinOpDialogT<NLMISC::CRGBA>( (NL3D::CPSColorBinOp *)(scheme),
|
||||||
(CAttribWidgetT<NLMISC::CRGBA> **) ad,
|
(CAttribWidgetT<NLMISC::CRGBA> **) ad,
|
||||||
this);
|
this);
|
||||||
bod->init();
|
bod->init();
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
{
|
{
|
||||||
|
@ -783,26 +784,26 @@ void CAttribRGBAWidget::setCurrentScheme(uint index)
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
scheme = new NL3D::CPSColorBlender;
|
scheme = new NL3D::CPSColorBlender;
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
scheme = new NL3D::CPSColorGradient(NL3D::CPSColorGradient::_DefaultGradient, 2, 16, 1.f);
|
scheme = new NL3D::CPSColorGradient(NL3D::CPSColorGradient::_DefaultGradient, 2, 16, 1.f);
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
scheme = new NL3D::CPSColorBlenderExact;
|
scheme = new NL3D::CPSColorBlenderExact;
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
scheme = new NL3D::CPSColorMemory;
|
scheme = new NL3D::CPSColorMemory;
|
||||||
((NL3D::CPSAttribMakerMemory<NLMISC::CRGBA> *) scheme)->setScheme(new NL3D::CPSColorBlender);
|
((NL3D::CPSAttribMakerMemory<NLMISC::CRGBA> *) scheme)->setScheme(new NL3D::CPSColorBlender);
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
scheme = new NL3D::CPSColorBinOp;
|
scheme = new NL3D::CPSColorBinOp;
|
||||||
((NL3D::CPSColorBinOp *) scheme)->setArg(0, new NL3D::CPSColorBlender);
|
((NL3D::CPSColorBinOp *) scheme)->setArg(0, new NL3D::CPSColorBlender);
|
||||||
((NL3D::CPSColorBinOp *) scheme)->setArg(1, new NL3D::CPSColorBlender);
|
((NL3D::CPSColorBinOp *) scheme)->setArg(1, new NL3D::CPSColorBlender);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (scheme)
|
if (scheme)
|
||||||
{
|
{
|
||||||
|
@ -833,7 +834,7 @@ void CAttribRGBAWidget::cstValueUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
CAttribPlaneBasisWidget::CAttribPlaneBasisWidget(QWidget *parent)
|
CAttribPlaneBasisWidget::CAttribPlaneBasisWidget(QWidget *parent)
|
||||||
: CAttribWidgetT<NL3D::CPlaneBasis>(parent)
|
: CAttribWidgetT<NL3D::CPlaneBasis>(parent)
|
||||||
{
|
{
|
||||||
_ui.schemeComboBox->addItem(tr("basis gradient"));
|
_ui.schemeComboBox->addItem(tr("basis gradient"));
|
||||||
_ui.schemeComboBox->addItem(tr("follow path"));
|
_ui.schemeComboBox->addItem(tr("follow path"));
|
||||||
|
@ -847,8 +848,8 @@ CAttribPlaneBasisWidget::~CAttribPlaneBasisWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAttribPlaneBasisWidget::setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper)
|
void CAttribPlaneBasisWidget::setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper)
|
||||||
{
|
{
|
||||||
nlassert(wrapper);
|
nlassert(wrapper);
|
||||||
_Wrapper = wrapper;
|
_Wrapper = wrapper;
|
||||||
_ui.constAttribPlaneWidget->setWrapper(_Wrapper);
|
_ui.constAttribPlaneWidget->setWrapper(_Wrapper);
|
||||||
}
|
}
|
||||||
|
@ -856,7 +857,7 @@ void CAttribPlaneBasisWidget::setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper)
|
||||||
QDialog *CAttribPlaneBasisWidget::editScheme(void)
|
QDialog *CAttribPlaneBasisWidget::editScheme(void)
|
||||||
{
|
{
|
||||||
NL3D::CPSAttribMaker<NL3D::CPlaneBasis> *scheme = _SchemeWrapper->getScheme();
|
NL3D::CPSAttribMaker<NL3D::CPlaneBasis> *scheme = _SchemeWrapper->getScheme();
|
||||||
if (dynamic_cast<NL3D::CPSPlaneBasisGradient *>(scheme))
|
if (dynamic_cast<NL3D::CPSPlaneBasisGradient *>(scheme))
|
||||||
{
|
{
|
||||||
CPlaneBasisGradientWrapper *wrapper = new CPlaneBasisGradientWrapper;
|
CPlaneBasisGradientWrapper *wrapper = new CPlaneBasisGradientWrapper;
|
||||||
wrapper->Scheme = &(((NL3D::CPSPlaneBasisGradient *) (_SchemeWrapper->getScheme()) )->_F);
|
wrapper->Scheme = &(((NL3D::CPSPlaneBasisGradient *) (_SchemeWrapper->getScheme()) )->_F);
|
||||||
|
@ -864,23 +865,23 @@ QDialog *CAttribPlaneBasisWidget::editScheme(void)
|
||||||
wrapper->DefaultValue = NL3D::CPlaneBasis(NLMISC::CVector::K);
|
wrapper->DefaultValue = NL3D::CPlaneBasis(NLMISC::CVector::K);
|
||||||
return gd;
|
return gd;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSPlaneBasisFollowSpeed *>(scheme))
|
if (dynamic_cast<NL3D::CPSPlaneBasisFollowSpeed *>(scheme))
|
||||||
{
|
{
|
||||||
CFollowPathDialog *dialog = new CFollowPathDialog(dynamic_cast<NL3D::CPSPlaneBasisFollowSpeed *>(scheme), _Node, this);
|
CFollowPathDialog *dialog = new CFollowPathDialog(dynamic_cast<NL3D::CPSPlaneBasisFollowSpeed *>(scheme), _Node, this);
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSPlaneBasisMemory *>(scheme))
|
if (dynamic_cast<NL3D::CPSPlaneBasisMemory *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribPlaneBasisWidget *ad = new CAttribPlaneBasisWidget();
|
CAttribPlaneBasisWidget *ad = new CAttribPlaneBasisWidget();
|
||||||
CValueFromEmitterDialogT<NL3D::CPlaneBasis> *vfe = new CValueFromEmitterDialogT<NL3D::CPlaneBasis>
|
CValueFromEmitterDialogT<NL3D::CPlaneBasis> *vfe = new CValueFromEmitterDialogT<NL3D::CPlaneBasis>
|
||||||
( (NL3D::CPSPlaneBasisMemory *)(scheme),
|
( (NL3D::CPSPlaneBasisMemory *)(scheme),
|
||||||
ad, this);
|
ad, this);
|
||||||
vfe->init();
|
vfe->init();
|
||||||
ad->setWorkspaceNode(_Node);
|
ad->setWorkspaceNode(_Node);
|
||||||
ad->updateUi();
|
ad->updateUi();
|
||||||
return vfe;
|
return vfe;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSPlaneBasisBinOp *>(scheme))
|
if (dynamic_cast<NL3D::CPSPlaneBasisBinOp *>(scheme))
|
||||||
{
|
{
|
||||||
CAttribPlaneBasisWidget *ad[2] = { NULL, NULL};
|
CAttribPlaneBasisWidget *ad[2] = { NULL, NULL};
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
|
@ -888,8 +889,8 @@ QDialog *CAttribPlaneBasisWidget::editScheme(void)
|
||||||
ad[k] = new CAttribPlaneBasisWidget();
|
ad[k] = new CAttribPlaneBasisWidget();
|
||||||
}
|
}
|
||||||
CBinOpDialogT<NL3D::CPlaneBasis> *bod = new CBinOpDialogT<NL3D::CPlaneBasis>( (NL3D::CPSPlaneBasisBinOp *)(scheme),
|
CBinOpDialogT<NL3D::CPlaneBasis> *bod = new CBinOpDialogT<NL3D::CPlaneBasis>( (NL3D::CPSPlaneBasisBinOp *)(scheme),
|
||||||
(CAttribWidgetT<NL3D::CPlaneBasis> **) ad,
|
(CAttribWidgetT<NL3D::CPlaneBasis> **) ad,
|
||||||
this);
|
this);
|
||||||
bod->init();
|
bod->init();
|
||||||
for (uint k = 0; k <2; ++k)
|
for (uint k = 0; k <2; ++k)
|
||||||
{
|
{
|
||||||
|
@ -898,7 +899,7 @@ QDialog *CAttribPlaneBasisWidget::editScheme(void)
|
||||||
}
|
}
|
||||||
return bod;
|
return bod;
|
||||||
}
|
}
|
||||||
if (dynamic_cast<NL3D::CPSBasisSpinner *>(scheme))
|
if (dynamic_cast<NL3D::CPSBasisSpinner *>(scheme))
|
||||||
{
|
{
|
||||||
CSpinnerDialog *dialog = new CSpinnerDialog(dynamic_cast<NL3D::CPSBasisSpinner *>(scheme), _Node, this);
|
CSpinnerDialog *dialog = new CSpinnerDialog(dynamic_cast<NL3D::CPSBasisSpinner *>(scheme), _Node, this);
|
||||||
return dialog;
|
return dialog;
|
||||||
|
@ -912,34 +913,34 @@ void CAttribPlaneBasisWidget::setCurrentScheme(uint index)
|
||||||
NL3D::CPSAttribMaker<NL3D::CPlaneBasis> *scheme = NULL;
|
NL3D::CPSAttribMaker<NL3D::CPlaneBasis> *scheme = NULL;
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
scheme = new NL3D::CPSPlaneBasisGradient;
|
scheme = new NL3D::CPSPlaneBasisGradient;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
scheme = new NL3D::CPSPlaneBasisFollowSpeed;
|
scheme = new NL3D::CPSPlaneBasisFollowSpeed;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
scheme = new NL3D::CPSBasisSpinner;
|
scheme = new NL3D::CPSBasisSpinner;
|
||||||
static_cast<NL3D::CPSBasisSpinner *>(scheme)->_F.setNumSamples(16);
|
static_cast<NL3D::CPSBasisSpinner *>(scheme)->_F.setNumSamples(16);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
scheme = new NL3D::CPSPlaneBasisMemory;
|
scheme = new NL3D::CPSPlaneBasisMemory;
|
||||||
((NL3D::CPSAttribMakerMemory<NL3D::CPlaneBasis> *) scheme)->setScheme(new NL3D::CPSPlaneBasisFollowSpeed);
|
((NL3D::CPSAttribMakerMemory<NL3D::CPlaneBasis> *) scheme)->setScheme(new NL3D::CPSPlaneBasisFollowSpeed);
|
||||||
if (_Node)
|
if (_Node)
|
||||||
{
|
{
|
||||||
_Node->setModified(true);
|
_Node->setModified(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
scheme = new NL3D::CPSPlaneBasisBinOp;
|
scheme = new NL3D::CPSPlaneBasisBinOp;
|
||||||
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(0, new NL3D::CPSPlaneBasisFollowSpeed);
|
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(0, new NL3D::CPSPlaneBasisFollowSpeed);
|
||||||
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(1, new NL3D::CPSPlaneBasisFollowSpeed);
|
((NL3D::CPSPlaneBasisBinOp *) scheme)->setArg(1, new NL3D::CPSPlaneBasisFollowSpeed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheme)
|
if (scheme)
|
||||||
{
|
{
|
||||||
_SchemeWrapper->setSchemeAndUpdateModifiedFlag(scheme);
|
_SchemeWrapper->setSchemeAndUpdateModifiedFlag(scheme);
|
||||||
|
@ -955,7 +956,7 @@ sint CAttribPlaneBasisWidget::getCurrentScheme(void) const
|
||||||
if (dynamic_cast<const NL3D::CPSBasisSpinner *>(scheme)) return 2;
|
if (dynamic_cast<const NL3D::CPSBasisSpinner *>(scheme)) return 2;
|
||||||
if (dynamic_cast<const NL3D::CPSPlaneBasisMemory *>(scheme)) return 3;
|
if (dynamic_cast<const NL3D::CPSPlaneBasisMemory *>(scheme)) return 3;
|
||||||
if (dynamic_cast<const NL3D::CPSPlaneBasisBinOp *>(scheme)) return 4;
|
if (dynamic_cast<const NL3D::CPSPlaneBasisBinOp *>(scheme)) return 4;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,16 @@
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
@class CAttribWidget
|
@class CAttribWidget
|
||||||
@brief Base attrib maker edition dialog.
|
@brief Base attrib maker edition dialog.
|
||||||
*/
|
*/
|
||||||
class CAttribWidget: public QGroupBox
|
class CAttribWidget: public QGroupBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAttribWidget(QWidget *parent = 0);
|
CAttribWidget(QWidget *parent = 0);
|
||||||
~CAttribWidget();
|
~CAttribWidget();
|
||||||
|
@ -59,10 +60,10 @@ public:
|
||||||
|
|
||||||
/// Сonnects all the slots with signals
|
/// Сonnects all the slots with signals
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
/// Sets the pointer CWorkspaceNode* in the wrappers.
|
/// Sets the pointer CWorkspaceNode* in the wrappers.
|
||||||
virtual void setWorkspaceNode(CWorkspaceNode *node) = 0;
|
virtual void setWorkspaceNode(CWorkspaceNode *node) = 0;
|
||||||
|
|
||||||
/// Private usage (not private because accessed by a static function) : return the nbCycles parameter of the scheme (e.g the input multiplier).
|
/// Private usage (not private because accessed by a static function) : return the nbCycles parameter of the scheme (e.g the input multiplier).
|
||||||
virtual float getSchemeNbCycles(void) const = 0;
|
virtual float getSchemeNbCycles(void) const = 0;
|
||||||
|
|
||||||
|
@ -70,21 +71,36 @@ public:
|
||||||
virtual void setSchemeNbCycles(float nbCycles) = 0;
|
virtual void setSchemeNbCycles(float nbCycles) = 0;
|
||||||
|
|
||||||
/// Enable the srcInput
|
/// Enable the srcInput
|
||||||
void enableSrcInput(bool enable = true) { _SrcInputEnabled = enable; }
|
void enableSrcInput(bool enable = true)
|
||||||
|
{
|
||||||
bool isSrcInputEnabled() const { return _SrcInputEnabled; }
|
_SrcInputEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
/// 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)
|
/// because located have already some memory to store it)
|
||||||
void enableMemoryScheme(bool enabled = true);
|
void enableMemoryScheme(bool enabled = true);
|
||||||
|
|
||||||
/// Tells wether memory schemes are enables
|
/// Tells wether memory schemes are enables
|
||||||
/// @see enableMemoryScheme()
|
/// @see enableMemoryScheme()
|
||||||
bool isMemorySchemeEnabled() const { return !_DisableMemoryScheme; }
|
bool isMemorySchemeEnabled() const
|
||||||
|
{
|
||||||
|
return !_DisableMemoryScheme;
|
||||||
|
}
|
||||||
|
|
||||||
/// Enable Nb Cycle tuning
|
/// Enable Nb Cycle tuning
|
||||||
void enableNbCycles(bool enabled) { _NbCycleEnabled = enabled; }
|
void enableNbCycles(bool enabled)
|
||||||
bool isNbCycleEnabled() const { return _NbCycleEnabled; }
|
{
|
||||||
|
_NbCycleEnabled = enabled;
|
||||||
|
}
|
||||||
|
bool isNbCycleEnabled() const
|
||||||
|
{
|
||||||
|
return _NbCycleEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
virtual void clickedEdit();
|
virtual void clickedEdit();
|
||||||
|
@ -93,7 +109,7 @@ private Q_SLOTS:
|
||||||
virtual void setCurrentSrc(int index);
|
virtual void setCurrentSrc(int index);
|
||||||
virtual void setUserIndex();
|
virtual void setUserIndex();
|
||||||
virtual void changeUseScheme(int index);
|
virtual void changeUseScheme(int index);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// change the dialog for constant values
|
/// change the dialog for constant values
|
||||||
|
@ -128,10 +144,10 @@ protected:
|
||||||
|
|
||||||
/// tells wether the scheme supports custom input
|
/// tells wether the scheme supports custom input
|
||||||
virtual bool hasSchemeCustomInput(void) const = 0;
|
virtual bool hasSchemeCustomInput(void) const = 0;
|
||||||
|
|
||||||
/// retrieve the scheme input id
|
/// retrieve the scheme input id
|
||||||
virtual NL3D::CPSInputType getSchemeInput(void) const = 0;
|
virtual NL3D::CPSInputType getSchemeInput(void) const = 0;
|
||||||
|
|
||||||
/// set the scheme input id
|
/// set the scheme input id
|
||||||
virtual void setSchemeInput(const NL3D::CPSInputType &input) = 0;
|
virtual void setSchemeInput(const NL3D::CPSInputType &input) = 0;
|
||||||
|
|
||||||
|
@ -159,15 +175,21 @@ protected:
|
||||||
/// wrapper to tune the number of cycles
|
/// wrapper to tune the number of cycles
|
||||||
struct CNbCyclesWrapper : public IPSWrapperFloat
|
struct CNbCyclesWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
CAttribWidget *widget;
|
CAttribWidget *widget;
|
||||||
float get(void) const { return widget->getSchemeNbCycles(); }
|
float get(void) const
|
||||||
void set(const float &v) { widget->setSchemeNbCycles(v); }
|
{
|
||||||
|
return widget->getSchemeNbCycles();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
widget->setSchemeNbCycles(v);
|
||||||
|
}
|
||||||
} _NbCyclesWrapper;
|
} _NbCyclesWrapper;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
QDialog *_SchemeWidget;
|
QDialog *_SchemeWidget;
|
||||||
|
|
||||||
Ui::CAttribWidget _ui;
|
Ui::CAttribWidget _ui;
|
||||||
}; /* class CAttribWidget */
|
}; /* class CAttribWidget */
|
||||||
|
|
||||||
|
@ -179,45 +201,78 @@ template <typename T> class CAttribWidgetT : public CAttribWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CAttribWidgetT(QWidget *parent = 0): CAttribWidget(parent),
|
CAttribWidgetT(QWidget *parent = 0): CAttribWidget(parent),
|
||||||
_Wrapper(NULL),
|
_Wrapper(NULL),
|
||||||
_SchemeWrapper(NULL)
|
_SchemeWrapper(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void setWrapper(IPSWrapper<T> *wrapper) = 0;
|
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
|
// Inherited from CAttribWidget
|
||||||
virtual QDialog *editScheme(void) = 0;
|
virtual QDialog *editScheme(void) = 0;
|
||||||
virtual void setCurrentScheme(uint index) = 0;
|
virtual void setCurrentScheme(uint index) = 0;
|
||||||
virtual sint getCurrentScheme(void) const = 0;
|
virtual sint getCurrentScheme(void) const = 0;
|
||||||
|
|
||||||
virtual void resetCstValue(void)
|
virtual void resetCstValue(void)
|
||||||
{
|
{
|
||||||
_Wrapper->setAndUpdateModifiedFlag(_Wrapper->get()); // reuse current color
|
_Wrapper->setAndUpdateModifiedFlag(_Wrapper->get()); // reuse current color
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool hasSchemeCustomInput(void) const { return _SchemeWrapper->getScheme()->hasCustomInput(); }
|
virtual bool hasSchemeCustomInput(void) const
|
||||||
virtual NL3D::CPSInputType getSchemeInput(void) const { return _SchemeWrapper->getScheme()->getInput(); }
|
{
|
||||||
virtual void setSchemeInput(const NL3D::CPSInputType &input) { _SchemeWrapper->getScheme()->setInput(input); }
|
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)
|
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 float getSchemeNbCycles(void) const
|
||||||
virtual void setSchemeNbCycles(float nbCycles) { _SchemeWrapper->getScheme()->setNbCycles(nbCycles); }
|
{
|
||||||
|
return _SchemeWrapper->getScheme()->getNbCycles();
|
||||||
virtual bool isSchemeClamped(void) const { return _SchemeWrapper->getScheme()->getClamping(); }
|
}
|
||||||
virtual void clampScheme(bool clamped = true) { _SchemeWrapper->getScheme()->setClamping(clamped); }
|
virtual void setSchemeNbCycles(float nbCycles)
|
||||||
virtual bool isClampingSupported(void) const { return _SchemeWrapper->getScheme()->isClampingSupported(); };
|
{
|
||||||
virtual NL3D::CPSAttribMakerBase *getCurrentSchemePtr(void) const { return _SchemeWrapper->getScheme(); }
|
_SchemeWrapper->getScheme()->setNbCycles(nbCycles);
|
||||||
virtual void setCurrentSchemePtr(NL3D::CPSAttribMakerBase *s)
|
}
|
||||||
{
|
|
||||||
|
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));
|
_SchemeWrapper->setSchemeAndUpdateModifiedFlag(NLMISC::safe_cast<NL3D::CPSAttribMaker<T> *>(s));
|
||||||
}
|
}
|
||||||
virtual void cstValueUpdate() = 0;
|
virtual void cstValueUpdate() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool useScheme(void) const
|
virtual bool useScheme(void) const
|
||||||
{
|
{
|
||||||
|
@ -231,53 +286,53 @@ public:
|
||||||
IPSSchemeWrapper<T> *_SchemeWrapper;
|
IPSSchemeWrapper<T> *_SchemeWrapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CAttribFloatWidget
|
@class CAttribFloatWidget
|
||||||
@brief An attribute editor specialized for float values
|
@brief An attribute editor specialized for float values
|
||||||
*/
|
*/
|
||||||
class CAttribFloatWidget: public CAttribWidgetT<float>
|
class CAttribFloatWidget: public CAttribWidgetT<float>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAttribFloatWidget(QWidget *parent = 0);
|
CAttribFloatWidget(QWidget *parent = 0);
|
||||||
~CAttribFloatWidget();
|
~CAttribFloatWidget();
|
||||||
|
|
||||||
void setRange(float minValue = 0, float maxValue = 10);
|
void setRange(float minValue = 0, float maxValue = 10);
|
||||||
void setWrapper(IPSWrapper<float> *wrapper);
|
void setWrapper(IPSWrapper<float> *wrapper);
|
||||||
|
|
||||||
// inherited from CAttribWidget
|
// inherited from CAttribWidget
|
||||||
virtual QDialog *editScheme(void);
|
virtual QDialog *editScheme(void);
|
||||||
virtual void setCurrentScheme(uint index);
|
virtual void setCurrentScheme(uint index);
|
||||||
virtual sint getCurrentScheme(void) const;
|
virtual sint getCurrentScheme(void) const;
|
||||||
virtual void cstValueUpdate();
|
virtual void cstValueUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
float _MinRange, _MaxRange;
|
float _MinRange, _MaxRange;
|
||||||
}; /* class CAttribFloatWidget */
|
}; /* class CAttribFloatWidget */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CAttribUIntWidget
|
@class CAttribUIntWidget
|
||||||
@brief An attribute editor specialized for unsigned int values
|
@brief An attribute editor specialized for unsigned int values
|
||||||
*/
|
*/
|
||||||
class CAttribUIntWidget: public CAttribWidgetT<uint32>
|
class CAttribUIntWidget: public CAttribWidgetT<uint32>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAttribUIntWidget(QWidget *parent = 0);
|
CAttribUIntWidget(QWidget *parent = 0);
|
||||||
~CAttribUIntWidget();
|
~CAttribUIntWidget();
|
||||||
|
|
||||||
void setRange(uint32 minValue = 0, uint32 maxValue = 10);
|
void setRange(uint32 minValue = 0, uint32 maxValue = 10);
|
||||||
void setWrapper(IPSWrapper<uint32> *wrapper);
|
void setWrapper(IPSWrapper<uint32> *wrapper);
|
||||||
|
|
||||||
// inherited from CAttribWidget
|
// inherited from CAttribWidget
|
||||||
virtual QDialog *editScheme(void);
|
virtual QDialog *editScheme(void);
|
||||||
virtual void setCurrentScheme(uint index);
|
virtual void setCurrentScheme(uint index);
|
||||||
virtual sint getCurrentScheme(void) const;
|
virtual sint getCurrentScheme(void) const;
|
||||||
virtual void cstValueUpdate();
|
virtual void cstValueUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint32 _MinRange, _MaxRange;
|
uint32 _MinRange, _MaxRange;
|
||||||
|
@ -289,12 +344,12 @@ private:
|
||||||
*/
|
*/
|
||||||
class CAttribIntWidget: public CAttribWidgetT<sint32>
|
class CAttribIntWidget: public CAttribWidgetT<sint32>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAttribIntWidget(QWidget *parent = 0);
|
CAttribIntWidget(QWidget *parent = 0);
|
||||||
~CAttribIntWidget();
|
~CAttribIntWidget();
|
||||||
|
|
||||||
void setRange(sint32 minValue = 0, sint32 maxValue = 10);
|
void setRange(sint32 minValue = 0, sint32 maxValue = 10);
|
||||||
void setWrapper(IPSWrapper<sint32> *wrapper);
|
void setWrapper(IPSWrapper<sint32> *wrapper);
|
||||||
|
|
||||||
|
@ -303,7 +358,7 @@ public:
|
||||||
virtual void setCurrentScheme(uint index);
|
virtual void setCurrentScheme(uint index);
|
||||||
virtual sint getCurrentScheme(void) const;
|
virtual sint getCurrentScheme(void) const;
|
||||||
virtual void cstValueUpdate();
|
virtual void cstValueUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
sint32 _MinRange, _MaxRange;
|
sint32 _MinRange, _MaxRange;
|
||||||
|
@ -315,20 +370,20 @@ private:
|
||||||
*/
|
*/
|
||||||
class CAttribRGBAWidget: public CAttribWidgetT<NLMISC::CRGBA>
|
class CAttribRGBAWidget: public CAttribWidgetT<NLMISC::CRGBA>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAttribRGBAWidget(QWidget *parent = 0);
|
CAttribRGBAWidget(QWidget *parent = 0);
|
||||||
~CAttribRGBAWidget();
|
~CAttribRGBAWidget();
|
||||||
|
|
||||||
void setWrapper(IPSWrapper<NLMISC::CRGBA> *wrapper);
|
void setWrapper(IPSWrapper<NLMISC::CRGBA> *wrapper);
|
||||||
|
|
||||||
// inherited from CAttribWidget
|
// inherited from CAttribWidget
|
||||||
virtual QDialog *editScheme(void);
|
virtual QDialog *editScheme(void);
|
||||||
virtual void setCurrentScheme(uint index);
|
virtual void setCurrentScheme(uint index);
|
||||||
virtual sint getCurrentScheme(void) const;
|
virtual sint getCurrentScheme(void) const;
|
||||||
virtual void cstValueUpdate();
|
virtual void cstValueUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
}; /* class CAttribRGBAWidget */
|
}; /* class CAttribRGBAWidget */
|
||||||
|
@ -339,14 +394,14 @@ private:
|
||||||
*/
|
*/
|
||||||
class CAttribPlaneBasisWidget: public CAttribWidgetT<NL3D::CPlaneBasis>
|
class CAttribPlaneBasisWidget: public CAttribWidgetT<NL3D::CPlaneBasis>
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAttribPlaneBasisWidget(QWidget *parent = 0);
|
CAttribPlaneBasisWidget(QWidget *parent = 0);
|
||||||
~CAttribPlaneBasisWidget();
|
~CAttribPlaneBasisWidget();
|
||||||
|
|
||||||
void setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper);
|
void setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper);
|
||||||
|
|
||||||
// inherited from CAttribWidget
|
// inherited from CAttribWidget
|
||||||
virtual QDialog *editScheme(void);
|
virtual QDialog *editScheme(void);
|
||||||
virtual void setCurrentScheme(uint index);
|
virtual void setCurrentScheme(uint index);
|
||||||
|
|
|
@ -28,10 +28,11 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
|
CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent)
|
||||||
: QDialog(parent), _Node(ownerNode), _PS(ps)
|
: QDialog(parent), _Node(ownerNode), _PS(ps)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -41,14 +42,14 @@ CAutoLODDialog::CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem
|
||||||
_MaxDistLODBiasWrapper.PS = _PS;
|
_MaxDistLODBiasWrapper.PS = _PS;
|
||||||
_DistRatioWrapper.OwnerNode = _Node;
|
_DistRatioWrapper.OwnerNode = _Node;
|
||||||
_MaxDistLODBiasWrapper.OwnerNode = _Node;
|
_MaxDistLODBiasWrapper.OwnerNode = _Node;
|
||||||
|
|
||||||
// Edit the distance at which LOD starts
|
// Edit the distance at which LOD starts
|
||||||
_ui.startPercentDistWidget->setRange(0.f, 0.99f);
|
_ui.startPercentDistWidget->setRange(0.f, 0.99f);
|
||||||
_ui.startPercentDistWidget->enableUpperBound(1.f, true);
|
_ui.startPercentDistWidget->enableUpperBound(1.f, true);
|
||||||
_ui.startPercentDistWidget->enableLowerBound(0.f, false);
|
_ui.startPercentDistWidget->enableLowerBound(0.f, false);
|
||||||
_ui.startPercentDistWidget->setWrapper(&_DistRatioWrapper);
|
_ui.startPercentDistWidget->setWrapper(&_DistRatioWrapper);
|
||||||
_ui.startPercentDistWidget->updateUi();
|
_ui.startPercentDistWidget->updateUi();
|
||||||
|
|
||||||
// For non-shared systems only : Set the LOD bias at the max distance, so that some particles are still displayed
|
// For non-shared systems only : Set the LOD bias at the max distance, so that some particles are still displayed
|
||||||
_ui.maxDistBiasWidget->setRange(0.f, 1.0f);
|
_ui.maxDistBiasWidget->setRange(0.f, 1.0f);
|
||||||
_ui.maxDistBiasWidget->enableUpperBound(1.f, false);
|
_ui.maxDistBiasWidget->enableUpperBound(1.f, false);
|
||||||
|
|
|
@ -32,16 +32,17 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CAutoLODDialog: public QDialog
|
class CAutoLODDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent = 0);
|
CAutoLODDialog(CWorkspaceNode *ownerNode, NL3D::CParticleSystem *ps, QWidget *parent = 0);
|
||||||
~CAutoLODDialog();
|
~CAutoLODDialog();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setDegradationExponent(int value);
|
void setDegradationExponent(int value);
|
||||||
void setSkipParticles(bool state);
|
void setSkipParticles(bool state);
|
||||||
|
@ -54,17 +55,29 @@ private:
|
||||||
struct CDistRatioWrapper : IPSWrapperFloat
|
struct CDistRatioWrapper : IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CParticleSystem *PS;
|
NL3D::CParticleSystem *PS;
|
||||||
virtual float get() const { return PS->getAutoLODStartDistPercent(); }
|
virtual float get() const
|
||||||
virtual void set(const float &v) { PS->setupAutoLOD(v, PS->getAutoLODDegradationExponent()); }
|
{
|
||||||
|
return PS->getAutoLODStartDistPercent();
|
||||||
|
}
|
||||||
|
virtual void set(const float &v)
|
||||||
|
{
|
||||||
|
PS->setupAutoLOD(v, PS->getAutoLODDegradationExponent());
|
||||||
|
}
|
||||||
} _DistRatioWrapper;
|
} _DistRatioWrapper;
|
||||||
|
|
||||||
struct CMaxDistLODBiasWrapper : IPSWrapperFloat
|
struct CMaxDistLODBiasWrapper : IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CParticleSystem *PS;
|
NL3D::CParticleSystem *PS;
|
||||||
virtual float get() const { return PS->getMaxDistLODBias(); }
|
virtual float get() const
|
||||||
virtual void set(const float &v) { PS->setMaxDistLODBias(v); }
|
{
|
||||||
|
return PS->getMaxDistLODBias();
|
||||||
|
}
|
||||||
|
virtual void set(const float &v)
|
||||||
|
{
|
||||||
|
PS->setMaxDistLODBias(v);
|
||||||
|
}
|
||||||
} _MaxDistLODBiasWrapper;
|
} _MaxDistLODBiasWrapper;
|
||||||
|
|
||||||
Ui::CAutoLODDialog _ui;
|
Ui::CAutoLODDialog _ui;
|
||||||
}; /* class CAutoLODDialog */
|
}; /* class CAutoLODDialog */
|
||||||
|
|
||||||
|
|
|
@ -26,15 +26,16 @@
|
||||||
#include "nel/misc/matrix.h"
|
#include "nel/misc/matrix.h"
|
||||||
#include "nel/misc/vector.h"
|
#include "nel/misc/vector.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// build an euler matrix
|
// build an euler matrix
|
||||||
NLMISC::CMatrix BuildEulerMatrix(float psi, float theta, float phi)
|
NLMISC::CMatrix BuildEulerMatrix(float psi, float theta, float phi)
|
||||||
{
|
{
|
||||||
float ca = cosf(psi), sa = sinf(psi)
|
float ca = cosf(psi), sa = sinf(psi)
|
||||||
, cb = cosf(theta), sb = sinf(theta)
|
, cb = cosf(theta), sb = sinf(theta)
|
||||||
, cc = cosf(phi), sc = sinf(phi);
|
, cc = cosf(phi), sc = sinf(phi);
|
||||||
NLMISC::CMatrix m;
|
NLMISC::CMatrix m;
|
||||||
m.identity();
|
m.identity();
|
||||||
m.setRot(NLMISC::CVector(ca * cb * cc - sa * sc, -cc * sa - ca * cb *sc, ca * sb)
|
m.setRot(NLMISC::CVector(ca * cb * cc - sa * sc, -cc * sa - ca * cb *sc, ca * sb)
|
||||||
|
@ -53,9 +54,11 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
|
||||||
mat.getRot(v[0], v[1], v[2]);
|
mat.getRot(v[0], v[1], v[2]);
|
||||||
for (uint l = 0; l < 3; ++l)
|
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
|
// there are eight triplet that may satisfy the equation
|
||||||
// we compute them all, and test them against the matrix
|
// we compute them all, and test them against the matrix
|
||||||
|
|
||||||
|
@ -85,8 +88,8 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
|
||||||
|
|
||||||
a2 = (float) NLMISC::Pi - a0;
|
a2 = (float) NLMISC::Pi - a0;
|
||||||
a3 = (float) NLMISC::Pi - a1;
|
a3 = (float) NLMISC::Pi - a1;
|
||||||
|
|
||||||
|
|
||||||
c2 = (float) NLMISC::Pi - c0;
|
c2 = (float) NLMISC::Pi - c0;
|
||||||
c3 = (float) NLMISC::Pi - c1;
|
c3 = (float) NLMISC::Pi - c1;
|
||||||
|
|
||||||
|
@ -110,8 +113,8 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
|
||||||
for (uint k = 0; k < 8; ++k)
|
for (uint k = 0; k < 8; ++k)
|
||||||
{
|
{
|
||||||
float ca = cosf(sol[k].x), sa = sinf(sol[k].x)
|
float ca = cosf(sol[k].x), sa = sinf(sol[k].x)
|
||||||
, cb = cosf(sol[k].y), sb = sinf(sol[k].y)
|
, cb = cosf(sol[k].y), sb = sinf(sol[k].y)
|
||||||
, cc = cosf(sol[k].z), sc = sinf(sol[k].z);
|
, cc = cosf(sol[k].z), sc = sinf(sol[k].z);
|
||||||
|
|
||||||
float gap = fabsf(m[0][0] - ca * cb * cc + sa * sc);
|
float gap = fabsf(m[0][0] - ca * cb * cc + sa * sc);
|
||||||
gap += fabsf(m[1][0] + cc * sa + ca * cb *sc);
|
gap += fabsf(m[1][0] + cc * sa + ca * cb *sc);
|
||||||
|
@ -124,7 +127,7 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
|
||||||
if (k == 0 || gap < bestGap)
|
if (k == 0 || gap < bestGap)
|
||||||
{
|
{
|
||||||
bestGap = gap;
|
bestGap = gap;
|
||||||
bestIndex = k;
|
bestIndex = k;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +135,7 @@ NLMISC::CVector GetEulerAngles(const NLMISC::CMatrix &mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
CBasicEditWidget::CBasicEditWidget(QWidget *parent)
|
CBasicEditWidget::CBasicEditWidget(QWidget *parent)
|
||||||
: QWidget(parent), _Wrapper(NULL)
|
: QWidget(parent), _Wrapper(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -161,26 +164,26 @@ void CBasicEditWidget::updateUi()
|
||||||
_ui.psiSpinBox->blockSignals(true);
|
_ui.psiSpinBox->blockSignals(true);
|
||||||
_ui.thetaSpinBox->blockSignals(true);
|
_ui.thetaSpinBox->blockSignals(true);
|
||||||
_ui.phiSpinBox->blockSignals(true);
|
_ui.phiSpinBox->blockSignals(true);
|
||||||
|
|
||||||
_ui.psiSpinBox->setValue(int(360.f * angles.x / (2.f * (float) NLMISC::Pi)));
|
_ui.psiSpinBox->setValue(int(360.f * angles.x / (2.f * (float) NLMISC::Pi)));
|
||||||
_ui.thetaSpinBox->setValue(int(360.f * angles.y / (2.f * (float) NLMISC::Pi)));
|
_ui.thetaSpinBox->setValue(int(360.f * angles.y / (2.f * (float) NLMISC::Pi)));
|
||||||
_ui.phiSpinBox->setValue(int(360.f * angles.z / (2.f * (float) NLMISC::Pi)));
|
_ui.phiSpinBox->setValue(int(360.f * angles.z / (2.f * (float) NLMISC::Pi)));
|
||||||
|
|
||||||
_ui.psiSpinBox->blockSignals(false);
|
_ui.psiSpinBox->blockSignals(false);
|
||||||
_ui.thetaSpinBox->blockSignals(false);
|
_ui.thetaSpinBox->blockSignals(false);
|
||||||
_ui.phiSpinBox->blockSignals(false);
|
_ui.phiSpinBox->blockSignals(false);
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBasicEditWidget::updateGraphics()
|
void CBasicEditWidget::updateGraphics()
|
||||||
{
|
{
|
||||||
if (_Wrapper == NULL) return;
|
if (_Wrapper == NULL) return;
|
||||||
|
|
||||||
NLMISC::CVector angles(2.f * (float) NLMISC::Pi * _ui.psiSpinBox->value() / 360.f
|
NLMISC::CVector angles(2.f * (float) NLMISC::Pi * _ui.psiSpinBox->value() / 360.f
|
||||||
, 2.f * (float) NLMISC::Pi * _ui.thetaSpinBox->value() / 360.f
|
, 2.f * (float) NLMISC::Pi * _ui.thetaSpinBox->value() / 360.f
|
||||||
, 2.f * (float) NLMISC::Pi * _ui.phiSpinBox->value() / 360.f
|
, 2.f * (float) NLMISC::Pi * _ui.phiSpinBox->value() / 360.f
|
||||||
);
|
);
|
||||||
NLMISC::CMatrix mat = BuildEulerMatrix(angles.x, angles.y, angles.z);
|
NLMISC::CMatrix mat = BuildEulerMatrix(angles.x, angles.y, angles.z);
|
||||||
NL3D::CPlaneBasis pb;
|
NL3D::CPlaneBasis pb;
|
||||||
pb.X = mat.getI();
|
pb.X = mat.getI();
|
||||||
|
|
|
@ -31,16 +31,17 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CBasicEditWidget: public QWidget
|
class CBasicEditWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CBasicEditWidget(QWidget *parent = 0);
|
CBasicEditWidget(QWidget *parent = 0);
|
||||||
~CBasicEditWidget();
|
~CBasicEditWidget();
|
||||||
|
|
||||||
void setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper);
|
void setWrapper(IPSWrapper<NL3D::CPlaneBasis> *wrapper);
|
||||||
void updateUi();
|
void updateUi();
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ private:
|
||||||
IPSWrapper<NL3D::CPlaneBasis> *_Wrapper ;
|
IPSWrapper<NL3D::CPlaneBasis> *_Wrapper ;
|
||||||
|
|
||||||
Ui::CBasicEditWidget _ui;
|
Ui::CBasicEditWidget _ui;
|
||||||
|
|
||||||
}; /* class CBasicEditWidget */
|
}; /* class CBasicEditWidget */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "bin_op_dialog.h"
|
#include "bin_op_dialog.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CBinOpDialog::CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent)
|
CBinOpDialog::CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +37,7 @@ CBinOpDialog::CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent)
|
||||||
_gridLayout->addItem(_horizontalSpacer, 1, 1, 1, 1);
|
_gridLayout->addItem(_horizontalSpacer, 1, 1, 1, 1);
|
||||||
|
|
||||||
_gridLayout->addWidget(widget2, 2, 0, 1, 2);
|
_gridLayout->addWidget(widget2, 2, 0, 1, 2);
|
||||||
|
|
||||||
setWindowTitle(tr("Bin operator"));
|
setWindowTitle(tr("Bin operator"));
|
||||||
_comboBox->clear();
|
_comboBox->clear();
|
||||||
|
|
||||||
|
|
|
@ -38,26 +38,27 @@
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
#include "attrib_widget.h"
|
#include "attrib_widget.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CBinOpDialog : public QDialog
|
class CBinOpDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
|
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
|
||||||
~CBinOpDialog();
|
~CBinOpDialog();
|
||||||
|
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
|
|
||||||
/// called when a new operator has been selected
|
/// called when a new operator has been selected
|
||||||
virtual void newOp(uint32 op) = 0 ;
|
virtual void newOp(uint32 op) = 0 ;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setNewOp(int index);
|
void setNewOp(int index);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
QGridLayout *_gridLayout;
|
QGridLayout *_gridLayout;
|
||||||
QWidget *_widget1;
|
QWidget *_widget1;
|
||||||
QComboBox *_comboBox;
|
QComboBox *_comboBox;
|
||||||
|
@ -66,9 +67,9 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CBinOpDialogT
|
@class CBinOpDialogT
|
||||||
@brief Construct a dialog that allow to edit a binary operator that produce argument of a particle system
|
@brief Construct a dialog that allow to edit a binary operator that produce argument of a particle system
|
||||||
*/
|
*/
|
||||||
template <class T> class CBinOpDialogT : public CBinOpDialog
|
template <class T> class CBinOpDialogT : public CBinOpDialog
|
||||||
{
|
{
|
||||||
|
@ -96,8 +97,8 @@ public:
|
||||||
_AttrbDlg[k]->setSchemeWrapper(&_SchemeWrapper[k]) ;
|
_AttrbDlg[k]->setSchemeWrapper(&_SchemeWrapper[k]) ;
|
||||||
_AttrbDlg[k]->init();
|
_AttrbDlg[k]->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const operators[] =
|
static const char * const operators[] =
|
||||||
{
|
{
|
||||||
QT_TR_NOOP("Select Arg1"),
|
QT_TR_NOOP("Select Arg1"),
|
||||||
QT_TR_NOOP("Select Arg2"),
|
QT_TR_NOOP("Select Arg2"),
|
||||||
|
@ -126,10 +127,10 @@ public:
|
||||||
{
|
{
|
||||||
delete _AttrbDlg[k] ;
|
delete _AttrbDlg[k] ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
NL3D::CPSAttribMakerBinOp<T> *_EditedScheme ;
|
NL3D::CPSAttribMakerBinOp<T> *_EditedScheme ;
|
||||||
|
|
||||||
/// the dialogs that allow us to edit the schemes
|
/// the dialogs that allow us to edit the schemes
|
||||||
|
@ -140,17 +141,30 @@ protected:
|
||||||
{
|
{
|
||||||
NL3D::CPSAttribMakerBinOp<T> *S ;
|
NL3D::CPSAttribMakerBinOp<T> *S ;
|
||||||
uint Index ;
|
uint Index ;
|
||||||
virtual NL3D::CPSAttribMaker<T> *getScheme(void) const { return S->getArg(Index) ; }
|
virtual NL3D::CPSAttribMaker<T> *getScheme(void) const
|
||||||
virtual void setScheme(NL3D::CPSAttribMaker<T> *s) { S->setArg(Index, s) ; } ;
|
{
|
||||||
|
return S->getArg(Index) ;
|
||||||
|
}
|
||||||
|
virtual void setScheme(NL3D::CPSAttribMaker<T> *s)
|
||||||
|
{
|
||||||
|
S->setArg(Index, s) ;
|
||||||
|
} ;
|
||||||
} _SchemeWrapper[2] ;
|
} _SchemeWrapper[2] ;
|
||||||
|
|
||||||
/// a dummy wrapper for constant value. This shouldn't be called , however
|
/// a dummy wrapper for constant value. This shouldn't be called , however
|
||||||
struct CDummyWrapper : public IPSWrapper<T>
|
struct CDummyWrapper : public IPSWrapper<T>
|
||||||
{
|
{
|
||||||
T get(void) const { nlassert(false) ; return T() ; }
|
T get(void) const
|
||||||
void set(const T &) { nlassert(false) ; }
|
{
|
||||||
|
nlassert(false) ;
|
||||||
|
return T() ;
|
||||||
|
}
|
||||||
|
void set(const T &)
|
||||||
|
{
|
||||||
|
nlassert(false) ;
|
||||||
|
}
|
||||||
} _DummyWrapper ;
|
} _DummyWrapper ;
|
||||||
|
|
||||||
|
|
||||||
void newOp(uint32 op)
|
void newOp(uint32 op)
|
||||||
{
|
{
|
||||||
|
@ -158,7 +172,7 @@ protected:
|
||||||
if (_EditedScheme->getOp() != (NL3D::CPSBinOp::BinOp) op)
|
if (_EditedScheme->getOp() != (NL3D::CPSBinOp::BinOp) op)
|
||||||
_EditedScheme->setOp((NL3D::CPSBinOp::BinOp) op);
|
_EditedScheme->setOp((NL3D::CPSBinOp::BinOp) op);
|
||||||
}
|
}
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 by authors
|
* Copyright (C) 2010 by authors
|
||||||
*
|
*
|
||||||
* This file is part of NEL QT.
|
* This file is part of NEL QT.
|
||||||
* NEL QT is free software: you can redistribute it and/or modify it
|
* NEL QT is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* NEL QT is distributed in the hope that it will be useful, but
|
* NEL QT is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with NEL QT; see the file COPYING. If not, see
|
* along with NEL QT; see the file COPYING. If not, see
|
||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
@ -20,7 +20,8 @@
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "callback.h"
|
#include "callback.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 by authors
|
* Copyright (C) 2010 by authors
|
||||||
*
|
*
|
||||||
* This file is part of NEL QT.
|
* This file is part of NEL QT.
|
||||||
* NEL QT is free software: you can redistribute it and/or modify it
|
* NEL QT is free software: you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License as published by
|
* under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* NEL QT is distributed in the hope that it will be useful, but
|
* NEL QT is distributed in the hope that it will be useful, but
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with NEL QT; see the file COPYING. If not, see
|
* along with NEL QT; see the file COPYING. If not, see
|
||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
@ -34,7 +34,8 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
#define NLQT_CALLBACK_TEMPLATE \
|
#define NLQT_CALLBACK_TEMPLATE \
|
||||||
/** \
|
/** \
|
||||||
|
@ -230,14 +231,14 @@ private: \
|
||||||
CCallbackBase *m_CallbackBase; \
|
CCallbackBase *m_CallbackBase; \
|
||||||
\
|
\
|
||||||
}; /* class CCallback */ \
|
}; /* class CCallback */ \
|
||||||
|
|
||||||
template<typename TReturn, typename TArgsA = void, typename TArgsB = void, typename TArgsC = void, typename TArgsD = void, typename TArgsE = void, typename TArgsF = void, typename TArgsG = void, typename TDummy = void>
|
template<typename TReturn, typename TArgsA = void, typename TArgsB = void, typename TArgsC = void, typename TArgsD = void, typename TArgsE = void, typename TArgsF = void, typename TArgsG = void, typename TDummy = void>
|
||||||
class CCallback;
|
class CCallback;
|
||||||
|
|
||||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, void, void, void, void, void, void, void, void>
|
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, void, void, void, void, void, void, void, void>
|
||||||
#define NLQT_CALLBACK_ARGS_TYPENAME
|
#define NLQT_CALLBACK_ARGS_TYPENAME
|
||||||
#define NLQT_CALLBACK_ARGS_DECL
|
#define NLQT_CALLBACK_ARGS_DECL
|
||||||
#define NLQT_CALLBACK_ARGS_IMPL
|
#define NLQT_CALLBACK_ARGS_IMPL
|
||||||
NLQT_CALLBACK_TEMPLATE
|
NLQT_CALLBACK_TEMPLATE
|
||||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
// Nel includes
|
// Nel includes
|
||||||
#include <nel/misc/rgba.h>
|
#include <nel/misc/rgba.h>
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CColorEditWidget::CColorEditWidget(QWidget *parent)
|
CColorEditWidget::CColorEditWidget(QWidget *parent)
|
||||||
: QWidget(parent), _Wrapper(NULL), _emit(true)
|
: QWidget(parent), _Wrapper(NULL), _emit(true)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ CColorEditWidget::CColorEditWidget(QWidget *parent)
|
||||||
connect(_ui.bSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setBlue(int)));
|
connect(_ui.bSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setBlue(int)));
|
||||||
connect(_ui.aSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAlpha(int)));
|
connect(_ui.aSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setAlpha(int)));
|
||||||
connect(_ui.browsePushButton, SIGNAL(clicked()), this, SLOT(browseColor()));
|
connect(_ui.browsePushButton, SIGNAL(clicked()), this, SLOT(browseColor()));
|
||||||
|
|
||||||
setColor(QColor(255, 255, 255, 255));
|
setColor(QColor(255, 255, 255, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,14 +87,14 @@ void CColorEditWidget::setRed(int r)
|
||||||
if (_emit)
|
if (_emit)
|
||||||
Q_EMIT colorChanged(NLMISC::CRGBA(r, _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value()));
|
Q_EMIT colorChanged(NLMISC::CRGBA(r, _ui.gSpinBox->value(), _ui.bSpinBox->value(), _ui.aSpinBox->value()));
|
||||||
|
|
||||||
if (_Wrapper == NULL)
|
if (_Wrapper == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NLMISC::CRGBA color = _Wrapper->get();
|
NLMISC::CRGBA color = _Wrapper->get();
|
||||||
|
|
||||||
if (r == color.R)
|
if (r == color.R)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color.R = r;
|
color.R = r;
|
||||||
_Wrapper->setAndUpdateModifiedFlag(color);
|
_Wrapper->setAndUpdateModifiedFlag(color);
|
||||||
|
|
||||||
|
@ -109,10 +110,10 @@ void CColorEditWidget::setGreen(int g)
|
||||||
if (_Wrapper == NULL) return;
|
if (_Wrapper == NULL) return;
|
||||||
|
|
||||||
NLMISC::CRGBA color = _Wrapper->get();
|
NLMISC::CRGBA color = _Wrapper->get();
|
||||||
|
|
||||||
if (g == color.G)
|
if (g == color.G)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color.G = g;
|
color.G = g;
|
||||||
_Wrapper->setAndUpdateModifiedFlag(color);
|
_Wrapper->setAndUpdateModifiedFlag(color);
|
||||||
}
|
}
|
||||||
|
@ -127,10 +128,10 @@ void CColorEditWidget::setBlue(int b)
|
||||||
if (_Wrapper == NULL) return;
|
if (_Wrapper == NULL) return;
|
||||||
|
|
||||||
NLMISC::CRGBA color = _Wrapper->get();
|
NLMISC::CRGBA color = _Wrapper->get();
|
||||||
|
|
||||||
if (b == color.B)
|
if (b == color.B)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color.B = b;
|
color.B = b;
|
||||||
_Wrapper->setAndUpdateModifiedFlag(color);
|
_Wrapper->setAndUpdateModifiedFlag(color);
|
||||||
}
|
}
|
||||||
|
@ -145,10 +146,10 @@ void CColorEditWidget::setAlpha(int a)
|
||||||
if (_Wrapper == NULL) return;
|
if (_Wrapper == NULL) return;
|
||||||
|
|
||||||
NLMISC::CRGBA color = _Wrapper->get();
|
NLMISC::CRGBA color = _Wrapper->get();
|
||||||
|
|
||||||
if (a == color.A)
|
if (a == color.A)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
color.A = a;
|
color.A = a;
|
||||||
_Wrapper->setAndUpdateModifiedFlag(color);
|
_Wrapper->setAndUpdateModifiedFlag(color);
|
||||||
}
|
}
|
||||||
|
@ -156,11 +157,11 @@ void CColorEditWidget::setAlpha(int a)
|
||||||
void CColorEditWidget::browseColor()
|
void CColorEditWidget::browseColor()
|
||||||
{
|
{
|
||||||
QColor color = QColorDialog::getColor(QColor(_ui.rSpinBox->value(),
|
QColor color = QColorDialog::getColor(QColor(_ui.rSpinBox->value(),
|
||||||
_ui.gSpinBox->value(),
|
_ui.gSpinBox->value(),
|
||||||
_ui.bSpinBox->value(),
|
_ui.bSpinBox->value(),
|
||||||
_ui.aSpinBox->value()));
|
_ui.aSpinBox->value()));
|
||||||
if (!color.isValid()) return;
|
if (!color.isValid()) return;
|
||||||
|
|
||||||
setColor(color);
|
setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CColorEditWidget
|
@class CColorEditWidget
|
||||||
@brief The widget provides a 4 horizontal slider or color dialog, to set the color.
|
@brief The widget provides a 4 horizontal slider or color dialog, to set the color.
|
||||||
|
@ -36,7 +37,7 @@ namespace NLQT {
|
||||||
Widget at the same time displays the color in the shaded rectangle at the side of the sliders.
|
Widget at the same time displays the color in the shaded rectangle at the side of the sliders.
|
||||||
Use this widget, have two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
Use this widget, have two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
||||||
|
|
||||||
1. Using the Qt Q_SIGNALS/SLOT can be set current color by class methods setColor() and
|
1. Using the Qt Q_SIGNALS/SLOT can be set current color by class methods setColor() and
|
||||||
changes in current color(QSliders or QColorDialog) emits the signal colorChanged().
|
changes in current color(QSliders or QColorDialog) emits the signal colorChanged().
|
||||||
|
|
||||||
2. Using wrapper, create wpapper struct, example:
|
2. Using wrapper, create wpapper struct, example:
|
||||||
|
@ -52,26 +53,26 @@ to set the current values, need call class methods updateUi();
|
||||||
*/
|
*/
|
||||||
class CColorEditWidget: public QWidget
|
class CColorEditWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructor, sets the default color (255, 255, 255, 255)
|
/// Constructor, sets the default color (255, 255, 255, 255)
|
||||||
CColorEditWidget(QWidget *parent = 0);
|
CColorEditWidget(QWidget *parent = 0);
|
||||||
~CColorEditWidget();
|
~CColorEditWidget();
|
||||||
|
|
||||||
/// Sets the current color.
|
/// Sets the current color.
|
||||||
/// @param color - NeL NLMISC::CRGBA color
|
/// @param color - NeL NLMISC::CRGBA color
|
||||||
/// @param emit - will emit colorChanged() if the new value is different from the old one and param emit = true
|
/// @param emit - will emit colorChanged() if the new value is different from the old one and param emit = true
|
||||||
void setColor(const NLMISC::CRGBA &color, bool emit = true);
|
void setColor(const NLMISC::CRGBA &color, bool emit = true);
|
||||||
|
|
||||||
/// Sets the current color.
|
/// Sets the current color.
|
||||||
/// @param color - Qt QColor color
|
/// @param color - Qt QColor color
|
||||||
/// @param emit - will emit colorChanged() if the new value is different from the old one and param emit = true
|
/// @param emit - will emit colorChanged() if the new value is different from the old one and param emit = true
|
||||||
void setColor(const QColor &color, bool emit = true);
|
void setColor(const QColor &color, bool emit = true);
|
||||||
|
|
||||||
/// Set a wrapper to get/set the datas.
|
/// Set a wrapper to get/set the datas.
|
||||||
void setWrapper(IPSWrapperRGBA *wrapper);
|
void setWrapper(IPSWrapperRGBA *wrapper);
|
||||||
|
|
||||||
/// Update the content of the widget using the wrapper.
|
/// Update the content of the widget using the wrapper.
|
||||||
void updateUi();
|
void updateUi();
|
||||||
|
|
||||||
|
@ -84,16 +85,16 @@ private Q_SLOTS:
|
||||||
void setBlue(int b);
|
void setBlue(int b);
|
||||||
void setAlpha(int a);
|
void setAlpha(int a);
|
||||||
void browseColor();
|
void browseColor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// wrapper to the datas
|
// wrapper to the datas
|
||||||
IPSWrapperRGBA *_Wrapper;
|
IPSWrapperRGBA *_Wrapper;
|
||||||
|
|
||||||
bool _emit;
|
bool _emit;
|
||||||
|
|
||||||
Ui::CColorEditWidget _ui;
|
Ui::CColorEditWidget _ui;
|
||||||
|
|
||||||
}; /* class CColorEditWidget */
|
}; /* class CColorEditWidget */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -31,25 +31,26 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CConfiguration::CConfiguration()
|
CConfiguration::CConfiguration()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfiguration::~CConfiguration()
|
CConfiguration::~CConfiguration()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfiguration::init()
|
void CConfiguration::init()
|
||||||
{
|
{
|
||||||
nldebug("CConfiguration::init");
|
nldebug("CConfiguration::init");
|
||||||
|
|
||||||
// verify data
|
// verify data
|
||||||
nlassert(!ConfigCallbacks.size());
|
nlassert(!ConfigCallbacks.size());
|
||||||
|
|
||||||
// load config
|
// load config
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -67,23 +68,23 @@ void CConfiguration::init()
|
||||||
void CConfiguration::release()
|
void CConfiguration::release()
|
||||||
{
|
{
|
||||||
nldebug("CConfiguration::release");
|
nldebug("CConfiguration::release");
|
||||||
|
|
||||||
Modules::config().dropCallback("SearchPaths");
|
Modules::config().dropCallback("SearchPaths");
|
||||||
|
|
||||||
// save and release the config file
|
// save and release the config file
|
||||||
if (ConfigFile.exists("SaveConfig") && ConfigFile.getVarPtr("SaveConfig")->asBool())
|
if (ConfigFile.exists("SaveConfig") && ConfigFile.getVarPtr("SaveConfig")->asBool())
|
||||||
{
|
{
|
||||||
ConfigFile.save();
|
ConfigFile.save();
|
||||||
}
|
}
|
||||||
ConfigFile.clear();
|
ConfigFile.clear();
|
||||||
|
|
||||||
// release the search paths etc
|
// release the search paths etc
|
||||||
CPath::releaseInstance();
|
CPath::releaseInstance();
|
||||||
|
|
||||||
// verify data
|
// verify data
|
||||||
nlassert(!ConfigCallbacks.size());
|
nlassert(!ConfigCallbacks.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfiguration::updateUtilities()
|
void CConfiguration::updateUtilities()
|
||||||
{
|
{
|
||||||
//H_AUTO2
|
//H_AUTO2
|
||||||
|
@ -101,7 +102,7 @@ void CConfiguration::configRemapExtensions()
|
||||||
var = ConfigFile.getVarPtr("RemapExtensions");
|
var = ConfigFile.getVarPtr("RemapExtensions");
|
||||||
uint varsize = var->size();
|
uint varsize = var->size();
|
||||||
for (uint i = 0; i < varsize; i += 2)
|
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)
|
void CConfiguration::setAndCallback(const std::string &varName, CConfigCallback configCallback)
|
||||||
|
@ -127,7 +128,7 @@ float CConfiguration::getValue(const string &varName, float defaultValue)
|
||||||
{
|
{
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asFloat();
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asFloat();
|
||||||
CConfigFile::CVar varToCopy;
|
CConfigFile::CVar varToCopy;
|
||||||
varToCopy.forceAsDouble((double)defaultValue);
|
varToCopy.forceAsDouble((double)defaultValue);
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ double CConfiguration::getValue(const string &varName, double defaultValue)
|
||||||
{
|
{
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asDouble();
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asDouble();
|
||||||
CConfigFile::CVar varToCopy;
|
CConfigFile::CVar varToCopy;
|
||||||
varToCopy.forceAsDouble(defaultValue);
|
varToCopy.forceAsDouble(defaultValue);
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +146,7 @@ int CConfiguration::getValue(const string &varName, int defaultValue)
|
||||||
{
|
{
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asInt();
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asInt();
|
||||||
CConfigFile::CVar varToCopy;
|
CConfigFile::CVar varToCopy;
|
||||||
varToCopy.forceAsInt(defaultValue);
|
varToCopy.forceAsInt(defaultValue);
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -172,14 +173,14 @@ bool CConfiguration::getValue(const string &varName, bool defaultValue)
|
||||||
{
|
{
|
||||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asBool();
|
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asBool();
|
||||||
CConfigFile::CVar varToCopy;
|
CConfigFile::CVar varToCopy;
|
||||||
varToCopy.forceAsInt(defaultValue ? 1 : 0);
|
varToCopy.forceAsInt(defaultValue ? 1 : 0);
|
||||||
ConfigFile.insertVar(varName, varToCopy);
|
ConfigFile.insertVar(varName, varToCopy);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRGBA CConfiguration::getValue(const string &varName, const CRGBA &defaultValue)
|
CRGBA CConfiguration::getValue(const string &varName, const CRGBA &defaultValue)
|
||||||
{
|
{
|
||||||
if (ConfigFile.exists(varName))
|
if (ConfigFile.exists(varName))
|
||||||
{
|
{
|
||||||
return getValue(ConfigFile.getVar(varName), defaultValue);
|
return getValue(ConfigFile.getVar(varName), defaultValue);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +204,7 @@ CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaul
|
||||||
if (var.size() > 4) nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
if (var.size() > 4) nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
||||||
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
|
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
|
||||||
}
|
}
|
||||||
nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A);
|
nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +217,7 @@ void CConfiguration::cfcbSearchPaths(NLMISC::CConfigFile::CVar &var)
|
||||||
{
|
{
|
||||||
uint varsize = var.size();
|
uint varsize = var.size();
|
||||||
for (uint i = 0; i < varsize; ++i)
|
for (uint i = 0; i < varsize; ++i)
|
||||||
CPath::addSearchPath(var.asString(i), true, false);
|
CPath::addSearchPath(var.asString(i), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -35,7 +35,8 @@
|
||||||
|
|
||||||
#define NLQT_CONFIG_FILE "object_viewer.cfg"
|
#define NLQT_CONFIG_FILE "object_viewer.cfg"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
typedef CCallback<void, NLMISC::CConfigFile::CVar &> CConfigCallback;
|
typedef CCallback<void, NLMISC::CConfigFile::CVar &> CConfigCallback;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ public:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void release();
|
void release();
|
||||||
|
|
||||||
void updateUtilities();
|
void updateUtilities();
|
||||||
void configSearchPaths();
|
void configSearchPaths();
|
||||||
void configRemapExtensions();
|
void configRemapExtensions();
|
||||||
|
@ -63,7 +64,7 @@ public:
|
||||||
void setAndCallback(const std::string &varName, CConfigCallback configCallback);
|
void setAndCallback(const std::string &varName, CConfigCallback configCallback);
|
||||||
void setCallback(const std::string &varName, CConfigCallback configCallback);
|
void setCallback(const std::string &varName, CConfigCallback configCallback);
|
||||||
void dropCallback(const std::string &varName);
|
void dropCallback(const std::string &varName);
|
||||||
|
|
||||||
float getValue(const std::string &varName, float defaultValue);
|
float getValue(const std::string &varName, float defaultValue);
|
||||||
double getValue(const std::string &varName, double defaultValue);
|
double getValue(const std::string &varName, double defaultValue);
|
||||||
int getValue(const std::string &varName, int defaultValue);
|
int getValue(const std::string &varName, int defaultValue);
|
||||||
|
@ -72,8 +73,11 @@ public:
|
||||||
bool getValue(const std::string &varName, bool defaultValue);
|
bool getValue(const std::string &varName, bool defaultValue);
|
||||||
NLMISC::CRGBA getValue(const std::string &varName, const NLMISC::CRGBA &defaultValue);
|
NLMISC::CRGBA getValue(const std::string &varName, const NLMISC::CRGBA &defaultValue);
|
||||||
NLMISC::CRGBA getValue(const NLMISC::CConfigFile::CVar &var, 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:
|
private:
|
||||||
static void cbConfigCallback(NLMISC::CConfigFile::CVar &var);
|
static void cbConfigCallback(NLMISC::CConfigFile::CVar &var);
|
||||||
|
@ -85,7 +89,7 @@ private:
|
||||||
|
|
||||||
NLMISC::CConfigFile ConfigFile;
|
NLMISC::CConfigFile ConfigFile;
|
||||||
std::map<std::string, CConfigCallback> ConfigCallbacks;
|
std::map<std::string, CConfigCallback> ConfigCallbacks;
|
||||||
|
|
||||||
};/* class CConfiguration */
|
};/* class CConfiguration */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -23,23 +23,24 @@
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include "nel/3d/ps_mesh.h"
|
#include "nel/3d/ps_mesh.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CConstraintMeshWidget::CConstraintMeshWidget(QWidget *parent )
|
CConstraintMeshWidget::CConstraintMeshWidget(QWidget *parent )
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
connect(_ui.stageCheckBox_0, SIGNAL(clicked(bool)), this, SLOT(setForceStage0(bool)));
|
connect(_ui.stageCheckBox_0, SIGNAL(clicked(bool)), this, SLOT(setForceStage0(bool)));
|
||||||
connect(_ui.stageCheckBox_1, SIGNAL(clicked(bool)), this, SLOT(setForceStage1(bool)));
|
connect(_ui.stageCheckBox_1, SIGNAL(clicked(bool)), this, SLOT(setForceStage1(bool)));
|
||||||
connect(_ui.stageCheckBox_2, SIGNAL(clicked(bool)), this, SLOT(setForceStage2(bool)));
|
connect(_ui.stageCheckBox_2, SIGNAL(clicked(bool)), this, SLOT(setForceStage2(bool)));
|
||||||
connect(_ui.stageCheckBox_3, SIGNAL(clicked(bool)), this, SLOT(setForceStage3(bool)));
|
connect(_ui.stageCheckBox_3, SIGNAL(clicked(bool)), this, SLOT(setForceStage3(bool)));
|
||||||
connect(_ui.vertexColorLightingCheckBox, SIGNAL(clicked(bool)), this, SLOT(setForceVertexColorLighting(bool)));
|
connect(_ui.vertexColorLightingCheckBox, SIGNAL(clicked(bool)), this, SLOT(setForceVertexColorLighting(bool)));
|
||||||
|
|
||||||
connect(_ui.texAnimTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTexAnimType(int)));
|
connect(_ui.texAnimTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTexAnimType(int)));
|
||||||
connect(_ui.reinitCheckBox, SIGNAL(toggled(bool)), this, SLOT(setReinitWhenNewElementIsCreated(bool)));
|
connect(_ui.reinitCheckBox, SIGNAL(toggled(bool)), this, SLOT(setReinitWhenNewElementIsCreated(bool)));
|
||||||
connect(_ui.stageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setStage(int)));
|
connect(_ui.stageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setStage(int)));
|
||||||
|
|
||||||
connectGlobalTexAnim();
|
connectGlobalTexAnim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,14 +56,14 @@ void CConstraintMeshWidget::connectGlobalTexAnim()
|
||||||
connect(_ui.transVSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.transVSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.transUAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.transUAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.transVAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.transVAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
|
|
||||||
connect(_ui.scaleUStartDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.scaleUStartDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.scaleVStartDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.scaleVStartDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.scaleUSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.scaleUSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.scaleVSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.scaleVSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.scaleUAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.scaleUAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.scaleVAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.scaleVAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
|
|
||||||
connect(_ui.rotSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.rotSpeedDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
connect(_ui.rotAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
connect(_ui.rotAccelDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setGlobalTexAnimValue()));
|
||||||
}
|
}
|
||||||
|
@ -97,7 +98,7 @@ void CConstraintMeshWidget::setCurrentConstraintMesh(CWorkspaceNode *ownerNode,
|
||||||
_ui.stageCheckBox_2->setChecked(_CM->isStageModulationForced(2));
|
_ui.stageCheckBox_2->setChecked(_CM->isStageModulationForced(2));
|
||||||
_ui.stageCheckBox_3->setChecked(_CM->isStageModulationForced(3));
|
_ui.stageCheckBox_3->setChecked(_CM->isStageModulationForced(3));
|
||||||
_ui.vertexColorLightingCheckBox->setChecked(_CM->isVertexColorLightingForced());
|
_ui.vertexColorLightingCheckBox->setChecked(_CM->isVertexColorLightingForced());
|
||||||
|
|
||||||
_ui.texAnimTypeComboBox->setCurrentIndex(_CM->getTexAnimType());
|
_ui.texAnimTypeComboBox->setCurrentIndex(_CM->getTexAnimType());
|
||||||
if (_CM->getTexAnimType() == NL3D::CPSConstraintMesh::GlobalAnim)
|
if (_CM->getTexAnimType() == NL3D::CPSConstraintMesh::GlobalAnim)
|
||||||
{
|
{
|
||||||
|
@ -135,24 +136,24 @@ void CConstraintMeshWidget::setTexAnimType(int index)
|
||||||
{
|
{
|
||||||
switch(index)
|
switch(index)
|
||||||
{
|
{
|
||||||
case 0: // no anim
|
case 0: // no anim
|
||||||
_CM->setTexAnimType(NL3D::CPSConstraintMesh::NoAnim);
|
_CM->setTexAnimType(NL3D::CPSConstraintMesh::NoAnim);
|
||||||
_ui.stageSpinBox->hide();
|
_ui.stageSpinBox->hide();
|
||||||
_ui.stageLabel->hide();
|
_ui.stageLabel->hide();
|
||||||
_ui.tabWidget->hide();
|
_ui.tabWidget->hide();
|
||||||
_ui.reinitCheckBox->hide();
|
_ui.reinitCheckBox->hide();
|
||||||
break;
|
break;
|
||||||
case 1: // global anim
|
case 1: // global anim
|
||||||
_CM->setTexAnimType(NL3D::CPSConstraintMesh::GlobalAnim);
|
_CM->setTexAnimType(NL3D::CPSConstraintMesh::GlobalAnim);
|
||||||
_ui.stageSpinBox->show();
|
_ui.stageSpinBox->show();
|
||||||
_ui.stageLabel->show();
|
_ui.stageLabel->show();
|
||||||
_ui.tabWidget->show();
|
_ui.tabWidget->show();
|
||||||
_ui.reinitCheckBox->show();
|
_ui.reinitCheckBox->show();
|
||||||
_ui.stageSpinBox->setValue(0);
|
_ui.stageSpinBox->setValue(0);
|
||||||
_ui.reinitCheckBox->setChecked(_CM->isGlobalAnimTimeResetOnNewElementForced());
|
_ui.reinitCheckBox->setChecked(_CM->isGlobalAnimTimeResetOnNewElementForced());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nlstop;
|
nlstop;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ void CConstraintMeshWidget::setStage(int value)
|
||||||
void CConstraintMeshWidget::updateGlobalTexAnim(int value)
|
void CConstraintMeshWidget::updateGlobalTexAnim(int value)
|
||||||
{
|
{
|
||||||
disconnectGlobalTexAnim();
|
disconnectGlobalTexAnim();
|
||||||
|
|
||||||
const NL3D::CPSConstraintMesh::CGlobalTexAnim >a = _CM->getGlobalTexAnim(value);
|
const NL3D::CPSConstraintMesh::CGlobalTexAnim >a = _CM->getGlobalTexAnim(value);
|
||||||
|
|
||||||
_ui.transUStartDoubleSpinBox->setValue(gta.TransOffset.x);
|
_ui.transUStartDoubleSpinBox->setValue(gta.TransOffset.x);
|
||||||
|
@ -179,41 +180,41 @@ void CConstraintMeshWidget::updateGlobalTexAnim(int value)
|
||||||
_ui.transVSpeedDoubleSpinBox->setValue(gta.TransSpeed.y);
|
_ui.transVSpeedDoubleSpinBox->setValue(gta.TransSpeed.y);
|
||||||
_ui.transUAccelDoubleSpinBox->setValue(gta.TransAccel.x);
|
_ui.transUAccelDoubleSpinBox->setValue(gta.TransAccel.x);
|
||||||
_ui.transVAccelDoubleSpinBox->setValue(gta.TransAccel.y);
|
_ui.transVAccelDoubleSpinBox->setValue(gta.TransAccel.y);
|
||||||
|
|
||||||
_ui.scaleUStartDoubleSpinBox->setValue(gta.ScaleStart.x);
|
_ui.scaleUStartDoubleSpinBox->setValue(gta.ScaleStart.x);
|
||||||
_ui.scaleVStartDoubleSpinBox->setValue(gta.ScaleStart.y);
|
_ui.scaleVStartDoubleSpinBox->setValue(gta.ScaleStart.y);
|
||||||
_ui.scaleUSpeedDoubleSpinBox->setValue(gta.ScaleSpeed.x);
|
_ui.scaleUSpeedDoubleSpinBox->setValue(gta.ScaleSpeed.x);
|
||||||
_ui.scaleVSpeedDoubleSpinBox->setValue(gta.ScaleSpeed.y);
|
_ui.scaleVSpeedDoubleSpinBox->setValue(gta.ScaleSpeed.y);
|
||||||
_ui.scaleUAccelDoubleSpinBox->setValue(gta.ScaleAccel.x);
|
_ui.scaleUAccelDoubleSpinBox->setValue(gta.ScaleAccel.x);
|
||||||
_ui.scaleVAccelDoubleSpinBox->setValue(gta.ScaleAccel.y);
|
_ui.scaleVAccelDoubleSpinBox->setValue(gta.ScaleAccel.y);
|
||||||
|
|
||||||
_ui.rotSpeedDoubleSpinBox->setValue(gta.WRotSpeed);
|
_ui.rotSpeedDoubleSpinBox->setValue(gta.WRotSpeed);
|
||||||
_ui.rotAccelDoubleSpinBox->setValue(gta.WRotAccel);
|
_ui.rotAccelDoubleSpinBox->setValue(gta.WRotAccel);
|
||||||
|
|
||||||
connectGlobalTexAnim();
|
connectGlobalTexAnim();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConstraintMeshWidget::setGlobalTexAnimValue()
|
void CConstraintMeshWidget::setGlobalTexAnimValue()
|
||||||
{
|
{
|
||||||
NL3D::CPSConstraintMesh::CGlobalTexAnim gta;
|
NL3D::CPSConstraintMesh::CGlobalTexAnim gta;
|
||||||
|
|
||||||
gta.TransOffset.x = _ui.transUStartDoubleSpinBox->value();
|
gta.TransOffset.x = _ui.transUStartDoubleSpinBox->value();
|
||||||
gta.TransOffset.y = _ui.transVStartDoubleSpinBox->value();
|
gta.TransOffset.y = _ui.transVStartDoubleSpinBox->value();
|
||||||
gta.TransSpeed.x = _ui.transUSpeedDoubleSpinBox->value();
|
gta.TransSpeed.x = _ui.transUSpeedDoubleSpinBox->value();
|
||||||
gta.TransSpeed.y = _ui.transVSpeedDoubleSpinBox->value();
|
gta.TransSpeed.y = _ui.transVSpeedDoubleSpinBox->value();
|
||||||
gta.TransAccel.x = _ui.transUAccelDoubleSpinBox->value();
|
gta.TransAccel.x = _ui.transUAccelDoubleSpinBox->value();
|
||||||
gta.TransAccel.y = _ui.transVAccelDoubleSpinBox->value();
|
gta.TransAccel.y = _ui.transVAccelDoubleSpinBox->value();
|
||||||
|
|
||||||
gta.ScaleStart.x = _ui.scaleUStartDoubleSpinBox->value();
|
gta.ScaleStart.x = _ui.scaleUStartDoubleSpinBox->value();
|
||||||
gta.ScaleStart.y = _ui.scaleVStartDoubleSpinBox->value();
|
gta.ScaleStart.y = _ui.scaleVStartDoubleSpinBox->value();
|
||||||
gta.ScaleSpeed.x = _ui.scaleUSpeedDoubleSpinBox->value();
|
gta.ScaleSpeed.x = _ui.scaleUSpeedDoubleSpinBox->value();
|
||||||
gta.ScaleSpeed.y = _ui.scaleVSpeedDoubleSpinBox->value();
|
gta.ScaleSpeed.y = _ui.scaleVSpeedDoubleSpinBox->value();
|
||||||
gta.ScaleAccel.x = _ui.scaleUAccelDoubleSpinBox->value();
|
gta.ScaleAccel.x = _ui.scaleUAccelDoubleSpinBox->value();
|
||||||
gta.ScaleAccel.y = _ui.scaleVAccelDoubleSpinBox->value();
|
gta.ScaleAccel.y = _ui.scaleVAccelDoubleSpinBox->value();
|
||||||
|
|
||||||
gta.WRotSpeed = _ui.rotSpeedDoubleSpinBox->value();
|
gta.WRotSpeed = _ui.rotSpeedDoubleSpinBox->value();
|
||||||
gta.WRotAccel = _ui.rotAccelDoubleSpinBox->value();
|
gta.WRotAccel = _ui.rotAccelDoubleSpinBox->value();
|
||||||
|
|
||||||
_CM->setGlobalTexAnim(_ui.stageSpinBox->value(), gta);
|
_CM->setGlobalTexAnim(_ui.stageSpinBox->value(), gta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NL3D {
|
namespace NL3D
|
||||||
class CPSConstraintMesh;
|
{
|
||||||
|
class CPSConstraintMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CConstraintMeshWidget
|
@class CConstraintMeshWidget
|
||||||
|
@ -43,12 +45,12 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CConstraintMeshWidget: public QWidget
|
class CConstraintMeshWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CConstraintMeshWidget(QWidget *parent = 0);
|
CConstraintMeshWidget(QWidget *parent = 0);
|
||||||
~CConstraintMeshWidget();
|
~CConstraintMeshWidget();
|
||||||
|
|
||||||
/// Set the constraint mesh to edit.
|
/// Set the constraint mesh to edit.
|
||||||
void setCurrentConstraintMesh(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm);
|
void setCurrentConstraintMesh(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm);
|
||||||
|
|
||||||
|
@ -62,16 +64,16 @@ private Q_SLOTS:
|
||||||
void setReinitWhenNewElementIsCreated(bool state);
|
void setReinitWhenNewElementIsCreated(bool state);
|
||||||
void setStage(int value);
|
void setStage(int value);
|
||||||
void setGlobalTexAnimValue();
|
void setGlobalTexAnimValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void connectGlobalTexAnim();
|
void connectGlobalTexAnim();
|
||||||
void disconnectGlobalTexAnim();
|
void disconnectGlobalTexAnim();
|
||||||
void updateGlobalTexAnim(int value);
|
void updateGlobalTexAnim(int value);
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
NL3D::CPSConstraintMesh *_CM;
|
NL3D::CPSConstraintMesh *_CM;
|
||||||
|
|
||||||
Ui::CConstraintMeshWidget _ui;
|
Ui::CConstraintMeshWidget _ui;
|
||||||
}; /* class CConstraintMeshWidget */
|
}; /* class CConstraintMeshWidget */
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,9 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent)
|
CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||||
: QDialog(parent) , _Curve(curve), _scale(1.0), _pos(0.0), _Node(ownerNode)
|
: QDialog(parent) , _Curve(curve), _scale(1.0), _pos(0.0), _Node(ownerNode)
|
||||||
{
|
{
|
||||||
|
@ -32,16 +33,16 @@ CurveEditDialog::CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNo
|
||||||
|
|
||||||
show();
|
show();
|
||||||
_hoverPoints = new HoverPoints(_ui.curveWidget, HoverPoints::CircleShape);
|
_hoverPoints = new HoverPoints(_ui.curveWidget, HoverPoints::CircleShape);
|
||||||
|
|
||||||
if (_Curve->hasSmoothing())
|
if (_Curve->hasSmoothing())
|
||||||
_hoverPoints->setConnectionType(HoverPoints::CurveConnection);
|
_hoverPoints->setConnectionType(HoverPoints::CurveConnection);
|
||||||
else
|
else
|
||||||
_hoverPoints->setConnectionType(HoverPoints::LineConnection);
|
_hoverPoints->setConnectionType(HoverPoints::LineConnection);
|
||||||
|
|
||||||
_ui.smoothingCheckBox->setChecked(_Curve->hasSmoothing());
|
_ui.smoothingCheckBox->setChecked(_Curve->hasSmoothing());
|
||||||
|
|
||||||
buildPoints();
|
buildPoints();
|
||||||
|
|
||||||
_hoverPoints->setSortType(HoverPoints::XSort);
|
_hoverPoints->setSortType(HoverPoints::XSort);
|
||||||
_hoverPoints->setShapePen(QPen(QColor(0, 0, 100, 127), 1));
|
_hoverPoints->setShapePen(QPen(QColor(0, 0, 100, 127), 1));
|
||||||
_hoverPoints->setShapeBrush(QBrush(QColor(0, 0, 200, 127)));
|
_hoverPoints->setShapeBrush(QBrush(QColor(0, 0, 200, 127)));
|
||||||
|
@ -69,11 +70,11 @@ CurveEditDialog::~CurveEditDialog()
|
||||||
|
|
||||||
void CurveEditDialog::setSmoothing(bool state)
|
void CurveEditDialog::setSmoothing(bool state)
|
||||||
{
|
{
|
||||||
if (state)
|
if (state)
|
||||||
_hoverPoints->setConnectionType(HoverPoints::CurveConnection);
|
_hoverPoints->setConnectionType(HoverPoints::CurveConnection);
|
||||||
else
|
else
|
||||||
_hoverPoints->setConnectionType(HoverPoints::LineConnection);
|
_hoverPoints->setConnectionType(HoverPoints::LineConnection);
|
||||||
|
|
||||||
_Curve->enableSmoothing(state);
|
_Curve->enableSmoothing(state);
|
||||||
|
|
||||||
_ui.curveWidget->update();
|
_ui.curveWidget->update();
|
||||||
|
@ -85,13 +86,13 @@ void CurveEditDialog::setDisplayInterpolation(bool state)
|
||||||
|
|
||||||
void CurveEditDialog::curveChanged(const QPolygonF &points)
|
void CurveEditDialog::curveChanged(const QPolygonF &points)
|
||||||
{
|
{
|
||||||
if (_Curve->getNumCtrlPoints() > uint(points.size()))
|
if (_Curve->getNumCtrlPoints() > uint(points.size()))
|
||||||
_Curve->removeCtrlPoint(0);
|
_Curve->removeCtrlPoint(0);
|
||||||
else if (_Curve->getNumCtrlPoints() < uint(points.size()))
|
else if (_Curve->getNumCtrlPoints() < uint(points.size()))
|
||||||
_Curve->addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
|
_Curve->addControlPoint(NL3D::CPSFloatCurveFunctor::CCtrlPoint(1, 0.5f));
|
||||||
for (int i = 0; i < points.size(); i++)
|
for (int i = 0; i < points.size(); i++)
|
||||||
_Curve->setCtrlPoint(uint(i), NL3D::CPSFloatCurveFunctor::CCtrlPoint(points.at(i).x() / _ui.curveWidget->width(),
|
_Curve->setCtrlPoint(uint(i), NL3D::CPSFloatCurveFunctor::CCtrlPoint(points.at(i).x() / _ui.curveWidget->width(),
|
||||||
(_ui.curveWidget->height() - points.at(i).y() + _pos) / (_ui.curveWidget->height() * _scale)));
|
(_ui.curveWidget->height() - points.at(i).y() + _pos) / (_ui.curveWidget->height() * _scale)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurveEditDialog::setScale(int value)
|
void CurveEditDialog::setScale(int value)
|
||||||
|
@ -146,8 +147,8 @@ void CurveEditDialog::buildPoints()
|
||||||
{
|
{
|
||||||
QPolygonF points;
|
QPolygonF points;
|
||||||
for (uint i = 0; i < _Curve->getNumCtrlPoints(); i++)
|
for (uint i = 0; i < _Curve->getNumCtrlPoints(); i++)
|
||||||
points << QPointF((_Curve->getControlPoint(i).Date * _ui.curveWidget->width()),
|
points << QPointF((_Curve->getControlPoint(i).Date * _ui.curveWidget->width()),
|
||||||
_pos + _ui.curveWidget->height() - (_scale * _Curve->getControlPoint(i).Value * _ui.curveWidget->height()));
|
_pos + _ui.curveWidget->height() - (_scale * _Curve->getControlPoint(i).Value * _ui.curveWidget->height()));
|
||||||
|
|
||||||
_hoverPoints->setPoints(points);
|
_hoverPoints->setPoints(points);
|
||||||
//_hoverPoints->setPointLock(0, HoverPoints::LockToLeft);
|
//_hoverPoints->setPointLock(0, HoverPoints::LockToLeft);
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
#include "hoverpoints.h"
|
#include "hoverpoints.h"
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
@class CurveEditDialog
|
@class CurveEditDialog
|
||||||
@brief Dialogue editing graphics curve.
|
@brief Dialogue editing graphics curve.
|
||||||
|
@ -45,15 +46,15 @@ The choice of the interpolation algorithm.
|
||||||
*/
|
*/
|
||||||
class CurveEditDialog : public QDialog
|
class CurveEditDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent = 0);
|
CurveEditDialog(NL3D::CPSFloatCurveFunctor *curve, CWorkspaceNode *ownerNode, QWidget *parent = 0);
|
||||||
~CurveEditDialog();
|
~CurveEditDialog();
|
||||||
|
|
||||||
/// the scheme being edited
|
/// the scheme being edited
|
||||||
NL3D::CPSFloatCurveFunctor *_Curve;
|
NL3D::CPSFloatCurveFunctor *_Curve;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setSmoothing(bool state);
|
void setSmoothing(bool state);
|
||||||
void setDisplayInterpolation(bool state);
|
void setDisplayInterpolation(bool state);
|
||||||
|
@ -64,17 +65,17 @@ private Q_SLOTS:
|
||||||
void setLastTiFirst();
|
void setLastTiFirst();
|
||||||
void setFirstToLast();
|
void setFirstToLast();
|
||||||
void setNumSamples(uint32 value);
|
void setNumSamples(uint32 value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void buildPoints();
|
void buildPoints();
|
||||||
|
|
||||||
float _scale;
|
float _scale;
|
||||||
float _pos;
|
float _pos;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
HoverPoints *_hoverPoints;
|
HoverPoints *_hoverPoints;
|
||||||
|
|
||||||
Ui::CurveEditDialog _ui;
|
Ui::CurveEditDialog _ui;
|
||||||
}; /* CurveEditDialog */
|
}; /* CurveEditDialog */
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CDayNightDialog::CDayNightDialog(QWidget *parent)
|
CDayNightDialog::CDayNightDialog(QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CDayNightDialog
|
@class CDayNightDialog
|
||||||
|
@ -37,12 +38,12 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CDayNightDialog: public QDockWidget
|
class CDayNightDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDayNightDialog(QWidget *parent = 0);
|
CDayNightDialog(QWidget *parent = 0);
|
||||||
~CDayNightDialog();
|
~CDayNightDialog();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setDayNight(int value);
|
void setDayNight(int value);
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
@section introduce Introduce
|
@section introduce Introduce
|
||||||
@details
|
@details
|
||||||
The Object Viewer Qt (ovqt) is a tool for working with graphics technology NeL data,
|
The Object Viewer Qt (ovqt) is a tool for working with graphics technology NeL data,
|
||||||
which can be useful durung the development and preparation of the game content.
|
which can be useful durung the development and preparation of the game content.
|
||||||
The tool can be used in different tasks:
|
The tool can be used in different tasks:
|
||||||
- Loading and viewing NeL data (.shape, .ps) files with the ability to set wind power, color light.
|
- Loading and viewing NeL data (.shape, .ps) files with the ability to set wind power, color light.
|
||||||
- Viewing animation shape (loading .anim, .skel, .swt files) using playlist or slot manager(mixing animation).
|
- Viewing animation shape (loading .anim, .skel, .swt files) using playlist or slot manager(mixing animation).
|
||||||
- Create and modify NeL particle system.
|
- Create and modify NeL particle system.
|
||||||
- Viewing water shape with the ability to set day/night.
|
- Viewing water shape with the ability to set day/night.
|
||||||
- Modify skeleton (.skel files, .scale file).
|
- Modify skeleton (.skel files, .scale file).
|
||||||
- Create and modify micro-vegetation material (.vegetset files)
|
- Create and modify micro-vegetation material (.vegetset files)
|
||||||
|
@ -18,58 +18,58 @@ The tool can be used in different tasks:
|
||||||
|
|
||||||
@section project_structure Overview of the Object Viewer Qt Project Structure
|
@section project_structure Overview of the Object Viewer Qt Project Structure
|
||||||
@details
|
@details
|
||||||
OVQT - consists of several major subsystems. Each subsystem performs its defined part of the task.
|
OVQT - consists of several major subsystems. Each subsystem performs its defined part of the task.
|
||||||
Through Modules:: provides access to all other program subsystems.
|
Through Modules:: provides access to all other program subsystems.
|
||||||
|
|
||||||
Program has the following subsystems:
|
Program has the following subsystems:
|
||||||
- @ref Modules - Main modules aggregated all parts of the program.
|
- @ref Modules - Main modules aggregated all parts of the program.
|
||||||
- @ref NLQT::CConfiguration - is responsible for loading and saving settings from the configuration file. As well as search path of data.
|
- @ref NLQT::CConfiguration - is responsible for loading and saving settings from the configuration file. As well as search path of data.
|
||||||
- @ref NLQT::CObjectViewer - main subsystem of the program, which initializes the driver, creates a scene and other supporting elements.
|
- @ref NLQT::CObjectViewer - main subsystem of the program, which initializes the driver, creates a scene and other supporting elements.
|
||||||
It is a container for loaded models, which can further be viewed and animated.
|
It is a container for loaded models, which can further be viewed and animated.
|
||||||
- @ref NLQT::CMainWindow - is responsible for the GUI.
|
- @ref NLQT::CMainWindow - is responsible for the GUI.
|
||||||
- @ref NLQT::CParticleEditor - is responsible for the particle systems and provides access to a container that keeps all the loaded particle systems.
|
- @ref NLQT::CParticleEditor - is responsible for the particle systems and provides access to a container that keeps all the loaded particle systems.
|
||||||
And also allows you to view an animation of particle systems, with the ability to control its parameters.
|
And also allows you to view an animation of particle systems, with the ability to control its parameters.
|
||||||
- @ref NLQT::CVegetableEditor - is responsible for the landscape zones and the editor of vegetation.
|
- @ref NLQT::CVegetableEditor - is responsible for the landscape zones and the editor of vegetation.
|
||||||
Allows you to load and view the landscape. Also has the ability to create and edit the parameters of the micro-vegetation.
|
Allows you to load and view the landscape. Also has the ability to create and edit the parameters of the micro-vegetation.
|
||||||
- @ref NLQT::CSoundSystem - is responsible for the sound in the program.
|
- @ref NLQT::CSoundSystem - is responsible for the sound in the program.
|
||||||
|
|
||||||
<b>
|
<b>
|
||||||
The structure of the GUI in the editor of the particles.
|
The structure of the GUI in the editor of the particles.
|
||||||
</b><br>
|
</b><br>
|
||||||
This can be useful for new developers who want to add more new dialogs or to improve the functionality of existing dialogues.
|
This can be useful for new developers who want to add more new dialogs or to improve the functionality of existing dialogues.
|
||||||
<img src="gui_struct.png" alt="Particle Workspace">
|
<img src="gui_struct.png" alt="Particle Workspace">
|
||||||
ParticleWorkspace dialogue uses the technique of model-view.
|
ParticleWorkspace dialogue uses the technique of model-view.
|
||||||
Using the signal/slot link QTreeView with QStackWidget, Editor properties dialog.
|
Using the signal/slot link QTreeView with QStackWidget, Editor properties dialog.
|
||||||
When you select an item in QTreeView, QStackWidget displays the necessary page(PageWidget) where you can edit the element of the particles system.
|
When you select an item in QTreeView, QStackWidget displays the necessary page(PageWidget) where you can edit the element of the particles system.
|
||||||
Each page is made in the designer and has a separate forms(.ui).
|
Each page is made in the designer and has a separate forms(.ui).
|
||||||
In accordance with the recommendations of dialogues design, with a large number of items,every page uses QTabWidget.
|
In accordance with the recommendations of dialogues design, with a large number of items,every page uses QTabWidget.
|
||||||
In case when there is a great number of controls, and not everything you want to display,
|
In case when there is a great number of controls, and not everything you want to display,
|
||||||
it's used the dynamic creation of tabs. Moreover, each tab uses a separate forms(.ui).
|
it's used the dynamic creation of tabs. Moreover, each tab uses a separate forms(.ui).
|
||||||
|
|
||||||
@section for_new_developer Guide for new developers of the Object Viewer Qt.
|
@section for_new_developer Guide for new developers of the Object Viewer Qt.
|
||||||
@details
|
@details
|
||||||
First of all, to begin developing dialogues that add new features ovqt,
|
First of all, to begin developing dialogues that add new features ovqt,
|
||||||
it is needed to read the documentation Qt libs (http://doc.qt.nokia.com/) and NeL documentation.
|
it is needed to read the documentation Qt libs (http://doc.qt.nokia.com/) and NeL documentation.
|
||||||
|
|
||||||
In order to have convenient using of the tool and its further development,
|
In order to have convenient using of the tool and its further development,
|
||||||
it is expected to make a unified interface that is why all dialogs should adhere to a standard design,
|
it is expected to make a unified interface that is why all dialogs should adhere to a standard design,
|
||||||
which will be written further. For this goals program provides some additional widgets,
|
which will be written further. For this goals program provides some additional widgets,
|
||||||
which are recommended to use. As in the development Qt Designer is actively used.
|
which are recommended to use. As in the development Qt Designer is actively used.
|
||||||
To get access to founded here widgets from the designer,the technique promotion is used,
|
To get access to founded here widgets from the designer,the technique promotion is used,
|
||||||
which can be found <a href="http://doc.qt.nokia.com/4.5/designer-using-custom-widgets.html"> here </a>.
|
which can be found <a href="http://doc.qt.nokia.com/4.5/designer-using-custom-widgets.html"> here </a>.
|
||||||
<ol>
|
<ol>
|
||||||
<li><b>
|
<li><b>
|
||||||
CEditRangeUIntWidget / CEditRangeIntWidget / CEditRangeFloatWidget
|
CEditRangeUIntWidget / CEditRangeIntWidget / CEditRangeFloatWidget
|
||||||
</b><br>
|
</b><br>
|
||||||
Widgets provides a slider that allows you to specify an integer (or float, depending on which widget used) number within a set range.
|
Widgets provides a slider that allows you to specify an integer (or float, depending on which widget used) number within a set range.
|
||||||
The range is also can be set by the user, or for a more accurate selection of numbers, either for receiving large values.
|
The range is also can be set by the user, or for a more accurate selection of numbers, either for receiving large values.
|
||||||
As there may be situations when the range that a user requests,has to be restricted, and widget provides methods that allow you to do so.
|
As there may be situations when the range that a user requests,has to be restricted, and widget provides methods that allow you to do so.
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="cedit_range_int_widget.png" alt="CEditRangeIntWidget">
|
<img src="cedit_range_int_widget.png" alt="CEditRangeIntWidget">
|
||||||
<br>
|
<br>
|
||||||
<img src="cedit_range_float_widget.png" alt="CEditRangeFloatWidget">
|
<img src="cedit_range_float_widget.png" alt="CEditRangeFloatWidget">
|
||||||
@see
|
@see
|
||||||
@ref NLQT::CEditRangeUIntWidget, @ref NLQT::CEditRangeIntWidget, @ref NLQT::CEditRangeFloatWidget
|
@ref NLQT::CEditRangeUIntWidget, @ref NLQT::CEditRangeIntWidget, @ref NLQT::CEditRangeFloatWidget
|
||||||
|
|
||||||
<li><b>
|
<li><b>
|
||||||
CColorEditWidget
|
CColorEditWidget
|
||||||
|
@ -81,46 +81,46 @@ Using this widget you can set the color(RGBA) using the four sliders or through
|
||||||
@ref NLQT::CColorEditWidget
|
@ref NLQT::CColorEditWidget
|
||||||
|
|
||||||
<li><b>
|
<li><b>
|
||||||
CDirectionWidget
|
CDirectionWidget
|
||||||
</b><br>
|
</b><br>
|
||||||
This widget helps to choose from several preset directions, or to choose a custom one.
|
This widget helps to choose from several preset directions, or to choose a custom one.
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="cdirection_widget.png" alt="CDirectionWidget">
|
<img src="cdirection_widget.png" alt="CDirectionWidget">
|
||||||
@see
|
@see
|
||||||
@ref NLQT::CDirectionWidget
|
@ref NLQT::CDirectionWidget
|
||||||
</ol><br><br>
|
</ol><br><br>
|
||||||
|
|
||||||
To further convinience of instrument using dialogues interface is recommended to make as follows.
|
To further convinience of instrument using dialogues interface is recommended to make as follows.
|
||||||
The most sophisticated tools of the program, should take the form of three dock windows (example shown in the screenshot).
|
The most sophisticated tools of the program, should take the form of three dock windows (example shown in the screenshot).
|
||||||
<img src="object_viewer_qt_window.png" alt="Object Viewer Qt">
|
<img src="object_viewer_qt_window.png" alt="Object Viewer Qt">
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
The first dock window - is a control dock window, it should focus all of the control functions of general purpose
|
The first dock window - is a control dock window, it should focus all of the control functions of general purpose
|
||||||
(for example: start/stop/pause animations or particles system).
|
(for example: start/stop/pause animations or particles system).
|
||||||
It is recommended to perform of the horizontal type window and placed in the bottom of the main window.
|
It is recommended to perform of the horizontal type window and placed in the bottom of the main window.
|
||||||
<li>
|
<li>
|
||||||
The second dock window - is a list or a tree of items. In which selecting of the current element,
|
The second dock window - is a list or a tree of items. In which selecting of the current element,
|
||||||
which assumes to modify or viewis possible.Operations "add/remove/insert or other" items are recommended to make as a popur menu.
|
which assumes to modify or viewis possible.Operations "add/remove/insert or other" items are recommended to make as a popur menu.
|
||||||
It is recommended to perform of the vertical type window and placed in the left of the main window.
|
It is recommended to perform of the vertical type window and placed in the left of the main window.
|
||||||
<li>
|
<li>
|
||||||
The third dock - is an editor for properties of the element that was selected in the list or in the tree of elements.
|
The third dock - is an editor for properties of the element that was selected in the list or in the tree of elements.
|
||||||
As all the controls occupy much space or do not fit at all, you have to use tabs QTabWidget,
|
As all the controls occupy much space or do not fit at all, you have to use tabs QTabWidget,
|
||||||
which in total can contains quite a lot of elements.
|
which in total can contains quite a lot of elements.
|
||||||
For a small number of tabs it is allowed to use both horizontal and vertical location.
|
For a small number of tabs it is allowed to use both horizontal and vertical location.
|
||||||
But with a large number of tabs, it is necessary to apply the vertical arrangement.
|
But with a large number of tabs, it is necessary to apply the vertical arrangement.
|
||||||
It is recommended to perform of the vertical type of window and placed in the right of the main window.
|
It is recommended to perform of the vertical type of window and placed in the right of the main window.
|
||||||
</ol>
|
</ol>
|
||||||
In the simple dialogues do not necessary to use all three windows, but user has to adhere to the recommendations given above as well.
|
In the simple dialogues do not necessary to use all three windows, but user has to adhere to the recommendations given above as well.
|
||||||
Also, <b>all dialogs must use the qt layout manager</b>. And if you do not use the designer,
|
Also, <b>all dialogs must use the qt layout manager</b>. And if you do not use the designer,
|
||||||
make sure you use the qt tools internationalization applications.
|
make sure you use the qt tools internationalization applications.
|
||||||
<br><br>
|
<br><br>
|
||||||
In ovqt for most dialogs their owner is NLQT::CMainWindow and in its methods creating and initializing all dependent dialogs occur.
|
In ovqt for most dialogs their owner is NLQT::CMainWindow and in its methods creating and initializing all dependent dialogs occur.
|
||||||
For the convenience of the program using, most dialogues are created in the form of docking windows.
|
For the convenience of the program using, most dialogues are created in the form of docking windows.
|
||||||
Creating all the dialogues are carried out in a private method NLQT::CMainWindow::createDialogs().
|
Creating all the dialogues are carried out in a private method NLQT::CMainWindow::createDialogs().
|
||||||
Hence, it is necessary to add operations in this method to create new dialogues.
|
Hence, it is necessary to add operations in this method to create new dialogues.
|
||||||
But we must take into account that at this moment is fully available only one component of the program CConfiguration,
|
But we must take into account that at this moment is fully available only one component of the program CConfiguration,
|
||||||
to read the settings from the configuration file. The remaining components of the program are available only after the main window stays visible.
|
to read the settings from the configuration file. The remaining components of the program are available only after the main window stays visible.
|
||||||
Calling the dialogues going through the menu or the toolbar, usually it is a checkable item.
|
Calling the dialogues going through the menu or the toolbar, usually it is a checkable item.
|
||||||
Adding of the new menu items or items toolbars is need in methods NLQT::CMainWindow::createMenus(), NLQT::CMainWindow::createToolBars().
|
Adding of the new menu items or items toolbars is need in methods NLQT::CMainWindow::createMenus(), NLQT::CMainWindow::createToolBars().
|
||||||
|
|
||||||
@section license_ovqt License Object Viewer Qt
|
@section license_ovqt License Object Viewer Qt
|
||||||
|
|
|
@ -26,19 +26,20 @@
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/vector.h>
|
#include <nel/misc/vector.h>
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CDirectionWidget::CDirectionWidget(QWidget *parent)
|
CDirectionWidget::CDirectionWidget(QWidget *parent)
|
||||||
: QWidget(parent), _globalName("")
|
: QWidget(parent), _globalName("")
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.xzWidget->setMode(Mode::Direction);
|
_ui.xzWidget->setMode(Mode::Direction);
|
||||||
_ui.yzWidget->setMode(Mode::Direction);
|
_ui.yzWidget->setMode(Mode::Direction);
|
||||||
_ui.xzWidget->setText("XZ");
|
_ui.xzWidget->setText("XZ");
|
||||||
_ui.yzWidget->setText("YZ");
|
_ui.yzWidget->setText("YZ");
|
||||||
_ui.globalPushButton->hide();
|
_ui.globalPushButton->hide();
|
||||||
|
|
||||||
connect(_ui.globalPushButton ,SIGNAL(clicked()), this, SLOT(setGlobalDirection()));
|
connect(_ui.globalPushButton ,SIGNAL(clicked()), this, SLOT(setGlobalDirection()));
|
||||||
connect(_ui.incVecIPushButton ,SIGNAL(clicked()), this, SLOT(incVecI()));
|
connect(_ui.incVecIPushButton ,SIGNAL(clicked()), this, SLOT(incVecI()));
|
||||||
connect(_ui.incVecJPushButton ,SIGNAL(clicked()), this, SLOT(incVecJ()));
|
connect(_ui.incVecJPushButton ,SIGNAL(clicked()), this, SLOT(incVecJ()));
|
||||||
|
@ -46,10 +47,10 @@ CDirectionWidget::CDirectionWidget(QWidget *parent)
|
||||||
connect(_ui.decVecIPushButton ,SIGNAL(clicked()), this, SLOT(decVecI()));
|
connect(_ui.decVecIPushButton ,SIGNAL(clicked()), this, SLOT(decVecI()));
|
||||||
connect(_ui.decVecJPushButton ,SIGNAL(clicked()), this, SLOT(decVecJ()));
|
connect(_ui.decVecJPushButton ,SIGNAL(clicked()), this, SLOT(decVecJ()));
|
||||||
connect(_ui.decVecKPushButton ,SIGNAL(clicked()), this, SLOT(decVecK()));
|
connect(_ui.decVecKPushButton ,SIGNAL(clicked()), this, SLOT(decVecK()));
|
||||||
|
|
||||||
connect(_ui.xzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecXZ(float,float)));
|
connect(_ui.xzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecXZ(float,float)));
|
||||||
connect(_ui.yzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecYZ(float,float)));
|
connect(_ui.yzWidget, SIGNAL(applyNewVector(float,float)), this, SLOT(setNewVecYZ(float,float)));
|
||||||
|
|
||||||
// Set default value +K
|
// Set default value +K
|
||||||
setValue(NLMISC::CVector::K);
|
setValue(NLMISC::CVector::K);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +73,7 @@ void CDirectionWidget::setValue(const NLMISC::CVector &value, bool emit)
|
||||||
_ui.xzWidget->repaint();
|
_ui.xzWidget->repaint();
|
||||||
_ui.yzWidget->repaint();
|
_ui.yzWidget->repaint();
|
||||||
|
|
||||||
if (emit)
|
if (emit)
|
||||||
{
|
{
|
||||||
Q_EMIT valueChanged(_value);
|
Q_EMIT valueChanged(_value);
|
||||||
}
|
}
|
||||||
|
@ -81,10 +82,10 @@ void CDirectionWidget::setValue(const NLMISC::CVector &value, bool emit)
|
||||||
void CDirectionWidget::setGlobalName(const QString &globalName, bool emit)
|
void CDirectionWidget::setGlobalName(const QString &globalName, bool emit)
|
||||||
{
|
{
|
||||||
_globalName = globalName;
|
_globalName = globalName;
|
||||||
|
|
||||||
_ui.xzWidget->setVisible(_globalName.isEmpty());
|
_ui.xzWidget->setVisible(_globalName.isEmpty());
|
||||||
_ui.yzWidget->setVisible(_globalName.isEmpty());
|
_ui.yzWidget->setVisible(_globalName.isEmpty());
|
||||||
|
|
||||||
_ui.incVecIPushButton->setEnabled(_globalName.isEmpty());
|
_ui.incVecIPushButton->setEnabled(_globalName.isEmpty());
|
||||||
_ui.incVecJPushButton->setEnabled(_globalName.isEmpty());
|
_ui.incVecJPushButton->setEnabled(_globalName.isEmpty());
|
||||||
_ui.incVecKPushButton->setEnabled(_globalName.isEmpty());
|
_ui.incVecKPushButton->setEnabled(_globalName.isEmpty());
|
||||||
|
@ -100,10 +101,10 @@ void CDirectionWidget::setGlobalDirection()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QString text = QInputDialog::getText(this, tr("Enter Name"),
|
QString text = QInputDialog::getText(this, tr("Enter Name"),
|
||||||
"", QLineEdit::Normal,
|
"", QLineEdit::Normal,
|
||||||
QString(_globalName), &ok);
|
QString(_globalName), &ok);
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
setGlobalName(text);
|
setGlobalName(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,20 +142,20 @@ void CDirectionWidget::setNewVecXZ(float x, float y)
|
||||||
{
|
{
|
||||||
const float epsilon = 10E-3f;
|
const float epsilon = 10E-3f;
|
||||||
NLMISC::CVector v = _value;
|
NLMISC::CVector v = _value;
|
||||||
|
|
||||||
v.x = x;
|
v.x = x;
|
||||||
v.z = y;
|
v.z = y;
|
||||||
|
|
||||||
float d = v.x * v.x + v.z * v.z;
|
float d = v.x * v.x + v.z * v.z;
|
||||||
float f;
|
float f;
|
||||||
if (fabs(d) > epsilon)
|
if (fabs(d) > epsilon)
|
||||||
f = sqrt((1.f - v.y * v.y) / d);
|
f = sqrt((1.f - v.y * v.y) / d);
|
||||||
else
|
else
|
||||||
f = 1;
|
f = 1;
|
||||||
|
|
||||||
v.x *= f;
|
v.x *= f;
|
||||||
v.z *= f;
|
v.z *= f;
|
||||||
|
|
||||||
v.normalize();
|
v.normalize();
|
||||||
|
|
||||||
setValue(v);
|
setValue(v);
|
||||||
|
@ -164,20 +165,20 @@ void CDirectionWidget::setNewVecYZ(float x, float y)
|
||||||
{
|
{
|
||||||
const float epsilon = 10E-3f;
|
const float epsilon = 10E-3f;
|
||||||
NLMISC::CVector v = _value;
|
NLMISC::CVector v = _value;
|
||||||
|
|
||||||
v.y = x;
|
v.y = x;
|
||||||
v.z = y;
|
v.z = y;
|
||||||
|
|
||||||
float d = v.y * v.y + v.z * v.z;
|
float d = v.y * v.y + v.z * v.z;
|
||||||
float f;
|
float f;
|
||||||
if (fabs(d) > epsilon)
|
if (fabs(d) > epsilon)
|
||||||
f = sqrt((1.f - v.x * v.x) / d);
|
f = sqrt((1.f - v.x * v.x) / d);
|
||||||
else
|
else
|
||||||
f = 1;
|
f = 1;
|
||||||
|
|
||||||
v.y *= f;
|
v.y *= f;
|
||||||
v.z *= f;
|
v.z *= f;
|
||||||
|
|
||||||
v.normalize();
|
v.normalize();
|
||||||
|
|
||||||
setValue(v);
|
setValue(v);
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CDirectionWidget
|
@class CDirectionWidget
|
||||||
|
@ -38,12 +39,12 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CDirectionWidget: public QWidget
|
class CDirectionWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDirectionWidget(QWidget *parent = 0);
|
CDirectionWidget(QWidget *parent = 0);
|
||||||
~CDirectionWidget();
|
~CDirectionWidget();
|
||||||
|
|
||||||
void enabledGlobalVariable(bool enabled);
|
void enabledGlobalVariable(bool enabled);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
@ -64,13 +65,13 @@ private Q_SLOTS:
|
||||||
void decVecK();
|
void decVecK();
|
||||||
void setNewVecXZ(float x, float y);
|
void setNewVecXZ(float x, float y);
|
||||||
void setNewVecYZ(float x, float y);
|
void setNewVecYZ(float x, float y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NLMISC::CVector _value;
|
NLMISC::CVector _value;
|
||||||
QString _globalName;
|
QString _globalName;
|
||||||
|
|
||||||
Ui::CDirectionWidget _ui;
|
Ui::CDirectionWidget _ui;
|
||||||
|
|
||||||
}; /* class CDirectionWidget */
|
}; /* class CDirectionWidget */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -34,23 +34,23 @@ using namespace NL3D;
|
||||||
|
|
||||||
|
|
||||||
/** This can duplicate any serializable type by using a serialization policy (polymorphic, non polymorphic ..)
|
/** This can duplicate any serializable type by using a serialization policy (polymorphic, non polymorphic ..)
|
||||||
* The serialization policy must have a method to serial a pointer on the object (see example below)
|
* The serialization policy must have a method to serial a pointer on the object (see example below)
|
||||||
* NB : of course this is slow (but convenient) way of performing a copy
|
* NB : of course this is slow (but convenient) way of performing a copy
|
||||||
* TODO maybe this could be used elsewhere ?
|
* TODO maybe this could be used elsewhere ?
|
||||||
*/
|
*/
|
||||||
template <class TSerializePolicy, typename T>
|
template <class TSerializePolicy, typename T>
|
||||||
static T *DupSerializable(const T *in) throw(NLMISC::EStream)
|
static T *DupSerializable(const T *in) throw(NLMISC::EStream)
|
||||||
{
|
{
|
||||||
NLMISC::CMemStream ms;
|
NLMISC::CMemStream ms;
|
||||||
nlassert(!ms.isReading());
|
nlassert(!ms.isReading());
|
||||||
T *nonConstIn = const_cast<T *>(in);
|
T *nonConstIn = const_cast<T *>(in);
|
||||||
TSerializePolicy::serial(nonConstIn, ms);
|
TSerializePolicy::serial(nonConstIn, ms);
|
||||||
std::vector<uint8> datas(ms.length());
|
std::vector<uint8> datas(ms.length());
|
||||||
std::copy(ms.buffer(), ms.buffer() + ms.length(), datas.begin());
|
std::copy(ms.buffer(), ms.buffer() + ms.length(), datas.begin());
|
||||||
ms.resetPtrTable();
|
ms.resetPtrTable();
|
||||||
ms.invert();
|
ms.invert();
|
||||||
ms.fill(&datas[0], (uint)datas.size());
|
ms.fill(&datas[0], (uint)datas.size());
|
||||||
nlassert(ms.isReading());
|
nlassert(ms.isReading());
|
||||||
T *newObj = NULL;
|
T *newObj = NULL;
|
||||||
TSerializePolicy::serial(newObj, ms);
|
TSerializePolicy::serial(newObj, ms);
|
||||||
return newObj;
|
return newObj;
|
||||||
|
@ -62,7 +62,7 @@ struct CDupObjPolicy
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void serial(T *&obj, NLMISC::IStream &dest) throw(NLMISC::EStream)
|
static void serial(T *&obj, NLMISC::IStream &dest) throw(NLMISC::EStream)
|
||||||
{
|
{
|
||||||
dest.serialPtr(obj);
|
dest.serialPtr(obj);
|
||||||
/*if (dest.isReading())
|
/*if (dest.isReading())
|
||||||
{
|
{
|
||||||
|
@ -72,10 +72,10 @@ struct CDupObjPolicy
|
||||||
obj = newObj.release();
|
obj = newObj.release();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
obj->serial(dest);
|
obj->serial(dest);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A policy to duplicate a polymorphic type
|
/** A policy to duplicate a polymorphic type
|
||||||
|
@ -84,8 +84,8 @@ struct CDupPolymorphicObjPolicy
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void serial(T *&obj, NLMISC::IStream &dest) throw(NLMISC::EStream)
|
static void serial(T *&obj, NLMISC::IStream &dest) throw(NLMISC::EStream)
|
||||||
{
|
{
|
||||||
dest.serialPolyPtr(obj);
|
dest.serialPolyPtr(obj);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,10 +111,10 @@ NL3D::CParticleSystemProcess *DupPSLocated(const CParticleSystemProcess *in)
|
||||||
/** Duplicate the system, and detach.
|
/** 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...)
|
* 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()));
|
std::auto_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(in->getOwner()));
|
||||||
// scene pointer is not serialised, but 'detach' may need the scene to be specified
|
// scene pointer is not serialised, but 'detach' may need the scene to be specified
|
||||||
newPS->setScene(in->getOwner()->getScene());
|
newPS->setScene(in->getOwner()->getScene());
|
||||||
return newPS->detach(index);
|
return newPS->detach(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NLMISC::EStream &e)
|
catch (NLMISC::EStream &e)
|
||||||
|
@ -141,13 +141,13 @@ NL3D::CPSLocatedBindable *DupPSLocatedBindable(CPSLocatedBindable *in)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CParticleSystem *srcPS = in->getOwner()->getOwner();
|
CParticleSystem *srcPS = in->getOwner()->getOwner();
|
||||||
std::auto_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS));
|
std::auto_ptr<CParticleSystem> newPS(DupSerializable<CDupObjPolicy>(srcPS));
|
||||||
// scene pointer is not serialised, but 'detach' may need the scene to be specified
|
// scene pointer is not serialised, but 'detach' may need the scene to be specified
|
||||||
newPS->setScene(in->getOwner()->getOwner()->getScene());
|
newPS->setScene(in->getOwner()->getOwner()->getScene());
|
||||||
//
|
//
|
||||||
uint index = srcPS->getIndexOf(*(in->getOwner()));
|
uint index = srcPS->getIndexOf(*(in->getOwner()));
|
||||||
uint subIndex = in->getOwner()->getIndexOf(in);
|
uint subIndex = in->getOwner()->getIndexOf(in);
|
||||||
//
|
//
|
||||||
newPS->setScene(in->getOwner()->getScene()); // 'unbind' require the scene to be attached
|
newPS->setScene(in->getOwner()->getScene()); // 'unbind' require the scene to be attached
|
||||||
CPSLocated *loc = NLMISC::safe_cast<CPSLocated *>(newPS->getProcess(index));
|
CPSLocated *loc = NLMISC::safe_cast<CPSLocated *>(newPS->getProcess(index));
|
||||||
return loc->unbind(subIndex);
|
return loc->unbind(subIndex);
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CParticleSystemProcess;
|
class CParticleSystemProcess;
|
||||||
class CPSLocatedBindable;
|
class CPSLocatedBindable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace NL3D
|
||||||
* return NULL if the copy failed
|
* return NULL if the copy failed
|
||||||
*/
|
*/
|
||||||
NL3D::CParticleSystemProcess *DupPSLocated(const NL3D::CParticleSystemProcess *in);
|
NL3D::CParticleSystemProcess *DupPSLocated(const NL3D::CParticleSystemProcess *in);
|
||||||
|
|
||||||
/** temp : duplicate a located bindable of a particle system
|
/** temp : duplicate a located bindable of a particle system
|
||||||
* return NULL if the copy failed
|
* return NULL if the copy failed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,12 +28,13 @@
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
const int max_range = 9999;
|
const int max_range = 9999;
|
||||||
|
|
||||||
CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
|
CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
|
||||||
: QWidget(parent), _Wrapper(NULL), _emit(true)
|
: QWidget(parent), _Wrapper(NULL), _emit(true)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ CEditRangeUIntWidget::CEditRangeUIntWidget(QWidget *parent)
|
||||||
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinimum(int)));
|
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinimum(int)));
|
||||||
connect(_ui.endSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMaximum(int)));
|
connect(_ui.endSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMaximum(int)));
|
||||||
connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(changeSlider(int)));
|
connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(changeSlider(int)));
|
||||||
|
|
||||||
setValue(0, false);
|
setValue(0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,13 +143,13 @@ void CEditRangeUIntWidget::updateUi()
|
||||||
}
|
}
|
||||||
|
|
||||||
CEditRangeIntWidget::CEditRangeIntWidget(QWidget *parent)
|
CEditRangeIntWidget::CEditRangeIntWidget(QWidget *parent)
|
||||||
: QWidget(parent), _Wrapper(NULL)
|
: QWidget(parent), _Wrapper(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinimum(int)));
|
connect(_ui.startSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinimum(int)));
|
||||||
connect(_ui.endSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMaximum(int)));
|
connect(_ui.endSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMaximum(int)));
|
||||||
connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(changeSlider(int)));
|
connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(changeSlider(int)));
|
||||||
|
|
||||||
setValue(0, false);
|
setValue(0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +184,7 @@ void CEditRangeIntWidget::setValue(sint32 value, bool emit)
|
||||||
_ui.endSpinBox->setValue(value);
|
_ui.endSpinBox->setValue(value);
|
||||||
if (value < sint32(_ui.startSpinBox->value()))
|
if (value < sint32(_ui.startSpinBox->value()))
|
||||||
_ui.startSpinBox->setValue(value);
|
_ui.startSpinBox->setValue(value);
|
||||||
|
|
||||||
_emit = emit;
|
_emit = emit;
|
||||||
_ui.horizontalSlider->setValue(value);
|
_ui.horizontalSlider->setValue(value);
|
||||||
_emit = true;
|
_emit = true;
|
||||||
|
@ -331,8 +332,8 @@ void CEditRangeFloatWidget::disableLowerBound(void)
|
||||||
|
|
||||||
void CEditRangeFloatWidget::changeRange()
|
void CEditRangeFloatWidget::changeRange()
|
||||||
{
|
{
|
||||||
if ((_ui.startSpinBox->value() < _ui.currentSpinBox->value()) &&
|
if ((_ui.startSpinBox->value() < _ui.currentSpinBox->value()) &&
|
||||||
(_ui.endSpinBox->value() > _ui.currentSpinBox->value()))
|
(_ui.endSpinBox->value() > _ui.currentSpinBox->value()))
|
||||||
setValue(_ui.currentSpinBox->value(), false);
|
setValue(_ui.currentSpinBox->value(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,13 +342,13 @@ void CEditRangeFloatWidget::changeSlider(int value)
|
||||||
float delta = _ui.endSpinBox->value() - _ui.startSpinBox->value();
|
float delta = _ui.endSpinBox->value() - _ui.startSpinBox->value();
|
||||||
int deltaSlider = _ui.horizontalSlider->maximum() - _ui.horizontalSlider->minimum();
|
int deltaSlider = _ui.horizontalSlider->maximum() - _ui.horizontalSlider->minimum();
|
||||||
float newValue = _ui.startSpinBox->value() + ((delta / deltaSlider) * value);
|
float newValue = _ui.startSpinBox->value() + ((delta / deltaSlider) * value);
|
||||||
|
|
||||||
_ui.currentSpinBox->blockSignals(true);
|
_ui.currentSpinBox->blockSignals(true);
|
||||||
_ui.currentSpinBox->setValue(newValue);
|
_ui.currentSpinBox->setValue(newValue);
|
||||||
_ui.currentSpinBox->blockSignals(false);
|
_ui.currentSpinBox->blockSignals(false);
|
||||||
|
|
||||||
// NeL wrapper
|
// NeL wrapper
|
||||||
if ((_Wrapper != NULL) && (fabs(newValue - _Wrapper->get()) > 0.0001))
|
if ((_Wrapper != NULL) && (fabs(newValue - _Wrapper->get()) > 0.0001))
|
||||||
_Wrapper->setAndUpdateModifiedFlag(newValue);
|
_Wrapper->setAndUpdateModifiedFlag(newValue);
|
||||||
|
|
||||||
if (_emit)
|
if (_emit)
|
||||||
|
|
|
@ -28,18 +28,19 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CEditRangeUIntWidget
|
@class CEditRangeUIntWidget
|
||||||
@brief The widget provides a horizontal slider and 3 QSpinBox(to set start/end value range and сurrent value from this range.).
|
@brief The widget provides a horizontal slider and 3 QSpinBox(to set start/end value range and сurrent value from this range.).
|
||||||
@details Slider sets the uint32 value within a specified range (start/end QSpinBox).
|
@details Slider sets the uint32 value within a specified range (start/end QSpinBox).
|
||||||
The values range can be set through the class methods: setRange() or setRangeMin(), setRangeMax().
|
The values range can be set through the class methods: setRange() or setRangeMin(), setRangeMax().
|
||||||
Or the user input values in the widgets start/end QSpinBox.
|
Or the user input values in the widgets start/end QSpinBox.
|
||||||
Also the range of start/end values can be restricted through the class methods: enableLowerBound(), enableUpperBound()
|
Also the range of start/end values can be restricted through the class methods: enableLowerBound(), enableUpperBound()
|
||||||
this widget can be used by a two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
this widget can be used by a two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
||||||
|
|
||||||
1. Using the Qt Q_SIGNAL/SLOT current value can be set by class methods setValue() and
|
1. Using the Qt Q_SIGNAL/SLOT current value can be set by class methods setValue() and
|
||||||
changes in current value(QSlider or QSpinBox) the signal valueChanged() will be emitted.
|
changes in current value(QSlider or QSpinBox) the signal valueChanged() will be emitted.
|
||||||
|
|
||||||
2. Using wrapper, create wpapper struct, example:
|
2. Using wrapper, create wpapper struct, example:
|
||||||
|
@ -51,13 +52,13 @@ struct CMaxNbParticlesWrapper : public IPSWrapperUInt
|
||||||
void set(const uint32 &v) { Located->setMaxSize(v); }
|
void set(const uint32 &v) { Located->setMaxSize(v); }
|
||||||
} _MaxNbParticlesWrapper;
|
} _MaxNbParticlesWrapper;
|
||||||
@endcode
|
@endcode
|
||||||
to set the current values,it is need to call class methods updateUi();
|
to set the current values,it is need to call class methods updateUi();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CEditRangeUIntWidget: public QWidget
|
class CEditRangeUIntWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructor, sets 0 default current value
|
/// Constructor, sets 0 default current value
|
||||||
CEditRangeUIntWidget(QWidget *parent = 0);
|
CEditRangeUIntWidget(QWidget *parent = 0);
|
||||||
|
@ -67,7 +68,7 @@ public:
|
||||||
/// NB : The 'OwnerNode' field of the wrapper
|
/// NB : The 'OwnerNode' field of the wrapper
|
||||||
void setWrapper(IPSWrapperUInt *wrapper);
|
void setWrapper(IPSWrapperUInt *wrapper);
|
||||||
|
|
||||||
/// Convenience function to set the minimum, and maximum values with a single function call
|
/// Convenience function to set the minimum, and maximum values with a single function call
|
||||||
void setRange(uint32 minValue, uint32 maxValue);
|
void setRange(uint32 minValue, uint32 maxValue);
|
||||||
|
|
||||||
/// Set the minimum value that can take range(slider)
|
/// Set the minimum value that can take range(slider)
|
||||||
|
@ -85,21 +86,21 @@ public:
|
||||||
/// @param lowerBound - minimum value of the range
|
/// @param lowerBound - minimum value of the range
|
||||||
/// @param lowerBoundExcluded - if true then the test is <, otherwise its <=
|
/// @param lowerBoundExcluded - if true then the test is <, otherwise its <=
|
||||||
void enableLowerBound(uint32 lowerBound, bool lowerBoundExcluded);
|
void enableLowerBound(uint32 lowerBound, bool lowerBoundExcluded);
|
||||||
|
|
||||||
/// Disable upper bound usage
|
/// Disable upper bound usage
|
||||||
void disableUpperBound(void);
|
void disableUpperBound(void);
|
||||||
|
|
||||||
/// Disable lower bound usage
|
/// Disable lower bound usage
|
||||||
void disableLowerBound(void);
|
void disableLowerBound(void);
|
||||||
|
|
||||||
/// With changes wrapper to be called for the installation of new range values
|
/// With changes wrapper to be called for the installation of new range values
|
||||||
void updateUi();
|
void updateUi();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged(uint32 value);
|
void valueChanged(uint32 value);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// Set current value
|
/// Set current value
|
||||||
/// @param value - 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
|
/// @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);
|
void setValue(uint32 value, bool emit = true);
|
||||||
|
@ -120,13 +121,13 @@ private:
|
||||||
/**
|
/**
|
||||||
@class CEditRangeIntWidget
|
@class CEditRangeIntWidget
|
||||||
@brief The widget provides a horizontal slider and 3 QSpinBox(to set start/end value range and сurrent value from this range.).
|
@brief The widget provides a horizontal slider and 3 QSpinBox(to set start/end value range and сurrent value from this range.).
|
||||||
@details Slider sets the sint32 value within a specified range (start/end QSpinBox).
|
@details Slider sets the sint32 value within a specified range (start/end QSpinBox).
|
||||||
The values range can be set through the class methods: setRange() or setRangeMin(), setRangeMax().
|
The values range can be set through the class methods: setRange() or setRangeMin(), setRangeMax().
|
||||||
Or the user input values in the widgets start/end QSpinBox.
|
Or the user input values in the widgets start/end QSpinBox.
|
||||||
Also the range of start/end values can be restricted through the class methods: enableLowerBound(), enableUpperBound()
|
Also the range of start/end values can be restricted through the class methods: enableLowerBound(), enableUpperBound()
|
||||||
this widget can be used by a two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
this widget can be used by a two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
||||||
|
|
||||||
1. Using the Qt Q_SIGNAL/SLOT current value can be set by class methods setValue() and
|
1. Using the Qt Q_SIGNAL/SLOT current value can be set by class methods setValue() and
|
||||||
changes in current value(QSlider or QSpinBox) the signal valueChanged() will be emitted.
|
changes in current value(QSlider or QSpinBox) the signal valueChanged() will be emitted.
|
||||||
|
|
||||||
2. Using wrapper, create wpapper struct, example:
|
2. Using wrapper, create wpapper struct, example:
|
||||||
|
@ -138,13 +139,13 @@ struct CRadialViscosityWrapper : public IPSWrapperFloat
|
||||||
void set(const sint32 &value) { V->setRadialViscosity(value); }
|
void set(const sint32 &value) { V->setRadialViscosity(value); }
|
||||||
} _RadialViscosityWrapper;
|
} _RadialViscosityWrapper;
|
||||||
@endcode
|
@endcode
|
||||||
to set the current values,it is need to call class methods updateUi();
|
to set the current values,it is need to call class methods updateUi();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CEditRangeIntWidget: public QWidget
|
class CEditRangeIntWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructor, sets 0 default current value
|
/// Constructor, sets 0 default current value
|
||||||
CEditRangeIntWidget(QWidget *parent = 0);
|
CEditRangeIntWidget(QWidget *parent = 0);
|
||||||
|
@ -153,8 +154,8 @@ public:
|
||||||
/// set an interface of a wrapper to read / write values in the particle system
|
/// set an interface of a wrapper to read / write values in the particle system
|
||||||
/// NB : The 'OwnerNode' field of the wrapper
|
/// NB : The 'OwnerNode' field of the wrapper
|
||||||
void setWrapper(IPSWrapperInt *wrapper);
|
void setWrapper(IPSWrapperInt *wrapper);
|
||||||
|
|
||||||
/// Convenience function to set the minimum, and maximum values with a single function call
|
/// Convenience function to set the minimum, and maximum values with a single function call
|
||||||
void setRange(sint32 minValue, sint32 maxValue);
|
void setRange(sint32 minValue, sint32 maxValue);
|
||||||
|
|
||||||
/// Set the minimum value that can take range(slider)
|
/// Set the minimum value that can take range(slider)
|
||||||
|
@ -162,30 +163,30 @@ public:
|
||||||
|
|
||||||
/// Set the maximum value that can take range(slider)
|
/// Set the maximum value that can take range(slider)
|
||||||
void setRangeMax(sint32 maxValue);
|
void setRangeMax(sint32 maxValue);
|
||||||
|
|
||||||
/// Enable upper bound use (e.g. value must be < or <= upper bound )
|
/// Enable upper bound use (e.g. value must be < or <= upper bound )
|
||||||
/// @param upperBound - maximum value of the range
|
/// @param upperBound - maximum value of the range
|
||||||
/// @param upperBoundExcluded - if true then the test is <, otherwise its <=
|
/// @param upperBoundExcluded - if true then the test is <, otherwise its <=
|
||||||
void enableUpperBound(sint32 upperBound, bool upperBoundExcluded);
|
void enableUpperBound(sint32 upperBound, bool upperBoundExcluded);
|
||||||
|
|
||||||
/// Enable lower bound use (e.g. value must be < or <= lower bound )
|
/// Enable lower bound use (e.g. value must be < or <= lower bound )
|
||||||
/// @param lowerBound - minimum value of the range
|
/// @param lowerBound - minimum value of the range
|
||||||
/// @param lowerBoundExcluded - if true then the test is <, otherwise its <=
|
/// @param lowerBoundExcluded - if true then the test is <, otherwise its <=
|
||||||
void enableLowerBound(sint32 lowerBound, bool lowerBoundExcluded);
|
void enableLowerBound(sint32 lowerBound, bool lowerBoundExcluded);
|
||||||
|
|
||||||
/// Disable upper bound usage
|
/// Disable upper bound usage
|
||||||
void disableUpperBound(void);
|
void disableUpperBound(void);
|
||||||
|
|
||||||
/// Disable lower bound usage
|
/// Disable lower bound usage
|
||||||
void disableLowerBound(void);
|
void disableLowerBound(void);
|
||||||
|
|
||||||
/// With changes wrapper to be called for the installation of new range values
|
/// With changes wrapper to be called for the installation of new range values
|
||||||
void updateUi();
|
void updateUi();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged(sint32 value);
|
void valueChanged(sint32 value);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// Set current value
|
/// Set current value
|
||||||
/// @param value - 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
|
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
|
||||||
|
@ -207,13 +208,13 @@ private:
|
||||||
/**
|
/**
|
||||||
@class CEditRangeFloatWidget
|
@class CEditRangeFloatWidget
|
||||||
@brief The widget provides a horizontal slider and 3 QDoubleSpinBox(to set start/end value range and сurrent value from this range.).
|
@brief The widget provides a horizontal slider and 3 QDoubleSpinBox(to set start/end value range and сurrent value from this range.).
|
||||||
@details Slider sets the float value within a specified range (start/end QDoubleSpinBox).
|
@details Slider sets the float value within a specified range (start/end QDoubleSpinBox).
|
||||||
The values range can be set through the class methods: setRange() or setRangeMin(), setRangeMax().
|
The values range can be set through the class methods: setRange() or setRangeMin(), setRangeMax().
|
||||||
Or the user input values in the widgets start/end QDoubleSpinBox.
|
Or the user input values in the widgets start/end QDoubleSpinBox.
|
||||||
Also the range of start/end values can be restricted through the class methods: enableLowerBound(), enableUpperBound()
|
Also the range of start/end values can be restricted through the class methods: enableLowerBound(), enableUpperBound()
|
||||||
this widget can be used by a two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
this widget can be used by a two ways: Qt Q_SIGNAL/SLOT or wrapper.
|
||||||
|
|
||||||
1. Using the Qt Q_SIGNAL/SLOT current value can be set by class methods setValue() and
|
1. Using the Qt Q_SIGNAL/SLOT current value can be set by class methods setValue() and
|
||||||
changes in current value(only QSlider) the signal valueChanged()will be emitted.
|
changes in current value(only QSlider) the signal valueChanged()will be emitted.
|
||||||
|
|
||||||
2. Using wrapper, create wpapper struct, example:
|
2. Using wrapper, create wpapper struct, example:
|
||||||
|
@ -225,22 +226,22 @@ struct CTangentialViscosityWrapper : public IPSWrapperFloat
|
||||||
void set(const float &value) { V->setTangentialViscosity(value); }
|
void set(const float &value) { V->setTangentialViscosity(value); }
|
||||||
} _TangentialViscosityWrapper;
|
} _TangentialViscosityWrapper;
|
||||||
@endcode
|
@endcode
|
||||||
to set the current values,it is need to call class methods updateUi();
|
to set the current values,it is need to call class methods updateUi();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CEditRangeFloatWidget: public QWidget
|
class CEditRangeFloatWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
/// Constructor, sets 0 default current value
|
/// Constructor, sets 0 default current value
|
||||||
CEditRangeFloatWidget(QWidget *parent = 0);
|
CEditRangeFloatWidget(QWidget *parent = 0);
|
||||||
~CEditRangeFloatWidget();
|
~CEditRangeFloatWidget();
|
||||||
|
|
||||||
/// Set an interface of a wrapper to read / write values in the particle system
|
/// Set an interface of a wrapper to read / write values in the particle system
|
||||||
/// NB : The 'OwnerNode' field of the wrapper
|
/// NB : The 'OwnerNode' field of the wrapper
|
||||||
void setWrapper(IPSWrapperFloat *wrapper);
|
void setWrapper(IPSWrapperFloat *wrapper);
|
||||||
|
|
||||||
/// Convenience function to set the minimum, and maximum values with a single function call
|
/// Convenience function to set the minimum, and maximum values with a single function call
|
||||||
void setRange(float minValue, float maxValue);
|
void setRange(float minValue, float maxValue);
|
||||||
|
|
||||||
/// Set the minimum value that can take range(slider)
|
/// Set the minimum value that can take range(slider)
|
||||||
|
@ -248,12 +249,12 @@ public:
|
||||||
|
|
||||||
/// Set the maximum value that can take range(slider)
|
/// Set the maximum value that can take range(slider)
|
||||||
void setRangeMax(float maxValue);
|
void setRangeMax(float maxValue);
|
||||||
|
|
||||||
/// Enable upper bound use (e.g. value must be < or <= upper bound )
|
/// Enable upper bound use (e.g. value must be < or <= upper bound )
|
||||||
/// @param upperBound - maximum value of the range
|
/// @param upperBound - maximum value of the range
|
||||||
/// @param upperBoundExcluded - if true then the test is <, otherwise its <=
|
/// @param upperBoundExcluded - if true then the test is <, otherwise its <=
|
||||||
void enableUpperBound(float upperBound, bool upperBoundExcluded);
|
void enableUpperBound(float upperBound, bool upperBoundExcluded);
|
||||||
|
|
||||||
/// Enable lower bound use (e.g. value must be < or <= lower bound )
|
/// Enable lower bound use (e.g. value must be < or <= lower bound )
|
||||||
/// @param lowerBound - minimum value of the range
|
/// @param lowerBound - minimum value of the range
|
||||||
/// @param lowerBoundExcluded - if true then the test is <, otherwise its <=
|
/// @param lowerBoundExcluded - if true then the test is <, otherwise its <=
|
||||||
|
@ -271,7 +272,7 @@ public:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged(float value);
|
void valueChanged(float value);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// Set current value
|
/// Set current value
|
||||||
/// @param value - 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
|
/// @param emit - will emit valueChanged() if the new value is different from the old one and param emit = true
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "emitter_page.h"
|
#include "emitter_page.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
|
||||||
|
@ -29,11 +29,12 @@
|
||||||
#include "edit_range_widget.h"
|
#include "edit_range_widget.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CEmitterPage::CEmitterPage(QWidget *parent)
|
CEmitterPage::CEmitterPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ CEmitterPage::CEmitterPage(QWidget *parent)
|
||||||
_ui.genNbWidget->setWrapper(&_GenNbWrapper);
|
_ui.genNbWidget->setWrapper(&_GenNbWrapper);
|
||||||
_ui.genNbWidget->setSchemeWrapper(&_GenNbWrapper);
|
_ui.genNbWidget->setSchemeWrapper(&_GenNbWrapper);
|
||||||
_ui.genNbWidget->init();
|
_ui.genNbWidget->init();
|
||||||
|
|
||||||
// deals with emitters that have a direction
|
// deals with emitters that have a direction
|
||||||
_ui.strenghtModulateWidget->setRange(0, 10);
|
_ui.strenghtModulateWidget->setRange(0, 10);
|
||||||
_ui.strenghtModulateWidget->setWrapper(&_ModulatedStrenghtWrapper);
|
_ui.strenghtModulateWidget->setWrapper(&_ModulatedStrenghtWrapper);
|
||||||
|
@ -58,7 +59,7 @@ CEmitterPage::CEmitterPage(QWidget *parent)
|
||||||
// SPEED_INHERITANCE_FACTOR
|
// SPEED_INHERITANCE_FACTOR
|
||||||
_ui.speedInherFactorWidget->setRange(-1.f, 1.f);
|
_ui.speedInherFactorWidget->setRange(-1.f, 1.f);
|
||||||
//_ui.speedInherFactorWidget->setWrapper(&_SpeedInheritanceFactorWrapper);
|
//_ui.speedInherFactorWidget->setWrapper(&_SpeedInheritanceFactorWrapper);
|
||||||
|
|
||||||
// DELAYED_EMISSION
|
// DELAYED_EMISSION
|
||||||
_ui.delayedEmissionWidget->setRange(0.f, 10.f);
|
_ui.delayedEmissionWidget->setRange(0.f, 10.f);
|
||||||
_ui.delayedEmissionWidget->enableLowerBound(0.f, false);
|
_ui.delayedEmissionWidget->enableLowerBound(0.f, false);
|
||||||
|
@ -66,10 +67,10 @@ CEmitterPage::CEmitterPage(QWidget *parent)
|
||||||
// MAX_EMISSION_COUNT
|
// MAX_EMISSION_COUNT
|
||||||
_ui.maxEmissionCountWidget->setRange(0, 100);
|
_ui.maxEmissionCountWidget->setRange(0, 100);
|
||||||
_ui.maxEmissionCountWidget->enableUpperBound(256, false);
|
_ui.maxEmissionCountWidget->enableUpperBound(256, false);
|
||||||
|
|
||||||
// radius for conic emitter
|
// radius for conic emitter
|
||||||
_ui.radiusWidget->setRange(0.1f, 2.1f);
|
_ui.radiusWidget->setRange(0.1f, 2.1f);
|
||||||
|
|
||||||
connect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
|
connect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
|
||||||
connect(_ui.typeEmissionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTypeOfEmission(int)));
|
connect(_ui.typeEmissionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTypeOfEmission(int)));
|
||||||
connect(_ui.directionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirectionMode(int)));
|
connect(_ui.directionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setDirectionMode(int)));
|
||||||
|
@ -117,8 +118,8 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_ui.strenghtModulateWidget->hide();
|
_ui.strenghtModulateWidget->hide();
|
||||||
|
|
||||||
|
|
||||||
// deals with emitters that have a direction
|
// deals with emitters that have a direction
|
||||||
if (dynamic_cast<NL3D::CPSDirection *>(_Emitter))
|
if (dynamic_cast<NL3D::CPSDirection *>(_Emitter))
|
||||||
{
|
{
|
||||||
|
@ -127,7 +128,7 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_ui.directionWidget->hide();
|
_ui.directionWidget->hide();
|
||||||
|
|
||||||
|
|
||||||
// radius for conic emitter
|
// radius for conic emitter
|
||||||
if (dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter))
|
if (dynamic_cast<NL3D::CPSEmitterConic *>(_Emitter))
|
||||||
|
@ -141,7 +142,7 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
|
||||||
_ui.radiusWidget->hide();
|
_ui.radiusWidget->hide();
|
||||||
_ui.radiusLabel->hide();
|
_ui.radiusLabel->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
_ui.forceConsistentCheckBox->setChecked(_Emitter->isConsistentEmissionEnabled());
|
_ui.forceConsistentCheckBox->setChecked(_Emitter->isConsistentEmissionEnabled());
|
||||||
|
|
||||||
_ui.directionComboBox->blockSignals(true);
|
_ui.directionComboBox->blockSignals(true);
|
||||||
|
@ -170,7 +171,7 @@ void CEmitterPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBind
|
||||||
nlassert(0);
|
nlassert(0);
|
||||||
}
|
}
|
||||||
_ui.directionComboBox->blockSignals(false);
|
_ui.directionComboBox->blockSignals(false);
|
||||||
|
|
||||||
updatePeriodWidget();
|
updatePeriodWidget();
|
||||||
|
|
||||||
_ui.typeEmissionComboBox->setCurrentIndex(int(_Emitter->getEmissionType()));
|
_ui.typeEmissionComboBox->setCurrentIndex(int(_Emitter->getEmissionType()));
|
||||||
|
@ -193,20 +194,20 @@ void CEmitterPage::setEmittedType(int index)
|
||||||
{
|
{
|
||||||
if (_Emitter->getOwner()->getOwner()->getBehaviourType() == NL3D::CParticleSystem::SpellFX || _Emitter->getOwner()->getOwner()->getBypassMaxNumIntegrationSteps())
|
if (_Emitter->getOwner()->getOwner()->getBehaviourType() == NL3D::CParticleSystem::SpellFX || _Emitter->getOwner()->getOwner()->getBypassMaxNumIntegrationSteps())
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL Particle Editor"),
|
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',"
|
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."),
|
"and thus, should have a finite duration. This operation create a loop in the system, and so is forbidden."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL Particle Editor"),
|
QMessageBox::critical(this, tr("NeL Particle Editor"),
|
||||||
tr("Loops with emitters are forbidden."),
|
tr("Loops with emitters are forbidden."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
updateEmittedType();
|
updateEmittedType();
|
||||||
}
|
}
|
||||||
|
|
||||||
Modules::psEdit().resetAutoCount(_Node);
|
Modules::psEdit().resetAutoCount(_Node);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
@ -216,11 +217,11 @@ void CEmitterPage::setTypeOfEmission(int index)
|
||||||
if (_Emitter->getEmissionType() == index) return;
|
if (_Emitter->getEmissionType() == index) return;
|
||||||
if (!_Emitter->setEmissionType((NL3D::CPSEmitter::TEmissionType) index))
|
if (!_Emitter->setEmissionType((NL3D::CPSEmitter::TEmissionType) index))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL Particle Editor"),
|
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', "
|
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."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
|
||||||
_ui.typeEmissionComboBox->setCurrentIndex(int(_Emitter->getEmissionType()));
|
_ui.typeEmissionComboBox->setCurrentIndex(int(_Emitter->getEmissionType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,28 +251,28 @@ void CEmitterPage::setDirectionMode(int index)
|
||||||
nlassert(_Emitter);
|
nlassert(_Emitter);
|
||||||
switch(index)
|
switch(index)
|
||||||
{
|
{
|
||||||
case Default:
|
case Default:
|
||||||
_Emitter->enableSpeedBasisEmission(false);
|
_Emitter->enableSpeedBasisEmission(false);
|
||||||
_Emitter->enableUserMatrixModeForEmissionDirection(false);
|
_Emitter->enableUserMatrixModeForEmissionDirection(false);
|
||||||
break;
|
break;
|
||||||
case AlignOnEmitterDirection:
|
case AlignOnEmitterDirection:
|
||||||
_Emitter->enableSpeedBasisEmission(true);
|
_Emitter->enableSpeedBasisEmission(true);
|
||||||
_Emitter->enableUserMatrixModeForEmissionDirection(false);
|
_Emitter->enableUserMatrixModeForEmissionDirection(false);
|
||||||
break;
|
break;
|
||||||
case InWorld:
|
case InWorld:
|
||||||
_Emitter->enableSpeedBasisEmission(false);
|
_Emitter->enableSpeedBasisEmission(false);
|
||||||
_Emitter->enableUserMatrixModeForEmissionDirection(true);
|
_Emitter->enableUserMatrixModeForEmissionDirection(true);
|
||||||
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSIdentityMatrix);
|
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSIdentityMatrix);
|
||||||
break;
|
break;
|
||||||
case LocalToSystem:
|
case LocalToSystem:
|
||||||
_Emitter->enableSpeedBasisEmission(false);
|
_Emitter->enableSpeedBasisEmission(false);
|
||||||
_Emitter->enableUserMatrixModeForEmissionDirection(true);
|
_Emitter->enableUserMatrixModeForEmissionDirection(true);
|
||||||
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSFXWorldMatrix);
|
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSFXWorldMatrix);
|
||||||
break;
|
break;
|
||||||
case LocalToFatherSkeleton:
|
case LocalToFatherSkeleton:
|
||||||
_Emitter->enableSpeedBasisEmission(false);
|
_Emitter->enableSpeedBasisEmission(false);
|
||||||
_Emitter->enableUserMatrixModeForEmissionDirection(true);
|
_Emitter->enableUserMatrixModeForEmissionDirection(true);
|
||||||
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSUserMatrix);
|
_Emitter->setUserMatrixModeForEmissionDirection(NL3D::PSUserMatrix);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -291,7 +292,7 @@ void CEmitterPage::setConicEmitterRadius(float value)
|
||||||
|
|
||||||
void CEmitterPage::setEmitDelay(float value)
|
void CEmitterPage::setEmitDelay(float value)
|
||||||
{
|
{
|
||||||
_Emitter->setEmitDelay(value);
|
_Emitter->setEmitDelay(value);
|
||||||
Modules::psEdit().resetAutoCount(_Node);
|
Modules::psEdit().resetAutoCount(_Node);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
@ -300,11 +301,11 @@ void CEmitterPage::setMaxEmissionCount(uint32 value)
|
||||||
{
|
{
|
||||||
if (!_Emitter->setMaxEmissionCount((uint8)value))
|
if (!_Emitter->setMaxEmissionCount((uint8)value))
|
||||||
{
|
{
|
||||||
|
|
||||||
QMessageBox::critical(this, tr("NeL Particle Editor"),
|
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', "
|
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."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
|
||||||
_ui.maxEmissionCountWidget->setValue((uint32)_Emitter->getMaxEmissionCount(), false);
|
_ui.maxEmissionCountWidget->setValue((uint32)_Emitter->getMaxEmissionCount(), false);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -321,7 +322,7 @@ void CEmitterPage::setDir(const NLMISC::CVector &value)
|
||||||
void CEmitterPage::updatePeriodWidget()
|
void CEmitterPage::updatePeriodWidget()
|
||||||
{
|
{
|
||||||
bool bEnable = _Emitter->getEmissionType() == NL3D::CPSEmitter::regular;
|
bool bEnable = _Emitter->getEmissionType() == NL3D::CPSEmitter::regular;
|
||||||
|
|
||||||
_ui.periodWidget->setEnabled(bEnable);
|
_ui.periodWidget->setEnabled(bEnable);
|
||||||
_ui.delayedEmissionWidget->setEnabled(bEnable);
|
_ui.delayedEmissionWidget->setEnabled(bEnable);
|
||||||
_ui.delayedEmissionLabel->setEnabled(bEnable);
|
_ui.delayedEmissionLabel->setEnabled(bEnable);
|
||||||
|
@ -332,13 +333,13 @@ void CEmitterPage::updatePeriodWidget()
|
||||||
void CEmitterPage::updateEmittedType()
|
void CEmitterPage::updateEmittedType()
|
||||||
{
|
{
|
||||||
disconnect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
|
disconnect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
|
||||||
|
|
||||||
_ui.emittedTypeComboBox->clear();
|
_ui.emittedTypeComboBox->clear();
|
||||||
_ui.emittedTypeComboBox->addItem(tr("no emission"));
|
_ui.emittedTypeComboBox->addItem(tr("no emission"));
|
||||||
_LocatedList.clear();
|
_LocatedList.clear();
|
||||||
_LocatedList.push_back(NULL);
|
_LocatedList.push_back(NULL);
|
||||||
NL3D::CParticleSystem *ps = _Emitter->getOwner()->getOwner();
|
NL3D::CParticleSystem *ps = _Emitter->getOwner()->getOwner();
|
||||||
uint nbLocated = ps->getNbProcess();
|
uint nbLocated = ps->getNbProcess();
|
||||||
for (uint k = 0; k < nbLocated; ++k)
|
for (uint k = 0; k < nbLocated; ++k)
|
||||||
{
|
{
|
||||||
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
|
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
|
||||||
|
@ -353,25 +354,25 @@ void CEmitterPage::updateEmittedType()
|
||||||
connect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
|
connect(_ui.emittedTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEmittedType(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::CPeriodWrapper::set(const float &v)
|
void CEmitterPage::CPeriodWrapper::set(const float &v)
|
||||||
{
|
{
|
||||||
E->setPeriod(v);
|
E->setPeriod(v);
|
||||||
Modules::psEdit().resetAutoCount(Node);
|
Modules::psEdit().resetAutoCount(Node);
|
||||||
}
|
}
|
||||||
void CEmitterPage::CPeriodWrapper::setScheme(scheme_type *s)
|
void CEmitterPage::CPeriodWrapper::setScheme(scheme_type *s)
|
||||||
{
|
{
|
||||||
E->setPeriodScheme(s);
|
E->setPeriodScheme(s);
|
||||||
Modules::psEdit().resetAutoCount(Node);
|
Modules::psEdit().resetAutoCount(Node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::CGenNbWrapper::set(const uint32 &v)
|
void CEmitterPage::CGenNbWrapper::set(const uint32 &v)
|
||||||
{
|
{
|
||||||
E->setGenNb(v);
|
E->setGenNb(v);
|
||||||
Modules::psEdit().resetAutoCount(Node);
|
Modules::psEdit().resetAutoCount(Node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmitterPage::CGenNbWrapper::setScheme(scheme_type *s)
|
void CEmitterPage::CGenNbWrapper::setScheme(scheme_type *s)
|
||||||
{
|
{
|
||||||
E->setGenNbScheme(s);
|
E->setGenNbScheme(s);
|
||||||
Modules::psEdit().resetAutoCount(Node);
|
Modules::psEdit().resetAutoCount(Node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CEmitterPage
|
@class CEmitterPage
|
||||||
|
@ -41,19 +42,19 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CEmitterPage: public QWidget
|
class CEmitterPage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// This enum match the option in the combo box that allow to choose how the direction of emission is computed.
|
/// This enum match the option in the combo box that allow to choose how the direction of emission is computed.
|
||||||
enum TDirectionMode
|
enum TDirectionMode
|
||||||
{
|
{
|
||||||
Default = 0,
|
Default = 0,
|
||||||
AlignOnEmitterDirection,
|
AlignOnEmitterDirection,
|
||||||
InWorld,
|
InWorld,
|
||||||
LocalToSystem,
|
LocalToSystem,
|
||||||
LocalToFatherSkeleton
|
LocalToFatherSkeleton
|
||||||
};
|
};
|
||||||
|
|
||||||
CEmitterPage(QWidget *parent = 0);
|
CEmitterPage(QWidget *parent = 0);
|
||||||
~CEmitterPage();
|
~CEmitterPage();
|
||||||
|
|
||||||
|
@ -72,39 +73,63 @@ private Q_SLOTS:
|
||||||
void setEmitDelay(float value);
|
void setEmitDelay(float value);
|
||||||
void setMaxEmissionCount(uint32 value);
|
void setMaxEmissionCount(uint32 value);
|
||||||
void setDir(const NLMISC::CVector &value);
|
void setDir(const NLMISC::CVector &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// period of emission
|
/// period of emission
|
||||||
struct CPeriodWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CPeriodWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
CWorkspaceNode *Node;
|
CWorkspaceNode *Node;
|
||||||
NL3D::CPSEmitter *E;
|
NL3D::CPSEmitter *E;
|
||||||
float get(void) const { return E->getPeriod(); }
|
float get(void) const
|
||||||
|
{
|
||||||
|
return E->getPeriod();
|
||||||
|
}
|
||||||
void set(const float &v);
|
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);
|
void setScheme(scheme_type *s);
|
||||||
} _PeriodWrapper;
|
} _PeriodWrapper;
|
||||||
|
|
||||||
/// number of particle to generate each time
|
/// number of particle to generate each time
|
||||||
struct CGenNbWrapper : public IPSWrapperUInt, IPSSchemeWrapperUInt
|
struct CGenNbWrapper : public IPSWrapperUInt, IPSSchemeWrapperUInt
|
||||||
{
|
{
|
||||||
CWorkspaceNode *Node;
|
CWorkspaceNode *Node;
|
||||||
NL3D::CPSEmitter *E;
|
NL3D::CPSEmitter *E;
|
||||||
uint32 get(void) const { return E->getGenNb(); }
|
uint32 get(void) const
|
||||||
|
{
|
||||||
|
return E->getGenNb();
|
||||||
|
}
|
||||||
void set(const uint32 &v);
|
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);
|
void setScheme(scheme_type *s);
|
||||||
} _GenNbWrapper;
|
} _GenNbWrapper;
|
||||||
|
|
||||||
/// wrappers to emitters that have strenght modulation
|
/// wrappers to emitters that have strenght modulation
|
||||||
struct CModulateStrenghtWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CModulateStrenghtWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSModulatedEmitter *E;
|
NL3D::CPSModulatedEmitter *E;
|
||||||
float get(void) const { return E->getEmitteeSpeed(); }
|
float get(void) const
|
||||||
void set(const float &v) { E->setEmitteeSpeed(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return E->getEmitteeSpeedScheme(); }
|
return E->getEmitteeSpeed();
|
||||||
void setScheme(scheme_type *s) { E->setEmitteeSpeedScheme(s); }
|
}
|
||||||
|
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;
|
} _ModulatedStrenghtWrapper;
|
||||||
|
|
||||||
// the emitter being edited
|
// the emitter being edited
|
||||||
|
@ -112,12 +137,15 @@ private:
|
||||||
|
|
||||||
// contains pointers to the located
|
// contains pointers to the located
|
||||||
std::vector<NL3D::CPSLocated *> _LocatedList;
|
std::vector<NL3D::CPSLocated *> _LocatedList;
|
||||||
|
|
||||||
void updateEmittedType();
|
void updateEmittedType();
|
||||||
|
|
||||||
void updatePeriodWidget();
|
void updatePeriodWidget();
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
|
CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
|
||||||
{
|
{
|
||||||
|
@ -61,12 +62,12 @@ CSlotInfo& CSlotInfo::operator=(const CSlotInfo & slotInfo)
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity::CEntity(void):
|
CEntity::CEntity(void):
|
||||||
_Name("<Unknown>"), _FileNameShape(""),
|
_Name("<Unknown>"), _FileNameShape(""),
|
||||||
_FileNameSkeleton(""), _inPlace(false), _incPos(false),
|
_FileNameSkeleton(""), _inPlace(false), _incPos(false),
|
||||||
_Instance(NULL), _Skeleton(NULL),
|
_Instance(NULL), _Skeleton(NULL),
|
||||||
_PlayList(NULL), _AnimationSet(NULL)
|
_PlayList(NULL), _AnimationSet(NULL)
|
||||||
{
|
{
|
||||||
_CharacterScalePos = 1;
|
_CharacterScalePos = 1;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +100,7 @@ CEntity::~CEntity(void)
|
||||||
|
|
||||||
void CEntity::loadAnimation(std::string &fileName)
|
void CEntity::loadAnimation(std::string &fileName)
|
||||||
{
|
{
|
||||||
uint id = _AnimationSet->addAnimation(fileName.c_str(),CFile::getFilenameWithoutExtension(fileName).c_str());
|
uint id = _AnimationSet->addAnimation(fileName.c_str(),CFile::getFilenameWithoutExtension(fileName).c_str());
|
||||||
_AnimationList.push_back(_AnimationSet->getAnimationName(id));
|
_AnimationList.push_back(_AnimationSet->getAnimationName(id));
|
||||||
_AnimationSet->build();
|
_AnimationSet->build();
|
||||||
if (!_Skeleton.empty()) _PlayList->registerTransform(_Skeleton);
|
if (!_Skeleton.empty()) _PlayList->registerTransform(_Skeleton);
|
||||||
|
@ -115,30 +116,30 @@ void CEntity::loadSWT(std::string &fileName)
|
||||||
void CEntity::addAnimToPlayList(std::string &name)
|
void CEntity::addAnimToPlayList(std::string &name)
|
||||||
{
|
{
|
||||||
_PlayListAnimation.push_back(name);
|
_PlayListAnimation.push_back(name);
|
||||||
|
|
||||||
_AnimationStatus.EndAnim = this->getPlayListLength();
|
_AnimationStatus.EndAnim = this->getPlayListLength();
|
||||||
|
|
||||||
_Instance.start();
|
_Instance.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntity::removeAnimToPlayList(uint row)
|
void CEntity::removeAnimToPlayList(uint row)
|
||||||
{
|
{
|
||||||
if (row < _PlayListAnimation.size())
|
if (row < _PlayListAnimation.size())
|
||||||
_PlayListAnimation.erase(_PlayListAnimation.begin() + row);
|
_PlayListAnimation.erase(_PlayListAnimation.begin() + row);
|
||||||
|
|
||||||
_AnimationStatus.EndAnim = this->getPlayListLength();
|
_AnimationStatus.EndAnim = this->getPlayListLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntity::swapAnimToPlayList(uint row1, uint row2)
|
void CEntity::swapAnimToPlayList(uint row1, uint row2)
|
||||||
{
|
{
|
||||||
if ((row1 < _PlayListAnimation.size()) && (row2 < _PlayListAnimation.size()))
|
if ((row1 < _PlayListAnimation.size()) && (row2 < _PlayListAnimation.size()))
|
||||||
std::swap(_PlayListAnimation[row1], _PlayListAnimation[row2]);
|
std::swap(_PlayListAnimation[row1], _PlayListAnimation[row2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntity::playbackAnim(bool play)
|
void CEntity::playbackAnim(bool play)
|
||||||
{
|
{
|
||||||
_AnimationStatus.PlayAnim = play;
|
_AnimationStatus.PlayAnim = play;
|
||||||
|
|
||||||
if (play)
|
if (play)
|
||||||
_Instance.start();
|
_Instance.start();
|
||||||
else
|
else
|
||||||
|
@ -150,7 +151,7 @@ void CEntity::reset()
|
||||||
_PlayListAnimation.clear();
|
_PlayListAnimation.clear();
|
||||||
_AnimationList.clear();
|
_AnimationList.clear();
|
||||||
_SWTList.clear();
|
_SWTList.clear();
|
||||||
|
|
||||||
_PlayList->resetAllChannels();
|
_PlayList->resetAllChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,14 +174,14 @@ float CEntity::getAnimLength(std::string name)
|
||||||
void CEntity::update(NL3D::TAnimationTime time)
|
void CEntity::update(NL3D::TAnimationTime time)
|
||||||
{
|
{
|
||||||
this->resetChannel();
|
this->resetChannel();
|
||||||
switch (_AnimationStatus.Mode)
|
switch (_AnimationStatus.Mode)
|
||||||
{
|
{
|
||||||
case Mode::PlayList:
|
case Mode::PlayList:
|
||||||
animatePlayList(time);
|
animatePlayList(time);
|
||||||
break;
|
break;
|
||||||
case Mode::Mixer:
|
case Mode::Mixer:
|
||||||
animateChannelMixer();
|
animateChannelMixer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,11 +189,11 @@ void CEntity::update(NL3D::TAnimationTime time)
|
||||||
void CEntity::resetChannel()
|
void CEntity::resetChannel()
|
||||||
{
|
{
|
||||||
for(uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++)
|
for(uint i = 0; i < NL3D::CChannelMixer::NumAnimationSlot; i++)
|
||||||
_PlayList->setAnimation(i, UPlayList::empty);
|
_PlayList->setAnimation(i, UPlayList::empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEntity::addTransformation (CMatrix ¤t, UAnimation *anim, float begin, float end, UTrack *posTrack, UTrack *rotquatTrack,
|
void CEntity::addTransformation (CMatrix ¤t, UAnimation *anim, float begin, float end, UTrack *posTrack, UTrack *rotquatTrack,
|
||||||
UTrack *nextPosTrack, UTrack *nextRotquatTrack, bool removeLast)
|
UTrack *nextPosTrack, UTrack *nextRotquatTrack, bool removeLast)
|
||||||
{
|
{
|
||||||
// In place ?
|
// In place ?
|
||||||
if (_inPlace)
|
if (_inPlace)
|
||||||
|
@ -272,10 +273,10 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
|
||||||
{
|
{
|
||||||
// Animation index
|
// Animation index
|
||||||
uint id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[0].c_str());
|
uint id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[0].c_str());
|
||||||
|
|
||||||
// Try channel AnimationSet
|
// Try channel AnimationSet
|
||||||
NL3D::UAnimation *anim = _AnimationSet->getAnimation(id);
|
NL3D::UAnimation *anim = _AnimationSet->getAnimation(id);
|
||||||
|
|
||||||
bool there = false;
|
bool there = false;
|
||||||
|
|
||||||
UTrack *posTrack = NULL;
|
UTrack *posTrack = NULL;
|
||||||
|
@ -294,7 +295,7 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
|
||||||
// Accumul time
|
// Accumul time
|
||||||
float startTime = 0;
|
float startTime = 0;
|
||||||
float endTime = anim->getEndTime() - anim->getBeginTime();
|
float endTime = anim->getEndTime() - anim->getBeginTime();
|
||||||
|
|
||||||
uint index = 0;
|
uint index = 0;
|
||||||
while (time >= endTime)
|
while (time >= endTime)
|
||||||
{
|
{
|
||||||
|
@ -303,7 +304,7 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
|
||||||
{
|
{
|
||||||
id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str());
|
id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str());
|
||||||
NL3D::UAnimation *newAnim = _AnimationSet->getAnimation(id);
|
NL3D::UAnimation *newAnim = _AnimationSet->getAnimation(id);
|
||||||
|
|
||||||
UTrack *newPosTrack = newAnim->getTrackByName ("pos");
|
UTrack *newPosTrack = newAnim->getTrackByName ("pos");
|
||||||
UTrack *newRotquatTrack = newAnim->getTrackByName ("rotquat");
|
UTrack *newRotquatTrack = newAnim->getTrackByName ("rotquat");
|
||||||
|
|
||||||
|
@ -319,14 +320,14 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
|
||||||
startTime = endTime;
|
startTime = endTime;
|
||||||
endTime = startTime + (anim->getEndTime() - anim->getBeginTime());
|
endTime = startTime + (anim->getEndTime() - anim->getBeginTime());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add the transformation
|
// Add the transformation
|
||||||
addTransformation (current, anim, 0, anim->getEndTime(), posTrack, rotQuatTrack, NULL, NULL, false);
|
addTransformation (current, anim, 0, anim->getEndTime(), posTrack, rotQuatTrack, NULL, NULL, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time cropped ?
|
// Time cropped ?
|
||||||
if (index >= _PlayListAnimation.size())
|
if (index >= _PlayListAnimation.size())
|
||||||
{
|
{
|
||||||
|
@ -334,24 +335,24 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
|
||||||
index--;
|
index--;
|
||||||
id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str());
|
id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str());
|
||||||
anim = _AnimationSet->getAnimation(id);
|
anim = _AnimationSet->getAnimation(id);
|
||||||
|
|
||||||
// End time for last anim
|
// End time for last anim
|
||||||
startTime = anim->getEndTime() - time;
|
startTime = anim->getEndTime() - time;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No
|
// No
|
||||||
|
|
||||||
// Add the transformation
|
// Add the transformation
|
||||||
addTransformation (current, anim, 0, anim->getBeginTime() + time - startTime, posTrack, rotQuatTrack, NULL, NULL, false);
|
addTransformation (current, anim, 0, anim->getBeginTime() + time - startTime, posTrack, rotQuatTrack, NULL, NULL, false);
|
||||||
|
|
||||||
id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str());
|
id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str());
|
||||||
anim = _AnimationSet->getAnimation(id);
|
anim = _AnimationSet->getAnimation(id);
|
||||||
|
|
||||||
// Final time
|
// Final time
|
||||||
startTime -= anim->getBeginTime();
|
startTime -= anim->getBeginTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the slot
|
// Set the slot
|
||||||
_PlayList->setAnimation(0, id);
|
_PlayList->setAnimation(0, id);
|
||||||
_PlayList->setTimeOrigin(0, startTime);
|
_PlayList->setTimeOrigin(0, startTime);
|
||||||
|
@ -360,7 +361,7 @@ void CEntity::animatePlayList(NL3D::TAnimationTime time)
|
||||||
_PlayList->setStartWeight(0, 1, 0);
|
_PlayList->setStartWeight(0, 1, 0);
|
||||||
_PlayList->setEndWeight(0, 1, 1);
|
_PlayList->setEndWeight(0, 1, 1);
|
||||||
_PlayList->setWrapMode(0, UPlayList::Clamp);
|
_PlayList->setWrapMode(0, UPlayList::Clamp);
|
||||||
|
|
||||||
// Setup the pos and rot for this shape
|
// Setup the pos and rot for this shape
|
||||||
if (there)
|
if (there)
|
||||||
{
|
{
|
||||||
|
@ -391,11 +392,11 @@ void CEntity::animateChannelMixer()
|
||||||
{
|
{
|
||||||
// Set the animation
|
// Set the animation
|
||||||
uint animId = _AnimationSet->getAnimationIdByName(_SlotInfo[i].Animation);
|
uint animId = _AnimationSet->getAnimationIdByName(_SlotInfo[i].Animation);
|
||||||
if (animId == UAnimationSet::NotFound)
|
if (animId == UAnimationSet::NotFound)
|
||||||
_PlayList->setAnimation(i, UPlayList::empty);
|
_PlayList->setAnimation(i, UPlayList::empty);
|
||||||
else
|
else
|
||||||
_PlayList->setAnimation(i, animId);
|
_PlayList->setAnimation(i, animId);
|
||||||
|
|
||||||
// Set the skeleton weight
|
// Set the skeleton weight
|
||||||
uint skelId = _AnimationSet->getSkeletonWeightIdByName(_SlotInfo[i].Skeleton);
|
uint skelId = _AnimationSet->getSkeletonWeightIdByName(_SlotInfo[i].Skeleton);
|
||||||
if (skelId == UAnimationSet::NotFound)
|
if (skelId == UAnimationSet::NotFound)
|
||||||
|
@ -413,15 +414,15 @@ void CEntity::animateChannelMixer()
|
||||||
// Switch between wrap modes
|
// Switch between wrap modes
|
||||||
switch (_SlotInfo[i].ClampMode)
|
switch (_SlotInfo[i].ClampMode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_PlayList->setWrapMode (i, UPlayList::Clamp);
|
_PlayList->setWrapMode (i, UPlayList::Clamp);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
_PlayList->setWrapMode (i, UPlayList::Repeat);
|
_PlayList->setWrapMode (i, UPlayList::Repeat);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_PlayList->setWrapMode (i, UPlayList::Disable);
|
_PlayList->setWrapMode (i, UPlayList::Disable);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,15 @@
|
||||||
#include <nel/3d/u_skeleton.h>
|
#include <nel/3d/u_skeleton.h>
|
||||||
#include <nel/3d/channel_mixer.h>
|
#include <nel/3d/channel_mixer.h>
|
||||||
|
|
||||||
namespace NL3D {
|
namespace NL3D
|
||||||
class UPlayList;
|
{
|
||||||
class UAnimationSet;
|
class UPlayList;
|
||||||
|
class UAnimationSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CSlotInfo
|
class CSlotInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -51,7 +53,7 @@ public:
|
||||||
Offset(0), StartTime(0), EndTime(0),
|
Offset(0), StartTime(0), EndTime(0),
|
||||||
StartBlend(1), EndBlend (1), Smoothness(1),
|
StartBlend(1), EndBlend (1), Smoothness(1),
|
||||||
SpeedFactor(1), ClampMode(0),
|
SpeedFactor(1), ClampMode(0),
|
||||||
SkeletonInverted(false),
|
SkeletonInverted(false),
|
||||||
Enable(true) {} ;
|
Enable(true) {} ;
|
||||||
|
|
||||||
std::string Animation;
|
std::string Animation;
|
||||||
|
@ -67,16 +69,16 @@ public:
|
||||||
sint32 ClampMode;
|
sint32 ClampMode;
|
||||||
bool SkeletonInverted;
|
bool SkeletonInverted;
|
||||||
bool Enable;
|
bool Enable;
|
||||||
|
|
||||||
CSlotInfo &operator=(const CSlotInfo &);
|
CSlotInfo &operator=(const CSlotInfo &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CEntity
|
@class CEntity
|
||||||
@brief Class manage animated shape.
|
@brief Class manage animated shape.
|
||||||
@details
|
@details
|
||||||
Allows you to load animations for shape and skeleton weight.
|
Allows you to load animations for shape and skeleton weight.
|
||||||
Contains a built-in playlist. Has management and playback Playlists or Mixer.
|
Contains a built-in playlist. Has management and playback Playlists or Mixer.
|
||||||
*/
|
*/
|
||||||
class CEntity
|
class CEntity
|
||||||
|
@ -101,131 +103,176 @@ public:
|
||||||
float EndAnim;
|
float EndAnim;
|
||||||
float SpeedAnim;
|
float SpeedAnim;
|
||||||
int Mode;
|
int Mode;
|
||||||
|
|
||||||
SAnimationStatus():
|
SAnimationStatus():
|
||||||
LoopAnim(false), PlayAnim(false),
|
LoopAnim(false), PlayAnim(false),
|
||||||
CurrentTimeAnim(0), StartAnim(0),
|
CurrentTimeAnim(0), StartAnim(0),
|
||||||
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
|
EndAnim(0), SpeedAnim(1), Mode(Mode::PlayList) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~CEntity(void);
|
~CEntity(void);
|
||||||
|
|
||||||
/// Loads a file animations
|
/// Loads a file animations
|
||||||
/// @param fileName - name animation file
|
/// @param fileName - name animation file
|
||||||
void loadAnimation(std::string &fileName);
|
void loadAnimation(std::string &fileName);
|
||||||
|
|
||||||
/// Loads a file skeleton weight
|
/// Loads a file skeleton weight
|
||||||
void loadSWT(std::string &fileName);
|
void loadSWT(std::string &fileName);
|
||||||
|
|
||||||
/// Adds an animation to a playlist
|
/// Adds an animation to a playlist
|
||||||
/// @param name - name loaded animations
|
/// @param name - name loaded animations
|
||||||
void addAnimToPlayList(std::string &name);
|
void addAnimToPlayList(std::string &name);
|
||||||
|
|
||||||
/// Removes the animation from a playlist
|
/// Removes the animation from a playlist
|
||||||
/// @param row - number of animations in the playlist
|
/// @param row - number of animations in the playlist
|
||||||
void removeAnimToPlayList(uint row);
|
void removeAnimToPlayList(uint row);
|
||||||
|
|
||||||
/// Swaps animations to a playlist
|
/// Swaps animations to a playlist
|
||||||
/// @param row1 - first number of animations in the playlist
|
/// @param row1 - first number of animations in the playlist
|
||||||
/// @param row2 - second number of animations in the playlist
|
/// @param row2 - second number of animations in the playlist
|
||||||
void swapAnimToPlayList(uint row1, uint row2);
|
void swapAnimToPlayList(uint row1, uint row2);
|
||||||
|
|
||||||
/// Playback animation
|
/// Playback animation
|
||||||
void playbackAnim(bool play);
|
void playbackAnim(bool play);
|
||||||
|
|
||||||
/// Reset playlist and animation
|
/// Reset playlist and animation
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
/// Get the total time of animation playlist
|
/// Get the total time of animation playlist
|
||||||
/// @return total time of animation
|
/// @return total time of animation
|
||||||
float getPlayListLength();
|
float getPlayListLength();
|
||||||
|
|
||||||
/// get time length single animation
|
/// get time length single animation
|
||||||
float getAnimLength(std::string name);
|
float getAnimLength(std::string name);
|
||||||
|
|
||||||
/// Get slot infomation
|
/// 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
|
/// 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
|
/// Set in place mode animation
|
||||||
void setInPlace(bool enabled) { _inPlace = enabled; }
|
void setInPlace(bool enabled)
|
||||||
|
{
|
||||||
|
_inPlace = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get in place mode
|
/// Get in place mode
|
||||||
bool getInPlace() { return _inPlace; }
|
bool getInPlace()
|
||||||
|
{
|
||||||
|
return _inPlace;
|
||||||
|
}
|
||||||
|
|
||||||
/// Set inc position
|
/// Set inc position
|
||||||
void setIncPos(bool enabled) { _incPos = enabled; }
|
void setIncPos(bool enabled)
|
||||||
|
{
|
||||||
|
_incPos = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get inc position
|
/// Get inc position
|
||||||
bool getIncPos() { return _incPos; }
|
bool getIncPos()
|
||||||
|
{
|
||||||
|
return _incPos;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get information about the current status of playing a playlist
|
/// Get information about the current status of playing a playlist
|
||||||
/// @return struct containing current information playback
|
/// @return struct containing current information playback
|
||||||
SAnimationStatus getStatus() { return _AnimationStatus; }
|
SAnimationStatus getStatus()
|
||||||
|
{
|
||||||
|
return _AnimationStatus;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get name entity
|
/// Get name entity
|
||||||
/// @return name entity
|
/// @return name entity
|
||||||
std::string getName() { return _Name; }
|
std::string getName()
|
||||||
|
{
|
||||||
|
return _Name;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get file name shape
|
/// Get file name shape
|
||||||
/// @return file name shape
|
/// @return file name shape
|
||||||
std::string getFileNameShape() { return _FileNameShape; }
|
std::string getFileNameShape()
|
||||||
|
{
|
||||||
|
return _FileNameShape;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get file name skeleton
|
/// Get file name skeleton
|
||||||
/// @return file name skeleton
|
/// @return file name skeleton
|
||||||
std::string getFileNameSkeleton() { return _FileNameSkeleton; }
|
std::string getFileNameSkeleton()
|
||||||
|
{
|
||||||
|
return _FileNameSkeleton;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get slot information
|
/// Get slot information
|
||||||
CSlotInfo getSlotInfo(uint num) { return _SlotInfo[num]; }
|
CSlotInfo getSlotInfo(uint num)
|
||||||
|
{
|
||||||
|
return _SlotInfo[num];
|
||||||
|
}
|
||||||
|
|
||||||
/// Get list loaded animations files
|
/// Get list loaded animations files
|
||||||
std::vector<std::string>& getAnimationList() { return _AnimationList; }
|
std::vector<std::string>& getAnimationList()
|
||||||
|
{
|
||||||
|
return _AnimationList;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get playlist animations
|
/// Get playlist animations
|
||||||
std::vector<std::string>& getPlayListAnimation() { return _PlayListAnimation; }
|
std::vector<std::string>& getPlayListAnimation()
|
||||||
|
{
|
||||||
|
return _PlayListAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get list loaded skeleton weight template files
|
/// 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.
|
/// Get game interface for manipulating Skeleton.
|
||||||
NL3D::USkeleton getSkeleton() const { return _Skeleton; }
|
NL3D::USkeleton getSkeleton() const
|
||||||
|
{
|
||||||
|
return _Skeleton;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
CEntity(void);
|
CEntity(void);
|
||||||
|
|
||||||
/// Update the animate from the playlist or channel mixer
|
/// Update the animate from the playlist or channel mixer
|
||||||
/// @param time - current time in second
|
/// @param time - current time in second
|
||||||
void update(NL3D::TAnimationTime time);
|
void update(NL3D::TAnimationTime time);
|
||||||
|
|
||||||
void resetChannel();
|
void resetChannel();
|
||||||
|
|
||||||
/// Update the animate from the playlist
|
/// Update the animate from the playlist
|
||||||
void animatePlayList(NL3D::TAnimationTime time);
|
void animatePlayList(NL3D::TAnimationTime time);
|
||||||
|
|
||||||
/// Update the animate from the mixer
|
/// Update the animate from the mixer
|
||||||
void animateChannelMixer();
|
void animateChannelMixer();
|
||||||
void addTransformation (NLMISC::CMatrix ¤t, NL3D::UAnimation *anim,
|
void addTransformation (NLMISC::CMatrix ¤t, NL3D::UAnimation *anim,
|
||||||
float begin, float end,
|
float begin, float end,
|
||||||
NL3D::UTrack *posTrack, NL3D::UTrack *rotquatTrack,
|
NL3D::UTrack *posTrack, NL3D::UTrack *rotquatTrack,
|
||||||
NL3D::UTrack *nextPosTrack, NL3D::UTrack *nextRotquatTrack,
|
NL3D::UTrack *nextPosTrack, NL3D::UTrack *nextRotquatTrack,
|
||||||
bool removeLast);
|
bool removeLast);
|
||||||
|
|
||||||
// The name of the entity
|
// The name of the entity
|
||||||
std::string _Name;
|
std::string _Name;
|
||||||
std::string _FileNameShape;
|
std::string _FileNameShape;
|
||||||
std::string _FileNameSkeleton;
|
std::string _FileNameSkeleton;
|
||||||
|
|
||||||
SAnimationStatus _AnimationStatus;
|
SAnimationStatus _AnimationStatus;
|
||||||
|
|
||||||
bool _inPlace;
|
bool _inPlace;
|
||||||
bool _incPos;
|
bool _incPos;
|
||||||
|
|
||||||
float _CharacterScalePos;
|
float _CharacterScalePos;
|
||||||
|
|
||||||
// The mesh instance associated to this entity
|
// The mesh instance associated to this entity
|
||||||
NL3D::UInstance _Instance;
|
NL3D::UInstance _Instance;
|
||||||
|
|
||||||
|
@ -238,13 +285,13 @@ private:
|
||||||
|
|
||||||
// Animation input file
|
// Animation input file
|
||||||
std::vector<std::string> _AnimationList;
|
std::vector<std::string> _AnimationList;
|
||||||
|
|
||||||
// Skeleton weight input file
|
// Skeleton weight input file
|
||||||
std::vector<std::string> _SWTList;
|
std::vector<std::string> _SWTList;
|
||||||
|
|
||||||
// Play list animation
|
// Play list animation
|
||||||
std::vector<std::string > _PlayListAnimation;
|
std::vector<std::string > _PlayListAnimation;
|
||||||
|
|
||||||
// Slot info for this object
|
// Slot info for this object
|
||||||
CSlotInfo _SlotInfo[NL3D::CChannelMixer::NumAnimationSlot];
|
CSlotInfo _SlotInfo[NL3D::CChannelMixer::NumAnimationSlot];
|
||||||
|
|
||||||
|
|
|
@ -26,41 +26,42 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent)
|
CFollowPathDialog::CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent)
|
||||||
: QDialog(parent), _FollowPath(pbfs), _Node(ownerNode)
|
: QDialog(parent), _FollowPath(pbfs), _Node(ownerNode)
|
||||||
{
|
{
|
||||||
resize(270, 90);
|
resize(270, 90);
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
sizePolicy.setVerticalStretch(0);
|
sizePolicy.setVerticalStretch(0);
|
||||||
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
|
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
|
||||||
setSizePolicy(sizePolicy);
|
setSizePolicy(sizePolicy);
|
||||||
setMinimumSize(QSize(0, 90));
|
setMinimumSize(QSize(0, 90));
|
||||||
setMaximumSize(QSize(16777215, 90));
|
setMaximumSize(QSize(16777215, 90));
|
||||||
gridLayout = new QGridLayout(this);
|
gridLayout = new QGridLayout(this);
|
||||||
label = new QLabel(this);
|
label = new QLabel(this);
|
||||||
gridLayout->addWidget(label, 0, 0, 1, 1);
|
gridLayout->addWidget(label, 0, 0, 1, 1);
|
||||||
comboBox = new QComboBox(this);
|
comboBox = new QComboBox(this);
|
||||||
gridLayout->addWidget(comboBox, 1, 0, 1, 2);
|
gridLayout->addWidget(comboBox, 1, 0, 1, 2);
|
||||||
horizontalSpacer = new QSpacerItem(207, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
horizontalSpacer = new QSpacerItem(207, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
gridLayout->addItem(horizontalSpacer, 2, 0, 1, 1);
|
gridLayout->addItem(horizontalSpacer, 2, 0, 1, 1);
|
||||||
pushButton = new QPushButton(this);
|
pushButton = new QPushButton(this);
|
||||||
gridLayout->addWidget(pushButton, 2, 1, 1, 1);
|
gridLayout->addWidget(pushButton, 2, 1, 1, 1);
|
||||||
|
|
||||||
setWindowTitle(tr("Follow path param"));
|
setWindowTitle(tr("Follow path param"));
|
||||||
label->setText(tr("Projection plane:"));
|
label->setText(tr("Projection plane:"));
|
||||||
comboBox->clear();
|
comboBox->clear();
|
||||||
comboBox->insertItems(0, QStringList()
|
comboBox->insertItems(0, QStringList()
|
||||||
<< tr("No projection")
|
<< tr("No projection")
|
||||||
<< tr("XY plane")
|
<< tr("XY plane")
|
||||||
<< tr("XZ plane")
|
<< tr("XZ plane")
|
||||||
<< tr("YZ plane"));
|
<< tr("YZ plane"));
|
||||||
pushButton->setText(("Ok"));
|
pushButton->setText(("Ok"));
|
||||||
|
|
||||||
comboBox->setCurrentIndex(_FollowPath->getProjectionPlane());
|
comboBox->setCurrentIndex(_FollowPath->getProjectionPlane());
|
||||||
|
|
||||||
setFixedHeight(sizeHint().height());
|
setFixedHeight(sizeHint().height());
|
||||||
|
|
||||||
connect(pushButton, SIGNAL(clicked()), this, SLOT(accept()));
|
connect(pushButton, SIGNAL(clicked()), this, SLOT(accept()));
|
||||||
|
|
|
@ -29,17 +29,18 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CPSPlaneBasisFollowSpeed;
|
class CPSPlaneBasisFollowSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CWorkspaceNode;
|
class CWorkspaceNode;
|
||||||
|
|
||||||
class CFollowPathDialog : public QDialog
|
class CFollowPathDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent = 0);
|
CFollowPathDialog(NL3D::CPSPlaneBasisFollowSpeed *pbfs, CWorkspaceNode *ownerNode, QWidget *parent = 0);
|
||||||
~CFollowPathDialog();
|
~CFollowPathDialog();
|
||||||
|
@ -53,7 +54,7 @@ protected:
|
||||||
QComboBox *comboBox;
|
QComboBox *comboBox;
|
||||||
QSpacerItem *horizontalSpacer;
|
QSpacerItem *horizontalSpacer;
|
||||||
QPushButton *pushButton;
|
QPushButton *pushButton;
|
||||||
|
|
||||||
NL3D::CPSPlaneBasisFollowSpeed *_FollowPath;
|
NL3D::CPSPlaneBasisFollowSpeed *_FollowPath;
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
}; /* class CFollowPathDialog */
|
}; /* class CFollowPathDialog */
|
||||||
|
|
|
@ -24,10 +24,11 @@
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include <nel/3d/u_scene.h>
|
#include <nel/3d/u_scene.h>
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CGlobalWindDialog::CGlobalWindDialog(QWidget *parent)
|
CGlobalWindDialog::CGlobalWindDialog(QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
|
|
@ -28,30 +28,31 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CGlobalWindDialog: public QDockWidget
|
class CGlobalWindDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGlobalWindDialog(QWidget *parent = 0);
|
CGlobalWindDialog(QWidget *parent = 0);
|
||||||
~CGlobalWindDialog();
|
~CGlobalWindDialog();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setWndPower(int value);
|
void setWndPower(int value);
|
||||||
void updateWnd(bool visible);
|
void updateWnd(bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// wrappers to tune the direction of wind
|
/// wrappers to tune the direction of wind
|
||||||
/* struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
|
/* struct CDirectionWrapper : public IPSWrapper<NLMISC::CVector>
|
||||||
{
|
{
|
||||||
NLMISC::CVector get(void) const;
|
NLMISC::CVector get(void) const;
|
||||||
void set(const NLMISC::CVector &d);
|
void set(const NLMISC::CVector &d);
|
||||||
} _DirectionWrapper;*/
|
} _DirectionWrapper;*/
|
||||||
|
|
||||||
Ui::CGlobalWindDialog _ui;
|
Ui::CGlobalWindDialog _ui;
|
||||||
|
|
||||||
}; /* class CGlobalWindDialog */
|
}; /* class CGlobalWindDialog */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
|
|
||||||
// STL includes
|
// STL includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
const int directionSize = 35;
|
const int directionSize = 35;
|
||||||
|
|
||||||
CGraphicsInfoWidget::CGraphicsInfoWidget(QWidget *parent)
|
CGraphicsInfoWidget::CGraphicsInfoWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_color = Qt::white;
|
_color = Qt::white;
|
||||||
_mode = Mode::Color;
|
_mode = Mode::Color;
|
||||||
|
@ -91,10 +92,10 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
|
||||||
painter.drawLine(width() / 2, 4, width() / 2, height() - 4);
|
painter.drawLine(width() / 2, 4, width() / 2, height() - 4);
|
||||||
painter.drawLine(4, height() / 2, width() - 4, height() / 2);
|
painter.drawLine(4, height() / 2, width() - 4, height() / 2);
|
||||||
painter.drawText( 10, 15, _text);
|
painter.drawText( 10, 15, _text);
|
||||||
|
|
||||||
painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
|
painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
|
||||||
painter.drawLine(width() / 2, height() / 2,
|
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)
|
if (_mode == Mode::PlaneBasic)
|
||||||
{
|
{
|
||||||
|
@ -108,25 +109,25 @@ void CGraphicsInfoWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
for(uint k = 0; k < _verts.size() / 2; ++k)
|
for(uint k = 0; k < _verts.size() / 2; ++k)
|
||||||
{
|
{
|
||||||
painter.drawLine(int((width() / 2.0) * (1 + _verts[2 * k].x)),
|
painter.drawLine(int((width() / 2.0) * (1 + _verts[2 * k].x)),
|
||||||
int((height() / 2.0) * (1 - _verts[2 * k].y)),
|
int((height() / 2.0) * (1 - _verts[2 * k].y)),
|
||||||
int((width() / 2.0) * (1 + _verts[2 * k + 1].x)),
|
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 + 1].y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(uint k = 1; k < _verts.size(); k++)
|
for(uint k = 1; k < _verts.size(); k++)
|
||||||
{
|
{
|
||||||
painter.drawLine(int((width() / 2.0) * (1 + _verts[k - 1].x)),
|
painter.drawLine(int((width() / 2.0) * (1 + _verts[k - 1].x)),
|
||||||
int((height() / 2.0) * (1 - _verts[k - 1].y)),
|
int((height() / 2.0) * (1 - _verts[k - 1].y)),
|
||||||
int((width() / 2.0) * (1 + _verts[ k].x)),
|
int((width() / 2.0) * (1 + _verts[ k].x)),
|
||||||
int((height() / 2.0) * (1 - _verts[k].y)));
|
int((height() / 2.0) * (1 - _verts[k].y)));
|
||||||
}
|
}
|
||||||
painter.drawLine(int((width() / 2.0) * (1 + _verts[0].x)),
|
painter.drawLine(int((width() / 2.0) * (1 + _verts[0].x)),
|
||||||
int((height() / 2.0) * (1 - _verts[0].y)),
|
int((height() / 2.0) * (1 - _verts[0].y)),
|
||||||
int((width() / 2.0) * (1 + _verts[_verts.size() - 1].x)),
|
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[_verts.size() - 1].y)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +136,7 @@ void CGraphicsInfoWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
float vx = (event->x() - (width() / 2)) / 0.9f;
|
float vx = (event->x() - (width() / 2)) / 0.9f;
|
||||||
float vy = ((height() / 2) - event->y()) / 0.9f;
|
float vy = ((height() / 2) - event->y()) / 0.9f;
|
||||||
|
|
||||||
Q_EMIT applyNewVector(vx, vy);
|
Q_EMIT applyNewVector(vx, vy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
struct Mode
|
struct Mode
|
||||||
{
|
{
|
||||||
|
@ -42,28 +43,28 @@ struct Mode
|
||||||
RibbonShape
|
RibbonShape
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CGraphicsInfoWidget: public QWidget
|
class CGraphicsInfoWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGraphicsInfoWidget(QWidget *parent = 0);
|
CGraphicsInfoWidget(QWidget *parent = 0);
|
||||||
~CGraphicsInfoWidget();
|
~CGraphicsInfoWidget();
|
||||||
|
|
||||||
void setMode(int mode);
|
void setMode(int mode);
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void setVector(float x, float y);
|
void setVector(float x, float y);
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
void setRibbonShape(const std::vector<NLMISC::CVector> &verts, bool braceMode);
|
void setRibbonShape(const std::vector<NLMISC::CVector> &verts, bool braceMode);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void applyNewVector(float x, float y);
|
void applyNewVector(float x, float y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *event);
|
virtual void paintEvent(QPaintEvent *event);
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
virtual void mouseDoubleClickEvent(QMouseEvent *event);
|
||||||
|
|
||||||
int _mode;
|
int _mode;
|
||||||
QColor _color;
|
QColor _color;
|
||||||
float _x;
|
float _x;
|
||||||
|
@ -71,7 +72,7 @@ protected:
|
||||||
QString _text;
|
QString _text;
|
||||||
std::vector<NLMISC::CVector> _verts;
|
std::vector<NLMISC::CVector> _verts;
|
||||||
bool _braceMode;
|
bool _braceMode;
|
||||||
|
|
||||||
}; /* class CGraphicsInfoWidget */
|
}; /* class CGraphicsInfoWidget */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -43,27 +43,28 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CGraphicsViewport::CGraphicsViewport(QWidget *parent)
|
CGraphicsViewport::CGraphicsViewport(QWidget *parent)
|
||||||
: QNLWidget(parent)
|
: QNLWidget(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CGraphicsViewport::~CGraphicsViewport()
|
CGraphicsViewport::~CGraphicsViewport()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGraphicsViewport::init()
|
void CGraphicsViewport::init()
|
||||||
{
|
{
|
||||||
//H_AUTO2
|
//H_AUTO2
|
||||||
nldebug("CGraphicsViewport::init");
|
nldebug("CGraphicsViewport::init");
|
||||||
|
|
||||||
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||||
|
|
||||||
Modules::objView().init((nlWindow)winId(), width(), height());
|
Modules::objView().init((nlWindow)winId(), width(), height());
|
||||||
Modules::psEdit().init();
|
Modules::psEdit().init();
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ void CGraphicsViewport::release()
|
||||||
{
|
{
|
||||||
//H_AUTO2
|
//H_AUTO2
|
||||||
nldebug("CGraphicsViewport::release");
|
nldebug("CGraphicsViewport::release");
|
||||||
|
|
||||||
Modules::psEdit().release();
|
Modules::psEdit().release();
|
||||||
Modules::objView().release();
|
Modules::objView().release();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ QAction *CGraphicsViewport::createSaveScreenshotAction(QObject *parent)
|
||||||
|
|
||||||
QAction *CGraphicsViewport::createSetBackgroundColor(QObject *parent)
|
QAction *CGraphicsViewport::createSetBackgroundColor(QObject *parent)
|
||||||
{
|
{
|
||||||
QAction *action = new QAction(parent);
|
QAction *action = new QAction(parent);
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));
|
connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundColor()));
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
@ -102,9 +103,9 @@ void CGraphicsViewport::saveScreenshot()
|
||||||
void CGraphicsViewport::setBackgroundColor()
|
void CGraphicsViewport::setBackgroundColor()
|
||||||
{
|
{
|
||||||
QColor color = QColorDialog::getColor(QColor(Modules::objView().getBackgroundColor().R,
|
QColor color = QColorDialog::getColor(QColor(Modules::objView().getBackgroundColor().R,
|
||||||
Modules::objView().getBackgroundColor().G,
|
Modules::objView().getBackgroundColor().G,
|
||||||
Modules::objView().getBackgroundColor().B));
|
Modules::objView().getBackgroundColor().B));
|
||||||
if (color.isValid())
|
if (color.isValid())
|
||||||
Modules::objView().setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
|
Modules::objView().setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ typedef QGLWidget QNLWidget;
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CGraphicsViewport
|
@class CGraphicsViewport
|
||||||
|
@ -58,7 +59,10 @@ public:
|
||||||
CGraphicsViewport(QWidget *parent);
|
CGraphicsViewport(QWidget *parent);
|
||||||
virtual ~CGraphicsViewport();
|
virtual ~CGraphicsViewport();
|
||||||
|
|
||||||
virtual QPaintEngine* paintEngine() const { return NULL; }
|
virtual QPaintEngine* paintEngine() const
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void release();
|
void release();
|
||||||
|
@ -69,13 +73,13 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void saveScreenshot();
|
void saveScreenshot();
|
||||||
void setBackgroundColor();
|
void setBackgroundColor();
|
||||||
|
|
||||||
void submitEvents(NLMISC::CEventServer &server, bool allWindows) { }
|
void submitEvents(NLMISC::CEventServer &server, bool allWindows) { }
|
||||||
void emulateMouseRawMode(bool) { }
|
void emulateMouseRawMode(bool) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *resizeEvent);
|
virtual void resizeEvent(QResizeEvent *resizeEvent);
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
virtual bool winEvent(MSG * message, long * result);
|
virtual bool winEvent(MSG * message, long * result);
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
|
@ -83,11 +87,11 @@ protected:
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
virtual bool x11Event(XEvent *event);
|
virtual bool x11Event(XEvent *event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CGraphicsViewport(const CGraphicsViewport &);
|
CGraphicsViewport(const CGraphicsViewport &);
|
||||||
CGraphicsViewport &operator=(const CGraphicsViewport &);
|
CGraphicsViewport &operator=(const CGraphicsViewport &);
|
||||||
|
|
||||||
}; /* class CGraphicsViewport */
|
}; /* class CGraphicsViewport */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -39,370 +39,413 @@
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "hoverpoints.h"
|
#include "hoverpoints.h"
|
||||||
|
|
||||||
#define printf
|
#define printf
|
||||||
|
|
||||||
HoverPoints::HoverPoints(QWidget *widget, PointShape shape)
|
HoverPoints::HoverPoints(QWidget *widget, PointShape shape)
|
||||||
: QObject(widget)
|
: QObject(widget)
|
||||||
{
|
{
|
||||||
m_widget = widget;
|
m_widget = widget;
|
||||||
widget->installEventFilter(this);
|
widget->installEventFilter(this);
|
||||||
widget->setAttribute(Qt::WA_AcceptTouchEvents);
|
widget->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
|
|
||||||
m_connectionType = CurveConnection;
|
m_connectionType = CurveConnection;
|
||||||
m_sortType = NoSort;
|
m_sortType = NoSort;
|
||||||
m_shape = shape;
|
m_shape = shape;
|
||||||
m_pointPen = QPen(QColor(255, 255, 255, 191), 1);
|
m_pointPen = QPen(QColor(255, 255, 255, 191), 1);
|
||||||
m_connectionPen = QPen(QColor(255, 255, 255, 127), 2);
|
m_connectionPen = QPen(QColor(255, 255, 255, 127), 2);
|
||||||
m_pointBrush = QBrush(QColor(191, 191, 191, 127));
|
m_pointBrush = QBrush(QColor(191, 191, 191, 127));
|
||||||
m_pointSize = QSize(11, 11);
|
m_pointSize = QSize(11, 11);
|
||||||
m_currentIndex = -1;
|
m_currentIndex = -1;
|
||||||
m_editable = true;
|
m_editable = true;
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
m_minCountPoints = 2;
|
m_minCountPoints = 2;
|
||||||
|
|
||||||
createGradient();
|
createGradient();
|
||||||
|
|
||||||
connect(this, SIGNAL(pointsChanged(QPolygonF)),
|
connect(this, SIGNAL(pointsChanged(QPolygonF)),
|
||||||
m_widget, SLOT(update()));
|
m_widget, SLOT(update()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HoverPoints::setEnabled(bool enabled)
|
void HoverPoints::setEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (m_enabled != enabled) {
|
if (m_enabled != enabled)
|
||||||
m_enabled = enabled;
|
{
|
||||||
m_widget->update();
|
m_enabled = enabled;
|
||||||
}
|
m_widget->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool HoverPoints::eventFilter(QObject *object, QEvent *event)
|
bool HoverPoints::eventFilter(QObject *object, QEvent *event)
|
||||||
{
|
{
|
||||||
if (object == m_widget && m_enabled) {
|
if (object == m_widget && m_enabled)
|
||||||
switch (event->type()) {
|
{
|
||||||
|
switch (event->type())
|
||||||
|
{
|
||||||
|
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
{
|
{
|
||||||
if (!m_fingerPointMapping.isEmpty())
|
if (!m_fingerPointMapping.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
QMouseEvent *me = (QMouseEvent *) event;
|
QMouseEvent *me = (QMouseEvent *) event;
|
||||||
|
|
||||||
QPointF clickPos = me->pos();
|
QPointF clickPos = me->pos();
|
||||||
int index = -1;
|
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)
|
QPainterPath path;
|
||||||
path.addEllipse(pointBoundingRect(i));
|
if (m_shape == CircleShape)
|
||||||
else
|
path.addEllipse(pointBoundingRect(i));
|
||||||
path.addRect(pointBoundingRect(i));
|
else
|
||||||
|
path.addRect(pointBoundingRect(i));
|
||||||
|
|
||||||
if (path.contains(clickPos)) {
|
if (path.contains(clickPos))
|
||||||
index = i;
|
{
|
||||||
break;
|
index = i;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (me->button() == Qt::LeftButton) {
|
if (me->button() == Qt::LeftButton)
|
||||||
if (index == -1) {
|
{
|
||||||
if (!m_editable)
|
if (index == -1)
|
||||||
return false;
|
{
|
||||||
int pos = 0;
|
if (!m_editable)
|
||||||
// Insert sort for x or y
|
return false;
|
||||||
if (m_sortType == XSort) {
|
int pos = 0;
|
||||||
for (int i=0; i<m_points.size(); ++i)
|
// Insert sort for x or y
|
||||||
if (m_points.at(i).x() > clickPos.x()) {
|
if (m_sortType == XSort)
|
||||||
pos = i;
|
{
|
||||||
break;
|
for (int i=0; i<m_points.size(); ++i)
|
||||||
}
|
if (m_points.at(i).x() > clickPos.x())
|
||||||
} else if (m_sortType == YSort) {
|
{
|
||||||
for (int i=0; i<m_points.size(); ++i)
|
pos = i;
|
||||||
if (m_points.at(i).y() > clickPos.y()) {
|
break;
|
||||||
pos = i;
|
}
|
||||||
break;
|
}
|
||||||
}
|
else if (m_sortType == YSort)
|
||||||
}
|
{
|
||||||
|
for (int i=0; i<m_points.size(); ++i)
|
||||||
m_points.insert(pos, clickPos);
|
if (m_points.at(i).y() > clickPos.y())
|
||||||
|
{
|
||||||
|
pos = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_points.insert(pos, clickPos);
|
||||||
m_locks.insert(pos, 0);
|
m_locks.insert(pos, 0);
|
||||||
m_currentIndex = pos;
|
m_currentIndex = pos;
|
||||||
firePointChange();
|
firePointChange();
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_currentIndex = index;
|
m_currentIndex = index;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (me->button() == Qt::RightButton) {
|
}
|
||||||
if (index >= 0 && m_editable) {
|
else if (me->button() == Qt::RightButton)
|
||||||
if ((m_points.size() - 1) < m_minCountPoints)
|
{
|
||||||
return true;
|
if (index >= 0 && m_editable)
|
||||||
if (m_locks[index] == 0) {
|
{
|
||||||
m_locks.remove(index);
|
if ((m_points.size() - 1) < m_minCountPoints)
|
||||||
m_points.remove(index);
|
return true;
|
||||||
}
|
if (m_locks[index] == 0)
|
||||||
firePointChange();
|
{
|
||||||
return true;
|
m_locks.remove(index);
|
||||||
}
|
m_points.remove(index);
|
||||||
}
|
}
|
||||||
|
firePointChange();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
if (!m_fingerPointMapping.isEmpty())
|
if (!m_fingerPointMapping.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
m_currentIndex = -1;
|
m_currentIndex = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::MouseMove:
|
case QEvent::MouseMove:
|
||||||
if (!m_fingerPointMapping.isEmpty())
|
if (!m_fingerPointMapping.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
if (m_currentIndex >= 0)
|
if (m_currentIndex >= 0)
|
||||||
movePoint(m_currentIndex, ((QMouseEvent *)event)->pos());
|
movePoint(m_currentIndex, ((QMouseEvent *)event)->pos());
|
||||||
break;
|
break;
|
||||||
case QEvent::TouchBegin:
|
case QEvent::TouchBegin:
|
||||||
case QEvent::TouchUpdate:
|
case QEvent::TouchUpdate:
|
||||||
{
|
{
|
||||||
const QTouchEvent *const touchEvent = static_cast<const QTouchEvent*>(event);
|
const QTouchEvent *const touchEvent = static_cast<const QTouchEvent*>(event);
|
||||||
const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
|
const QList<QTouchEvent::TouchPoint> points = touchEvent->touchPoints();
|
||||||
const qreal pointSize = qMax(m_pointSize.width(), m_pointSize.height());
|
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()) {
|
const int id = touchPoint.id();
|
||||||
case Qt::TouchPointPressed:
|
switch (touchPoint.state())
|
||||||
{
|
{
|
||||||
// find the point, move it
|
case Qt::TouchPointPressed:
|
||||||
QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
|
{
|
||||||
int activePoint = -1;
|
// find the point, move it
|
||||||
qreal distance = -1;
|
QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
|
||||||
const int pointsCount = m_points.size();
|
int activePoint = -1;
|
||||||
const int activePointCount = activePoints.size();
|
qreal distance = -1;
|
||||||
if (pointsCount == 2 && activePointCount == 1) { // only two points
|
const int pointsCount = m_points.size();
|
||||||
activePoint = activePoints.contains(0) ? 1 : 0;
|
const int activePointCount = activePoints.size();
|
||||||
} else {
|
if (pointsCount == 2 && activePointCount == 1) // only two points
|
||||||
for (int i=0; i<pointsCount; ++i) {
|
{
|
||||||
if (activePoints.contains(i))
|
activePoint = activePoints.contains(0) ? 1 : 0;
|
||||||
continue;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i=0; i<pointsCount; ++i)
|
||||||
|
{
|
||||||
|
if (activePoints.contains(i))
|
||||||
|
continue;
|
||||||
|
|
||||||
qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
|
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;
|
distance = d;
|
||||||
}
|
activePoint = i;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (activePoint != -1) {
|
if (activePoint != -1)
|
||||||
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
|
{
|
||||||
movePoint(activePoint, touchPoint.pos());
|
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
|
||||||
}
|
movePoint(activePoint, touchPoint.pos());
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case Qt::TouchPointReleased:
|
break;
|
||||||
{
|
case Qt::TouchPointReleased:
|
||||||
// move the point and release
|
{
|
||||||
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
|
// move the point and release
|
||||||
movePoint(it.value(), touchPoint.pos());
|
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
|
||||||
m_fingerPointMapping.erase(it);
|
movePoint(it.value(), touchPoint.pos());
|
||||||
}
|
m_fingerPointMapping.erase(it);
|
||||||
break;
|
}
|
||||||
case Qt::TouchPointMoved:
|
break;
|
||||||
{
|
case Qt::TouchPointMoved:
|
||||||
// move the point
|
{
|
||||||
const int pointIdx = m_fingerPointMapping.value(id, -1);
|
// move the point
|
||||||
if (pointIdx >= 0) // do we track this point?
|
const int pointIdx = m_fingerPointMapping.value(id, -1);
|
||||||
movePoint(pointIdx, touchPoint.pos());
|
if (pointIdx >= 0) // do we track this point?
|
||||||
}
|
movePoint(pointIdx, touchPoint.pos());
|
||||||
break;
|
}
|
||||||
default:
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
if (m_fingerPointMapping.isEmpty()) {
|
}
|
||||||
event->ignore();
|
if (m_fingerPointMapping.isEmpty())
|
||||||
return false;
|
{
|
||||||
} else {
|
event->ignore();
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
break;
|
{
|
||||||
case QEvent::TouchEnd:
|
return true;
|
||||||
if (m_fingerPointMapping.isEmpty()) {
|
}
|
||||||
event->ignore();
|
}
|
||||||
return false;
|
break;
|
||||||
}
|
case QEvent::TouchEnd:
|
||||||
return true;
|
if (m_fingerPointMapping.isEmpty())
|
||||||
break;
|
{
|
||||||
|
event->ignore();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
case QEvent::Resize:
|
case QEvent::Resize:
|
||||||
{
|
{
|
||||||
QResizeEvent *e = (QResizeEvent *) event;
|
QResizeEvent *e = (QResizeEvent *) event;
|
||||||
if (e->oldSize().width() == 0 || e->oldSize().height() == 0)
|
if (e->oldSize().width() == 0 || e->oldSize().height() == 0)
|
||||||
break;
|
break;
|
||||||
qreal stretch_x = e->size().width() / qreal(e->oldSize().width());
|
qreal stretch_x = e->size().width() / qreal(e->oldSize().width());
|
||||||
qreal stretch_y = e->size().height() / qreal(e->oldSize().height());
|
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);
|
QPointF p = m_points[i];
|
||||||
}
|
movePoint(i, QPointF(p.x() * stretch_x, p.y() * stretch_y), false);
|
||||||
|
}
|
||||||
|
|
||||||
firePointChange();
|
firePointChange();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case QEvent::Paint:
|
case QEvent::Paint:
|
||||||
{
|
{
|
||||||
QWidget *that_widget = m_widget;
|
QWidget *that_widget = m_widget;
|
||||||
m_widget = 0;
|
m_widget = 0;
|
||||||
QApplication::sendEvent(object, event);
|
QApplication::sendEvent(object, event);
|
||||||
m_widget = that_widget;
|
m_widget = that_widget;
|
||||||
paintPoints();
|
paintPoints();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoverPoints::paintPoints()
|
void HoverPoints::paintPoints()
|
||||||
{
|
{
|
||||||
QPainter p;
|
QPainter p;
|
||||||
p.begin(m_widget);
|
p.begin(m_widget);
|
||||||
p.setRenderHint(QPainter::Antialiasing);
|
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(QBrush());
|
|
||||||
|
|
||||||
if (m_connectionPen.style() != Qt::NoPen && m_connectionType != NoConnection) {
|
|
||||||
p.setPen(m_connectionPen);
|
|
||||||
|
|
||||||
if (m_connectionType == CurveConnection) {
|
p.setBrush(m_gradient);
|
||||||
QPainterPath path;
|
//p.setBrush(QColor(230,230,230));
|
||||||
path.moveTo(m_points.at(0));
|
p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
for (int i=1; i<m_points.size(); ++i) {
|
p.drawRoundedRect(QRect(1, 1, m_widget->width() - 2, m_widget->height() - 2), 4.0, 4.0);
|
||||||
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(),
|
p.setBrush(QBrush());
|
||||||
p1.x() + distance / 2, p2.y(),
|
|
||||||
p2.x(), p2.y());
|
|
||||||
}
|
|
||||||
p.drawPath(path);
|
|
||||||
} else {
|
|
||||||
p.drawPolyline(m_points);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.setPen(m_pointPen);
|
if (m_connectionPen.style() != Qt::NoPen && m_connectionType != NoConnection)
|
||||||
p.setBrush(m_pointBrush);
|
{
|
||||||
|
p.setPen(m_connectionPen);
|
||||||
|
|
||||||
for (int i=0; i<m_points.size(); ++i) {
|
if (m_connectionType == CurveConnection)
|
||||||
QRectF bounds = pointBoundingRect(i);
|
{
|
||||||
if (m_shape == CircleShape)
|
QPainterPath path;
|
||||||
p.drawEllipse(bounds);
|
path.moveTo(m_points.at(0));
|
||||||
else
|
for (int i=1; i<m_points.size(); ++i)
|
||||||
p.drawRect(bounds);
|
{
|
||||||
}
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static QPointF bound_point(const QPointF &point, const QRectF &bounds, int lock)
|
static QPointF bound_point(const QPointF &point, const QRectF &bounds, int lock)
|
||||||
{
|
{
|
||||||
QPointF p = point;
|
QPointF p = point;
|
||||||
|
|
||||||
qreal left = bounds.left();
|
qreal left = bounds.left();
|
||||||
qreal right = bounds.right();
|
qreal right = bounds.right();
|
||||||
qreal top = bounds.top();
|
qreal top = bounds.top();
|
||||||
qreal bottom = bounds.bottom();
|
qreal bottom = bounds.bottom();
|
||||||
|
|
||||||
if (p.x() < left || (lock & HoverPoints::LockToLeft)) p.setX(left);
|
if (p.x() < left || (lock & HoverPoints::LockToLeft)) p.setX(left);
|
||||||
else if (p.x() > right || (lock & HoverPoints::LockToRight)) p.setX(right);
|
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);
|
else if (p.y() > bottom || (lock & HoverPoints::LockToBottom)) p.setY(bottom);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoverPoints::setPoints(const QPolygonF &points)
|
void HoverPoints::setPoints(const QPolygonF &points)
|
||||||
{
|
{
|
||||||
if (points.size() != m_points.size())
|
if (points.size() != m_points.size())
|
||||||
m_fingerPointMapping.clear();
|
m_fingerPointMapping.clear();
|
||||||
m_points.clear();
|
m_points.clear();
|
||||||
for (int i=0; i<points.size(); ++i)
|
for (int i=0; i<points.size(); ++i)
|
||||||
m_points << bound_point(points.at(i), boundingRect(), 0);
|
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.fill(0);
|
m_locks.clear();
|
||||||
}
|
if (m_points.size() > 0)
|
||||||
|
{
|
||||||
|
m_locks.resize(m_points.size());
|
||||||
|
|
||||||
|
m_locks.fill(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HoverPoints::movePoint(int index, const QPointF &point, bool emitUpdate)
|
void HoverPoints::movePoint(int index, const QPointF &point, bool emitUpdate)
|
||||||
{
|
{
|
||||||
m_points[index] = bound_point(point, boundingRect(), m_locks.at(index));
|
m_points[index] = bound_point(point, boundingRect(), m_locks.at(index));
|
||||||
if (emitUpdate)
|
if (emitUpdate)
|
||||||
firePointChange();
|
firePointChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoverPoints::createGradient()
|
void HoverPoints::createGradient()
|
||||||
{
|
{
|
||||||
m_gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
|
m_gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
m_gradient.setCenter(0.45, 0.50);
|
m_gradient.setCenter(0.45, 0.50);
|
||||||
m_gradient.setFocalPoint(0.40, 0.45);
|
m_gradient.setFocalPoint(0.40, 0.45);
|
||||||
m_gradient.setColorAt(0.0, QColor(175, 216, 252));
|
m_gradient.setColorAt(0.0, QColor(175, 216, 252));
|
||||||
m_gradient.setColorAt(0.4, QColor(151, 183, 220));
|
m_gradient.setColorAt(0.4, QColor(151, 183, 220));
|
||||||
m_gradient.setColorAt(0.8, QColor(86, 126, 191));
|
m_gradient.setColorAt(0.8, QColor(86, 126, 191));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static bool x_less_than(const QPointF &p1, const QPointF &p2)
|
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)
|
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()
|
void HoverPoints::firePointChange()
|
||||||
{
|
{
|
||||||
if (m_sortType != NoSort) {
|
if (m_sortType != NoSort)
|
||||||
|
{
|
||||||
QPointF oldCurrent;
|
|
||||||
if (m_currentIndex != -1) {
|
QPointF oldCurrent;
|
||||||
oldCurrent = m_points[m_currentIndex];
|
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)
|
if (m_sortType == XSort)
|
||||||
qSort(m_points.begin(), m_points.end(), y_less_than);
|
qSort(m_points.begin(), m_points.end(), x_less_than);
|
||||||
|
else if (m_sortType == YSort)
|
||||||
// Compensate for changed order...
|
qSort(m_points.begin(), m_points.end(), y_less_than);
|
||||||
if (m_currentIndex != -1) {
|
|
||||||
for (int i=0; i<m_points.size(); ++i) {
|
// Compensate for changed order...
|
||||||
if (m_points[i] == oldCurrent) {
|
if (m_currentIndex != -1)
|
||||||
m_currentIndex = i;
|
{
|
||||||
break;
|
for (int i=0; i<m_points.size(); ++i)
|
||||||
}
|
{
|
||||||
}
|
if (m_points[i] == oldCurrent)
|
||||||
}
|
{
|
||||||
}
|
m_currentIndex = i;
|
||||||
Q_EMIT pointsChanged(m_points);
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Q_EMIT pointsChanged(m_points);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,118 +48,167 @@ QT_FORWARD_DECLARE_CLASS(QBypassWidget)
|
||||||
|
|
||||||
class HoverPoints : public QObject
|
class HoverPoints : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum PointShape {
|
enum PointShape
|
||||||
CircleShape,
|
{
|
||||||
RectangleShape
|
CircleShape,
|
||||||
};
|
RectangleShape
|
||||||
|
};
|
||||||
|
|
||||||
enum LockType {
|
enum LockType
|
||||||
LockToLeft = 0x01,
|
{
|
||||||
LockToRight = 0x02,
|
LockToLeft = 0x01,
|
||||||
LockToTop = 0x04,
|
LockToRight = 0x02,
|
||||||
LockToBottom = 0x08
|
LockToTop = 0x04,
|
||||||
};
|
LockToBottom = 0x08
|
||||||
|
};
|
||||||
|
|
||||||
enum SortType {
|
enum SortType
|
||||||
NoSort,
|
{
|
||||||
XSort,
|
NoSort,
|
||||||
YSort
|
XSort,
|
||||||
};
|
YSort
|
||||||
|
};
|
||||||
|
|
||||||
enum ConnectionType {
|
enum ConnectionType
|
||||||
NoConnection,
|
{
|
||||||
LineConnection,
|
NoConnection,
|
||||||
CurveConnection
|
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;
|
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
|
||||||
void setPoints(const QPolygonF &points);
|
{
|
||||||
|
return m_points;
|
||||||
|
}
|
||||||
|
void setPoints(const QPolygonF &points);
|
||||||
|
|
||||||
QSizeF pointSize() const { return m_pointSize; }
|
QSizeF pointSize() const
|
||||||
void setPointSize(const QSizeF &size) { m_pointSize = size; }
|
{
|
||||||
|
return m_pointSize;
|
||||||
|
}
|
||||||
|
void setPointSize(const QSizeF &size)
|
||||||
|
{
|
||||||
|
m_pointSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
SortType sortType() const { return m_sortType; }
|
SortType sortType() const
|
||||||
void setSortType(SortType sortType) { m_sortType = sortType; }
|
{
|
||||||
|
return m_sortType;
|
||||||
|
}
|
||||||
|
void setSortType(SortType sortType)
|
||||||
|
{
|
||||||
|
m_sortType = sortType;
|
||||||
|
}
|
||||||
|
|
||||||
ConnectionType connectionType() const { return m_connectionType; }
|
ConnectionType connectionType() const
|
||||||
void setConnectionType(ConnectionType connectionType) { m_connectionType = connectionType; }
|
{
|
||||||
|
return m_connectionType;
|
||||||
|
}
|
||||||
|
void setConnectionType(ConnectionType connectionType)
|
||||||
|
{
|
||||||
|
m_connectionType = connectionType;
|
||||||
|
}
|
||||||
|
|
||||||
void setConnectionPen(const QPen &pen) { m_connectionPen = pen; }
|
void setConnectionPen(const QPen &pen)
|
||||||
void setShapePen(const QPen &pen) { m_pointPen = pen; }
|
{
|
||||||
void setShapeBrush(const QBrush &brush) { m_pointBrush = brush; }
|
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; }
|
void setEditable(bool editable)
|
||||||
bool editable() const { return m_editable; }
|
{
|
||||||
|
m_editable = editable;
|
||||||
|
}
|
||||||
|
bool editable() const
|
||||||
|
{
|
||||||
|
return m_editable;
|
||||||
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
void setDisabled(bool disabled) { setEnabled(!disabled); }
|
void setDisabled(bool disabled)
|
||||||
|
{
|
||||||
|
setEnabled(!disabled);
|
||||||
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void pointsChanged(const QPolygonF &points);
|
void pointsChanged(const QPolygonF &points);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void firePointChange();
|
void firePointChange();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline QRectF pointBoundingRect(int i) const;
|
inline QRectF pointBoundingRect(int i) const;
|
||||||
void movePoint(int i, const QPointF &newPos, bool emitChange = true);
|
void movePoint(int i, const QPointF &newPos, bool emitChange = true);
|
||||||
void createGradient();
|
void createGradient();
|
||||||
|
|
||||||
QWidget *m_widget;
|
|
||||||
|
|
||||||
QPolygonF m_points;
|
QWidget *m_widget;
|
||||||
QRectF m_bounds;
|
|
||||||
PointShape m_shape;
|
|
||||||
SortType m_sortType;
|
|
||||||
ConnectionType m_connectionType;
|
|
||||||
|
|
||||||
QVector<uint> m_locks;
|
QPolygonF m_points;
|
||||||
|
QRectF m_bounds;
|
||||||
|
PointShape m_shape;
|
||||||
|
SortType m_sortType;
|
||||||
|
ConnectionType m_connectionType;
|
||||||
|
|
||||||
QSizeF m_pointSize;
|
QVector<uint> m_locks;
|
||||||
int m_currentIndex;
|
|
||||||
int m_minCountPoints;
|
|
||||||
bool m_editable;
|
|
||||||
bool m_enabled;
|
|
||||||
|
|
||||||
QHash<int, int> m_fingerPointMapping;
|
QSizeF m_pointSize;
|
||||||
|
int m_currentIndex;
|
||||||
|
int m_minCountPoints;
|
||||||
|
bool m_editable;
|
||||||
|
bool m_enabled;
|
||||||
|
|
||||||
QPen m_pointPen;
|
QHash<int, int> m_fingerPointMapping;
|
||||||
QBrush m_pointBrush;
|
|
||||||
QPen m_connectionPen;
|
QPen m_pointPen;
|
||||||
QRadialGradient m_gradient;
|
QBrush m_pointBrush;
|
||||||
|
QPen m_connectionPen;
|
||||||
|
QRadialGradient m_gradient;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline QRectF HoverPoints::pointBoundingRect(int i) const
|
inline QRectF HoverPoints::pointBoundingRect(int i) const
|
||||||
{
|
{
|
||||||
QPointF p = m_points.at(i);
|
QPointF p = m_points.at(i);
|
||||||
qreal w = m_pointSize.width();
|
qreal w = m_pointSize.width();
|
||||||
qreal h = m_pointSize.height();
|
qreal h = m_pointSize.height();
|
||||||
qreal x = p.x() - w / 2;
|
qreal x = p.x() - w / 2;
|
||||||
qreal y = p.y() - h / 2;
|
qreal y = p.y() - h / 2;
|
||||||
return QRectF(x, y, w, h);
|
return QRectF(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QRectF HoverPoints::boundingRect() const
|
inline QRectF HoverPoints::boundingRect() const
|
||||||
{
|
{
|
||||||
if (m_bounds.isEmpty())
|
if (m_bounds.isEmpty())
|
||||||
return m_widget->rect();
|
return m_widget->rect();
|
||||||
else
|
else
|
||||||
return m_bounds;
|
return m_bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HOVERPOINTS_H
|
#endif // HOVERPOINTS_H
|
||||||
|
|
|
@ -29,10 +29,11 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
|
CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -57,11 +58,11 @@ CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
|
||||||
_ui.particlePlaneBasicWidget->setWrapper(&_PlaneBasisWrapper);
|
_ui.particlePlaneBasicWidget->setWrapper(&_PlaneBasisWrapper);
|
||||||
_ui.particlePlaneBasicWidget->setSchemeWrapper(&_PlaneBasisWrapper);
|
_ui.particlePlaneBasicWidget->setSchemeWrapper(&_PlaneBasisWrapper);
|
||||||
_ui.particlePlaneBasicWidget->init();
|
_ui.particlePlaneBasicWidget->init();
|
||||||
|
|
||||||
// Fake motion blur coeff
|
// Fake motion blur coeff
|
||||||
_ui.blurCoeffWidget->setRange(0.0, 5.0);
|
_ui.blurCoeffWidget->setRange(0.0, 5.0);
|
||||||
_ui.blurCoeffWidget->setWrapper(&_MotionBlurCoeffWrapper);
|
_ui.blurCoeffWidget->setWrapper(&_MotionBlurCoeffWrapper);
|
||||||
|
|
||||||
// Fake motion blur threshold
|
// Fake motion blur threshold
|
||||||
_ui.blurTresholdWidget->setRange(0.0, 5.0);
|
_ui.blurTresholdWidget->setRange(0.0, 5.0);
|
||||||
_ui.blurTresholdWidget->setWrapper(&_MotionBlurThresholdWrapper);
|
_ui.blurTresholdWidget->setWrapper(&_MotionBlurThresholdWrapper);
|
||||||
|
@ -106,7 +107,7 @@ CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
|
||||||
// Ribbon texture U factor
|
// Ribbon texture U factor
|
||||||
_ui.ribbonTexUfactorWidget->setRange(0, 5);
|
_ui.ribbonTexUfactorWidget->setRange(0, 5);
|
||||||
_ui.ribbonTexUfactorWidget->setWrapper(&_RibbonUFactorWrapper);
|
_ui.ribbonTexUfactorWidget->setWrapper(&_RibbonUFactorWrapper);
|
||||||
|
|
||||||
// Ribbon texture V factor
|
// Ribbon texture V factor
|
||||||
_ui.ribbonTexVfactorWidget->setRange(0, 5);
|
_ui.ribbonTexVfactorWidget->setRange(0, 5);
|
||||||
_ui.ribbonTexVfactorWidget->setWrapper(&_RibbonVFactorWrapper);
|
_ui.ribbonTexVfactorWidget->setWrapper(&_RibbonVFactorWrapper);
|
||||||
|
@ -129,9 +130,9 @@ CLocatedBindablePage::CLocatedBindablePage(QWidget *parent)
|
||||||
|
|
||||||
_ui.particleTextureWidget->setWrapper(&_TextureNoAnimWrapper);
|
_ui.particleTextureWidget->setWrapper(&_TextureNoAnimWrapper);
|
||||||
_ui.particleTextureWidget->enableRemoveButton(true);
|
_ui.particleTextureWidget->enableRemoveButton(true);
|
||||||
|
|
||||||
hideAllWidget();
|
hideAllWidget();
|
||||||
|
|
||||||
connect(_ui.autoLodCheckBox, SIGNAL(toggled(bool)), this, SLOT(setAutoLOD(bool)));
|
connect(_ui.autoLodCheckBox, SIGNAL(toggled(bool)), this, SLOT(setAutoLOD(bool)));
|
||||||
connect(_ui.globalColorLightingCheckBox, SIGNAL(toggled(bool)), this, SLOT(setGlobalColorLight(bool)));
|
connect(_ui.globalColorLightingCheckBox, SIGNAL(toggled(bool)), this, SLOT(setGlobalColorLight(bool)));
|
||||||
connect(_ui.independantSizeCheckBox, SIGNAL(toggled(bool)), this, SLOT(setIndependantSize(bool)));
|
connect(_ui.independantSizeCheckBox, SIGNAL(toggled(bool)), this, SLOT(setIndependantSize(bool)));
|
||||||
|
@ -159,7 +160,7 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
{
|
{
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_Bindable = locatedBindable;
|
_Bindable = locatedBindable;
|
||||||
|
|
||||||
hideAllWidget();
|
hideAllWidget();
|
||||||
|
|
||||||
// No Auto LOD
|
// No Auto LOD
|
||||||
|
@ -209,26 +210,26 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_ui.globalColorLightingCheckBox->hide();
|
_ui.globalColorLightingCheckBox->hide();
|
||||||
|
|
||||||
// check support for color
|
// check support for color
|
||||||
if (dynamic_cast<NL3D::CPSColoredParticle *>(_Bindable))
|
if (dynamic_cast<NL3D::CPSColoredParticle *>(_Bindable))
|
||||||
{
|
{
|
||||||
_ColorWrapper.S = dynamic_cast<NL3D::CPSColoredParticle *>(_Bindable);
|
_ColorWrapper.S = dynamic_cast<NL3D::CPSColoredParticle *>(_Bindable);
|
||||||
_ui.colorWidget->setWorkspaceNode(_Node);
|
_ui.colorWidget->setWorkspaceNode(_Node);
|
||||||
_ui.colorWidget->updateUi();
|
_ui.colorWidget->updateUi();
|
||||||
|
|
||||||
// Add material page in tabWidget
|
// Add material page in tabWidget
|
||||||
_ui.tabWidget->addTab(_ui.materialPage, tr("Material"));
|
_ui.tabWidget->addTab(_ui.materialPage, tr("Material"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynamic_cast<NL3D::CPSSizedParticle *>(_Bindable))
|
if (dynamic_cast<NL3D::CPSSizedParticle *>(_Bindable))
|
||||||
{
|
{
|
||||||
updateSizeControl();
|
updateSizeControl();
|
||||||
|
|
||||||
// Size/Angle2D page in tabWidget
|
// Size/Angle2D page in tabWidget
|
||||||
_ui.tabWidget->addTab(_ui.sizeAnglePage, tr("Size/Angle 2D"));
|
_ui.tabWidget->addTab(_ui.sizeAnglePage, tr("Size/Angle 2D"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// check support for angle 2D
|
// check support for angle 2D
|
||||||
if (dynamic_cast<NL3D::CPSRotated2DParticle *>(_Bindable))
|
if (dynamic_cast<NL3D::CPSRotated2DParticle *>(_Bindable))
|
||||||
{
|
{
|
||||||
|
@ -239,7 +240,7 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_ui.angle2DWidget->hide();
|
_ui.angle2DWidget->hide();
|
||||||
|
|
||||||
// check support for plane basis
|
// check support for plane basis
|
||||||
if (dynamic_cast<NL3D::CPSRotated3DPlaneParticle *>(_Bindable))
|
if (dynamic_cast<NL3D::CPSRotated3DPlaneParticle *>(_Bindable))
|
||||||
{
|
{
|
||||||
|
@ -247,7 +248,7 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
_ui.particlePlaneBasicWidget->setWorkspaceNode(_Node);
|
_ui.particlePlaneBasicWidget->setWorkspaceNode(_Node);
|
||||||
_ui.particlePlaneBasicWidget->updateUi();
|
_ui.particlePlaneBasicWidget->updateUi();
|
||||||
_ui.particlePlaneBasicWidget->setEnabled(true);
|
_ui.particlePlaneBasicWidget->setEnabled(true);
|
||||||
|
|
||||||
// Add material page in tabWidget
|
// Add material page in tabWidget
|
||||||
_ui.tabWidget->addTab(_ui.rotatePage, tr("Rotations"));
|
_ui.tabWidget->addTab(_ui.rotatePage, tr("Rotations"));
|
||||||
}
|
}
|
||||||
|
@ -275,18 +276,18 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
_MotionBlurThresholdWrapper.P = fla;
|
_MotionBlurThresholdWrapper.P = fla;
|
||||||
_MotionBlurThresholdWrapper.OwnerNode = _Node;
|
_MotionBlurThresholdWrapper.OwnerNode = _Node;
|
||||||
_ui.blurTresholdWidget->updateUi();
|
_ui.blurTresholdWidget->updateUi();
|
||||||
|
|
||||||
_ui.zalignCheckBox->show();
|
_ui.zalignCheckBox->show();
|
||||||
_ui.alignCheckBox->show();
|
_ui.alignCheckBox->show();
|
||||||
_ui.alignCheckBox->setChecked(fla->getAlignOnMotion());
|
_ui.alignCheckBox->setChecked(fla->getAlignOnMotion());
|
||||||
_ui.zalignCheckBox->setChecked(fla->getAlignOnZAxis());
|
_ui.zalignCheckBox->setChecked(fla->getAlignOnZAxis());
|
||||||
|
|
||||||
// 'look at' independant sizes
|
// 'look at' independant sizes
|
||||||
_ui.independantSizeCheckBox->setChecked(fla->hasIndependantSizes());
|
_ui.independantSizeCheckBox->setChecked(fla->hasIndependantSizes());
|
||||||
|
|
||||||
_ui.independantSizeCheckBox->show();
|
_ui.independantSizeCheckBox->show();
|
||||||
_ui.independantGroupBox->show();
|
_ui.independantGroupBox->show();
|
||||||
|
|
||||||
// Add Look at page in tabWidget
|
// Add Look at page in tabWidget
|
||||||
_ui.tabWidget->addTab(_ui.lookAtPage, tr("Look At param"));
|
_ui.tabWidget->addTab(_ui.lookAtPage, tr("Look At param"));
|
||||||
}
|
}
|
||||||
|
@ -300,7 +301,7 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
if (dynamic_cast<NL3D::CPSShockWave *>(_Bindable))
|
if (dynamic_cast<NL3D::CPSShockWave *>(_Bindable))
|
||||||
{
|
{
|
||||||
NL3D::CPSShockWave *sw = static_cast<NL3D::CPSShockWave *>(_Bindable);
|
NL3D::CPSShockWave *sw = static_cast<NL3D::CPSShockWave *>(_Bindable);
|
||||||
|
|
||||||
_RadiusCutWrapper.OwnerNode = _Node;
|
_RadiusCutWrapper.OwnerNode = _Node;
|
||||||
_RadiusCutWrapper.S = sw;
|
_RadiusCutWrapper.S = sw;
|
||||||
_ui.radiusCutWidget->updateUi();
|
_ui.radiusCutWidget->updateUi();
|
||||||
|
@ -323,19 +324,19 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
_FanLightWrapper.OwnerNode = _Node;
|
_FanLightWrapper.OwnerNode = _Node;
|
||||||
_FanLightWrapper.P = dynamic_cast<NL3D::CPSFanLight *>(_Bindable);
|
_FanLightWrapper.P = dynamic_cast<NL3D::CPSFanLight *>(_Bindable);
|
||||||
_ui.nbFanLightWidget->updateUi();
|
_ui.nbFanLightWidget->updateUi();
|
||||||
|
|
||||||
_FanLightSmoothnessWrapper.OwnerNode = _Node;
|
_FanLightSmoothnessWrapper.OwnerNode = _Node;
|
||||||
_FanLightSmoothnessWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
|
_FanLightSmoothnessWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
|
||||||
_ui.phaseSmoothnesWidget->updateUi();
|
_ui.phaseSmoothnesWidget->updateUi();
|
||||||
|
|
||||||
_FanLightPhaseWrapper.OwnerNode = _Node;
|
_FanLightPhaseWrapper.OwnerNode = _Node;
|
||||||
_FanLightPhaseWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
|
_FanLightPhaseWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
|
||||||
_ui.fanLightSpeedWidget->updateUi();
|
_ui.fanLightSpeedWidget->updateUi();
|
||||||
|
|
||||||
_FanLightIntensityWrapper.OwnerNode = _Node;
|
_FanLightIntensityWrapper.OwnerNode = _Node;
|
||||||
_FanLightIntensityWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
|
_FanLightIntensityWrapper.P = static_cast<NL3D::CPSFanLight *>(_Bindable);
|
||||||
_ui.fanLightIntensityWidget->updateUi();
|
_ui.fanLightIntensityWidget->updateUi();
|
||||||
|
|
||||||
// Add Fan Light page in tabWidget
|
// Add Fan Light page in tabWidget
|
||||||
_ui.tabWidget->addTab(_ui.fanLightPage, tr("Fan Light param"));
|
_ui.tabWidget->addTab(_ui.fanLightPage, tr("Fan Light param"));
|
||||||
}
|
}
|
||||||
|
@ -349,14 +350,14 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
_TailParticleWrapper.OwnerNode = _Node;
|
_TailParticleWrapper.OwnerNode = _Node;
|
||||||
_TailParticleWrapper.P = dynamic_cast<NL3D::CPSTailParticle *>(_Bindable);
|
_TailParticleWrapper.P = dynamic_cast<NL3D::CPSTailParticle *>(_Bindable);
|
||||||
_ui.tailNbSegsWidget->updateUi();
|
_ui.tailNbSegsWidget->updateUi();
|
||||||
|
|
||||||
_ui.tailWidget->setCurrentTailParticle(_Node, dynamic_cast<NL3D::CPSTailParticle *>(_Bindable));
|
_ui.tailWidget->setCurrentTailParticle(_Node, dynamic_cast<NL3D::CPSTailParticle *>(_Bindable));
|
||||||
|
|
||||||
_ui.ribbonTexUfactorWidget->hide();
|
_ui.ribbonTexUfactorWidget->hide();
|
||||||
_ui.ribbonTexVfactorWidget->hide();
|
_ui.ribbonTexVfactorWidget->hide();
|
||||||
_ui.tailTexUflabel->hide();
|
_ui.tailTexUflabel->hide();
|
||||||
_ui.tailTexVflabel->hide();
|
_ui.tailTexVflabel->hide();
|
||||||
|
|
||||||
// Add tail page in tabWidget
|
// Add tail page in tabWidget
|
||||||
_ui.tabWidget->addTab(_ui.ribbonTailPage, tr("Tail param"));
|
_ui.tabWidget->addTab(_ui.ribbonTailPage, tr("Tail param"));
|
||||||
}
|
}
|
||||||
|
@ -384,10 +385,10 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
if (dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable))
|
if (dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable))
|
||||||
{
|
{
|
||||||
_ui.texAnimWidget->setCurrentTextureAnim(dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable),
|
_ui.texAnimWidget->setCurrentTextureAnim(dynamic_cast<NL3D::CPSTexturedParticle *>(_Bindable),
|
||||||
dynamic_cast<NL3D::CPSMultiTexturedParticle *>(_Bindable),
|
dynamic_cast<NL3D::CPSMultiTexturedParticle *>(_Bindable),
|
||||||
_Node);
|
_Node);
|
||||||
_ui.texAnimWidget->show();
|
_ui.texAnimWidget->show();
|
||||||
|
|
||||||
_ui.tabWidget->addTab(_ui.texturePage, tr("Texture param"));
|
_ui.tabWidget->addTab(_ui.texturePage, tr("Texture param"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -401,7 +402,7 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
|
|
||||||
_ui.particleTextureWidget->updateUi();
|
_ui.particleTextureWidget->updateUi();
|
||||||
_ui.particleTextureWidget->show();
|
_ui.particleTextureWidget->show();
|
||||||
|
|
||||||
_ui.tabWidget->addTab(_ui.texturePage, tr("Texture param"));
|
_ui.tabWidget->addTab(_ui.texturePage, tr("Texture param"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -417,7 +418,7 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
_RibbonVFactorWrapper.OwnerNode = _Node;
|
_RibbonVFactorWrapper.OwnerNode = _Node;
|
||||||
_RibbonVFactorWrapper.R = static_cast<NL3D::CPSRibbon *>(_Bindable);
|
_RibbonVFactorWrapper.R = static_cast<NL3D::CPSRibbon *>(_Bindable);
|
||||||
_ui.ribbonTexVfactorWidget->updateUi();
|
_ui.ribbonTexVfactorWidget->updateUi();
|
||||||
|
|
||||||
_ui.ribbonTexUfactorWidget->show();
|
_ui.ribbonTexUfactorWidget->show();
|
||||||
_ui.ribbonTexVfactorWidget->show();
|
_ui.ribbonTexVfactorWidget->show();
|
||||||
_ui.tailTexUflabel->show();
|
_ui.tailTexUflabel->show();
|
||||||
|
@ -441,12 +442,12 @@ void CLocatedBindablePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLoc
|
||||||
_LODDegradationWrapper.OwnerNode = _Node;
|
_LODDegradationWrapper.OwnerNode = _Node;
|
||||||
_LODDegradationWrapper.R = ribbon;
|
_LODDegradationWrapper.R = ribbon;
|
||||||
_ui.lodDegradationWidget->updateUi();
|
_ui.lodDegradationWidget->updateUi();
|
||||||
|
|
||||||
// Coord system
|
// Coord system
|
||||||
_ui.coordSystemComboBox->setCurrentIndex(ribbon->getMatrixMode());
|
_ui.coordSystemComboBox->setCurrentIndex(ribbon->getMatrixMode());
|
||||||
_ui.useHermitteCheckBox->setChecked(ribbon->getInterpolationMode() == NL3D::CPSRibbonBase::Hermitte);
|
_ui.useHermitteCheckBox->setChecked(ribbon->getInterpolationMode() == NL3D::CPSRibbonBase::Hermitte);
|
||||||
_ui.constantLengthCheckBox->setChecked(ribbon->getRibbonMode() == NL3D::CPSRibbonBase::FixedSize);
|
_ui.constantLengthCheckBox->setChecked(ribbon->getRibbonMode() == NL3D::CPSRibbonBase::FixedSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +570,7 @@ void CLocatedBindablePage::setRotSpeedMax(double value)
|
||||||
nlassert(rotatedParticle);
|
nlassert(rotatedParticle);
|
||||||
float valueMin, valueMax;
|
float valueMin, valueMax;
|
||||||
uint32 nbModels = rotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
|
uint32 nbModels = rotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
|
||||||
if (valueMax != value)
|
if (valueMax != value)
|
||||||
{
|
{
|
||||||
rotatedParticle->hintRotateTheSame(nbModels, valueMin, value);
|
rotatedParticle->hintRotateTheSame(nbModels, valueMin, value);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -582,7 +583,7 @@ void CLocatedBindablePage::setRotSpeedMin(double value)
|
||||||
nlassert(rotatedParticle);
|
nlassert(rotatedParticle);
|
||||||
float valueMin, valueMax;
|
float valueMin, valueMax;
|
||||||
uint32 nbModels = rotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
|
uint32 nbModels = rotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
|
||||||
if (valueMin != value)
|
if (valueMin != value)
|
||||||
{
|
{
|
||||||
rotatedParticle->hintRotateTheSame(nbModels, value, valueMax);
|
rotatedParticle->hintRotateTheSame(nbModels, value, valueMax);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -595,9 +596,9 @@ void CLocatedBindablePage::setNumModels(int value)
|
||||||
nlassert(rotatedParticle);
|
nlassert(rotatedParticle);
|
||||||
float valueMin, valueMax;
|
float valueMin, valueMax;
|
||||||
sint32 nbModels;
|
sint32 nbModels;
|
||||||
|
|
||||||
nbModels = rotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
|
nbModels = rotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
|
||||||
if (nbModels != value)
|
if (nbModels != value)
|
||||||
{
|
{
|
||||||
rotatedParticle->hintRotateTheSame((uint32) value, valueMin, valueMax);
|
rotatedParticle->hintRotateTheSame((uint32) value, valueMin, valueMax);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -640,7 +641,7 @@ void CLocatedBindablePage::updateValidWidgetForAlignOnMotion(bool align)
|
||||||
void CLocatedBindablePage::updateSizeControl()
|
void CLocatedBindablePage::updateSizeControl()
|
||||||
{
|
{
|
||||||
if (!dynamic_cast<NL3D::CPSSizedParticle *>(_Bindable)) return;
|
if (!dynamic_cast<NL3D::CPSSizedParticle *>(_Bindable)) return;
|
||||||
|
|
||||||
NL3D::CPSFaceLookAt *fla = dynamic_cast<NL3D::CPSFaceLookAt *>(_Bindable);
|
NL3D::CPSFaceLookAt *fla = dynamic_cast<NL3D::CPSFaceLookAt *>(_Bindable);
|
||||||
// LookAt case
|
// LookAt case
|
||||||
if (fla && fla->hasIndependantSizes())
|
if (fla && fla->hasIndependantSizes())
|
||||||
|
@ -649,7 +650,7 @@ void CLocatedBindablePage::updateSizeControl()
|
||||||
_ui.sizeWidget->setTitle(tr("Width"));
|
_ui.sizeWidget->setTitle(tr("Width"));
|
||||||
else
|
else
|
||||||
_ui.sizeWidget->setTitle(tr("Height"));
|
_ui.sizeWidget->setTitle(tr("Height"));
|
||||||
|
|
||||||
if (_ui.widthRadioButton->isChecked()) // wrap to the wanted size
|
if (_ui.widthRadioButton->isChecked()) // wrap to the wanted size
|
||||||
_SizeWrapper.S = fla;
|
_SizeWrapper.S = fla;
|
||||||
else
|
else
|
||||||
|
@ -660,7 +661,7 @@ void CLocatedBindablePage::updateSizeControl()
|
||||||
_SizeWrapper.S = dynamic_cast<NL3D::CPSSizedParticle *>(_Bindable);
|
_SizeWrapper.S = dynamic_cast<NL3D::CPSSizedParticle *>(_Bindable);
|
||||||
_ui.sizeWidget->setTitle(tr("Size"));
|
_ui.sizeWidget->setTitle(tr("Size"));
|
||||||
}
|
}
|
||||||
|
|
||||||
_ui.sizeWidget->setWorkspaceNode(_Node);
|
_ui.sizeWidget->setWorkspaceNode(_Node);
|
||||||
_ui.sizeWidget->updateUi();
|
_ui.sizeWidget->updateUi();
|
||||||
}
|
}
|
||||||
|
@ -677,7 +678,7 @@ void CLocatedBindablePage::hideAllWidget()
|
||||||
void CLocatedBindablePage::touchPSState()
|
void CLocatedBindablePage::touchPSState()
|
||||||
{
|
{
|
||||||
if (_Node && _Node->getPSModel())
|
if (_Node && _Node->getPSModel())
|
||||||
{
|
{
|
||||||
_Node->getPSModel()->touchTransparencyState();
|
_Node->getPSModel()->touchTransparencyState();
|
||||||
_Node->getPSModel()->touchLightableState();
|
_Node->getPSModel()->touchLightableState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CLocatedBindablePage
|
@class CLocatedBindablePage
|
||||||
|
@ -45,8 +46,8 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CLocatedBindablePage: public QWidget
|
class CLocatedBindablePage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLocatedBindablePage(QWidget *parent = 0);
|
CLocatedBindablePage(QWidget *parent = 0);
|
||||||
~CLocatedBindablePage();
|
~CLocatedBindablePage();
|
||||||
|
@ -77,181 +78,328 @@ private:
|
||||||
/// Wrappers to various element of bindables
|
/// Wrappers to various element of bindables
|
||||||
|
|
||||||
/// Size
|
/// Size
|
||||||
struct CSizeWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CSizeWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSSizedParticle *S;
|
NL3D::CPSSizedParticle *S;
|
||||||
float get(void) const { return S->getSize(); }
|
float get(void) const
|
||||||
void set(const float &v) { S->setSize(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return S->getSizeScheme(); }
|
return S->getSize();
|
||||||
void setScheme(scheme_type *s) { S->setSizeScheme(s); }
|
}
|
||||||
|
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;
|
} _SizeWrapper;
|
||||||
|
|
||||||
/// Color
|
/// Color
|
||||||
struct CColorWrapper : public IPSWrapperRGBA, IPSSchemeWrapperRGBA
|
struct CColorWrapper : public IPSWrapperRGBA, IPSSchemeWrapperRGBA
|
||||||
{
|
{
|
||||||
NL3D::CPSColoredParticle *S;
|
NL3D::CPSColoredParticle *S;
|
||||||
NLMISC::CRGBA get(void) const { return S->getColor(); }
|
NLMISC::CRGBA get(void) const
|
||||||
void set(const NLMISC::CRGBA &v) { S->setColor(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return S->getColorScheme(); }
|
return S->getColor();
|
||||||
void setScheme(scheme_type *s) { S->setColorScheme(s); }
|
}
|
||||||
|
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;
|
} _ColorWrapper;
|
||||||
|
|
||||||
/// Angle 2D
|
/// Angle 2D
|
||||||
struct CAngle2DWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CAngle2DWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSRotated2DParticle *S;
|
NL3D::CPSRotated2DParticle *S;
|
||||||
float get(void) const { return S->getAngle2D(); }
|
float get(void) const
|
||||||
void set(const float &v) { S->setAngle2D(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return S->getAngle2DScheme(); }
|
return S->getAngle2D();
|
||||||
void setScheme(scheme_type *s) { S->setAngle2DScheme(s); }
|
}
|
||||||
|
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;
|
} _Angle2DWrapper;
|
||||||
|
|
||||||
/// Plane basis
|
/// Plane basis
|
||||||
struct CPlaneBasisWrapper : public IPSWrapper<NL3D::CPlaneBasis>, IPSSchemeWrapper<NL3D::CPlaneBasis>
|
struct CPlaneBasisWrapper : public IPSWrapper<NL3D::CPlaneBasis>, IPSSchemeWrapper<NL3D::CPlaneBasis>
|
||||||
{
|
{
|
||||||
NL3D::CPSRotated3DPlaneParticle *S;
|
NL3D::CPSRotated3DPlaneParticle *S;
|
||||||
NL3D::CPlaneBasis get(void) const { return S->getPlaneBasis(); }
|
NL3D::CPlaneBasis get(void) const
|
||||||
void set(const NL3D::CPlaneBasis &p) { S->setPlaneBasis(p); }
|
{
|
||||||
scheme_type *getScheme(void) const { return S->getPlaneBasisScheme(); }
|
return S->getPlaneBasis();
|
||||||
void setScheme(scheme_type *s) { S->setPlaneBasisScheme(s); }
|
}
|
||||||
|
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;
|
} _PlaneBasisWrapper;
|
||||||
|
|
||||||
/// Motion blur coeff
|
/// Motion blur coeff
|
||||||
struct CMotionBlurCoeffWrapper : public IPSWrapperFloat
|
struct CMotionBlurCoeffWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSFaceLookAt *P;
|
NL3D::CPSFaceLookAt *P;
|
||||||
float get(void) const { return P->getMotionBlurCoeff(); }
|
float get(void) const
|
||||||
void set(const float &v) { P->setMotionBlurCoeff(v); }
|
{
|
||||||
|
return P->getMotionBlurCoeff();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
P->setMotionBlurCoeff(v);
|
||||||
|
}
|
||||||
} _MotionBlurCoeffWrapper;
|
} _MotionBlurCoeffWrapper;
|
||||||
struct CMotionBlurThresholdWrapper : public IPSWrapperFloat
|
struct CMotionBlurThresholdWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSFaceLookAt *P;
|
NL3D::CPSFaceLookAt *P;
|
||||||
float get(void) const { return P->getMotionBlurThreshold(); }
|
float get(void) const
|
||||||
void set(const float &v) { P->setMotionBlurThreshold(v); }
|
{
|
||||||
|
return P->getMotionBlurThreshold();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
P->setMotionBlurThreshold(v);
|
||||||
|
}
|
||||||
} _MotionBlurThresholdWrapper;
|
} _MotionBlurThresholdWrapper;
|
||||||
|
|
||||||
/// Fanlight
|
/// Fanlight
|
||||||
struct CFanLightWrapper : public IPSWrapperUInt
|
struct CFanLightWrapper : public IPSWrapperUInt
|
||||||
{
|
{
|
||||||
NL3D::CPSFanLight *P;
|
NL3D::CPSFanLight *P;
|
||||||
uint32 get(void) const { return P->getNbFans(); }
|
uint32 get(void) const
|
||||||
void set(const uint32 &v) { P->setNbFans(v); }
|
{
|
||||||
|
return P->getNbFans();
|
||||||
|
}
|
||||||
|
void set(const uint32 &v)
|
||||||
|
{
|
||||||
|
P->setNbFans(v);
|
||||||
|
}
|
||||||
} _FanLightWrapper;
|
} _FanLightWrapper;
|
||||||
|
|
||||||
struct CFanLightSmoothnessWrapper : public IPSWrapperUInt
|
struct CFanLightSmoothnessWrapper : public IPSWrapperUInt
|
||||||
{
|
{
|
||||||
NL3D::CPSFanLight *P;
|
NL3D::CPSFanLight *P;
|
||||||
uint32 get(void) const { return P->getPhaseSmoothness(); }
|
uint32 get(void) const
|
||||||
void set(const uint32 &v) { P->setPhaseSmoothness(v); }
|
{
|
||||||
|
return P->getPhaseSmoothness();
|
||||||
|
}
|
||||||
|
void set(const uint32 &v)
|
||||||
|
{
|
||||||
|
P->setPhaseSmoothness(v);
|
||||||
|
}
|
||||||
} _FanLightSmoothnessWrapper;
|
} _FanLightSmoothnessWrapper;
|
||||||
|
|
||||||
struct CFanLightPhase : public IPSWrapperFloat
|
struct CFanLightPhase : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSFanLight *P;
|
NL3D::CPSFanLight *P;
|
||||||
float get(void) const { return P->getPhaseSpeed(); }
|
float get(void) const
|
||||||
void set(const float &v) { P->setPhaseSpeed(v); }
|
{
|
||||||
|
return P->getPhaseSpeed();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
P->setPhaseSpeed(v);
|
||||||
|
}
|
||||||
} _FanLightPhaseWrapper;
|
} _FanLightPhaseWrapper;
|
||||||
|
|
||||||
struct CFanLightIntensityWrapper : public IPSWrapperFloat
|
struct CFanLightIntensityWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSFanLight *P;
|
NL3D::CPSFanLight *P;
|
||||||
float get(void) const { return P->getMoveIntensity(); }
|
float get(void) const
|
||||||
void set(const float &v) { P->setMoveIntensity(v); }
|
{
|
||||||
|
return P->getMoveIntensity();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
P->setMoveIntensity(v);
|
||||||
|
}
|
||||||
} _FanLightIntensityWrapper;
|
} _FanLightIntensityWrapper;
|
||||||
|
|
||||||
/// Ribbon / tail dot
|
/// Ribbon / tail dot
|
||||||
struct CTailParticleWrapper : public IPSWrapperUInt
|
struct CTailParticleWrapper : public IPSWrapperUInt
|
||||||
{
|
{
|
||||||
NL3D::CPSTailParticle *P;
|
NL3D::CPSTailParticle *P;
|
||||||
uint32 get(void) const { return P->getTailNbSeg(); }
|
uint32 get(void) const
|
||||||
void set(const uint32 &v) { P->setTailNbSeg(v); }
|
{
|
||||||
|
return P->getTailNbSeg();
|
||||||
|
}
|
||||||
|
void set(const uint32 &v)
|
||||||
|
{
|
||||||
|
P->setTailNbSeg(v);
|
||||||
|
}
|
||||||
} _TailParticleWrapper;
|
} _TailParticleWrapper;
|
||||||
|
|
||||||
/// Duration of segment for a ribbon
|
/// Duration of segment for a ribbon
|
||||||
struct CSegDurationWrapper : public IPSWrapperFloat
|
struct CSegDurationWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSRibbonBase *R;
|
NL3D::CPSRibbonBase *R;
|
||||||
float get(void) const { return R->getSegDuration(); }
|
float get(void) const
|
||||||
void set(const float &v) { R->setSegDuration(v); }
|
{
|
||||||
|
return R->getSegDuration();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
R->setSegDuration(v);
|
||||||
|
}
|
||||||
} _SegDurationWrapper;
|
} _SegDurationWrapper;
|
||||||
|
|
||||||
/// Shockwave
|
/// Shockwave
|
||||||
struct CRadiusCutWrapper : public IPSWrapperFloat
|
struct CRadiusCutWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSShockWave *S;
|
NL3D::CPSShockWave *S;
|
||||||
float get(void) const { return S->getRadiusCut(); }
|
float get(void) const
|
||||||
void set(const float &v) { S->setRadiusCut(v); }
|
{
|
||||||
|
return S->getRadiusCut();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
S->setRadiusCut(v);
|
||||||
|
}
|
||||||
} _RadiusCutWrapper;
|
} _RadiusCutWrapper;
|
||||||
|
|
||||||
struct CShockWaveNbSegWrapper : public IPSWrapperUInt
|
struct CShockWaveNbSegWrapper : public IPSWrapperUInt
|
||||||
{
|
{
|
||||||
NL3D::CPSShockWave *S;
|
NL3D::CPSShockWave *S;
|
||||||
uint32 get(void) const { return S->getNbSegs(); }
|
uint32 get(void) const
|
||||||
void set(const uint32 &v) { S->setNbSegs(v); }
|
{
|
||||||
|
return S->getNbSegs();
|
||||||
|
}
|
||||||
|
void set(const uint32 &v)
|
||||||
|
{
|
||||||
|
S->setNbSegs(v);
|
||||||
|
}
|
||||||
} _ShockWaveNbSegWrapper;
|
} _ShockWaveNbSegWrapper;
|
||||||
|
|
||||||
struct CShockWaveUFactorWrapper : public IPSWrapperFloat
|
struct CShockWaveUFactorWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSShockWave *S;
|
NL3D::CPSShockWave *S;
|
||||||
float get(void) const { return S->getUFactor(); }
|
float get(void) const
|
||||||
void set(const float &v) { S->setUFactor(v); }
|
{
|
||||||
|
return S->getUFactor();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
S->setUFactor(v);
|
||||||
|
}
|
||||||
} _ShockWaveUFactorWrapper;
|
} _ShockWaveUFactorWrapper;
|
||||||
|
|
||||||
/// Unanimated texture
|
/// Unanimated texture
|
||||||
struct CTextureNoAnimWrapper : public IPSWrapperTexture
|
struct CTextureNoAnimWrapper : public IPSWrapperTexture
|
||||||
{
|
{
|
||||||
NL3D::CPSTexturedParticleNoAnim *TP;
|
NL3D::CPSTexturedParticleNoAnim *TP;
|
||||||
virtual NL3D::ITexture *get(void) { return TP->getTexture(); }
|
virtual NL3D::ITexture *get(void)
|
||||||
virtual void set(NL3D::ITexture *t) { TP->setTexture(t); }
|
{
|
||||||
|
return TP->getTexture();
|
||||||
|
}
|
||||||
|
virtual void set(NL3D::ITexture *t)
|
||||||
|
{
|
||||||
|
TP->setTexture(t);
|
||||||
|
}
|
||||||
} _TextureNoAnimWrapper;
|
} _TextureNoAnimWrapper;
|
||||||
|
|
||||||
/// u / v factors for ribbon
|
/// u / v factors for ribbon
|
||||||
struct CRibbonUFactorWrapper : public IPSWrapperFloat
|
struct CRibbonUFactorWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSRibbon *R;
|
NL3D::CPSRibbon *R;
|
||||||
float get(void) const { return R->getUFactor(); }
|
float get(void) const
|
||||||
void set(const float &u) { R->setTexFactor(u, R->getVFactor()); }
|
{
|
||||||
|
return R->getUFactor();
|
||||||
|
}
|
||||||
|
void set(const float &u)
|
||||||
|
{
|
||||||
|
R->setTexFactor(u, R->getVFactor());
|
||||||
|
}
|
||||||
} _RibbonUFactorWrapper;
|
} _RibbonUFactorWrapper;
|
||||||
|
|
||||||
struct CRibbonVFactorWrapper : public IPSWrapperFloat
|
struct CRibbonVFactorWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSRibbon *R;
|
NL3D::CPSRibbon *R;
|
||||||
float get(void) const { return R->getVFactor(); }
|
float get(void) const
|
||||||
void set(const float &v) { R->setTexFactor(R->getUFactor(), v); }
|
{
|
||||||
|
return R->getVFactor();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
R->setTexFactor(R->getUFactor(), v);
|
||||||
|
}
|
||||||
} _RibbonVFactorWrapper;
|
} _RibbonVFactorWrapper;
|
||||||
|
|
||||||
struct CRibbonLengthWrapper : IPSWrapperFloat
|
struct CRibbonLengthWrapper : IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSRibbonBase *R;
|
NL3D::CPSRibbonBase *R;
|
||||||
float get() const { return R->getRibbonLength(); }
|
float get() const
|
||||||
void set(const float &v) { R->setRibbonLength(v); }
|
{
|
||||||
|
return R->getRibbonLength();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
R->setRibbonLength(v);
|
||||||
|
}
|
||||||
} _RibbonLengthWrapper;
|
} _RibbonLengthWrapper;
|
||||||
|
|
||||||
|
|
||||||
struct CLODDegradationWrapper : IPSWrapperFloat
|
struct CLODDegradationWrapper : IPSWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSRibbonBase *R;
|
NL3D::CPSRibbonBase *R;
|
||||||
float get() const { return R->getLODDegradation(); }
|
float get() const
|
||||||
void set(const float &v) { R->setLODDegradation(v); }
|
{
|
||||||
|
return R->getLODDegradation();
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
R->setLODDegradation(v);
|
||||||
|
}
|
||||||
} _LODDegradationWrapper;
|
} _LODDegradationWrapper;
|
||||||
|
|
||||||
void updateValidWidgetForAlignOnMotion(bool align);
|
void updateValidWidgetForAlignOnMotion(bool align);
|
||||||
|
|
||||||
void updateSizeControl();
|
void updateSizeControl();
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
void hideAllWidget();
|
void hideAllWidget();
|
||||||
|
|
||||||
void touchPSState();
|
void touchPSState();
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
/// The bindable being edited
|
/// The bindable being edited
|
||||||
NL3D::CPSLocatedBindable *_Bindable;
|
NL3D::CPSLocatedBindable *_Bindable;
|
||||||
|
|
||||||
Ui::CLocatedBindablePage _ui;
|
Ui::CLocatedBindablePage _ui;
|
||||||
|
|
||||||
}; /* class CLocatedBindablePage */
|
}; /* class CLocatedBindablePage */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QInputDialog>
|
#include <QtGui/QInputDialog>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/3d/particle_system.h>
|
#include <nel/3d/particle_system.h>
|
||||||
|
@ -30,13 +30,14 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CLocatedPage::CLocatedPage(QWidget *parent)
|
CLocatedPage::CLocatedPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.lifeWidget->setRange(0, 10);
|
_ui.lifeWidget->setRange(0, 10);
|
||||||
_ui.lifeWidget->setWrapper(&_LifeWrapper);
|
_ui.lifeWidget->setWrapper(&_LifeWrapper);
|
||||||
_ui.lifeWidget->setSchemeWrapper(&_LifeWrapper);
|
_ui.lifeWidget->setSchemeWrapper(&_LifeWrapper);
|
||||||
|
@ -44,7 +45,7 @@ CLocatedPage::CLocatedPage(QWidget *parent)
|
||||||
///_ui.lifeWidget->enableLowerBound(0, true);
|
///_ui.lifeWidget->enableLowerBound(0, true);
|
||||||
_ui.lifeWidget->enableMemoryScheme(false);
|
_ui.lifeWidget->enableMemoryScheme(false);
|
||||||
_ui.lifeWidget->init();
|
_ui.lifeWidget->init();
|
||||||
|
|
||||||
_ui.massWidget->setRange(0.001f, 10);
|
_ui.massWidget->setRange(0.001f, 10);
|
||||||
_ui.massWidget->setWrapper(&_MassWrapper);
|
_ui.massWidget->setWrapper(&_MassWrapper);
|
||||||
_ui.massWidget->setSchemeWrapper(&_MassWrapper);
|
_ui.massWidget->setSchemeWrapper(&_MassWrapper);
|
||||||
|
@ -52,10 +53,10 @@ CLocatedPage::CLocatedPage(QWidget *parent)
|
||||||
///_ui.massWidget->enableLowerBound(0, true);
|
///_ui.massWidget->enableLowerBound(0, true);
|
||||||
_ui.massWidget->enableMemoryScheme(false);
|
_ui.massWidget->enableMemoryScheme(false);
|
||||||
_ui.massWidget->init();
|
_ui.massWidget->init();
|
||||||
|
|
||||||
_ui.maxNumParticleWidget->setRange(1, 501);
|
_ui.maxNumParticleWidget->setRange(1, 501);
|
||||||
_ui.maxNumParticleWidget->enableUpperBound(1 << 16, true);
|
_ui.maxNumParticleWidget->enableUpperBound(1 << 16, true);
|
||||||
|
|
||||||
connect(_ui.coordSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setMatrixMode(int)));
|
connect(_ui.coordSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setMatrixMode(int)));
|
||||||
connect(_ui.disgradeWithLODCheckBox, SIGNAL(toggled(bool)), this, SLOT(setDisgradeWithLod(bool)));
|
connect(_ui.disgradeWithLODCheckBox, SIGNAL(toggled(bool)), this, SLOT(setDisgradeWithLod(bool)));
|
||||||
connect(_ui.parametricMotionCheckBox, SIGNAL(toggled(bool)), this, SLOT(setParametricMotion(bool)));
|
connect(_ui.parametricMotionCheckBox, SIGNAL(toggled(bool)), this, SLOT(setParametricMotion(bool)));
|
||||||
|
@ -75,12 +76,12 @@ void CLocatedPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
|
||||||
{
|
{
|
||||||
_Located = located;
|
_Located = located;
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
|
|
||||||
_LifeWrapper.Located = _Located;
|
_LifeWrapper.Located = _Located;
|
||||||
_LifeWrapper.Node = _Node;
|
_LifeWrapper.Node = _Node;
|
||||||
_ui.lifeWidget->setWorkspaceNode(_Node);
|
_ui.lifeWidget->setWorkspaceNode(_Node);
|
||||||
_ui.lifeWidget->updateUi();
|
_ui.lifeWidget->updateUi();
|
||||||
|
|
||||||
if (_Located->getLastForever())
|
if (_Located->getLastForever())
|
||||||
_ui.lifeWidget->setEnabled(false);
|
_ui.lifeWidget->setEnabled(false);
|
||||||
|
|
||||||
|
@ -89,17 +90,17 @@ void CLocatedPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
|
||||||
_ui.massWidget->setWorkspaceNode(_Node);
|
_ui.massWidget->setWorkspaceNode(_Node);
|
||||||
_ui.massWidget->updateUi();
|
_ui.massWidget->updateUi();
|
||||||
|
|
||||||
if (_Located->getOwner())
|
if (_Located->getOwner())
|
||||||
_ui.maxNumParticleWidget->setEnabled(!_Located->getOwner()->getAutoCountFlag());
|
_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.coordSystemComboBox->setCurrentIndex(int(_Located->getMatrixMode()));
|
||||||
_ui.limitedLifeTimeCheckBox->setChecked(!_Located->getLastForever());
|
_ui.limitedLifeTimeCheckBox->setChecked(!_Located->getLastForever());
|
||||||
_ui.lifeWidget->setEnabled(!_Located->getLastForever());
|
_ui.lifeWidget->setEnabled(!_Located->getLastForever());
|
||||||
_ui.trigerOnDeathCheckBox->setChecked(_Located->isTriggerOnDeathEnabled());
|
_ui.trigerOnDeathCheckBox->setChecked(_Located->isTriggerOnDeathEnabled());
|
||||||
updateTriggerOnDeath();
|
updateTriggerOnDeath();
|
||||||
|
|
||||||
_ui.disgradeWithLODCheckBox->setChecked(_Located->hasLODDegradation());
|
_ui.disgradeWithLODCheckBox->setChecked(_Located->hasLODDegradation());
|
||||||
updateIntegrable();
|
updateIntegrable();
|
||||||
updateTriggerOnDeath();
|
updateTriggerOnDeath();
|
||||||
|
@ -127,13 +128,13 @@ void CLocatedPage::setLimitedLifeTime(bool state)
|
||||||
forceApplied = true;
|
forceApplied = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (forceApplied)
|
if (forceApplied)
|
||||||
{
|
{
|
||||||
int ret = QMessageBox::critical(this, tr("NeL particle system editor"),
|
int ret = QMessageBox::critical(this, tr("NeL particle system editor"),
|
||||||
tr("The object has force(s) applied on it. If it last forever, "
|
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 ..)"),
|
"its motion can become instable after a while. Continue anyway ? (clue : you've been warned ..)"),
|
||||||
QMessageBox::Ok | QMessageBox::Cancel);
|
QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
|
|
||||||
if (ret == QMessageBox::Cancel)
|
if (ret == QMessageBox::Cancel)
|
||||||
{
|
{
|
||||||
|
@ -147,10 +148,10 @@ void CLocatedPage::setLimitedLifeTime(bool state)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
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', "
|
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."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
_ui.limitedLifeTimeCheckBox->setChecked(true);
|
_ui.limitedLifeTimeCheckBox->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,10 +185,10 @@ void CLocatedPage::setParametricMotion(bool state)
|
||||||
|
|
||||||
void CLocatedPage::editTriggerOnDeath()
|
void CLocatedPage::editTriggerOnDeath()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int i = QInputDialog::getInt(this, tr("Set the extern ID"),
|
int i = QInputDialog::getInt(this, tr("Set the extern ID"),
|
||||||
tr("0 means no extern access."),
|
tr("0 means no extern access."),
|
||||||
_Located->getTriggerEmitterID(), 0, 9999, 1, &ok);
|
_Located->getTriggerEmitterID(), 0, 9999, 1, &ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
_Located->setTriggerEmitterID(uint32(i));
|
_Located->setTriggerEmitterID(uint32(i));
|
||||||
|
@ -233,7 +234,7 @@ void CLocatedPage::setNewMaxSize(uint32 value)
|
||||||
/// WARNING:
|
/// WARNING:
|
||||||
///TreeCtrl->suppressLocatedInstanceNbItem(*Node, v);
|
///TreeCtrl->suppressLocatedInstanceNbItem(*Node, v);
|
||||||
}
|
}
|
||||||
_Located->resize(value);
|
_Located->resize(value);
|
||||||
|
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
@ -246,21 +247,21 @@ void CLocatedPage::updateIntegrable(void)
|
||||||
|
|
||||||
void CLocatedPage::updateTriggerOnDeath(void)
|
void CLocatedPage::updateTriggerOnDeath(void)
|
||||||
{
|
{
|
||||||
nlassert(_Located);
|
nlassert(_Located);
|
||||||
bool enable = !_Located->getLastForever();
|
bool enable = !_Located->getLastForever();
|
||||||
_ui.trigerOnDeathCheckBox->setEnabled(enable);
|
_ui.trigerOnDeathCheckBox->setEnabled(enable);
|
||||||
_ui.editPushButton->setEnabled(enable && _Located->isTriggerOnDeathEnabled());
|
_ui.editPushButton->setEnabled(enable && _Located->isTriggerOnDeathEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLocatedPage::CLifeWrapper::set(const float &v)
|
void CLocatedPage::CLifeWrapper::set(const float &v)
|
||||||
{
|
{
|
||||||
Located->setInitialLife(v);
|
Located->setInitialLife(v);
|
||||||
Modules::psEdit().resetAutoCount(Node);
|
Modules::psEdit().resetAutoCount(Node);
|
||||||
}
|
}
|
||||||
void CLocatedPage::CLifeWrapper::setScheme(scheme_type *s)
|
void CLocatedPage::CLifeWrapper::setScheme(scheme_type *s)
|
||||||
{
|
{
|
||||||
Located->setLifeScheme(s);
|
Located->setLifeScheme(s);
|
||||||
Modules::psEdit().resetAutoCount(Node);
|
Modules::psEdit().resetAutoCount(Node);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -33,10 +33,11 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CPSLocated;
|
class CPSLocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CLocatedPage
|
@class CLocatedPage
|
||||||
|
@ -44,15 +45,15 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CLocatedPage: public QWidget
|
class CLocatedPage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLocatedPage(QWidget *parent = 0);
|
CLocatedPage(QWidget *parent = 0);
|
||||||
~CLocatedPage();
|
~CLocatedPage();
|
||||||
|
|
||||||
/// Set the located to edit.
|
/// Set the located to edit.
|
||||||
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *located);
|
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *located);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setDisabledCountPS(bool state);
|
void setDisabledCountPS(bool state);
|
||||||
void setLimitedLifeTime(bool state);
|
void setLimitedLifeTime(bool state);
|
||||||
|
@ -70,21 +71,39 @@ private:
|
||||||
/// wrapper to tune the mass of particles
|
/// wrapper to tune the mass of particles
|
||||||
struct CMassWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CMassWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSLocated *Located;
|
NL3D::CPSLocated *Located;
|
||||||
float get(void) const { return Located->getInitialMass(); }
|
float get(void) const
|
||||||
void set(const float &v) { Located->setInitialMass(v); }
|
{
|
||||||
virtual scheme_type *getScheme(void) const { return Located->getMassScheme(); }
|
return Located->getInitialMass();
|
||||||
virtual void setScheme(scheme_type *s) { Located->setMassScheme(s); }
|
}
|
||||||
|
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;
|
} _MassWrapper;
|
||||||
|
|
||||||
struct CLifeWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CLifeWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSLocated *Located;
|
NL3D::CPSLocated *Located;
|
||||||
CWorkspaceNode *Node;
|
CWorkspaceNode *Node;
|
||||||
float get(void) const { return Located->getInitialLife(); }
|
float get(void) const
|
||||||
void set(const float &v);
|
{
|
||||||
virtual scheme_type *getScheme(void) const { return Located->getLifeScheme(); }
|
return Located->getInitialLife();
|
||||||
virtual void setScheme(scheme_type *s);
|
}
|
||||||
|
void set(const float &v);
|
||||||
|
virtual scheme_type *getScheme(void) const
|
||||||
|
{
|
||||||
|
return Located->getLifeScheme();
|
||||||
|
}
|
||||||
|
virtual void setScheme(scheme_type *s);
|
||||||
} _LifeWrapper;
|
} _LifeWrapper;
|
||||||
|
|
||||||
/// the located this dialog is editing
|
/// the located this dialog is editing
|
||||||
|
@ -98,7 +117,10 @@ private:
|
||||||
/// update the 'trigger on death' control
|
/// update the 'trigger on death' control
|
||||||
void updateTriggerOnDeath(void);
|
void updateTriggerOnDeath(void);
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
Ui::CLocatedPage _ui;
|
Ui::CLocatedPage _ui;
|
||||||
}; /* class CLocatedPage */
|
}; /* class CLocatedPage */
|
||||||
|
|
|
@ -32,9 +32,11 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
CFileDisplayer *s_FileDisplayer = NULL;
|
CFileDisplayer *s_FileDisplayer = NULL;
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ CFileDisplayer *s_FileDisplayer = NULL;
|
||||||
|
|
||||||
sint main(int argc, char **argv)
|
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
|
// use log.log if NEL_LOG_IN_FILE and NLQT_USE_LOG_LOG defined as 1
|
||||||
createDebug(NULL, NLQT_USE_LOG_LOG, false);
|
createDebug(NULL, NLQT_USE_LOG_LOG, false);
|
||||||
|
@ -74,10 +76,10 @@ sint main(int argc, char **argv)
|
||||||
WarningLog->addDisplayer(NLQT::s_FileDisplayer);
|
WarningLog->addDisplayer(NLQT::s_FileDisplayer);
|
||||||
AssertLog->addDisplayer(NLQT::s_FileDisplayer);
|
AssertLog->addDisplayer(NLQT::s_FileDisplayer);
|
||||||
ErrorLog->addDisplayer(NLQT::s_FileDisplayer);
|
ErrorLog->addDisplayer(NLQT::s_FileDisplayer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nlinfo("Welcome to NeL!");
|
nlinfo("Welcome to NeL!");
|
||||||
|
|
||||||
NLMISC::CPath::remapExtension("tga", "png", true);
|
NLMISC::CPath::remapExtension("tga", "png", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +87,7 @@ sint main(int argc, char **argv)
|
||||||
QSplashScreen *splash = new QSplashScreen();
|
QSplashScreen *splash = new QSplashScreen();
|
||||||
splash->setPixmap(QPixmap(":/images/nel_ide_load.png"));
|
splash->setPixmap(QPixmap(":/images/nel_ide_load.png"));
|
||||||
splash->show();
|
splash->show();
|
||||||
|
|
||||||
Modules::init();
|
Modules::init();
|
||||||
|
|
||||||
// load and set remap extensions from config
|
// load and set remap extensions from config
|
||||||
|
|
|
@ -49,17 +49,18 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CMainWindow::CMainWindow(QWidget *parent)
|
CMainWindow::CMainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
_isGraphicsInitialized(false), _isGraphicsEnabled(false),
|
_isGraphicsInitialized(false), _isGraphicsEnabled(false),
|
||||||
_isSoundInitialized(false), _isSoundEnabled(false),
|
_isSoundInitialized(false), _isSoundEnabled(false),
|
||||||
_isLandscapeInitialized(false), _isLandscapeEnabled(false),
|
_isLandscapeInitialized(false), _isLandscapeEnabled(false),
|
||||||
_GraphicsViewport(NULL), _lastDir(".")
|
_GraphicsViewport(NULL), _lastDir(".")
|
||||||
{
|
{
|
||||||
nldebug("CMainWindow::CMainWindow:");
|
nldebug("CMainWindow::CMainWindow:");
|
||||||
|
|
||||||
// create NeL viewport
|
// create NeL viewport
|
||||||
_GraphicsViewport = new CGraphicsViewport(this);
|
_GraphicsViewport = new CGraphicsViewport(this);
|
||||||
setCentralWidget(_GraphicsViewport);
|
setCentralWidget(_GraphicsViewport);
|
||||||
|
@ -78,9 +79,9 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||||
createMenus();
|
createMenus();
|
||||||
createToolBars();
|
createToolBars();
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
|
|
||||||
setWindowIcon(QIcon(":/images/nel.png"));
|
setWindowIcon(QIcon(":/images/nel.png"));
|
||||||
|
|
||||||
QSettings settings("object_viewer_qt.ini", QSettings::IniFormat);
|
QSettings settings("object_viewer_qt.ini", QSettings::IniFormat);
|
||||||
settings.beginGroup("WindowSettings");
|
settings.beginGroup("WindowSettings");
|
||||||
restoreState(settings.value("QtWindowState").toByteArray());
|
restoreState(settings.value("QtWindowState").toByteArray());
|
||||||
|
@ -90,25 +91,25 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||||
_isGraphicsEnabled = true;
|
_isGraphicsEnabled = true;
|
||||||
_isLandscapeEnabled = true;
|
_isLandscapeEnabled = true;
|
||||||
|
|
||||||
// As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed.
|
// As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed.
|
||||||
// This can be used to do heavy work while providing a snappy user interface.
|
// This can be used to do heavy work while providing a snappy user interface.
|
||||||
_mainTimer = new QTimer(this);
|
_mainTimer = new QTimer(this);
|
||||||
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
||||||
// timer->start(); // <- timeout 0
|
// timer->start(); // <- timeout 0
|
||||||
// it's heavy on cpu, though, when no 3d driver initialized :)
|
// it's heavy on cpu, though, when no 3d driver initialized :)
|
||||||
_mainTimer->start(25); // 25fps
|
_mainTimer->start(25); // 25fps
|
||||||
|
|
||||||
_statusBarTimer = new QTimer(this);
|
_statusBarTimer = new QTimer(this);
|
||||||
connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
|
connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
|
||||||
_statusBarTimer->start(5000);
|
_statusBarTimer->start(5000);
|
||||||
|
|
||||||
Modules::config().setAndCallback("SoundEnabled", CConfigCallback(this, &CMainWindow::cfcbSoundEnabled));
|
Modules::config().setAndCallback("SoundEnabled", CConfigCallback(this, &CMainWindow::cfcbSoundEnabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMainWindow::~CMainWindow()
|
CMainWindow::~CMainWindow()
|
||||||
{
|
{
|
||||||
nldebug("CMainWindow::~CMainWindow:");
|
nldebug("CMainWindow::~CMainWindow:");
|
||||||
|
|
||||||
// save state & geometry of window and widgets
|
// save state & geometry of window and widgets
|
||||||
QSettings settings("object_viewer_qt.ini", QSettings::IniFormat);
|
QSettings settings("object_viewer_qt.ini", QSettings::IniFormat);
|
||||||
settings.beginGroup("WindowSettings");
|
settings.beginGroup("WindowSettings");
|
||||||
|
@ -159,23 +160,23 @@ int CMainWindow::getFrameRate()
|
||||||
void CMainWindow::open()
|
void CMainWindow::open()
|
||||||
{
|
{
|
||||||
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
||||||
tr("Open NeL data file"), _lastDir,
|
tr("Open NeL data file"), _lastDir,
|
||||||
tr("All NeL files (*.shape *.ps);;"
|
tr("All NeL files (*.shape *.ps);;"
|
||||||
"NeL shape files (*.shape);;"
|
"NeL shape files (*.shape);;"
|
||||||
"NeL particle system files (*.ps)"));
|
"NeL particle system files (*.ps)"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileNames.isEmpty())
|
if (!fileNames.isEmpty())
|
||||||
{
|
{
|
||||||
QStringList list = fileNames;
|
QStringList list = fileNames;
|
||||||
_lastDir = QFileInfo(list.front()).absolutePath();
|
_lastDir = QFileInfo(list.front()).absolutePath();
|
||||||
|
|
||||||
QString skelFileName = QFileDialog::getOpenFileName(this,
|
QString skelFileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open skeleton file"), _lastDir,
|
tr("Open skeleton file"), _lastDir,
|
||||||
tr("NeL skeleton file (*.skel)"));
|
tr("NeL skeleton file (*.skel)"));
|
||||||
|
|
||||||
Q_FOREACH(QString fileName, list)
|
Q_FOREACH(QString fileName, list)
|
||||||
loadFile(fileName, skelFileName);
|
loadFile(fileName, skelFileName);
|
||||||
|
|
||||||
_AnimationSetDialog->updateListObject();
|
_AnimationSetDialog->updateListObject();
|
||||||
_AnimationSetDialog->updateListAnim();
|
_AnimationSetDialog->updateListAnim();
|
||||||
|
@ -203,14 +204,14 @@ void CMainWindow::settings()
|
||||||
void CMainWindow::about()
|
void CMainWindow::about()
|
||||||
{
|
{
|
||||||
QMessageBox::about(this, tr("About Object Viewer Qt"),
|
QMessageBox::about(this, tr("About Object Viewer Qt"),
|
||||||
tr("<h2>Object Viewer Qt 8-)</h2>"
|
tr("<h2>Object Viewer Qt 8-)</h2>"
|
||||||
"<p> Authors: dnk-88, sfb, Kaetemi, kervala <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
"<p> Authors: dnk-88, sfb, Kaetemi, kervala <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::updateStatusBar()
|
void CMainWindow::updateStatusBar()
|
||||||
{
|
{
|
||||||
if (_isGraphicsInitialized)
|
if (_isGraphicsInitialized)
|
||||||
statusBar()->showMessage(QString(Modules::objView().getDriver()->getVideocardInformation()));
|
statusBar()->showMessage(QString(Modules::objView().getDriver()->getVideocardInformation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::updateInitialization(bool visible)
|
void CMainWindow::updateInitialization(bool visible)
|
||||||
|
@ -221,7 +222,7 @@ void CMainWindow::updateInitialization(bool visible)
|
||||||
done = true; // set false whenever change
|
done = true; // set false whenever change
|
||||||
bool wantSound = _isSoundEnabled && visible;
|
bool wantSound = _isSoundEnabled && visible;
|
||||||
bool wantGraphics = _isGraphicsEnabled && visible;
|
bool wantGraphics = _isGraphicsEnabled && visible;
|
||||||
// TODO WARNING: made Landscape stuff
|
// TODO WARNING: made Landscape stuff
|
||||||
bool wantLandscape = wantGraphics && _isGraphicsInitialized && _isLandscapeEnabled;
|
bool wantLandscape = wantGraphics && _isGraphicsInitialized && _isLandscapeEnabled;
|
||||||
|
|
||||||
// .. stuff that depends on other stuff goes on top to prioritize deinitialization
|
// .. stuff that depends on other stuff goes on top to prioritize deinitialization
|
||||||
|
@ -273,7 +274,7 @@ void CMainWindow::updateInitialization(bool visible)
|
||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sound (AudioMixer)
|
// Sound (AudioMixer)
|
||||||
if (_isSoundInitialized)
|
if (_isSoundInitialized)
|
||||||
{
|
{
|
||||||
|
@ -298,17 +299,18 @@ void CMainWindow::updateInitialization(bool visible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (!done);
|
}
|
||||||
|
while (!done);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::createActions()
|
void CMainWindow::createActions()
|
||||||
{
|
{
|
||||||
_openAction = new QAction(tr("&Open..."), this);
|
_openAction = new QAction(tr("&Open..."), this);
|
||||||
_openAction->setIcon(QIcon(":/images/open-file.png"));
|
_openAction->setIcon(QIcon(":/images/open-file.png"));
|
||||||
_openAction->setShortcut(QKeySequence::Open);
|
_openAction->setShortcut(QKeySequence::Open);
|
||||||
_openAction->setStatusTip(tr("Open an existing file"));
|
_openAction->setStatusTip(tr("Open an existing file"));
|
||||||
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
|
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
|
||||||
|
|
||||||
_exitAction = new QAction(tr("E&xit"), this);
|
_exitAction = new QAction(tr("E&xit"), this);
|
||||||
_exitAction->setShortcut(tr("Ctrl+Q"));
|
_exitAction->setShortcut(tr("Ctrl+Q"));
|
||||||
_exitAction->setStatusTip(tr("Exit the application"));
|
_exitAction->setStatusTip(tr("Exit the application"));
|
||||||
|
@ -318,7 +320,7 @@ void CMainWindow::createActions()
|
||||||
_setBackColorAction->setText(tr("Set &background color"));
|
_setBackColorAction->setText(tr("Set &background color"));
|
||||||
_setBackColorAction->setIcon(QIcon(":/images/ico_bgcolor.png"));
|
_setBackColorAction->setIcon(QIcon(":/images/ico_bgcolor.png"));
|
||||||
_setBackColorAction->setStatusTip(tr("Set background color"));
|
_setBackColorAction->setStatusTip(tr("Set background color"));
|
||||||
|
|
||||||
_resetSceneAction = new QAction(tr("&Reset scene"), this);
|
_resetSceneAction = new QAction(tr("&Reset scene"), this);
|
||||||
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
||||||
connect(_resetSceneAction, SIGNAL(triggered()), this, SLOT(resetScene()));
|
connect(_resetSceneAction, SIGNAL(triggered()), this, SLOT(resetScene()));
|
||||||
|
@ -331,7 +333,7 @@ void CMainWindow::createActions()
|
||||||
_settingsAction->setIcon(QIcon(":/images/preferences.png"));
|
_settingsAction->setIcon(QIcon(":/images/preferences.png"));
|
||||||
_settingsAction->setStatusTip(tr("Settings"));
|
_settingsAction->setStatusTip(tr("Settings"));
|
||||||
connect(_settingsAction, SIGNAL(triggered()), this, SLOT(settings()));
|
connect(_settingsAction, SIGNAL(triggered()), this, SLOT(settings()));
|
||||||
|
|
||||||
_aboutAction = new QAction(tr("&About"), this);
|
_aboutAction = new QAction(tr("&About"), this);
|
||||||
_aboutAction->setStatusTip(tr("Show the application's About box"));
|
_aboutAction->setStatusTip(tr("Show the application's About box"));
|
||||||
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
||||||
|
@ -351,43 +353,43 @@ void CMainWindow::createMenus()
|
||||||
_viewMenu = menuBar()->addMenu(tr("&View"));
|
_viewMenu = menuBar()->addMenu(tr("&View"));
|
||||||
_viewMenu->addAction(_setBackColorAction);
|
_viewMenu->addAction(_setBackColorAction);
|
||||||
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
||||||
|
|
||||||
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
||||||
_sceneMenu->addAction(_resetSceneAction);
|
_sceneMenu->addAction(_resetSceneAction);
|
||||||
_sceneMenu->addAction(_saveScreenshotAction);
|
_sceneMenu->addAction(_saveScreenshotAction);
|
||||||
|
|
||||||
_toolsMenu = menuBar()->addMenu(tr("&Tools"));
|
_toolsMenu = menuBar()->addMenu(tr("&Tools"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_AnimationDialog->toggleViewAction());
|
_toolsMenu->addAction(_AnimationDialog->toggleViewAction());
|
||||||
_AnimationDialog->toggleViewAction()->setIcon(QIcon(":/images/anim.png"));
|
_AnimationDialog->toggleViewAction()->setIcon(QIcon(":/images/anim.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_AnimationSetDialog->toggleViewAction());
|
_toolsMenu->addAction(_AnimationSetDialog->toggleViewAction());
|
||||||
_AnimationSetDialog->toggleViewAction()->setIcon(QIcon(":/images/animset.png"));
|
_AnimationSetDialog->toggleViewAction()->setIcon(QIcon(":/images/animset.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_SlotManagerDialog->toggleViewAction());
|
_toolsMenu->addAction(_SlotManagerDialog->toggleViewAction());
|
||||||
_SlotManagerDialog->toggleViewAction()->setIcon(QIcon(":/images/mixer.png"));
|
_SlotManagerDialog->toggleViewAction()->setIcon(QIcon(":/images/mixer.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_ParticleControlDialog->toggleViewAction());
|
_toolsMenu->addAction(_ParticleControlDialog->toggleViewAction());
|
||||||
_ParticleControlDialog->toggleViewAction()->setIcon(QIcon(":/images/pqrticles.png"));
|
_ParticleControlDialog->toggleViewAction()->setIcon(QIcon(":/images/pqrticles.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_DayNightDialog->toggleViewAction());
|
_toolsMenu->addAction(_DayNightDialog->toggleViewAction());
|
||||||
_DayNightDialog->toggleViewAction()->setIcon(QIcon(":/images/dqynight.png"));
|
_DayNightDialog->toggleViewAction()->setIcon(QIcon(":/images/dqynight.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_WaterPoolDialog->toggleViewAction());
|
_toolsMenu->addAction(_WaterPoolDialog->toggleViewAction());
|
||||||
_WaterPoolDialog->toggleViewAction()->setIcon(QIcon(":/images/water.png"));
|
_WaterPoolDialog->toggleViewAction()->setIcon(QIcon(":/images/water.png"));
|
||||||
_WaterPoolDialog->toggleViewAction()->setEnabled(false);
|
_WaterPoolDialog->toggleViewAction()->setEnabled(false);
|
||||||
|
|
||||||
_toolsMenu->addAction(_VegetableDialog->toggleViewAction());
|
_toolsMenu->addAction(_VegetableDialog->toggleViewAction());
|
||||||
_VegetableDialog->toggleViewAction()->setIcon(QIcon(":/images/veget.png"));
|
_VegetableDialog->toggleViewAction()->setIcon(QIcon(":/images/veget.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_GlobalWindDialog->toggleViewAction());
|
_toolsMenu->addAction(_GlobalWindDialog->toggleViewAction());
|
||||||
_GlobalWindDialog->toggleViewAction()->setIcon(QIcon(":/images/wind.png"));
|
_GlobalWindDialog->toggleViewAction()->setIcon(QIcon(":/images/wind.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_SkeletonScaleDialog->toggleViewAction());
|
_toolsMenu->addAction(_SkeletonScaleDialog->toggleViewAction());
|
||||||
_SkeletonScaleDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_skelscale.png"));
|
_SkeletonScaleDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_skelscale.png"));
|
||||||
|
|
||||||
_toolsMenu->addAction(_SunColorDialog->toggleViewAction());
|
_toolsMenu->addAction(_SunColorDialog->toggleViewAction());
|
||||||
|
|
||||||
connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)),
|
connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)),
|
||||||
_ParticleWorkspaceDialog, SLOT(setVisible(bool)));
|
_ParticleWorkspaceDialog, SLOT(setVisible(bool)));
|
||||||
|
|
||||||
|
@ -395,7 +397,7 @@ void CMainWindow::createMenus()
|
||||||
_ParticleWorkspaceDialog->_PropertyDialog, SLOT(setVisible(bool)));
|
_ParticleWorkspaceDialog->_PropertyDialog, SLOT(setVisible(bool)));
|
||||||
|
|
||||||
_toolsMenu->addSeparator();
|
_toolsMenu->addSeparator();
|
||||||
|
|
||||||
_toolsMenu->addAction(_settingsAction);
|
_toolsMenu->addAction(_settingsAction);
|
||||||
|
|
||||||
menuBar()->addSeparator();
|
menuBar()->addSeparator();
|
||||||
|
@ -409,7 +411,7 @@ void CMainWindow::createToolBars()
|
||||||
{
|
{
|
||||||
_fileToolBar = addToolBar(tr("&File"));
|
_fileToolBar = addToolBar(tr("&File"));
|
||||||
_fileToolBar->addAction(_openAction);
|
_fileToolBar->addAction(_openAction);
|
||||||
|
|
||||||
//_editToolBar = addToolBar(tr("&Edit"));
|
//_editToolBar = addToolBar(tr("&Edit"));
|
||||||
//_editToolBar->addSeparator();
|
//_editToolBar->addSeparator();
|
||||||
_toolsBar = addToolBar(tr("&Tools"));
|
_toolsBar = addToolBar(tr("&Tools"));
|
||||||
|
@ -435,7 +437,7 @@ void CMainWindow::createDialogs()
|
||||||
_AnimationDialog = new CAnimationDialog(this);
|
_AnimationDialog = new CAnimationDialog(this);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, _AnimationDialog);
|
addDockWidget(Qt::BottomDockWidgetArea, _AnimationDialog);
|
||||||
_AnimationDialog->setVisible(false);
|
_AnimationDialog->setVisible(false);
|
||||||
|
|
||||||
// create animation set manager dialog
|
// create animation set manager dialog
|
||||||
_AnimationSetDialog = new CAnimationSetDialog(this);
|
_AnimationSetDialog = new CAnimationSetDialog(this);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, _AnimationSetDialog);
|
addDockWidget(Qt::LeftDockWidgetArea, _AnimationSetDialog);
|
||||||
|
@ -445,7 +447,7 @@ void CMainWindow::createDialogs()
|
||||||
_SlotManagerDialog = new CSlotManagerDialog(this);
|
_SlotManagerDialog = new CSlotManagerDialog(this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, _SlotManagerDialog);
|
addDockWidget(Qt::RightDockWidgetArea, _SlotManagerDialog);
|
||||||
_SlotManagerDialog->setVisible(false);
|
_SlotManagerDialog->setVisible(false);
|
||||||
|
|
||||||
// create particle control dialog
|
// create particle control dialog
|
||||||
_ParticleControlDialog = new CParticleControlDialog(_SkeletonTreeModel ,this);
|
_ParticleControlDialog = new CParticleControlDialog(_SkeletonTreeModel ,this);
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, _ParticleControlDialog);
|
addDockWidget(Qt::BottomDockWidgetArea, _ParticleControlDialog);
|
||||||
|
@ -475,7 +477,7 @@ void CMainWindow::createDialogs()
|
||||||
_GlobalWindDialog = new CGlobalWindDialog(this);
|
_GlobalWindDialog = new CGlobalWindDialog(this);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, _GlobalWindDialog);
|
addDockWidget(Qt::TopDockWidgetArea, _GlobalWindDialog);
|
||||||
_GlobalWindDialog->setVisible(false);
|
_GlobalWindDialog->setVisible(false);
|
||||||
|
|
||||||
// create sun color dialog
|
// create sun color dialog
|
||||||
_SunColorDialog = new CSunColorDialog(this);
|
_SunColorDialog = new CSunColorDialog(this);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, _SunColorDialog);
|
addDockWidget(Qt::LeftDockWidgetArea, _SunColorDialog);
|
||||||
|
@ -489,12 +491,12 @@ void CMainWindow::createDialogs()
|
||||||
_SkeletonScaleDialog = new CSkeletonScaleDialog(_SkeletonTreeModel, this);
|
_SkeletonScaleDialog = new CSkeletonScaleDialog(_SkeletonTreeModel, this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, _SkeletonScaleDialog);
|
addDockWidget(Qt::RightDockWidgetArea, _SkeletonScaleDialog);
|
||||||
_SkeletonScaleDialog->setVisible(false);
|
_SkeletonScaleDialog->setVisible(false);
|
||||||
|
|
||||||
// create setup fog dialog
|
// create setup fog dialog
|
||||||
_SetupFog = new CSetupFog(this);
|
_SetupFog = new CSetupFog(this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, _SetupFog);
|
addDockWidget(Qt::RightDockWidgetArea, _SetupFog);
|
||||||
_SetupFog->setVisible(false);
|
_SetupFog->setVisible(false);
|
||||||
|
|
||||||
connect(_ParticleControlDialog, SIGNAL(changeState()), _ParticleWorkspaceDialog, SLOT(setNewState()));
|
connect(_ParticleControlDialog, SIGNAL(changeState()), _ParticleWorkspaceDialog, SLOT(setNewState()));
|
||||||
connect(_ParticleWorkspaceDialog, SIGNAL(changeActiveNode()), _ParticleControlDialog, SLOT(updateActiveNode()));
|
connect(_ParticleWorkspaceDialog, SIGNAL(changeActiveNode()), _ParticleControlDialog, SLOT(updateActiveNode()));
|
||||||
connect(_AnimationSetDialog->ui.setLengthPushButton, SIGNAL(clicked()), _AnimationDialog, SLOT(changeAnimLength()));
|
connect(_AnimationSetDialog->ui.setLengthPushButton, SIGNAL(clicked()), _AnimationDialog, SLOT(changeAnimLength()));
|
||||||
|
@ -535,23 +537,23 @@ void CMainWindow::cfcbSoundEnabled(NLMISC::CConfigFile::CVar &var)
|
||||||
void CMainWindow::updateRender()
|
void CMainWindow::updateRender()
|
||||||
{
|
{
|
||||||
updateInitialization(isVisible());
|
updateInitialization(isVisible());
|
||||||
|
|
||||||
if (isVisible())
|
if (isVisible())
|
||||||
{
|
{
|
||||||
|
|
||||||
// call all update functions
|
// call all update functions
|
||||||
// 01. Update Utilities (configuration etc)
|
// 01. Update Utilities (configuration etc)
|
||||||
|
|
||||||
// 02. Update Time (deltas)
|
// 02. Update Time (deltas)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 03. Update Receive (network, servertime, receive messages)
|
// 03. Update Receive (network, servertime, receive messages)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 04. Update Input (keyboard controls, etc)
|
// 04. Update Input (keyboard controls, etc)
|
||||||
if (_isGraphicsInitialized)
|
if (_isGraphicsInitialized)
|
||||||
Modules::objView().updateInput();
|
Modules::objView().updateInput();
|
||||||
|
|
||||||
// 05. Update Weather (sky, snow, wind, fog, sun)
|
// 05. Update Weather (sky, snow, wind, fog, sun)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
@ -563,29 +565,29 @@ void CMainWindow::updateRender()
|
||||||
|
|
||||||
// 07. Update Landscape (async zone loading near entity)
|
// 07. Update Landscape (async zone loading near entity)
|
||||||
|
|
||||||
|
|
||||||
// 08. Update Collisions (entities)
|
// 08. Update Collisions (entities)
|
||||||
// - Update entities
|
// - Update entities
|
||||||
// - Update move container (swap with Update entities? todo: check code!)
|
// - Update move container (swap with Update entities? todo: check code!)
|
||||||
// - Update bullets
|
// - Update bullets
|
||||||
Modules::veget().update();
|
Modules::veget().update();
|
||||||
|
|
||||||
// 09. Update Animations (playlists)
|
// 09. Update Animations (playlists)
|
||||||
// - Needs to be either before or after entities, not sure,
|
// - Needs to be either before or after entities, not sure,
|
||||||
// there was a problem with wrong order a while ago!!!
|
// there was a problem with wrong order a while ago!!!
|
||||||
Modules::objView().updateAnimatePS();
|
Modules::objView().updateAnimatePS();
|
||||||
|
|
||||||
Modules::objView().updateAnimation(_AnimationDialog->getTime());
|
Modules::objView().updateAnimation(_AnimationDialog->getTime());
|
||||||
|
|
||||||
// 09.2 Update Particle system editor
|
// 09.2 Update Particle system editor
|
||||||
Modules::psEdit().update();
|
Modules::psEdit().update();
|
||||||
|
|
||||||
// 10. Update Camera (depends on entities)
|
// 10. Update Camera (depends on entities)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 11. Update Interface (login, ui, etc)
|
// 11. Update Interface (login, ui, etc)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 12. Update Sound (sound driver)
|
// 12. Update Sound (sound driver)
|
||||||
if (_isSoundInitialized)
|
if (_isSoundInitialized)
|
||||||
{
|
{
|
||||||
|
@ -594,24 +596,24 @@ void CMainWindow::updateRender()
|
||||||
}
|
}
|
||||||
// 13. Update Send (network, send new position etc)
|
// 13. Update Send (network, send new position etc)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 14. Update Debug (stuff for dev)
|
// 14. Update Debug (stuff for dev)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
if (_isGraphicsInitialized && !Modules::objView().getDriver()->isLost())
|
||||||
{
|
{
|
||||||
// 01. Render Driver (background color)
|
// 01. Render Driver (background color)
|
||||||
Modules::objView().renderDriver(); // clear all buffers
|
Modules::objView().renderDriver(); // clear all buffers
|
||||||
|
|
||||||
// 02. Render Sky (sky scene)
|
// 02. Render Sky (sky scene)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 04. Render Scene (entity scene)
|
// 04. Render Scene (entity scene)
|
||||||
Modules::objView().renderScene();
|
Modules::objView().renderScene();
|
||||||
|
|
||||||
// 05. Render Effects (flare)
|
// 05. Render Effects (flare)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 06. Render Interface 3D (player names)
|
// 06. Render Interface 3D (player names)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
@ -620,7 +622,7 @@ void CMainWindow::updateRender()
|
||||||
|
|
||||||
// 08. Render Interface 2D (chatboxes etc, optionally does have 3d)
|
// 08. Render Interface 2D (chatboxes etc, optionally does have 3d)
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
// 09. Render Debug 2D (stuff for dev)
|
// 09. Render Debug 2D (stuff for dev)
|
||||||
Modules::objView().renderDebug2D();
|
Modules::objView().renderDebug2D();
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLMISC {
|
namespace NLMISC
|
||||||
class CConfigFile;
|
{
|
||||||
|
class CConfigFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CGraphicsViewport;
|
class CGraphicsViewport;
|
||||||
class CAnimationDialog;
|
class CAnimationDialog;
|
||||||
|
@ -60,10 +62,12 @@ public:
|
||||||
~CMainWindow();
|
~CMainWindow();
|
||||||
|
|
||||||
virtual void setVisible(bool visible);
|
virtual void setVisible(bool visible);
|
||||||
|
|
||||||
int getFrameRate();
|
int getFrameRate();
|
||||||
CSkeletonTreeModel *getSkeletonModel() const
|
CSkeletonTreeModel *getSkeletonModel() const
|
||||||
{ return _SkeletonTreeModel; }
|
{
|
||||||
|
return _SkeletonTreeModel;
|
||||||
|
}
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
|
@ -72,7 +76,7 @@ private Q_SLOTS:
|
||||||
void about();
|
void about();
|
||||||
void updateStatusBar();
|
void updateStatusBar();
|
||||||
void updateRender();
|
void updateRender();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
|
@ -82,11 +86,11 @@ private:
|
||||||
|
|
||||||
void updateInitialization(bool visible);
|
void updateInitialization(bool visible);
|
||||||
bool loadFile(const QString &fileName, const QString &skelName);
|
bool loadFile(const QString &fileName, const QString &skelName);
|
||||||
|
|
||||||
void cfcbQtStyle(NLMISC::CConfigFile::CVar &var);
|
void cfcbQtStyle(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbQtPalette(NLMISC::CConfigFile::CVar &var);
|
void cfcbQtPalette(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbSoundEnabled(NLMISC::CConfigFile::CVar &var);
|
void cfcbSoundEnabled(NLMISC::CConfigFile::CVar &var);
|
||||||
|
|
||||||
bool _isGraphicsInitialized, _isGraphicsEnabled;
|
bool _isGraphicsInitialized, _isGraphicsEnabled;
|
||||||
bool _isSoundInitialized, _isSoundEnabled;
|
bool _isSoundInitialized, _isSoundEnabled;
|
||||||
bool _isLandscapeInitialized, _isLandscapeEnabled;
|
bool _isLandscapeInitialized, _isLandscapeEnabled;
|
||||||
|
@ -106,7 +110,7 @@ private:
|
||||||
CSunColorDialog *_SunColorDialog;
|
CSunColorDialog *_SunColorDialog;
|
||||||
|
|
||||||
CSkeletonTreeModel *_SkeletonTreeModel;
|
CSkeletonTreeModel *_SkeletonTreeModel;
|
||||||
|
|
||||||
QPalette _originalPalette;
|
QPalette _originalPalette;
|
||||||
QString _lastDir;
|
QString _lastDir;
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,14 @@
|
||||||
#include "mesh_widget.h"
|
#include "mesh_widget.h"
|
||||||
#include "morph_mesh_dialog.h"
|
#include "morph_mesh_dialog.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CMeshWidget::CMeshWidget(QWidget *parent)
|
CMeshWidget::CMeshWidget(QWidget *parent)
|
||||||
: QGroupBox(parent)
|
: QGroupBox(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
connect(_ui.browsePushButton, SIGNAL(clicked(bool)), this, SLOT(browseShape()));
|
connect(_ui.browsePushButton, SIGNAL(clicked(bool)), this, SLOT(browseShape()));
|
||||||
connect(_ui.editPushButton, SIGNAL(clicked(bool)), this, SLOT(editMorph()));
|
connect(_ui.editPushButton, SIGNAL(clicked(bool)), this, SLOT(editMorph()));
|
||||||
connect(_ui.morphCheckBox, SIGNAL(toggled(bool)), this, SLOT(setMorphMesh(bool)));
|
connect(_ui.morphCheckBox, SIGNAL(toggled(bool)), this, SLOT(setMorphMesh(bool)));
|
||||||
|
@ -54,11 +55,11 @@ void CMeshWidget::setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParti
|
||||||
{
|
{
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_ShapeParticle = sp;
|
_ShapeParticle = sp;
|
||||||
|
|
||||||
if (!dynamic_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle))
|
if (!dynamic_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle))
|
||||||
{
|
{
|
||||||
_ui.groupBox->hide();
|
_ui.groupBox->hide();
|
||||||
_ui.browsePushButton->setEnabled(true);
|
_ui.browsePushButton->setEnabled(true);
|
||||||
_ui.meshLineEdit->setEnabled(true);
|
_ui.meshLineEdit->setEnabled(true);
|
||||||
_ui.label->setEnabled(true);
|
_ui.label->setEnabled(true);
|
||||||
_ui.meshLineEdit->setText(_ShapeParticle->getShape().c_str());
|
_ui.meshLineEdit->setText(_ShapeParticle->getShape().c_str());
|
||||||
|
@ -69,7 +70,7 @@ void CMeshWidget::setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParti
|
||||||
NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle);
|
NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle);
|
||||||
if (cm->getNumShapes() > 1)
|
if (cm->getNumShapes() > 1)
|
||||||
_ui.morphCheckBox->setChecked(true);
|
_ui.morphCheckBox->setChecked(true);
|
||||||
else
|
else
|
||||||
_ui.morphCheckBox->setChecked(false);
|
_ui.morphCheckBox->setChecked(false);
|
||||||
|
|
||||||
updateForMorph();
|
updateForMorph();
|
||||||
|
@ -79,11 +80,11 @@ void CMeshWidget::setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParti
|
||||||
void CMeshWidget::browseShape()
|
void CMeshWidget::browseShape()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open NeL data file"), ".",
|
tr("Open NeL data file"), ".",
|
||||||
tr("NeL shape file (*.shape)"));
|
tr("NeL shape file (*.shape)"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toStdString()));
|
NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toStdString()));
|
||||||
try
|
try
|
||||||
|
@ -137,11 +138,11 @@ void CMeshWidget::editMorph()
|
||||||
|
|
||||||
void CMeshWidget::updateForMorph()
|
void CMeshWidget::updateForMorph()
|
||||||
{
|
{
|
||||||
NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle);
|
NL3D::CPSConstraintMesh *cm = NLMISC::safe_cast<NL3D::CPSConstraintMesh *>(_ShapeParticle);
|
||||||
if (cm)
|
if (cm)
|
||||||
{
|
{
|
||||||
bool enable = cm->getNumShapes() > 1;
|
bool enable = cm->getNumShapes() > 1;
|
||||||
_ui.browsePushButton->setEnabled(!enable);
|
_ui.browsePushButton->setEnabled(!enable);
|
||||||
_ui.meshLineEdit->setEnabled(!enable);
|
_ui.meshLineEdit->setEnabled(!enable);
|
||||||
_ui.label->setEnabled(!enable);
|
_ui.label->setEnabled(!enable);
|
||||||
if (!enable)
|
if (!enable)
|
||||||
|
@ -163,7 +164,7 @@ void CMeshWidget::updateMeshErrorString()
|
||||||
if (numVerts.empty()) return;
|
if (numVerts.empty()) return;
|
||||||
if (numVerts.size() == 1)
|
if (numVerts.size() == 1)
|
||||||
_ui.infoLabel->setText(getShapeErrorString(numVerts[0]));
|
_ui.infoLabel->setText(getShapeErrorString(numVerts[0]));
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// display error msg for morphed meshs
|
// display error msg for morphed meshs
|
||||||
|
@ -185,10 +186,13 @@ QString CMeshWidget::getShapeErrorString(sint errorCode)
|
||||||
{
|
{
|
||||||
switch(errorCode)
|
switch(errorCode)
|
||||||
{
|
{
|
||||||
case NL3D::CPSConstraintMesh::ShapeFileIsNotAMesh: return tr("Not a mesh");
|
case NL3D::CPSConstraintMesh::ShapeFileIsNotAMesh:
|
||||||
case NL3D::CPSConstraintMesh::ShapeFileNotLoaded: return tr("Shape not loaded");
|
return tr("Not a mesh");
|
||||||
case NL3D::CPSConstraintMesh::ShapeHasTooMuchVertices: return tr("Too much vertices");
|
case NL3D::CPSConstraintMesh::ShapeFileNotLoaded:
|
||||||
default:
|
return tr("Shape not loaded");
|
||||||
|
case NL3D::CPSConstraintMesh::ShapeHasTooMuchVertices:
|
||||||
|
return tr("Too much vertices");
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
return QString();
|
return QString();
|
||||||
|
|
|
@ -33,41 +33,45 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
struct CPSShapeParticle;
|
struct CPSShapeParticle;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CMeshWidget: public QGroupBox
|
class CMeshWidget: public QGroupBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMeshWidget(QWidget *parent = 0);
|
CMeshWidget(QWidget *parent = 0);
|
||||||
~CMeshWidget();
|
~CMeshWidget();
|
||||||
|
|
||||||
void setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParticle *sp);
|
void setCurrentShape(CWorkspaceNode *ownerNode, NL3D::CPSShapeParticle *sp);
|
||||||
|
|
||||||
QString getShapeErrorString(sint errorCode);
|
QString getShapeErrorString(sint errorCode);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void browseShape();
|
void browseShape();
|
||||||
void setMorphMesh(bool state);
|
void setMorphMesh(bool state);
|
||||||
void editMorph();
|
void editMorph();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
NL3D::CPSShapeParticle *_ShapeParticle;
|
NL3D::CPSShapeParticle *_ShapeParticle;
|
||||||
|
|
||||||
void updateForMorph();
|
void updateForMorph();
|
||||||
|
|
||||||
void updateMeshErrorString();
|
void updateMeshErrorString();
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
void touchPSState();
|
void touchPSState();
|
||||||
|
|
||||||
Ui::CMeshWidget _ui;
|
Ui::CMeshWidget _ui;
|
||||||
}; /* class CMeshWidget */
|
}; /* class CMeshWidget */
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ void Modules::init()
|
||||||
{
|
{
|
||||||
if (_configuration == NULL) _configuration = new NLQT::CConfiguration;
|
if (_configuration == NULL) _configuration = new NLQT::CConfiguration;
|
||||||
config().init();
|
config().init();
|
||||||
|
|
||||||
if (_objectViewer == NULL) _objectViewer = new NLQT::CObjectViewer;
|
if (_objectViewer == NULL) _objectViewer = new NLQT::CObjectViewer;
|
||||||
if (_soundSystem == NULL) _soundSystem = new NLQT::CSoundSystem;
|
if (_soundSystem == NULL) _soundSystem = new NLQT::CSoundSystem;
|
||||||
if (_particleEditor == NULL) _particleEditor = new NLQT::CParticleEditor;
|
if (_particleEditor == NULL) _particleEditor = new NLQT::CParticleEditor;
|
||||||
|
@ -41,12 +41,18 @@ void Modules::init()
|
||||||
|
|
||||||
void Modules::release()
|
void Modules::release()
|
||||||
{
|
{
|
||||||
delete _mainWindow; _mainWindow = NULL;
|
delete _mainWindow;
|
||||||
delete _particleEditor; _particleEditor = NULL;
|
_mainWindow = NULL;
|
||||||
delete _vegetableEditor; _vegetableEditor = NULL;
|
delete _particleEditor;
|
||||||
delete _soundSystem; _soundSystem = NULL;
|
_particleEditor = NULL;
|
||||||
delete _objectViewer; _objectViewer = NULL;
|
delete _vegetableEditor;
|
||||||
|
_vegetableEditor = NULL;
|
||||||
|
delete _soundSystem;
|
||||||
|
_soundSystem = NULL;
|
||||||
|
delete _objectViewer;
|
||||||
|
_objectViewer = NULL;
|
||||||
|
|
||||||
config().release();
|
config().release();
|
||||||
delete _configuration; _configuration = NULL;
|
delete _configuration;
|
||||||
|
_configuration = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,31 @@ class Modules
|
||||||
public:
|
public:
|
||||||
static void init();
|
static void init();
|
||||||
static void release();
|
static void release();
|
||||||
|
|
||||||
static NLQT::CConfiguration &config() { return *_configuration; }
|
static NLQT::CConfiguration &config()
|
||||||
static NLQT::CObjectViewer &objView() { return *_objectViewer; }
|
{
|
||||||
static NLQT::CMainWindow &mainWin() { return *_mainWindow; }
|
return *_configuration;
|
||||||
static NLQT::CParticleEditor &psEdit() { return *_particleEditor; }
|
}
|
||||||
static NLQT::CSoundSystem &sound() { return *_soundSystem; }
|
static NLQT::CObjectViewer &objView()
|
||||||
static NLQT::CVegetableEditor &veget() { return *_vegetableEditor; }
|
{
|
||||||
|
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:
|
private:
|
||||||
static NLQT::CConfiguration *_configuration;
|
static NLQT::CConfiguration *_configuration;
|
||||||
static NLQT::CObjectViewer *_objectViewer;
|
static NLQT::CObjectViewer *_objectViewer;
|
||||||
|
|
|
@ -30,26 +30,27 @@
|
||||||
// Projects includes
|
// Projects includes
|
||||||
#include "mesh_widget.h"
|
#include "mesh_widget.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent)
|
CMorphMeshDialog::CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent)
|
||||||
: QDialog(parent), _Node(ownerNode), _CM(cm)
|
: QDialog(parent), _Node(ownerNode), _CM(cm)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.morphValueWidget->setRange(0, 10);
|
_ui.morphValueWidget->setRange(0, 10);
|
||||||
_ui.morphValueWidget->setWrapper(&_MorphSchemeWrapper);
|
_ui.morphValueWidget->setWrapper(&_MorphSchemeWrapper);
|
||||||
_ui.morphValueWidget->setSchemeWrapper(&_MorphSchemeWrapper);
|
_ui.morphValueWidget->setSchemeWrapper(&_MorphSchemeWrapper);
|
||||||
_ui.morphValueWidget->init();
|
_ui.morphValueWidget->init();
|
||||||
|
|
||||||
_MorphSchemeWrapper.CM = _CM;
|
_MorphSchemeWrapper.CM = _CM;
|
||||||
_ui.morphValueWidget->setWorkspaceNode(_Node);
|
_ui.morphValueWidget->setWorkspaceNode(_Node);
|
||||||
_ui.morphValueWidget->updateUi();
|
_ui.morphValueWidget->updateUi();
|
||||||
|
|
||||||
updateMeshList();
|
updateMeshList();
|
||||||
|
|
||||||
_ui.infoLabel->setVisible(!_CM->isValidBuild());
|
_ui.infoLabel->setVisible(!_CM->isValidBuild());
|
||||||
|
|
||||||
connect(_ui.addPushButton, SIGNAL(clicked()), this, SLOT(add()));
|
connect(_ui.addPushButton, SIGNAL(clicked()), this, SLOT(add()));
|
||||||
connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(remove()));
|
connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(remove()));
|
||||||
connect(_ui.insertPushButton, SIGNAL(clicked()), this, SLOT(insert()));
|
connect(_ui.insertPushButton, SIGNAL(clicked()), this, SLOT(insert()));
|
||||||
|
@ -70,7 +71,7 @@ void CMorphMeshDialog::updateMeshList()
|
||||||
_ui.listWidget->clear();
|
_ui.listWidget->clear();
|
||||||
for (uint k = 0; k < _CM->getNumShapes(); ++k)
|
for (uint k = 0; k < _CM->getNumShapes(); ++k)
|
||||||
_ui.listWidget->addItem(getShapeDescStr(k, numVerts[k]));
|
_ui.listWidget->addItem(getShapeDescStr(k, numVerts[k]));
|
||||||
|
|
||||||
_ui.listWidget->setCurrentRow(0);
|
_ui.listWidget->setCurrentRow(0);
|
||||||
if (_CM->getNumShapes() < 2)
|
if (_CM->getNumShapes() < 2)
|
||||||
_ui.removePushButton->setEnabled(false);
|
_ui.removePushButton->setEnabled(false);
|
||||||
|
@ -81,7 +82,7 @@ void CMorphMeshDialog::updateMeshList()
|
||||||
QString CMorphMeshDialog::getShapeDescStr(uint shapeIndex, sint numVerts) const
|
QString CMorphMeshDialog::getShapeDescStr(uint shapeIndex, sint numVerts) const
|
||||||
{
|
{
|
||||||
if (numVerts >= 0)
|
if (numVerts >= 0)
|
||||||
{
|
{
|
||||||
QString verts(tr("vertices"));
|
QString verts(tr("vertices"));
|
||||||
QString msg = _CM->getShape(shapeIndex).c_str() + tr(" (%1 vertices)").arg(numVerts);
|
QString msg = _CM->getShape(shapeIndex).c_str() + tr(" (%1 vertices)").arg(numVerts);
|
||||||
return msg;
|
return msg;
|
||||||
|
@ -97,11 +98,11 @@ QString CMorphMeshDialog::getShapeDescStr(uint shapeIndex, sint numVerts) const
|
||||||
void CMorphMeshDialog::add()
|
void CMorphMeshDialog::add()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open NeL data file"), ".",
|
tr("Open NeL data file"), ".",
|
||||||
tr("NeL shape files (*.shape)"));
|
tr("NeL shape files (*.shape)"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
std::vector<std::string> shapeNames;
|
std::vector<std::string> shapeNames;
|
||||||
shapeNames.resize(_CM->getNumShapes() + 1);
|
shapeNames.resize(_CM->getNumShapes() + 1);
|
||||||
|
@ -127,10 +128,10 @@ void CMorphMeshDialog::remove()
|
||||||
_CM->getShapesNames(&shapeNames[0]);
|
_CM->getShapesNames(&shapeNames[0]);
|
||||||
shapeNames.erase(shapeNames.begin() + row);
|
shapeNames.erase(shapeNames.begin() + row);
|
||||||
_CM->setShapes(&shapeNames[0], (uint)shapeNames.size());
|
_CM->setShapes(&shapeNames[0], (uint)shapeNames.size());
|
||||||
|
|
||||||
if (_CM->getNumShapes() < 2)
|
if (_CM->getNumShapes() < 2)
|
||||||
_ui.removePushButton->setEnabled(false);
|
_ui.removePushButton->setEnabled(false);
|
||||||
|
|
||||||
touchPSState();
|
touchPSState();
|
||||||
updateMeshList();
|
updateMeshList();
|
||||||
_ui.infoLabel->setVisible(!_CM->isValidBuild());
|
_ui.infoLabel->setVisible(!_CM->isValidBuild());
|
||||||
|
@ -139,11 +140,11 @@ void CMorphMeshDialog::remove()
|
||||||
void CMorphMeshDialog::insert()
|
void CMorphMeshDialog::insert()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open NeL data file"), ".",
|
tr("Open NeL data file"), ".",
|
||||||
tr("NeL shape files (*.shape)"));
|
tr("NeL shape files (*.shape)"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
sint row = _ui.listWidget->currentRow();
|
sint row = _ui.listWidget->currentRow();
|
||||||
std::vector<std::string> shapeNames;
|
std::vector<std::string> shapeNames;
|
||||||
|
@ -162,11 +163,11 @@ void CMorphMeshDialog::insert()
|
||||||
void CMorphMeshDialog::change()
|
void CMorphMeshDialog::change()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open NeL data file"), ".",
|
tr("Open NeL data file"), ".",
|
||||||
tr("NeL shape files (*.shape)"));
|
tr("NeL shape files (*.shape)"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
sint row = _ui.listWidget->currentRow();
|
sint row = _ui.listWidget->currentRow();
|
||||||
_CM->setShape(row, fileName.toStdString());
|
_CM->setShape(row, fileName.toStdString());
|
||||||
|
@ -193,7 +194,7 @@ void CMorphMeshDialog::up()
|
||||||
|
|
||||||
void CMorphMeshDialog::down()
|
void CMorphMeshDialog::down()
|
||||||
{
|
{
|
||||||
sint row = _ui.listWidget->currentRow();
|
sint row = _ui.listWidget->currentRow();
|
||||||
if (row == (sint) (_CM->getNumShapes() - 1)) return;
|
if (row == (sint) (_CM->getNumShapes() - 1)) return;
|
||||||
std::vector<std::string> shapeNames;
|
std::vector<std::string> shapeNames;
|
||||||
shapeNames.resize(_CM->getNumShapes());
|
shapeNames.resize(_CM->getNumShapes());
|
||||||
|
@ -208,7 +209,7 @@ void CMorphMeshDialog::down()
|
||||||
void CMorphMeshDialog::touchPSState()
|
void CMorphMeshDialog::touchPSState()
|
||||||
{
|
{
|
||||||
if (_Node && _Node->getPSModel())
|
if (_Node && _Node->getPSModel())
|
||||||
{
|
{
|
||||||
_Node->getPSModel()->touchTransparencyState();
|
_Node->getPSModel()->touchTransparencyState();
|
||||||
_Node->getPSModel()->touchLightableState();
|
_Node->getPSModel()->touchLightableState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,15 +33,16 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CPSConstraintMesh;
|
class CPSConstraintMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CMorphMeshDialog: public QDialog
|
class CMorphMeshDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent = 0);
|
CMorphMeshDialog(CWorkspaceNode *ownerNode, NL3D::CPSConstraintMesh *cm, QWidget *parent = 0);
|
||||||
~CMorphMeshDialog();
|
~CMorphMeshDialog();
|
||||||
|
@ -53,7 +54,7 @@ private Q_SLOTS:
|
||||||
void change();
|
void change();
|
||||||
void up();
|
void up();
|
||||||
void down();
|
void down();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// fill the mesh list with the mesh names in the object being edited
|
/// fill the mesh list with the mesh names in the object being edited
|
||||||
void updateMeshList();
|
void updateMeshList();
|
||||||
|
@ -69,11 +70,11 @@ private:
|
||||||
virtual scheme_type *getScheme(void) const;
|
virtual scheme_type *getScheme(void) const;
|
||||||
virtual void setScheme(scheme_type *s);
|
virtual void setScheme(scheme_type *s);
|
||||||
} _MorphSchemeWrapper;
|
} _MorphSchemeWrapper;
|
||||||
|
|
||||||
void touchPSState();
|
void touchPSState();
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
// the constraint mesh being edited
|
// the constraint mesh being edited
|
||||||
NL3D::CPSConstraintMesh *_CM;
|
NL3D::CPSConstraintMesh *_CM;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Object Viewer Qt
|
Object Viewer Qt
|
||||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -27,23 +27,24 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent)
|
CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent)
|
||||||
: QDialog(parent), _Node(ownerNode), _MTP(mtp)
|
: QDialog(parent), _Node(ownerNode), _MTP(mtp)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
nlassert(_MTP);
|
nlassert(_MTP);
|
||||||
|
|
||||||
_ui.basicCapsCheckBox->setChecked(NL3D::CPSMultiTexturedParticle::areBasicCapsForced());
|
_ui.basicCapsCheckBox->setChecked(NL3D::CPSMultiTexturedParticle::areBasicCapsForced());
|
||||||
_ui.useParticleDataCheckBox->setChecked(_MTP->getUseLocalDateAlt());
|
_ui.useParticleDataCheckBox->setChecked(_MTP->getUseLocalDateAlt());
|
||||||
_ui.useParticleDataCheckBox_2->setChecked(_MTP->getUseLocalDate());
|
_ui.useParticleDataCheckBox_2->setChecked(_MTP->getUseLocalDate());
|
||||||
|
|
||||||
bool bEnvBumpMapUsed = _MTP->getMainTexOp() == NL3D::CPSMultiTexturedParticle::EnvBumpMap ? true : false;
|
bool bEnvBumpMapUsed = _MTP->getMainTexOp() == NL3D::CPSMultiTexturedParticle::EnvBumpMap ? true : false;
|
||||||
_ui.bumpFactorLabel->setEnabled(bEnvBumpMapUsed);
|
_ui.bumpFactorLabel->setEnabled(bEnvBumpMapUsed);
|
||||||
_ui.bumpFactorDoubleSpinBox->setEnabled(bEnvBumpMapUsed);
|
_ui.bumpFactorDoubleSpinBox->setEnabled(bEnvBumpMapUsed);
|
||||||
|
|
||||||
_TexWrapper.OwnerNode = _Node;
|
_TexWrapper.OwnerNode = _Node;
|
||||||
_AlternateTexWrapper.OwnerNode = _Node;
|
_AlternateTexWrapper.OwnerNode = _Node;
|
||||||
_TexWrapper.MTP = _MTP;
|
_TexWrapper.MTP = _MTP;
|
||||||
|
@ -51,18 +52,18 @@ CMultiTexDialog::CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTextur
|
||||||
|
|
||||||
_ui.texWidget->setWrapper(&_TexWrapper);
|
_ui.texWidget->setWrapper(&_TexWrapper);
|
||||||
_ui.texWidget->updateUi();
|
_ui.texWidget->updateUi();
|
||||||
|
|
||||||
_ui.texWidget_2->setWrapper(&_AlternateTexWrapper);
|
_ui.texWidget_2->setWrapper(&_AlternateTexWrapper);
|
||||||
_ui.texWidget_2->updateUi();
|
_ui.texWidget_2->updateUi();
|
||||||
|
|
||||||
readValues();
|
readValues();
|
||||||
|
|
||||||
_ui.enableAlternateCheckBox->setChecked(_MTP->isAlternateTexEnabled());
|
_ui.enableAlternateCheckBox->setChecked(_MTP->isAlternateTexEnabled());
|
||||||
_ui.alternateTab->setEnabled(_MTP->isAlternateTexEnabled());
|
_ui.alternateTab->setEnabled(_MTP->isAlternateTexEnabled());
|
||||||
|
|
||||||
_ui.texOpComboBox->setCurrentIndex(int(_MTP->getMainTexOp()));
|
_ui.texOpComboBox->setCurrentIndex(int(_MTP->getMainTexOp()));
|
||||||
_ui.texOpComboBox_2->setCurrentIndex(int(_MTP->getAlternateTexOp()));
|
_ui.texOpComboBox_2->setCurrentIndex(int(_MTP->getAlternateTexOp()));
|
||||||
|
|
||||||
connect(_ui.bumpFactorDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateValues()));
|
connect(_ui.bumpFactorDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateValues()));
|
||||||
connect(_ui.enableAlternateCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledAlternate(bool)));
|
connect(_ui.enableAlternateCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledAlternate(bool)));
|
||||||
connect(_ui.basicCapsCheckBox, SIGNAL(toggled(bool)), this, SLOT(setForceBasicCaps(bool)));
|
connect(_ui.basicCapsCheckBox, SIGNAL(toggled(bool)), this, SLOT(setForceBasicCaps(bool)));
|
||||||
|
@ -100,15 +101,15 @@ void CMultiTexDialog::updateValues()
|
||||||
|
|
||||||
vs1.x = _ui.uSpeed1DoubleSpinBox->value();
|
vs1.x = _ui.uSpeed1DoubleSpinBox->value();
|
||||||
vs1.y = _ui.vSpeed1DoubleSpinBox->value();
|
vs1.y = _ui.vSpeed1DoubleSpinBox->value();
|
||||||
|
|
||||||
vs2.x = _ui.uSpeed2DoubleSpinBox->value();
|
vs2.x = _ui.uSpeed2DoubleSpinBox->value();
|
||||||
vs2.y = _ui.vSpeed2DoubleSpinBox->value();
|
vs2.y = _ui.vSpeed2DoubleSpinBox->value();
|
||||||
|
|
||||||
_MTP->setScrollSpeed(0, vs1);
|
_MTP->setScrollSpeed(0, vs1);
|
||||||
_MTP->setScrollSpeed(1, vs2);
|
_MTP->setScrollSpeed(1, vs2);
|
||||||
|
|
||||||
_MTP->setBumpFactor(_ui.bumpFactorDoubleSpinBox->value());
|
_MTP->setBumpFactor(_ui.bumpFactorDoubleSpinBox->value());
|
||||||
|
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,13 +119,13 @@ void CMultiTexDialog::updateValuesAlternate()
|
||||||
|
|
||||||
vs1.x = _ui.uSpeed1DoubleSpinBox_2->value();
|
vs1.x = _ui.uSpeed1DoubleSpinBox_2->value();
|
||||||
vs1.y = _ui.vSpeed1DoubleSpinBox_2->value();
|
vs1.y = _ui.vSpeed1DoubleSpinBox_2->value();
|
||||||
|
|
||||||
vs2.x = _ui.uSpeed2DoubleSpinBox_2->value();
|
vs2.x = _ui.uSpeed2DoubleSpinBox_2->value();
|
||||||
vs2.y = _ui.vSpeed2DoubleSpinBox_2->value();
|
vs2.y = _ui.vSpeed2DoubleSpinBox_2->value();
|
||||||
|
|
||||||
_MTP->setAlternateScrollSpeed(0, vs1);
|
_MTP->setAlternateScrollSpeed(0, vs1);
|
||||||
_MTP->setAlternateScrollSpeed(1, vs2);
|
_MTP->setAlternateScrollSpeed(1, vs2);
|
||||||
|
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +147,7 @@ void CMultiTexDialog::setMainOp(int index)
|
||||||
|
|
||||||
void CMultiTexDialog::setForceBasicCaps(bool state)
|
void CMultiTexDialog::setForceBasicCaps(bool state)
|
||||||
{
|
{
|
||||||
NL3D::CPSMultiTexturedParticle::forceBasicCaps(state);
|
NL3D::CPSMultiTexturedParticle::forceBasicCaps(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiTexDialog::setUseParticleDate(bool state)
|
void CMultiTexDialog::setUseParticleDate(bool state)
|
||||||
|
|
|
@ -34,17 +34,18 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CPSMultiTexturedParticle;
|
class CPSMultiTexturedParticle;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CWorkspaceNode;
|
class CWorkspaceNode;
|
||||||
|
|
||||||
class CMultiTexDialog: public QDialog
|
class CMultiTexDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent = 0);
|
CMultiTexDialog(CWorkspaceNode *ownerNode, NL3D::CPSMultiTexturedParticle *mtp, QWidget *parent = 0);
|
||||||
~CMultiTexDialog();
|
~CMultiTexDialog();
|
||||||
|
@ -58,7 +59,7 @@ private Q_SLOTS:
|
||||||
void setForceBasicCaps(bool state);
|
void setForceBasicCaps(bool state);
|
||||||
void setUseParticleDate(bool state);
|
void setUseParticleDate(bool state);
|
||||||
void setUseParticleDateAlt(bool state);
|
void setUseParticleDateAlt(bool state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CMainTexWrapper : IPSWrapperTexture
|
struct CMainTexWrapper : IPSWrapperTexture
|
||||||
{
|
{
|
||||||
|
@ -73,14 +74,17 @@ private:
|
||||||
virtual NL3D::ITexture *get(void);
|
virtual NL3D::ITexture *get(void);
|
||||||
virtual void set(NL3D::ITexture *);
|
virtual void set(NL3D::ITexture *);
|
||||||
} _AlternateTexWrapper;
|
} _AlternateTexWrapper;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
NL3D::CPSMultiTexturedParticle *_MTP;
|
NL3D::CPSMultiTexturedParticle *_MTP;
|
||||||
|
|
||||||
void readValues();
|
void readValues();
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
Ui::CMultiTexDialog _ui;
|
Ui::CMultiTexDialog _ui;
|
||||||
}; /* class CMultiTexDialog */
|
}; /* class CMultiTexDialog */
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,17 @@ using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
using namespace NL3D;
|
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)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CObjectViewer::CObjectViewer()
|
||||||
|
: _Driver(NULL), _TextContext(NULL),
|
||||||
|
_phi(0), _psi(0),_dist(20),
|
||||||
|
_CameraFocal(75),
|
||||||
|
_CurrentInstance(""),
|
||||||
|
_BloomEffect(false), _Scene(0)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CObjectViewer::~CObjectViewer()
|
CObjectViewer::~CObjectViewer()
|
||||||
|
@ -70,7 +71,7 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
||||||
{
|
{
|
||||||
//H_AUTO2
|
//H_AUTO2
|
||||||
nldebug("CObjectViewert::init");
|
nldebug("CObjectViewert::init");
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
||||||
// create the driver
|
// create the driver
|
||||||
|
@ -78,12 +79,12 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
||||||
|
|
||||||
_Driver = UDriver::createDriver(0, _Direct3D, 0);
|
_Driver = UDriver::createDriver(0, _Direct3D, 0);
|
||||||
nlassert(_Driver);
|
nlassert(_Driver);
|
||||||
|
|
||||||
// initialize the window with config file values
|
// initialize the window with config file values
|
||||||
_Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32));
|
_Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32));
|
||||||
|
|
||||||
_Light = ULight::createLight();
|
_Light = ULight::createLight();
|
||||||
|
|
||||||
// set mode of the light
|
// set mode of the light
|
||||||
_Light->setMode(ULight::DirectionalLight);
|
_Light->setMode(ULight::DirectionalLight);
|
||||||
|
|
||||||
|
@ -96,25 +97,25 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
||||||
// set and enable the light
|
// set and enable the light
|
||||||
_Driver->setLight(0, *_Light);
|
_Driver->setLight(0, *_Light);
|
||||||
_Driver->enableLight(0);
|
_Driver->enableLight(0);
|
||||||
|
|
||||||
// Create a scene
|
// Create a scene
|
||||||
_Scene = _Driver->createScene(true);
|
_Scene = _Driver->createScene(true);
|
||||||
|
|
||||||
_PlayListManager = _Scene->createPlayListManager();
|
_PlayListManager = _Scene->createPlayListManager();
|
||||||
|
|
||||||
_Scene->enableLightingSystem(true);
|
_Scene->enableLightingSystem(true);
|
||||||
|
|
||||||
// create the camera
|
// create the camera
|
||||||
UCamera camera = _Scene->getCam();
|
UCamera camera = _Scene->getCam();
|
||||||
camera.setTransformMode (UTransformable::DirectMatrix);
|
camera.setTransformMode (UTransformable::DirectMatrix);
|
||||||
|
|
||||||
setSizeViewport(w, h);
|
setSizeViewport(w, h);
|
||||||
|
|
||||||
// camera will look at entities
|
// camera will look at entities
|
||||||
updateCamera(0,0,0);
|
updateCamera(0,0,0);
|
||||||
|
|
||||||
NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0);
|
NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0);
|
||||||
|
|
||||||
_MouseListener = _Driver->create3dMouseListener();
|
_MouseListener = _Driver->create3dMouseListener();
|
||||||
_MouseListener->setMatrix(Modules::objView().getScene()->getCam().getMatrix());
|
_MouseListener->setMatrix(Modules::objView().getScene()->getCam().getMatrix());
|
||||||
_MouseListener->setFrustrum(Modules::objView().getScene()->getCam().getFrustum());
|
_MouseListener->setFrustrum(Modules::objView().getScene()->getCam().getFrustum());
|
||||||
|
@ -123,7 +124,7 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
||||||
|
|
||||||
// set the cache size for the font manager(in bytes)
|
// set the cache size for the font manager(in bytes)
|
||||||
_Driver->setFontManagerMaxMemory(2097152);
|
_Driver->setFontManagerMaxMemory(2097152);
|
||||||
|
|
||||||
// create the text context
|
// create the text context
|
||||||
nlassert(!_TextContext);
|
nlassert(!_TextContext);
|
||||||
_TextContext = _Driver->createTextContext(_FontName);
|
_TextContext = _Driver->createTextContext(_FontName);
|
||||||
|
@ -140,7 +141,7 @@ void CObjectViewer::release()
|
||||||
{
|
{
|
||||||
//H_AUTO2
|
//H_AUTO2
|
||||||
nldebug("CObjectViewer::release");
|
nldebug("CObjectViewer::release");
|
||||||
|
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
// release text context
|
// release text context
|
||||||
|
@ -171,7 +172,7 @@ void CObjectViewer::release()
|
||||||
void CObjectViewer::updateInput()
|
void CObjectViewer::updateInput()
|
||||||
{
|
{
|
||||||
_Driver->EventServer.pump();
|
_Driver->EventServer.pump();
|
||||||
|
|
||||||
// New matrix from camera
|
// New matrix from camera
|
||||||
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
_Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix);
|
||||||
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
_Scene->getCam().setMatrix (_MouseListener->getViewMatrix());
|
||||||
|
@ -182,7 +183,7 @@ void CObjectViewer::renderDriver()
|
||||||
// Render the scene.
|
// Render the scene.
|
||||||
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
||||||
{
|
{
|
||||||
NL3D::CBloomEffect::instance().initBloom();
|
NL3D::CBloomEffect::instance().initBloom();
|
||||||
}
|
}
|
||||||
_Driver->clearBuffers(_BackgroundColor);
|
_Driver->clearBuffers(_BackgroundColor);
|
||||||
}
|
}
|
||||||
|
@ -194,8 +195,8 @@ void CObjectViewer::renderScene()
|
||||||
|
|
||||||
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
||||||
{
|
{
|
||||||
NL3D::CBloomEffect::instance().endBloom();
|
NL3D::CBloomEffect::instance().endBloom();
|
||||||
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
|
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +209,7 @@ void CObjectViewer::saveScreenshot(const std::string &nameFile, bool jpg, bool p
|
||||||
//H_AUTO2
|
//H_AUTO2
|
||||||
|
|
||||||
// FIXME: create screenshot path if it doesn't exist!
|
// FIXME: create screenshot path if it doesn't exist!
|
||||||
|
|
||||||
// empty bitmap
|
// empty bitmap
|
||||||
CBitmap bitmap;
|
CBitmap bitmap;
|
||||||
// copy the driver buffer to the bitmap
|
// copy the driver buffer to the bitmap
|
||||||
|
@ -242,29 +243,29 @@ void CObjectViewer::saveScreenshot(const std::string &nameFile, bool jpg, bool p
|
||||||
bool CObjectViewer::loadMesh(const std::string &meshFileName, const std::string &skelFileName)
|
bool CObjectViewer::loadMesh(const std::string &meshFileName, const std::string &skelFileName)
|
||||||
{
|
{
|
||||||
std::string fileName = CFile::getFilenameWithoutExtension(meshFileName);
|
std::string fileName = CFile::getFilenameWithoutExtension(meshFileName);
|
||||||
if ( _Entities.count(fileName) != 0)
|
if ( _Entities.count(fileName) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CPath::addSearchPath(CFile::getPath(meshFileName), false, false);
|
CPath::addSearchPath(CFile::getPath(meshFileName), false, false);
|
||||||
|
|
||||||
// create instance of the mesh character
|
// create instance of the mesh character
|
||||||
UInstance Entity = _Scene->createInstance(meshFileName);
|
UInstance Entity = _Scene->createInstance(meshFileName);
|
||||||
|
|
||||||
USkeleton Skeleton = _Scene->createSkeleton(skelFileName);
|
USkeleton Skeleton = _Scene->createSkeleton(skelFileName);
|
||||||
|
|
||||||
// if we can't create entity, skip it
|
// if we can't create entity, skip it
|
||||||
if (Entity.empty()) return false;
|
if (Entity.empty()) return false;
|
||||||
|
|
||||||
// TODO: remade at typedef std::map<std::string, *CEntity> CEntities;
|
// TODO: remade at typedef std::map<std::string, *CEntity> CEntities;
|
||||||
EIT eit = (_Entities.insert (make_pair (fileName, CEntity()))).first;
|
EIT eit = (_Entities.insert (make_pair (fileName, CEntity()))).first;
|
||||||
CEntity &entity = (*eit).second;
|
CEntity &entity = (*eit).second;
|
||||||
|
|
||||||
// set the entity up
|
// set the entity up
|
||||||
entity._Name = fileName;
|
entity._Name = fileName;
|
||||||
entity._FileNameShape = meshFileName;
|
entity._FileNameShape = meshFileName;
|
||||||
entity._FileNameSkeleton = skelFileName;
|
entity._FileNameSkeleton = skelFileName;
|
||||||
entity._Instance = Entity;
|
entity._Instance = Entity;
|
||||||
if (!Skeleton.empty())
|
if (!Skeleton.empty())
|
||||||
{
|
{
|
||||||
entity._Skeleton = Skeleton;
|
entity._Skeleton = Skeleton;
|
||||||
entity._Skeleton.bindSkin (entity._Instance);
|
entity._Skeleton.bindSkin (entity._Instance);
|
||||||
|
@ -277,18 +278,18 @@ bool CObjectViewer::loadMesh(const std::string &meshFileName, const std::string
|
||||||
void CObjectViewer::resetScene()
|
void CObjectViewer::resetScene()
|
||||||
{
|
{
|
||||||
deleteEntities();
|
deleteEntities();
|
||||||
|
|
||||||
// Reset camera.
|
// Reset camera.
|
||||||
//..
|
//..
|
||||||
|
|
||||||
// to load files with the same name but located in different directories
|
// to load files with the same name but located in different directories
|
||||||
CPath::clearMap();
|
CPath::clearMap();
|
||||||
|
|
||||||
// load and set search paths from config
|
// load and set search paths from config
|
||||||
Modules::config().configSearchPaths();
|
Modules::config().configSearchPaths();
|
||||||
|
|
||||||
_CurrentInstance = "";
|
_CurrentInstance = "";
|
||||||
|
|
||||||
nlinfo("Scene cleared");
|
nlinfo("Scene cleared");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,15 +298,15 @@ void CObjectViewer::updateCamera(float deltaPsi, float deltaPhi, float deltaDist
|
||||||
_phi += deltaPhi;
|
_phi += deltaPhi;
|
||||||
_psi += deltaPsi;
|
_psi += deltaPsi;
|
||||||
_dist += deltaDist;
|
_dist += deltaDist;
|
||||||
|
|
||||||
if(_phi < -NLMISC::Pi/2) _phi -= deltaPhi;
|
if(_phi < -NLMISC::Pi/2) _phi -= deltaPhi;
|
||||||
if(_phi > NLMISC::Pi/2) _phi -= deltaPsi;
|
if(_phi > NLMISC::Pi/2) _phi -= deltaPsi;
|
||||||
if (_dist < 1) _dist = 1;
|
if (_dist < 1) _dist = 1;
|
||||||
|
|
||||||
NLMISC::CQuat q0,q1,q2;
|
NLMISC::CQuat q0,q1,q2;
|
||||||
NLMISC::CVector up(0,0,1);
|
NLMISC::CVector up(0,0,1);
|
||||||
NLMISC::CVector v(0,0,1);
|
NLMISC::CVector v(0,0,1);
|
||||||
|
|
||||||
q0.setAngleAxis(v,_psi);
|
q0.setAngleAxis(v,_psi);
|
||||||
v = NLMISC::CVector(0,1,0);
|
v = NLMISC::CVector(0,1,0);
|
||||||
q1.setAngleAxis(v,_phi);
|
q1.setAngleAxis(v,_phi);
|
||||||
|
@ -337,15 +338,15 @@ void CObjectViewer::updateAnimation(NL3D::TAnimationTime time)
|
||||||
CEntity &entity = (*eit).second;
|
CEntity &entity = (*eit).second;
|
||||||
entity.update(time);
|
entity.update(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate scene animation
|
// Animate scene animation
|
||||||
Modules::objView().getPlayListManager()->setup(time);
|
Modules::objView().getPlayListManager()->setup(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CObjectViewer::setBackgroundColor(NLMISC::CRGBA backgroundColor)
|
void CObjectViewer::setBackgroundColor(NLMISC::CRGBA backgroundColor)
|
||||||
{
|
{
|
||||||
_BackgroundColor = backgroundColor;
|
_BackgroundColor = backgroundColor;
|
||||||
|
|
||||||
// config file variable changes
|
// config file variable changes
|
||||||
Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.R, 0);
|
Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.R, 0);
|
||||||
Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.G, 1);
|
Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.G, 1);
|
||||||
|
@ -389,13 +390,13 @@ void CObjectViewer::getListObjects(std::vector<std::string> &listObj)
|
||||||
void CObjectViewer::loadConfig()
|
void CObjectViewer::loadConfig()
|
||||||
{
|
{
|
||||||
// set background color from config
|
// set background color from config
|
||||||
Modules::config().setAndCallback("BackgroundColor", CConfigCallback(this, &CObjectViewer::cfcbBackgroundColor));
|
Modules::config().setAndCallback("BackgroundColor", CConfigCallback(this, &CObjectViewer::cfcbBackgroundColor));
|
||||||
|
|
||||||
// set graphics driver from config
|
// set graphics driver from config
|
||||||
Modules::config().setAndCallback("GraphicsDriver",CConfigCallback(this,&CObjectViewer::cfcbGraphicsDriver));
|
Modules::config().setAndCallback("GraphicsDriver",CConfigCallback(this,&CObjectViewer::cfcbGraphicsDriver));
|
||||||
|
|
||||||
Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal));
|
Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal));
|
||||||
|
|
||||||
Modules::config().setAndCallback("FontName",CConfigCallback(this,&CObjectViewer::cfcbFontName));
|
Modules::config().setAndCallback("FontName",CConfigCallback(this,&CObjectViewer::cfcbFontName));
|
||||||
|
|
||||||
Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect));
|
Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect));
|
||||||
|
@ -425,7 +426,7 @@ void CObjectViewer::cfcbGraphicsDriver(NLMISC::CConfigFile::CVar &var)
|
||||||
{
|
{
|
||||||
// Choose driver opengl to work correctly under Linux example
|
// Choose driver opengl to work correctly under Linux example
|
||||||
_Direct3D = false; //_Driver = OpenGL;
|
_Direct3D = false; //_Driver = OpenGL;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
std::string driver = var.asString();
|
std::string driver = var.asString();
|
||||||
if (driver == "Direct3D") _Direct3D = true; //m_Driver = Direct3D;
|
if (driver == "Direct3D") _Direct3D = true; //m_Driver = Direct3D;
|
||||||
|
@ -446,7 +447,7 @@ void CObjectViewer::cfcbFontName(NLMISC::CConfigFile::CVar &var)
|
||||||
|
|
||||||
void CObjectViewer::cfcbBloomEffect(NLMISC::CConfigFile::CVar &var)
|
void CObjectViewer::cfcbBloomEffect(NLMISC::CConfigFile::CVar &var)
|
||||||
{
|
{
|
||||||
_BloomEffect = var.asBool();
|
_BloomEffect = var.asBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -34,24 +34,26 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
|
|
||||||
namespace NL3D {
|
namespace NL3D
|
||||||
class UDriver;
|
{
|
||||||
class UScene;
|
class UDriver;
|
||||||
class ULight;
|
class UScene;
|
||||||
class UInstance;
|
class ULight;
|
||||||
class UCamera;
|
class UInstance;
|
||||||
class USkeleton;
|
class UCamera;
|
||||||
class UTextContext;
|
class USkeleton;
|
||||||
class UPlayListManager;
|
class UTextContext;
|
||||||
class U3dMouseListener;
|
class UPlayListManager;
|
||||||
|
class U3dMouseListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CObjectViewer
|
@class CObjectViewer
|
||||||
@brief The class initializes the driver and creates a scene, provides basic control functions over the stage driver.
|
@brief The class initializes the driver and creates a scene, provides basic control functions over the stage driver.
|
||||||
@details The class initializes the driver (by choosing OpenGL or Direct3D), and creates a scene (set an aspect), respectively
|
@details The class initializes the driver (by choosing OpenGL or Direct3D), and creates a scene (set an aspect), respectively
|
||||||
creates a light as well, load the font that is available further for
|
creates a light as well, load the font that is available further for
|
||||||
all other subsystems (eg: the signature of the coordinate axes) and Mouse Listener.
|
all other subsystems (eg: the signature of the coordinate axes) and Mouse Listener.
|
||||||
Settings are loaded from the configuration file.
|
Settings are loaded from the configuration file.
|
||||||
|
@ -60,7 +62,7 @@ Also, the class provides the following features to scene control:
|
||||||
- Provides access to a animation object (getEntity(), getListObjects()).
|
- Provides access to a animation object (getEntity(), getListObjects()).
|
||||||
- Select of current object for various operation (mainly related to the animation and editing skeleton):setCurrentObject(), getCurrentObject().
|
- Select of current object for various operation (mainly related to the animation and editing skeleton):setCurrentObject(), getCurrentObject().
|
||||||
- Operations with the viewport, setting the correct perspective and creating of a screenshot.
|
- Operations with the viewport, setting the correct perspective and creating of a screenshot.
|
||||||
- Function's updating keyboard and mouse (acts on the camera updateInput()), update(updateAnimatePS(), updateAnimation())
|
- Function's updating keyboard and mouse (acts on the camera updateInput()), update(updateAnimatePS(), updateAnimation())
|
||||||
and render the scene (renderDriver(), renderScene()).
|
and render the scene (renderDriver(), renderScene()).
|
||||||
- Provides access to a general NeL systems (getDriver(), getScene(), getPlayListManager(), getTextContext(), get3dMouseListener()).
|
- Provides access to a general NeL systems (getDriver(), getScene(), getPlayListManager(), getTextContext(), get3dMouseListener()).
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +71,7 @@ class CObjectViewer
|
||||||
public:
|
public:
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
CObjectViewer();
|
CObjectViewer();
|
||||||
|
|
||||||
virtual ~CObjectViewer();
|
virtual ~CObjectViewer();
|
||||||
|
|
||||||
/// Init a driver and create scene.
|
/// Init a driver and create scene.
|
||||||
|
@ -131,8 +133,11 @@ public:
|
||||||
/// @param w - width window.
|
/// @param w - width window.
|
||||||
/// @param h - height window.
|
/// @param h - height window.
|
||||||
void setSizeViewport(uint16 w, uint16 h);
|
void setSizeViewport(uint16 w, uint16 h);
|
||||||
|
|
||||||
void setBloomEffect(bool enabled) { _BloomEffect = enabled; }
|
void setBloomEffect(bool enabled)
|
||||||
|
{
|
||||||
|
_BloomEffect = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// Select instance from the scene
|
/// Select instance from the scene
|
||||||
/// @param name - name instance, "" if no instance edited
|
/// @param name - name instance, "" if no instance edited
|
||||||
|
@ -140,8 +145,11 @@ public:
|
||||||
|
|
||||||
/// Get current instance from the scene
|
/// Get current instance from the scene
|
||||||
/// @return name current instance, "" if no instance edited
|
/// @return name current instance, "" if no instance edited
|
||||||
const std::string& getCurrentObject() { return _CurrentInstance; }
|
const std::string& getCurrentObject()
|
||||||
|
{
|
||||||
|
return _CurrentInstance;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get entity from the scene
|
/// Get entity from the scene
|
||||||
/// @return ref Entity
|
/// @return ref Entity
|
||||||
CEntity& getEntity(const std::string &name);
|
CEntity& getEntity(const std::string &name);
|
||||||
|
@ -152,49 +160,73 @@ public:
|
||||||
|
|
||||||
/// Get value background color.
|
/// Get value background color.
|
||||||
/// @return background color.
|
/// @return background color.
|
||||||
inline NLMISC::CRGBA getBackgroundColor() const { return _BackgroundColor; }
|
inline NLMISC::CRGBA getBackgroundColor() const
|
||||||
|
{
|
||||||
|
return _BackgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get type driver.
|
/// Get type driver.
|
||||||
/// @return true if have used Direct3D driver, false OpenGL 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.
|
/// Get a game interface for window driver.
|
||||||
/// @return pointer to the 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.
|
/// Get a game interface for scene.
|
||||||
/// @return pointer to the 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
|
/// Get a manager of playlist
|
||||||
/// @return pointer to the UPlayListManager
|
/// @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
|
/// Get a game interface to render string
|
||||||
/// @return pointer to the UPlayListManager
|
/// @return pointer to the UPlayListManager
|
||||||
inline NL3D::UTextContext *getTextContext() const { return _TextContext; }
|
inline NL3D::UTextContext *getTextContext() const
|
||||||
|
{
|
||||||
|
return _TextContext;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get a 3d mouse listener
|
/// Get a 3d mouse listener
|
||||||
/// @return pointer to the U3dMouseListener
|
/// @return pointer to the U3dMouseListener
|
||||||
inline NL3D::U3dMouseListener *get3dMouseListener() const { return _MouseListener; }
|
inline NL3D::U3dMouseListener *get3dMouseListener() const
|
||||||
|
{
|
||||||
|
return _MouseListener;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
|
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
|
|
||||||
// Delete all entities
|
// Delete all entities
|
||||||
void deleteEntities();
|
void deleteEntities();
|
||||||
|
|
||||||
// Load background color from config file, intended for CConfiguration.
|
// Load background color from config file, intended for CConfiguration.
|
||||||
void cfcbBackgroundColor(NLMISC::CConfigFile::CVar &var);
|
void cfcbBackgroundColor(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbGraphicsDriver(NLMISC::CConfigFile::CVar &var);
|
void cfcbGraphicsDriver(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbCameraFocal(NLMISC::CConfigFile::CVar &var);
|
void cfcbCameraFocal(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbFontName(NLMISC::CConfigFile::CVar &var);
|
void cfcbFontName(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbBloomEffect(NLMISC::CConfigFile::CVar &var);
|
void cfcbBloomEffect(NLMISC::CConfigFile::CVar &var);
|
||||||
|
|
||||||
NLMISC::CRGBA _BackgroundColor;
|
NLMISC::CRGBA _BackgroundColor;
|
||||||
|
|
||||||
NL3D::UDriver *_Driver;
|
NL3D::UDriver *_Driver;
|
||||||
|
@ -207,17 +239,17 @@ private:
|
||||||
|
|
||||||
// The entities storage
|
// The entities storage
|
||||||
CEntities _Entities;
|
CEntities _Entities;
|
||||||
|
|
||||||
/// Camera parameters.
|
/// Camera parameters.
|
||||||
float _phi, _psi, _dist;
|
float _phi, _psi, _dist;
|
||||||
|
|
||||||
float _CameraFocal;
|
float _CameraFocal;
|
||||||
|
|
||||||
std::string _FontName;
|
std::string _FontName;
|
||||||
|
|
||||||
bool _Direct3D;
|
bool _Direct3D;
|
||||||
bool _BloomEffect;
|
bool _BloomEffect;
|
||||||
|
|
||||||
std::string _CurrentInstance;
|
std::string _CurrentInstance;
|
||||||
|
|
||||||
};/* class CObjectViewer */
|
};/* class CObjectViewer */
|
||||||
|
|
|
@ -32,26 +32,27 @@
|
||||||
#include "particle_link_skeleton_dialog.h"
|
#include "particle_link_skeleton_dialog.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CParticleControlDialog::CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent)
|
CParticleControlDialog::CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_timer = new QTimer(this);
|
_timer = new QTimer(this);
|
||||||
|
|
||||||
_particleLinkDialog = new CParticleLinkDialog(model, parent);
|
_particleLinkDialog = new CParticleLinkDialog(model, parent);
|
||||||
_particleLinkDialog->setVisible(false);
|
_particleLinkDialog->setVisible(false);
|
||||||
|
|
||||||
_ui.numParticlesLabel->setMinimumWidth(_ui.numParticlesLabel->sizeHint().width());
|
_ui.numParticlesLabel->setMinimumWidth(_ui.numParticlesLabel->sizeHint().width());
|
||||||
_ui.numWantedFacesLabel->setMinimumWidth(_ui.numWantedFacesLabel->sizeHint().width());
|
_ui.numWantedFacesLabel->setMinimumWidth(_ui.numWantedFacesLabel->sizeHint().width());
|
||||||
_ui.systemTimesLabel->setMinimumWidth(_ui.systemTimesLabel->sizeHint().width());
|
_ui.systemTimesLabel->setMinimumWidth(_ui.systemTimesLabel->sizeHint().width());
|
||||||
|
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
connect(_timer, SIGNAL(timeout()), this, SLOT(updateCount()));
|
connect(_timer, SIGNAL(timeout()), this, SLOT(updateCount()));
|
||||||
|
|
||||||
connect(_ui.playToolButton, SIGNAL(clicked()), this, SLOT(play()));
|
connect(_ui.playToolButton, SIGNAL(clicked()), this, SLOT(play()));
|
||||||
connect(_ui.stopToolButton, SIGNAL(clicked()), this, SLOT(stop()));
|
connect(_ui.stopToolButton, SIGNAL(clicked()), this, SLOT(stop()));
|
||||||
connect(_ui.horizontalSlider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
|
connect(_ui.horizontalSlider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
|
||||||
|
@ -60,7 +61,7 @@ CParticleControlDialog::CParticleControlDialog(CSkeletonTreeModel *model, QWidge
|
||||||
connect(_ui.loopCheckBox, SIGNAL(toggled(bool)), this, SLOT(autoRepeat(bool)));
|
connect(_ui.loopCheckBox, SIGNAL(toggled(bool)), this, SLOT(autoRepeat(bool)));
|
||||||
connect(_ui.autoCountCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledAutoCount(bool)));
|
connect(_ui.autoCountCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledAutoCount(bool)));
|
||||||
connect(_ui.resetAutoCountPushButton, SIGNAL(clicked()), this, SLOT(resetAutoCount()));
|
connect(_ui.resetAutoCountPushButton, SIGNAL(clicked()), this, SLOT(resetAutoCount()));
|
||||||
|
|
||||||
connect(_ui.linkSkelPushButton, SIGNAL(clicked()), this, SLOT(linkSceleton()));
|
connect(_ui.linkSkelPushButton, SIGNAL(clicked()), this, SLOT(linkSceleton()));
|
||||||
connect(_ui.unlinkSkelPushButton, SIGNAL(clicked()), this, SLOT(unlink()));
|
connect(_ui.unlinkSkelPushButton, SIGNAL(clicked()), this, SLOT(unlink()));
|
||||||
connect(_ui.setAnimPushButton, SIGNAL(clicked()), this, SLOT(setAnim()));
|
connect(_ui.setAnimPushButton, SIGNAL(clicked()), this, SLOT(setAnim()));
|
||||||
|
@ -95,7 +96,7 @@ void CParticleControlDialog::play()
|
||||||
Modules::psEdit().startMultiple();
|
Modules::psEdit().startMultiple();
|
||||||
else
|
else
|
||||||
Modules::psEdit().start();
|
Modules::psEdit().start();
|
||||||
|
|
||||||
_timer->start(200);
|
_timer->start(200);
|
||||||
_ui.multipleCheckBox->setEnabled(false);
|
_ui.multipleCheckBox->setEnabled(false);
|
||||||
Q_EMIT changeState();
|
Q_EMIT changeState();
|
||||||
|
@ -107,11 +108,11 @@ void CParticleControlDialog::stop()
|
||||||
_ui.playToolButton->setChecked(false);
|
_ui.playToolButton->setChecked(false);
|
||||||
Modules::psEdit().stop();
|
Modules::psEdit().stop();
|
||||||
_ui.multipleCheckBox->setEnabled(true);
|
_ui.multipleCheckBox->setEnabled(true);
|
||||||
|
|
||||||
_ui.numParticlesLabel->setText(tr("Num particles:"));
|
_ui.numParticlesLabel->setText(tr("Num particles:"));
|
||||||
_ui.numWantedFacesLabel->setText(tr("Num wanted faces:"));
|
_ui.numWantedFacesLabel->setText(tr("Num wanted faces:"));
|
||||||
_ui.systemTimesLabel->setText(tr("System time:"));
|
_ui.systemTimesLabel->setText(tr("System time:"));
|
||||||
|
|
||||||
Q_EMIT changeState();
|
Q_EMIT changeState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,18 +155,18 @@ void CParticleControlDialog::updateCount()
|
||||||
{
|
{
|
||||||
if (Modules::psEdit().getActiveNode() == NULL)
|
if (Modules::psEdit().getActiveNode() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NL3D::CParticleSystem *ps = Modules::psEdit().getActiveNode()->getPSPointer();
|
NL3D::CParticleSystem *ps = Modules::psEdit().getActiveNode()->getPSPointer();
|
||||||
sint currNumParticles = (sint) ps->getCurrNumParticles();
|
sint currNumParticles = (sint) ps->getCurrNumParticles();
|
||||||
|
|
||||||
// display number of particles for the currently active node
|
// display number of particles for the currently active node
|
||||||
_ui.numParticlesLabel->setText(tr("Num particles: %1").arg(currNumParticles));
|
_ui.numParticlesLabel->setText(tr("Num particles: %1").arg(currNumParticles));
|
||||||
|
|
||||||
// display max number of wanted faces
|
// display max number of wanted faces
|
||||||
NLMISC::CMatrix camMat = ps->getScene()->getCam()->getMatrix();
|
NLMISC::CMatrix camMat = ps->getScene()->getCam()->getMatrix();
|
||||||
sint numWantedFaces = (uint) ps->getWantedNumTris((ps->getSysMat().getPos() - camMat.getPos()).norm());
|
sint numWantedFaces = (uint) ps->getWantedNumTris((ps->getSysMat().getPos() - camMat.getPos()).norm());
|
||||||
_ui.numWantedFacesLabel->setText(tr("Num wanted faces: %1").arg(numWantedFaces));
|
_ui.numWantedFacesLabel->setText(tr("Num wanted faces: %1").arg(numWantedFaces));
|
||||||
|
|
||||||
// display system date
|
// display system date
|
||||||
_ui.systemTimesLabel->setText(tr("System time: %1").arg(ps->getSystemDate(),0,'f',2));
|
_ui.systemTimesLabel->setText(tr("System time: %1").arg(ps->getSystemDate(),0,'f',2));
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ void CParticleControlDialog::linkSceleton()
|
||||||
void CParticleControlDialog::unlink()
|
void CParticleControlDialog::unlink()
|
||||||
{
|
{
|
||||||
CWorkspaceNode *node = Modules::psEdit().getActiveNode();
|
CWorkspaceNode *node = Modules::psEdit().getActiveNode();
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node->unstickPSFromSkeleton();
|
node->unstickPSFromSkeleton();
|
||||||
|
@ -197,7 +198,7 @@ void CParticleControlDialog::clearAnim()
|
||||||
void CParticleControlDialog::restickObjects()
|
void CParticleControlDialog::restickObjects()
|
||||||
{
|
{
|
||||||
CParticleWorkspace *pw = Modules::psEdit().getParticleWorkspace();
|
CParticleWorkspace *pw = Modules::psEdit().getParticleWorkspace();
|
||||||
if (pw == NULL)
|
if (pw == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pw->restickAllObjects();
|
pw->restickAllObjects();
|
||||||
|
|
|
@ -25,14 +25,15 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CSkeletonTreeModel;
|
class CSkeletonTreeModel;
|
||||||
class CParticleLinkDialog;
|
class CParticleLinkDialog;
|
||||||
|
|
||||||
class CParticleControlDialog: public QDockWidget
|
class CParticleControlDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent = 0);
|
CParticleControlDialog(CSkeletonTreeModel *model, QWidget *parent = 0);
|
||||||
~CParticleControlDialog();
|
~CParticleControlDialog();
|
||||||
|
@ -48,7 +49,7 @@ public Q_SLOTS:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void play();
|
void play();
|
||||||
void stop();
|
void stop();
|
||||||
void sliderMoved(int value);
|
void sliderMoved(int value);
|
||||||
void displayHelpers(bool state);
|
void displayHelpers(bool state);
|
||||||
void displayBBox(bool state);
|
void displayBBox(bool state);
|
||||||
void autoRepeat(bool state);
|
void autoRepeat(bool state);
|
||||||
|
|
|
@ -31,15 +31,16 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CParticleEditor::CParticleEditor(void):
|
CParticleEditor::CParticleEditor(void):
|
||||||
_ActiveNode(NULL), _State(State::Stopped), _Speed(1.0f),
|
_ActiveNode(NULL), _State(State::Stopped), _Speed(1.0f),
|
||||||
_AutoRepeat(false), _DisplayBBox(false),
|
_AutoRepeat(false), _DisplayBBox(false),
|
||||||
_DisplayHelpers(false), _AutoUpdateBBox(false),
|
_DisplayHelpers(false), _AutoUpdateBBox(false),
|
||||||
_EmptyBBox(true), _PW(NULL),
|
_EmptyBBox(true), _PW(NULL),
|
||||||
_Driver(NULL), _Scene(NULL),
|
_Driver(NULL), _Scene(NULL),
|
||||||
_FontManager(NULL), _FontGen(NULL)
|
_FontManager(NULL), _FontGen(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,10 +49,10 @@ CParticleEditor::~CParticleEditor(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleEditor::init()
|
void CParticleEditor::init()
|
||||||
{
|
{
|
||||||
NL3D::CDriverUser *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver());
|
NL3D::CDriverUser *driver = dynamic_cast<NL3D::CDriverUser*>(Modules::objView().getDriver());
|
||||||
_Driver = driver->getDriver();
|
_Driver = driver->getDriver();
|
||||||
|
|
||||||
NL3D::CSceneUser *scene = dynamic_cast<NL3D::CSceneUser*>(Modules::objView().getScene());
|
NL3D::CSceneUser *scene = dynamic_cast<NL3D::CSceneUser*>(Modules::objView().getScene());
|
||||||
_Scene = &scene->getScene();
|
_Scene = &scene->getScene();
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ void CParticleEditor::loadWorkspace(const std::string &fullPath)
|
||||||
// Add to the path
|
// Add to the path
|
||||||
std::auto_ptr<CParticleWorkspace> newPW(new CParticleWorkspace);
|
std::auto_ptr<CParticleWorkspace> newPW(new CParticleWorkspace);
|
||||||
newPW->init(fullPath);
|
newPW->init(fullPath);
|
||||||
|
|
||||||
// save empty workspace
|
// save empty workspace
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -106,8 +107,8 @@ void CParticleEditor::loadWorkspace(const std::string &fullPath)
|
||||||
{
|
{
|
||||||
nlerror(e.what());
|
nlerror(e.what());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to load each ps
|
// try to load each ps
|
||||||
CWorkspaceNode *firstLoadedNode = NULL;
|
CWorkspaceNode *firstLoadedNode = NULL;
|
||||||
TPWNodeItr itr = newPW->getNodeList().begin();
|
TPWNodeItr itr = newPW->getNodeList().begin();
|
||||||
|
@ -188,27 +189,27 @@ void CParticleEditor::start()
|
||||||
{
|
{
|
||||||
case State::Stopped:
|
case State::Stopped:
|
||||||
if (_ActiveNode)
|
if (_ActiveNode)
|
||||||
{
|
{
|
||||||
if (checkHasLoop(*_ActiveNode)) return;
|
if (checkHasLoop(*_ActiveNode)) return;
|
||||||
play(*_ActiveNode);
|
play(*_ActiveNode);
|
||||||
nlassert(_PlayingNodes.empty());
|
nlassert(_PlayingNodes.empty());
|
||||||
_PlayingNodes.push_back(_ActiveNode);
|
_PlayingNodes.push_back(_ActiveNode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case State::RunningSingle:
|
case State::RunningSingle:
|
||||||
// no-op
|
// no-op
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case State::RunningMultiple:
|
case State::RunningMultiple:
|
||||||
stop();
|
stop();
|
||||||
start();
|
start();
|
||||||
break;
|
break;
|
||||||
case State::PausedSingle:
|
case State::PausedSingle:
|
||||||
if (_ActiveNode)
|
if (_ActiveNode)
|
||||||
{
|
{
|
||||||
unpause(*_ActiveNode);
|
unpause(*_ActiveNode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case State::PausedMultiple:
|
case State::PausedMultiple:
|
||||||
for(uint k = 0; k < _PlayingNodes.size(); ++k)
|
for(uint k = 0; k < _PlayingNodes.size(); ++k)
|
||||||
{
|
{
|
||||||
|
@ -219,10 +220,10 @@ void CParticleEditor::start()
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
start();
|
start();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nlassert(0);
|
nlassert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_State = State::RunningSingle;
|
_State = State::RunningSingle;
|
||||||
}
|
}
|
||||||
|
@ -232,54 +233,54 @@ void CParticleEditor::startMultiple()
|
||||||
switch(_State)
|
switch(_State)
|
||||||
{
|
{
|
||||||
case State::Stopped:
|
case State::Stopped:
|
||||||
|
{
|
||||||
|
if (!_PW) return;
|
||||||
|
nlassert(_PlayingNodes.empty());
|
||||||
|
TPWNodeItr itr = _PW->getNodeList().begin();
|
||||||
|
while(itr != _PW->getNodeList().end())
|
||||||
{
|
{
|
||||||
if (!_PW) return;
|
CWorkspaceNode *node = (*itr);
|
||||||
nlassert(_PlayingNodes.empty());
|
if (node->isLoaded())
|
||||||
TPWNodeItr itr = _PW->getNodeList().begin();
|
if (checkHasLoop(*node)) return;
|
||||||
while(itr != _PW->getNodeList().end())
|
itr++;
|
||||||
{
|
}
|
||||||
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())
|
|
||||||
{
|
|
||||||
// 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++;
|
{
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
break;
|
||||||
case State::PausedSingle:
|
default:
|
||||||
case State::RunningSingle:
|
nlassert(0);
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_State = State::RunningMultiple;
|
_State = State::RunningMultiple;
|
||||||
|
@ -290,31 +291,31 @@ void CParticleEditor::pause()
|
||||||
switch(_State)
|
switch(_State)
|
||||||
{
|
{
|
||||||
case State::Stopped:
|
case State::Stopped:
|
||||||
// no-op
|
// no-op
|
||||||
return;
|
return;
|
||||||
case State::RunningSingle:
|
case State::RunningSingle:
|
||||||
if (_ActiveNode)
|
if (_ActiveNode)
|
||||||
{
|
{
|
||||||
pause(*_ActiveNode);
|
pause(*_ActiveNode);
|
||||||
}
|
}
|
||||||
_State = State::PausedSingle;
|
_State = State::PausedSingle;
|
||||||
break;
|
break;
|
||||||
case State::RunningMultiple:
|
case State::RunningMultiple:
|
||||||
for(uint k = 0; k < _PlayingNodes.size(); ++k)
|
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;
|
break;
|
||||||
case State::PausedSingle:
|
case State::PausedSingle:
|
||||||
case State::PausedMultiple:
|
case State::PausedMultiple:
|
||||||
// no-op
|
// no-op
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
nlassert(0);
|
nlassert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,28 +324,28 @@ void CParticleEditor::stop()
|
||||||
{
|
{
|
||||||
switch(_State)
|
switch(_State)
|
||||||
{
|
{
|
||||||
case State::Stopped:
|
case State::Stopped:
|
||||||
// no-op
|
// no-op
|
||||||
return;
|
return;
|
||||||
case State::RunningSingle:
|
case State::RunningSingle:
|
||||||
case State::RunningMultiple:
|
case State::RunningMultiple:
|
||||||
case State::PausedSingle:
|
case State::PausedSingle:
|
||||||
case State::PausedMultiple:
|
case State::PausedMultiple:
|
||||||
for(uint k = 0; k < _PlayingNodes.size(); ++k)
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
nlassert(0);
|
nlassert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_State = State::Stopped;
|
_State = State::Stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleEditor::update()
|
void CParticleEditor::update()
|
||||||
{
|
{
|
||||||
|
@ -352,7 +353,7 @@ void CParticleEditor::update()
|
||||||
if (_PW == NULL) return;
|
if (_PW == NULL) return;
|
||||||
|
|
||||||
NL3D::CParticleSystem *currPS = _ActiveNode->getPSPointer();
|
NL3D::CParticleSystem *currPS = _ActiveNode->getPSPointer();
|
||||||
|
|
||||||
// compute BBox
|
// compute BBox
|
||||||
if (_DisplayBBox)
|
if (_DisplayBBox)
|
||||||
{
|
{
|
||||||
|
@ -372,7 +373,7 @@ void CParticleEditor::update()
|
||||||
currPS->setPrecomputedBBox(_CurrBBox);
|
currPS->setPrecomputedBBox(_CurrBBox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto repeat feature
|
// auto repeat feature
|
||||||
if (_AutoRepeat)
|
if (_AutoRepeat)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +395,7 @@ void CParticleEditor::update()
|
||||||
allFXFinished = false;
|
allFXFinished = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (node->getPSPointer()->getCurrNumParticles() != 0)
|
if (node->getPSPointer()->getCurrNumParticles() != 0)
|
||||||
{
|
{
|
||||||
|
@ -456,7 +457,7 @@ void CParticleEditor::restartAllFX()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(uint k = 0; k < _PlayingNodes.size(); ++k)
|
for(uint k = 0; k < _PlayingNodes.size(); ++k)
|
||||||
{
|
{
|
||||||
if (_PlayingNodes[k])
|
if (_PlayingNodes[k])
|
||||||
|
@ -484,14 +485,14 @@ void CParticleEditor::setSpeed(float value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleEditor::setDisplayBBox(bool enable)
|
void CParticleEditor::setDisplayBBox(bool enable)
|
||||||
{
|
{
|
||||||
_DisplayBBox = enable;
|
_DisplayBBox = enable;
|
||||||
NL3D::CParticleSystem::forceDisplayBBox(enable);
|
NL3D::CParticleSystem::forceDisplayBBox(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleEditor::enableAutoCount(bool enable)
|
void CParticleEditor::enableAutoCount(bool enable)
|
||||||
{
|
{
|
||||||
if (!_ActiveNode) return;
|
if (!_ActiveNode) return;
|
||||||
if (enable == _ActiveNode->getPSPointer()->getAutoCountFlag()) return;
|
if (enable == _ActiveNode->getPSPointer()->getAutoCountFlag()) return;
|
||||||
_ActiveNode->getPSPointer()->setAutoCountFlag(enable);
|
_ActiveNode->getPSPointer()->setAutoCountFlag(enable);
|
||||||
|
@ -517,7 +518,7 @@ bool CParticleEditor::checkHasLoop(CWorkspaceNode &node)
|
||||||
{
|
{
|
||||||
nlassert(node.isLoaded());
|
nlassert(node.isLoaded());
|
||||||
if (!node.getPSPointer()->hasLoop()) return false;
|
if (!node.getPSPointer()->hasLoop()) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleEditor::play(CWorkspaceNode &node)
|
void CParticleEditor::play(CWorkspaceNode &node)
|
||||||
|
@ -527,7 +528,7 @@ void CParticleEditor::play(CWorkspaceNode &node)
|
||||||
nlassert(node.isLoaded());
|
nlassert(node.isLoaded());
|
||||||
// if node not started, start it
|
// if node not started, start it
|
||||||
node.memorizeState();
|
node.memorizeState();
|
||||||
// enable the system to take the right date from the scene
|
// enable the system to take the right date from the scene
|
||||||
node.getPSModel()->enableAutoGetEllapsedTime(true);
|
node.getPSModel()->enableAutoGetEllapsedTime(true);
|
||||||
node.getPSPointer()->setSystemDate(0.f);
|
node.getPSPointer()->setSystemDate(0.f);
|
||||||
node.getPSPointer()->reactivateSound();
|
node.getPSPointer()->reactivateSound();
|
||||||
|
@ -540,8 +541,8 @@ void CParticleEditor::play(CWorkspaceNode &node)
|
||||||
node.getPSPointer()->matchArraySize();
|
node.getPSPointer()->matchArraySize();
|
||||||
}
|
}
|
||||||
resetAutoCount(&node, false);
|
resetAutoCount(&node, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set speed playback particle system
|
// Set speed playback particle system
|
||||||
node.getPSModel()->setEllapsedTimeRatio(_Speed);
|
node.getPSModel()->setEllapsedTimeRatio(_Speed);
|
||||||
}
|
}
|
||||||
|
@ -571,5 +572,5 @@ void CParticleEditor::stop(CWorkspaceNode &node)
|
||||||
node.getPSModel()->activateEmitters(true);
|
node.getPSModel()->activateEmitters(true);
|
||||||
node.getPSPointer()->stopSound();
|
node.getPSPointer()->stopSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -34,26 +34,28 @@
|
||||||
// Projects includes
|
// Projects includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NL3D {
|
namespace NL3D
|
||||||
class CParticleSystem;
|
{
|
||||||
class CParticleSystemModel;
|
class CParticleSystem;
|
||||||
class CShapeBank;
|
class CParticleSystemModel;
|
||||||
class CScene;
|
class CShapeBank;
|
||||||
class IDriver;
|
class CScene;
|
||||||
class CFontManager;
|
class IDriver;
|
||||||
class CFontGenerator;
|
class CFontManager;
|
||||||
|
class CFontGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
@class CParticleEditor
|
@class CParticleEditor
|
||||||
@brief The main class of the particles editor.
|
@brief The main class of the particles editor.
|
||||||
@details - Provides access to a container containing all of the particles systems (getParticleWorkspace())
|
@details - Provides access to a container containing all of the particles systems (getParticleWorkspace())
|
||||||
and also allows you to create an empty container (createNewWorkspace()) load / save from the file
|
and also allows you to create an empty container (createNewWorkspace()) load / save from the file
|
||||||
and unload (loadWorkspace(), saveWorkspaceStructure(), saveWorkspaceContent())
|
and unload (loadWorkspace(), saveWorkspaceStructure(), saveWorkspaceContent())
|
||||||
- Has basic operations management system to control a particles systems (start(), stop(), pause(), setSpeed() / setAutoRepeat())
|
- Has basic operations management system to control a particles systems (start(), stop(), pause(), setSpeed() / setAutoRepeat())
|
||||||
as in single mode, and in the multiple (start(), startMultiple()).
|
as in single mode, and in the multiple (start(), startMultiple()).
|
||||||
- Additional functions of particle systems: display / hide the assistanse elements (setDisplayHelpers()),
|
- Additional functions of particle systems: display / hide the assistanse elements (setDisplayHelpers()),
|
||||||
the calculation of bounding box (setAutoBBox(), getAutoBBox()), switching on the autoCount mode (setAutoBBox(), getAutoBBox()).
|
the calculation of bounding box (setAutoBBox(), getAutoBBox()), switching on the autoCount mode (setAutoBBox(), getAutoBBox()).
|
||||||
- Selection of the current system of particles for making various operations (setActiveNode(), getActiveNode()).
|
- Selection of the current system of particles for making various operations (setActiveNode(), getActiveNode()).
|
||||||
*/
|
*/
|
||||||
|
@ -65,29 +67,35 @@ public:
|
||||||
enum List
|
enum List
|
||||||
{
|
{
|
||||||
Stopped = 1,
|
Stopped = 1,
|
||||||
RunningSingle,
|
RunningSingle,
|
||||||
RunningMultiple,
|
RunningMultiple,
|
||||||
PausedSingle,
|
PausedSingle,
|
||||||
PausedMultiple
|
PausedMultiple
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
CParticleEditor(void);
|
CParticleEditor(void);
|
||||||
~CParticleEditor(void);
|
~CParticleEditor(void);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void release();
|
void release();
|
||||||
|
|
||||||
/// Active a new node of the workspace
|
/// Active a new node of the workspace
|
||||||
/// Current active node is ready for edition.
|
/// Current active node is ready for edition.
|
||||||
/// Its bbox is displayed.
|
/// Its bbox is displayed.
|
||||||
void setActiveNode(CWorkspaceNode *node);
|
void setActiveNode(CWorkspaceNode *node);
|
||||||
|
|
||||||
/// Get the node of the workspace that is currently active
|
/// 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
|
/// 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
|
/// Get a model from a ps pointer. The ps must belong to the workspace
|
||||||
NL3D::CParticleSystemModel *getModelFromPS(NL3D::CParticleSystem *ps) const;
|
NL3D::CParticleSystemModel *getModelFromPS(NL3D::CParticleSystem *ps) const;
|
||||||
|
@ -126,56 +134,92 @@ public:
|
||||||
|
|
||||||
void setDisplayBBox(bool enable);
|
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
|
/// 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
|
/// Enable / disbale auto-count
|
||||||
void enableAutoCount(bool enable);
|
void enableAutoCount(bool enable);
|
||||||
|
|
||||||
/// Reset the autocount the next time the system will be started
|
/// Reset the autocount the next time the system will be started
|
||||||
void resetAutoCount(CWorkspaceNode *node, bool reset = true);
|
void resetAutoCount(CWorkspaceNode *node, bool reset = true);
|
||||||
|
|
||||||
/// Reset the auto compute bbox
|
/// Reset the auto compute bbox
|
||||||
void resetAutoBBox() { _EmptyBBox = true; }
|
void resetAutoBBox()
|
||||||
|
{
|
||||||
|
_EmptyBBox = true;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get current state
|
/// Get current state
|
||||||
int getState() const { return _State; }
|
int getState() const
|
||||||
|
{
|
||||||
|
return _State;
|
||||||
|
}
|
||||||
|
|
||||||
/// Return true if one or several system are being played
|
/// 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.
|
/// Return true if a system is paused.
|
||||||
/// Must call only if running
|
/// Must call only if running
|
||||||
bool isPaused() const
|
bool isPaused() const
|
||||||
{
|
{
|
||||||
return _State == State::PausedSingle || _State == State::PausedMultiple;
|
return _State == State::PausedSingle || _State == State::PausedMultiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleWorkspace *getParticleWorkspace() const { return _PW; }
|
CParticleWorkspace *getParticleWorkspace() const
|
||||||
|
{
|
||||||
NL3D::IDriver *getDriver() const { return _Driver; }
|
return _PW;
|
||||||
|
}
|
||||||
NL3D::CScene *getScene() const { return _Scene; }
|
|
||||||
|
NL3D::IDriver *getDriver() const
|
||||||
|
{
|
||||||
|
return _Driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
NL3D::CScene *getScene() const
|
||||||
|
{
|
||||||
|
return _Scene;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the fontManager
|
/// Get the fontManager
|
||||||
NL3D::CFontManager *getFontManager() const {return _FontManager;}
|
NL3D::CFontManager *getFontManager() const
|
||||||
|
{
|
||||||
|
return _FontManager;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the fontGenerator
|
/// Get the fontGenerator
|
||||||
NL3D::CFontGenerator *getFontGenerator () const { return _FontGen; }
|
NL3D::CFontGenerator *getFontGenerator () const
|
||||||
|
{
|
||||||
|
return _FontGen;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Check if a node is inserted in the running list (it may be paused)
|
// Check if a node is inserted in the running list (it may be paused)
|
||||||
bool isRunning(CWorkspaceNode *node);
|
bool isRunning(CWorkspaceNode *node);
|
||||||
|
|
||||||
// Check is a node has loops
|
// Check is a node has loops
|
||||||
bool checkHasLoop(CWorkspaceNode &node);
|
bool checkHasLoop(CWorkspaceNode &node);
|
||||||
|
|
||||||
void play(CWorkspaceNode &node);
|
void play(CWorkspaceNode &node);
|
||||||
void unpause(CWorkspaceNode &node);
|
void unpause(CWorkspaceNode &node);
|
||||||
void pause(CWorkspaceNode &node);
|
void pause(CWorkspaceNode &node);
|
||||||
|
@ -194,15 +238,15 @@ private:
|
||||||
bool _AutoRepeat;
|
bool _AutoRepeat;
|
||||||
bool _DisplayBBox;
|
bool _DisplayBBox;
|
||||||
bool _DisplayHelpers;
|
bool _DisplayHelpers;
|
||||||
|
|
||||||
// The system bbox must be updated automatically
|
// The system bbox must be updated automatically
|
||||||
bool _AutoUpdateBBox;
|
bool _AutoUpdateBBox;
|
||||||
|
|
||||||
// The last computed bbox for the system
|
// The last computed bbox for the system
|
||||||
bool _EmptyBBox;
|
bool _EmptyBBox;
|
||||||
NLMISC::CAABBox _CurrBBox;
|
NLMISC::CAABBox _CurrBBox;
|
||||||
|
|
||||||
|
|
||||||
CParticleWorkspace *_PW;
|
CParticleWorkspace *_PW;
|
||||||
NL3D::IDriver *_Driver;
|
NL3D::IDriver *_Driver;
|
||||||
NL3D::CScene *_Scene;
|
NL3D::CScene *_Scene;
|
||||||
|
|
|
@ -21,29 +21,30 @@
|
||||||
#include "particle_force_page.h"
|
#include "particle_force_page.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/3d/particle_system.h>
|
#include <nel/3d/particle_system.h>
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CForcePage::CForcePage(QWidget *parent)
|
CForcePage::CForcePage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.forceIntensityWidget->setRange(0, 10);
|
_ui.forceIntensityWidget->setRange(0, 10);
|
||||||
_ui.forceIntensityWidget->setWrapper(&_ForceIntensityWrapper);
|
_ui.forceIntensityWidget->setWrapper(&_ForceIntensityWrapper);
|
||||||
_ui.forceIntensityWidget->setSchemeWrapper(&_ForceIntensityWrapper);
|
_ui.forceIntensityWidget->setSchemeWrapper(&_ForceIntensityWrapper);
|
||||||
_ui.forceIntensityWidget->init();
|
_ui.forceIntensityWidget->init();
|
||||||
|
|
||||||
_ui.parametricFactorWidget->setRange(0.0, 64.0);
|
_ui.parametricFactorWidget->setRange(0.0, 64.0);
|
||||||
_ui.radialViscosityWidget->setRange(0.0, 1.0);
|
_ui.radialViscosityWidget->setRange(0.0, 1.0);
|
||||||
_ui.tangentialViscosityWidget->setRange(0, 1);
|
_ui.tangentialViscosityWidget->setRange(0, 1);
|
||||||
|
|
||||||
connect(_ui.toTargetsPushButton, SIGNAL(clicked()), this, SLOT(addTarget()));
|
connect(_ui.toTargetsPushButton, SIGNAL(clicked()), this, SLOT(addTarget()));
|
||||||
connect(_ui.toAvaibleTargetsPushButton, SIGNAL(clicked()), this, SLOT(removeTarget()));
|
connect(_ui.toAvaibleTargetsPushButton, SIGNAL(clicked()), this, SLOT(removeTarget()));
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ CForcePage::~CForcePage()
|
||||||
void CForcePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
|
void CForcePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
|
||||||
{
|
{
|
||||||
nlassert(locatedBindable);
|
nlassert(locatedBindable);
|
||||||
|
|
||||||
hideAdditionalWidget();
|
hideAdditionalWidget();
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
|
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
|
||||||
|
@ -116,31 +117,31 @@ void CForcePage::addTarget()
|
||||||
if ((totalCount == 0) || (_ui.avaibleTargetsListWidget->currentRow() == -1)) return;
|
if ((totalCount == 0) || (_ui.avaibleTargetsListWidget->currentRow() == -1)) return;
|
||||||
|
|
||||||
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.avaibleTargetsListWidget->currentItem());
|
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.avaibleTargetsListWidget->currentItem());
|
||||||
|
|
||||||
NL3D::CPSLocated *loc = item->getUserData();
|
NL3D::CPSLocated *loc = item->getUserData();
|
||||||
nlassert(loc);
|
nlassert(loc);
|
||||||
|
|
||||||
// check that force isn't applied on a forever lasting object
|
// check that force isn't applied on a forever lasting object
|
||||||
if (dynamic_cast<NL3D::CPSForce *>(_LBTarget))
|
if (dynamic_cast<NL3D::CPSForce *>(_LBTarget))
|
||||||
{
|
{
|
||||||
if (loc->getLastForever())
|
if (loc->getLastForever())
|
||||||
{
|
{
|
||||||
int ret = QMessageBox::warning(this, tr("NeL particle system editor"),
|
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. "
|
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..)"),
|
"Continue ? (clue : you've been warned..)"),
|
||||||
QMessageBox::Ok | QMessageBox::Cancel);
|
QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
|
|
||||||
if (ret == QMessageBox::Cancel)
|
if (ret == QMessageBox::Cancel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
_LBTarget->attachTarget(loc);
|
_LBTarget->attachTarget(loc);
|
||||||
|
|
||||||
_ui.avaibleTargetsListWidget->takeItem(_ui.avaibleTargetsListWidget->currentRow());
|
_ui.avaibleTargetsListWidget->takeItem(_ui.avaibleTargetsListWidget->currentRow());
|
||||||
_ui.targetsListWidget->addItem(item);
|
_ui.targetsListWidget->addItem(item);
|
||||||
|
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +152,7 @@ void CForcePage::removeTarget()
|
||||||
if ((totalCount == 0) || (_ui.targetsListWidget->currentRow() == -1)) return;
|
if ((totalCount == 0) || (_ui.targetsListWidget->currentRow() == -1)) return;
|
||||||
|
|
||||||
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.targetsListWidget->takeItem(_ui.targetsListWidget->currentRow()));
|
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.targetsListWidget->takeItem(_ui.targetsListWidget->currentRow()));
|
||||||
|
|
||||||
NL3D::CPSLocated *loc = item->getUserData();
|
NL3D::CPSLocated *loc = item->getUserData();
|
||||||
nlassert(loc);
|
nlassert(loc);
|
||||||
|
|
||||||
|
@ -218,14 +219,14 @@ void CForcePage::updateTargets()
|
||||||
uint nbTarg = _LBTarget->getNbTargets();
|
uint nbTarg = _LBTarget->getNbTargets();
|
||||||
|
|
||||||
_ui.targetsListWidget->clear();
|
_ui.targetsListWidget->clear();
|
||||||
|
|
||||||
std::set<NL3D::CPSLocated *> targetSet;
|
std::set<NL3D::CPSLocated *> targetSet;
|
||||||
|
|
||||||
// fill the box thta tells us what the target are
|
// fill the box thta tells us what the target are
|
||||||
for(k = 0; k < nbTarg; ++k)
|
for(k = 0; k < nbTarg; ++k)
|
||||||
{
|
{
|
||||||
CLocatedItem *item = new CLocatedItem(QString(_LBTarget->getTarget(k)->getName().c_str()),
|
CLocatedItem *item = new CLocatedItem(QString(_LBTarget->getTarget(k)->getName().c_str()),
|
||||||
_ui.targetsListWidget);
|
_ui.targetsListWidget);
|
||||||
item->setUserData(_LBTarget->getTarget(k));
|
item->setUserData(_LBTarget->getTarget(k));
|
||||||
targetSet.insert(_LBTarget->getTarget(k));
|
targetSet.insert(_LBTarget->getTarget(k));
|
||||||
};
|
};
|
||||||
|
@ -236,7 +237,7 @@ void CForcePage::updateTargets()
|
||||||
uint nbLocated = ps->getNbProcess();
|
uint nbLocated = ps->getNbProcess();
|
||||||
|
|
||||||
_ui.avaibleTargetsListWidget->clear();
|
_ui.avaibleTargetsListWidget->clear();
|
||||||
|
|
||||||
for (k = 0; k < nbLocated; ++k)
|
for (k = 0; k < nbLocated; ++k)
|
||||||
{
|
{
|
||||||
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
|
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
|
||||||
|
@ -244,8 +245,8 @@ void CForcePage::updateTargets()
|
||||||
{
|
{
|
||||||
if (targetSet.find(loc) == targetSet.end())
|
if (targetSet.find(loc) == targetSet.end())
|
||||||
{
|
{
|
||||||
CLocatedItem *item = new CLocatedItem(QString(loc->getName().c_str()),
|
CLocatedItem *item = new CLocatedItem(QString(loc->getName().c_str()),
|
||||||
_ui.avaibleTargetsListWidget);
|
_ui.avaibleTargetsListWidget);
|
||||||
item->setUserData(loc);
|
item->setUserData(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,9 @@
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CLocatedItem
|
@class CLocatedItem
|
||||||
@brief Contain pointer to CPSLocated.
|
@brief Contain pointer to CPSLocated.
|
||||||
|
@ -42,14 +43,20 @@ namespace NLQT {
|
||||||
class CLocatedItem: public QListWidgetItem
|
class CLocatedItem: public QListWidgetItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLocatedItem ( const QString & text, QListWidget * parent = 0, int type = UserType ):
|
CLocatedItem ( const QString & text, QListWidget * parent = 0, int type = UserType ):
|
||||||
QListWidgetItem(text, parent, type), _loc(NULL) {}
|
QListWidgetItem(text, parent, type), _loc(NULL) {}
|
||||||
|
|
||||||
void setUserData(NL3D::CPSLocated *loc) { _loc = loc;}
|
void setUserData(NL3D::CPSLocated *loc)
|
||||||
NL3D::CPSLocated *getUserData() const { return _loc;}
|
{
|
||||||
|
_loc = loc;
|
||||||
|
}
|
||||||
|
NL3D::CPSLocated *getUserData() const
|
||||||
|
{
|
||||||
|
return _loc;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
NL3D::CPSLocated *_loc;
|
NL3D::CPSLocated *_loc;
|
||||||
}; /* class CLocatedItem */
|
}; /* class CLocatedItem */
|
||||||
|
|
||||||
|
@ -59,8 +66,8 @@ private:
|
||||||
*/
|
*/
|
||||||
class CForcePage: public QWidget
|
class CForcePage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CForcePage(QWidget *parent = 0);
|
CForcePage(QWidget *parent = 0);
|
||||||
virtual ~CForcePage();
|
virtual ~CForcePage();
|
||||||
|
@ -71,7 +78,7 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void addTarget();
|
void addTarget();
|
||||||
void removeTarget();
|
void removeTarget();
|
||||||
|
|
||||||
void setRadialViscosity(float value);
|
void setRadialViscosity(float value);
|
||||||
void setTangentialViscosity(float value);
|
void setTangentialViscosity(float value);
|
||||||
void setDir(const NLMISC::CVector &value);
|
void setDir(const NLMISC::CVector &value);
|
||||||
|
@ -79,30 +86,45 @@ private Q_SLOTS:
|
||||||
void setFactorBrownianForce(float value);
|
void setFactorBrownianForce(float value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// wrapper to tune the intensity of a force
|
/// wrapper to tune the intensity of a force
|
||||||
struct CForceIntensityWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CForceIntensityWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSForceIntensity *F;
|
NL3D::CPSForceIntensity *F;
|
||||||
float get(void) const { return F->getIntensity(); }
|
float get(void) const
|
||||||
void set(const float &value) {F->setIntensity(value); }
|
{
|
||||||
scheme_type *getScheme(void) const { return F->getIntensityScheme(); }
|
return F->getIntensity();
|
||||||
void setScheme(scheme_type *s) {F->setIntensityScheme(s); }
|
}
|
||||||
|
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;
|
} _ForceIntensityWrapper;
|
||||||
|
|
||||||
void hideAdditionalWidget();
|
void hideAdditionalWidget();
|
||||||
|
|
||||||
void updateTargets();
|
void updateTargets();
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
// the target we're focusing on
|
// the target we're focusing on
|
||||||
NL3D::CPSTargetLocatedBindable *_LBTarget;
|
NL3D::CPSTargetLocatedBindable *_LBTarget;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
Ui::CForcePage _ui;
|
Ui::CForcePage _ui;
|
||||||
|
|
||||||
}; /* class CForcePage */
|
}; /* class CForcePage */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CLightPage::CLightPage(QWidget *parent)
|
CLightPage::CLightPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ void CLightPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab
|
||||||
{
|
{
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_Light = static_cast<NL3D::CPSLight *>(locatedBindable);
|
_Light = static_cast<NL3D::CPSLight *>(locatedBindable);
|
||||||
|
|
||||||
_ColorWrapper.L = _Light;
|
_ColorWrapper.L = _Light;
|
||||||
_ui.lightColorWidget->setWorkspaceNode(_Node);
|
_ui.lightColorWidget->setWorkspaceNode(_Node);
|
||||||
_ui.lightColorWidget->updateUi();
|
_ui.lightColorWidget->updateUi();
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CLightPage
|
@class CLightPage
|
||||||
|
@ -40,15 +41,15 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CLightPage: public QWidget
|
class CLightPage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLightPage(QWidget *parent = 0);
|
CLightPage(QWidget *parent = 0);
|
||||||
~CLightPage();
|
~CLightPage();
|
||||||
|
|
||||||
/// Set the light to edit.
|
/// Set the light to edit.
|
||||||
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable);
|
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -56,36 +57,72 @@ private:
|
||||||
struct CColorWrapper : public IPSWrapperRGBA, IPSSchemeWrapperRGBA
|
struct CColorWrapper : public IPSWrapperRGBA, IPSSchemeWrapperRGBA
|
||||||
{
|
{
|
||||||
NL3D::CPSLight *L;
|
NL3D::CPSLight *L;
|
||||||
NLMISC::CRGBA get(void) const { return L->getColor(); }
|
NLMISC::CRGBA get(void) const
|
||||||
void set(const NLMISC::CRGBA &v) { L->setColor(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return L->getColorScheme(); }
|
return L->getColor();
|
||||||
void setScheme(scheme_type *s) { L->setColorScheme(s); }
|
}
|
||||||
|
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;
|
} _ColorWrapper;
|
||||||
|
|
||||||
/// wrapper to set start atten radius
|
/// wrapper to set start atten radius
|
||||||
struct CAttenStartWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CAttenStartWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSLight *L;
|
NL3D::CPSLight *L;
|
||||||
float get(void) const { return L->getAttenStart(); }
|
float get(void) const
|
||||||
void set(const float &v) { L->setAttenStart(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return L->getAttenStartScheme(); }
|
return L->getAttenStart();
|
||||||
void setScheme(scheme_type *s) { L->setAttenStartScheme(s); }
|
}
|
||||||
|
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;
|
} _AttenStartWrapper;
|
||||||
|
|
||||||
/// wrapper to set end atten radius
|
/// wrapper to set end atten radius
|
||||||
struct CAttenEndWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CAttenEndWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSLight *L;
|
NL3D::CPSLight *L;
|
||||||
float get(void) const { return L->getAttenEnd(); }
|
float get(void) const
|
||||||
void set(const float &v) { L->setAttenEnd(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return L->getAttenEndScheme(); }
|
return L->getAttenEnd();
|
||||||
void setScheme(scheme_type *s) { L->setAttenEndScheme(s); }
|
}
|
||||||
|
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;
|
} _AttenEndWrapper;
|
||||||
|
|
||||||
NL3D::CPSLight *_Light;
|
NL3D::CPSLight *_Light;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
Ui::CLightPage _ui;
|
Ui::CLightPage _ui;
|
||||||
}; /* class CLightPage */
|
}; /* class CLightPage */
|
||||||
|
|
||||||
|
|
|
@ -27,17 +27,18 @@
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CParticleLinkDialog::CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent)
|
CParticleLinkDialog::CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
qobject_cast< QMainWindow* >(parent)->addDockWidget(Qt::RightDockWidgetArea, this);
|
qobject_cast< QMainWindow* >(parent)->addDockWidget(Qt::RightDockWidgetArea, this);
|
||||||
|
|
||||||
_ui.treeView->setModel(model);
|
_ui.treeView->setModel(model);
|
||||||
|
|
||||||
connect(model, SIGNAL(modelReset()), this, SLOT(resetModel()));
|
connect(model, SIGNAL(modelReset()), this, SLOT(resetModel()));
|
||||||
connect(_ui.linkPushButton, SIGNAL(clicked()), this, SLOT(setLink()));
|
connect(_ui.linkPushButton, SIGNAL(clicked()), this, SLOT(setLink()));
|
||||||
connect(_ui.unlinkPushButton, SIGNAL(clicked()), this, SLOT(setUnlink()));
|
connect(_ui.unlinkPushButton, SIGNAL(clicked()), this, SLOT(setUnlink()));
|
||||||
|
@ -51,11 +52,11 @@ CParticleLinkDialog::~CParticleLinkDialog()
|
||||||
void CParticleLinkDialog::setLink()
|
void CParticleLinkDialog::setLink()
|
||||||
{
|
{
|
||||||
CWorkspaceNode *node = Modules::psEdit().getActiveNode();
|
CWorkspaceNode *node = Modules::psEdit().getActiveNode();
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string curObj = Modules::objView().getCurrentObject();
|
std::string curObj = Modules::objView().getCurrentObject();
|
||||||
if (curObj.empty())
|
if (curObj.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem*>(_ui.treeView->currentIndex().internalPointer());
|
CSkeletonTreeItem *item = static_cast<CSkeletonTreeItem*>(_ui.treeView->currentIndex().internalPointer());
|
||||||
|
@ -71,7 +72,7 @@ void CParticleLinkDialog::setLink()
|
||||||
void CParticleLinkDialog::setUnlink()
|
void CParticleLinkDialog::setUnlink()
|
||||||
{
|
{
|
||||||
CWorkspaceNode *node = Modules::psEdit().getActiveNode();
|
CWorkspaceNode *node = Modules::psEdit().getActiveNode();
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
node->unstickPSFromSkeleton();
|
node->unstickPSFromSkeleton();
|
||||||
|
|
|
@ -29,16 +29,17 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "skeleton_tree_model.h"
|
#include "skeleton_tree_model.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CParticleLinkDialog: public QDockWidget
|
class CParticleLinkDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent = 0);
|
CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent = 0);
|
||||||
~CParticleLinkDialog();
|
~CParticleLinkDialog();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setLink();
|
void setLink();
|
||||||
void setUnlink();
|
void setUnlink();
|
||||||
|
@ -46,9 +47,9 @@ private Q_SLOTS:
|
||||||
void clickedItem(const QModelIndex & index);
|
void clickedItem(const QModelIndex & index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::CParticleLinkDialog _ui;
|
Ui::CParticleLinkDialog _ui;
|
||||||
|
|
||||||
}; /* class CParticleLinkDialog */
|
}; /* class CParticleLinkDialog */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CWorkspaceNode::CWorkspaceNode()
|
CWorkspaceNode::CWorkspaceNode()
|
||||||
{
|
{
|
||||||
|
@ -72,9 +73,9 @@ bool CWorkspaceNode::isStateMemorized() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel,
|
void CWorkspaceNode::stickPSToSkeleton(NL3D::CSkeletonModel *skel,
|
||||||
uint bone,
|
uint bone,
|
||||||
const std::string &parentSkelName,
|
const std::string &parentSkelName,
|
||||||
const std::string &parentBoneName)
|
const std::string &parentBoneName)
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
if (!_PSM) return;
|
if (!_PSM) return;
|
||||||
|
@ -103,20 +104,20 @@ void CWorkspaceNode::unstickPSFromSkeleton()
|
||||||
{
|
{
|
||||||
_ParentSkel->detachSkeletonSon(_PSM);
|
_ParentSkel->detachSkeletonSon(_PSM);
|
||||||
_ParentSkel = NULL;
|
_ParentSkel = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::removeLocated(NL3D::CPSLocated *loc)
|
void CWorkspaceNode::removeLocated(NL3D::CPSLocated *loc)
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
if (_InitialPos.isStateMemorized())
|
if (_InitialPos.isStateMemorized())
|
||||||
{
|
{
|
||||||
_InitialPos.removeLocated(loc);
|
_InitialPos.removeLocated(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::removeLocatedBindable(NL3D::CPSLocatedBindable *lb)
|
void CWorkspaceNode::removeLocatedBindable(NL3D::CPSLocatedBindable *lb)
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
if (_InitialPos.isStateMemorized())
|
if (_InitialPos.isStateMemorized())
|
||||||
{
|
{
|
||||||
|
@ -160,7 +161,7 @@ void CWorkspaceNode::setup(NL3D::CParticleSystemModel &psm)
|
||||||
psm.bypassGlobalUserParamValue(k);
|
psm.bypassGlobalUserParamValue(k);
|
||||||
}
|
}
|
||||||
psm.enableAutoGetEllapsedTime(false);
|
psm.enableAutoGetEllapsedTime(false);
|
||||||
psm.setEllapsedTime(0.f); // system is paused
|
psm.setEllapsedTime(0.f); // system is paused
|
||||||
// initialy, the ps is hidden
|
// initialy, the ps is hidden
|
||||||
psm.hide();
|
psm.hide();
|
||||||
// link to the root for manipulation
|
// link to the root for manipulation
|
||||||
|
@ -172,7 +173,7 @@ void CWorkspaceNode::setup(NL3D::CParticleSystemModel &psm)
|
||||||
ps->setFontGenerator(Modules::psEdit().getFontGenerator());
|
ps->setFontGenerator(Modules::psEdit().getFontGenerator());
|
||||||
ps->stopSound();
|
ps->stopSound();
|
||||||
// flush textures
|
// flush textures
|
||||||
psm.Shape->flushTextures(*Modules::psEdit().getDriver(), 0);
|
psm.Shape->flushTextures(*Modules::psEdit().getDriver(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::setTriggerAnim(const std::string &anim)
|
void CWorkspaceNode::setTriggerAnim(const std::string &anim)
|
||||||
|
@ -184,7 +185,7 @@ void CWorkspaceNode::setTriggerAnim(const std::string &anim)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::createEmptyPS()
|
void CWorkspaceNode::createEmptyPS()
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
NL3D::CParticleSystem emptyPS;
|
NL3D::CParticleSystem emptyPS;
|
||||||
NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape;
|
NL3D::CParticleSystemShape *pss = new NL3D::CParticleSystemShape;
|
||||||
|
@ -207,7 +208,7 @@ void CWorkspaceNode::createEmptyPS()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::init(CParticleWorkspace *ws)
|
void CWorkspaceNode::init(CParticleWorkspace *ws)
|
||||||
{
|
{
|
||||||
nlassert(ws);
|
nlassert(ws);
|
||||||
_WS = ws;
|
_WS = ws;
|
||||||
}
|
}
|
||||||
|
@ -219,20 +220,20 @@ void CWorkspaceNode::setRelativePath(const std::string &relativePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspaceNode::serial(NLMISC::IStream &f)
|
void CWorkspaceNode::serial(NLMISC::IStream &f)
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
f.xmlPush("PROJECT_FILE");
|
f.xmlPush("PROJECT_FILE");
|
||||||
sint version = f.serialVersion(2);
|
sint version = f.serialVersion(2);
|
||||||
f.xmlSerial(_RelativePath, "RELATIVE_PATH");
|
f.xmlSerial(_RelativePath, "RELATIVE_PATH");
|
||||||
if (version >= 1)
|
if (version >= 1)
|
||||||
{
|
{
|
||||||
f.xmlSerial(_TriggerAnim, "TRIGGER_ANIMATION");
|
f.xmlSerial(_TriggerAnim, "TRIGGER_ANIMATION");
|
||||||
}
|
}
|
||||||
if (version >= 2)
|
if (version >= 2)
|
||||||
{
|
{
|
||||||
f.xmlSerial(_ParentSkelName, "PARENT_SKEL_NAME");
|
f.xmlSerial(_ParentSkelName, "PARENT_SKEL_NAME");
|
||||||
f.xmlSerial(_ParentBoneName, "PARENT_BONE_NAME");
|
f.xmlSerial(_ParentBoneName, "PARENT_BONE_NAME");
|
||||||
}
|
}
|
||||||
f.xmlPop();
|
f.xmlPop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +261,7 @@ std::string CWorkspaceNode::getFullPath() const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWorkspaceNode::loadPS() throw(NLMISC::EStream)
|
bool CWorkspaceNode::loadPS() throw(NLMISC::EStream)
|
||||||
{
|
{
|
||||||
nlassert(_WS);
|
nlassert(_WS);
|
||||||
// manually load the PS shape (so that we can deal with exceptions)
|
// manually load the PS shape (so that we can deal with exceptions)
|
||||||
NL3D::CShapeStream ss;
|
NL3D::CShapeStream ss;
|
||||||
|
@ -294,7 +295,7 @@ bool CWorkspaceNode::loadPS() throw(NLMISC::EStream)
|
||||||
_PSM = psm;
|
_PSM = psm;
|
||||||
_ShapeBank = sb.release();
|
_ShapeBank = sb.release();
|
||||||
_Modified = false;
|
_Modified = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,7 +314,7 @@ CParticleWorkspace::~CParticleWorkspace()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleWorkspace::init(const std::string &filename)
|
void CParticleWorkspace::init(const std::string &filename)
|
||||||
{
|
{
|
||||||
_Filename = filename;
|
_Filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,24 +330,24 @@ void CParticleWorkspace::setFileName(const std::string &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CParticleWorkspace::getFilename() const
|
std::string CParticleWorkspace::getFilename() const
|
||||||
{
|
{
|
||||||
return CFile::getFilename(_Filename);
|
return CFile::getFilename(_Filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception)
|
CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception)
|
||||||
{
|
{
|
||||||
// Check that file is not already inserted
|
// Check that file is not already inserted
|
||||||
std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath);
|
std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath);
|
||||||
for(uint k = 0; k < _Nodes.size(); ++k)
|
for(uint k = 0; k < _Nodes.size(); ++k)
|
||||||
{
|
{
|
||||||
if (NLMISC::nlstricmp(_Nodes[k]->getFilename(), fileName) == 0) return NULL;
|
if (NLMISC::nlstricmp(_Nodes[k]->getFilename(), fileName) == 0) return NULL;
|
||||||
}
|
}
|
||||||
// char resultPath[MAX_PATH];
|
// char resultPath[MAX_PATH];
|
||||||
// std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
|
// std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
|
||||||
std::string relativePath;
|
std::string relativePath;
|
||||||
// if (!PathRelativePathTo(resultPath, dosPath.c_str(), FILE_ATTRIBUTE_DIRECTORY, filenameWithFullPath.c_str(), 0))
|
// if (!PathRelativePathTo(resultPath, dosPath.c_str(), FILE_ATTRIBUTE_DIRECTORY, filenameWithFullPath.c_str(), 0))
|
||||||
// {
|
// {
|
||||||
relativePath = filenameWithFullPath;
|
relativePath = filenameWithFullPath;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
@ -418,7 +419,7 @@ void CParticleWorkspace::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
||||||
_Nodes.push_back(new CWorkspaceNode());
|
_Nodes.push_back(new CWorkspaceNode());
|
||||||
_Nodes.back()->init(this);
|
_Nodes.back()->init(this);
|
||||||
f.serial(*_Nodes.back());
|
f.serial(*_Nodes.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -492,32 +493,32 @@ bool CParticleWorkspace::isContentModified() const
|
||||||
|
|
||||||
void CParticleWorkspace::restickAllObjects()
|
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();
|
|
||||||
//
|
|
||||||
_Nodes[k]->unstickPSFromSkeleton();
|
|
||||||
if (!parentSkelName.empty())
|
|
||||||
// find instance to stick to in the scene
|
|
||||||
for(uint l = 0; l < ov->getNumInstance(); ++l)
|
|
||||||
{
|
{
|
||||||
CInstanceInfo *ii = ov->getInstance(l);
|
std::string parentSkelName = _Nodes[k]->getParentSkelName();
|
||||||
if (ii->TransformShape && ii->Saved.ShapeFilename == parentSkelName)
|
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);
|
CInstanceInfo *ii = ov->getInstance(l);
|
||||||
if (skel)
|
if (ii->TransformShape && ii->Saved.ShapeFilename == parentSkelName)
|
||||||
{
|
{
|
||||||
sint boneID = skel->getBoneIdByName(parentBoneName);
|
NL3D::CSkeletonModel *skel = dynamic_cast<NL3D::CSkeletonModel *>(ii->TransformShape);
|
||||||
if (boneID != -1)
|
if (skel)
|
||||||
{
|
{
|
||||||
_Nodes[k]->stickPSToSkeleton(skel, (uint) boneID, parentSkelName, parentBoneName);
|
sint boneID = skel->getBoneIdByName(parentBoneName);
|
||||||
break;
|
if (boneID != -1)
|
||||||
|
{
|
||||||
|
_Nodes[k]->stickPSToSkeleton(skel, (uint) boneID, parentSkelName, parentBoneName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
|
@ -32,14 +32,16 @@
|
||||||
#include "ps_initial_pos.h"
|
#include "ps_initial_pos.h"
|
||||||
|
|
||||||
|
|
||||||
namespace NL3D {
|
namespace NL3D
|
||||||
class CParticleSystem;
|
{
|
||||||
class CParticleSystemModel;
|
class CParticleSystem;
|
||||||
class CShapeBank;
|
class CParticleSystemModel;
|
||||||
|
class CShapeBank;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CParticleWorkspace;
|
class CParticleWorkspace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,93 +55,126 @@ class CParticleWorkspace;
|
||||||
- Loading and saving the existing system of particles.
|
- Loading and saving the existing system of particles.
|
||||||
- Linking / unlinking of the system of particles to any bone of the skeleton model.
|
- Linking / unlinking of the system of particles to any bone of the skeleton model.
|
||||||
- Operations with the name and directory location of the particles system file.
|
- Operations with the name and directory location of the particles system file.
|
||||||
- Has a flag indicating if the particles system changed or not (intended for the editor)
|
- Has a flag indicating if the particles system changed or not (intended for the editor)
|
||||||
*/
|
*/
|
||||||
class CWorkspaceNode : public NLMISC::CRefCount
|
class CWorkspaceNode : public NLMISC::CRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(CParticleWorkspace *ws);
|
void init(CParticleWorkspace *ws);
|
||||||
|
|
||||||
void setRelativePath(const std::string &relativePath);
|
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 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
|
/// 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);
|
void serial(NLMISC::IStream &f);
|
||||||
|
|
||||||
/// Save the particle system target file
|
/// Save the particle system target file
|
||||||
void savePS() throw(NLMISC::EStream);
|
void savePS() throw(NLMISC::EStream);
|
||||||
|
|
||||||
/// Save particle system with an arbitrary filename
|
/// Save particle system with an arbitrary filename
|
||||||
void savePSAs(const std::string &fullPath) throw(NLMISC::EStream);
|
void savePSAs(const std::string &fullPath) throw(NLMISC::EStream);
|
||||||
|
|
||||||
/// put back in the unloaded state
|
/// put back in the unloaded state
|
||||||
void unload();
|
void unload();
|
||||||
|
|
||||||
/// Load the particle system target file
|
/// Load the particle system target file
|
||||||
/// @return true if loading succeed (false means that loading was ok, but this is not a particle system). Other cases throw an exception.
|
/// @return true if loading succeed (false means that loading was ok, but this is not a particle system). Other cases throw an exception.
|
||||||
bool loadPS() throw(NLMISC::EStream);
|
bool loadPS() throw(NLMISC::EStream);
|
||||||
|
|
||||||
/// Create an empty particle system
|
/// Create an empty particle system
|
||||||
void createEmptyPS();
|
void createEmptyPS();
|
||||||
|
|
||||||
/// Helper flag to know if a ps has been modified
|
/// Helper flag to know if a ps has been modified
|
||||||
/// @{
|
/// @{
|
||||||
bool isModified() const { return _Modified; }
|
bool isModified() const
|
||||||
|
{
|
||||||
|
return _Modified;
|
||||||
|
}
|
||||||
void setModified(bool modified);
|
void setModified(bool modified);
|
||||||
/// @}
|
/// @}
|
||||||
NL3D::CParticleSystem *getPSPointer() const { return _PS; }
|
NL3D::CParticleSystem *getPSPointer() const
|
||||||
NL3D::CParticleSystemModel *getPSModel() const { return _PSM; }
|
{
|
||||||
|
return _PS;
|
||||||
|
}
|
||||||
|
NL3D::CParticleSystemModel *getPSModel() const
|
||||||
|
{
|
||||||
|
return _PSM;
|
||||||
|
}
|
||||||
|
|
||||||
/// See if this node ps has been loaded
|
/// 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
|
/// 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
|
/// Memorize current position of object in the system. Useful to play the system because instances can be created / deleted
|
||||||
void memorizeState();
|
void memorizeState();
|
||||||
|
|
||||||
/// Restore state previously memorize. Is usually called when the user stops a particle system
|
/// Restore state previously memorize. Is usually called when the user stops a particle system
|
||||||
void restoreState();
|
void restoreState();
|
||||||
|
|
||||||
/// Test if state is currenlty memorized
|
/// Test if state is currenlty memorized
|
||||||
bool isStateMemorized() const;
|
bool isStateMemorized() const;
|
||||||
|
|
||||||
/// For edition : If the state of the system has been memorized, keep it on par with the system when it is modified
|
/// For edition : If the state of the system has been memorized, keep it on par with the system when it is modified
|
||||||
void removeLocated(NL3D::CPSLocated *loc);
|
void removeLocated(NL3D::CPSLocated *loc);
|
||||||
|
|
||||||
/// For edition : If the state of the system has been memorized, keep it on par with the system when it is modified
|
/// For edition : If the state of the system has been memorized, keep it on par with the system when it is modified
|
||||||
void removeLocatedBindable(NL3D::CPSLocatedBindable *lb);
|
void removeLocatedBindable(NL3D::CPSLocatedBindable *lb);
|
||||||
|
|
||||||
/// Returns the skeleton to which the ps is currently sticked
|
/// Returns the skeleton to which the ps is currently sticked
|
||||||
NL3D::CSkeletonModel *getParentSkel() const { return _ParentSkel; }
|
NL3D::CSkeletonModel *getParentSkel() const
|
||||||
|
{
|
||||||
const std::string &getParentSkelName() const { return _ParentSkelName; }
|
return _ParentSkel;
|
||||||
|
}
|
||||||
const std::string &getParentBoneName() const { return _ParentBoneName; }
|
|
||||||
|
const std::string &getParentSkelName() const
|
||||||
std::string getTriggerAnim() { return _TriggerAnim; }
|
{
|
||||||
|
return _ParentSkelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string &getParentBoneName() const
|
||||||
|
{
|
||||||
|
return _ParentBoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getTriggerAnim()
|
||||||
|
{
|
||||||
|
return _TriggerAnim;
|
||||||
|
}
|
||||||
|
|
||||||
void setTriggerAnim(const std::string &anim);
|
void setTriggerAnim(const std::string &anim);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _TriggerAnim;
|
std::string _TriggerAnim;
|
||||||
NL3D::CParticleSystem *_PS;
|
NL3D::CParticleSystem *_PS;
|
||||||
NL3D::CParticleSystemModel *_PSM;
|
NL3D::CParticleSystemModel *_PSM;
|
||||||
|
|
||||||
// Keep a shape bank per node because we want the whole path to identify the ps, not just its filename
|
// Keep a shape bank per node because we want the whole path to identify the ps, not just its filename
|
||||||
// (shape bank keeps the filename only)
|
// (shape bank keeps the filename only)
|
||||||
NL3D::CShapeBank *_ShapeBank;
|
NL3D::CShapeBank *_ShapeBank;
|
||||||
|
|
||||||
// Relative path from which the ps was inserted
|
// Relative path from which the ps was inserted
|
||||||
// relative path is also a unique identifier for this ps in the workspace
|
// relative path is also a unique identifier for this ps in the workspace
|
||||||
std::string _RelativePath;
|
std::string _RelativePath;
|
||||||
|
|
||||||
// initial pos of system. Allow to restore the initial instances of the system when doing start / stop
|
// initial pos of system. Allow to restore the initial instances of the system when doing start / stop
|
||||||
CPSInitialPos _InitialPos;
|
CPSInitialPos _InitialPos;
|
||||||
bool _Modified;
|
bool _Modified;
|
||||||
|
@ -152,14 +187,20 @@ private:
|
||||||
private:
|
private:
|
||||||
void setup(NL3D::CParticleSystemModel &psm);
|
void setup(NL3D::CParticleSystemModel &psm);
|
||||||
public:
|
public:
|
||||||
bool getResetAutoCountFlag() const { return _ResetAutoCount; }
|
bool getResetAutoCountFlag() const
|
||||||
void setResetAutoCountFlag(bool reset) { _ResetAutoCount = reset; }
|
{
|
||||||
|
return _ResetAutoCount;
|
||||||
|
}
|
||||||
|
void setResetAutoCountFlag(bool reset)
|
||||||
|
{
|
||||||
|
_ResetAutoCount = reset;
|
||||||
|
}
|
||||||
|
|
||||||
/// Stick to a skeleton
|
/// Stick to a skeleton
|
||||||
void stickPSToSkeleton(NL3D::CSkeletonModel *skel,
|
void stickPSToSkeleton(NL3D::CSkeletonModel *skel,
|
||||||
uint bone,
|
uint bone,
|
||||||
const std::string &parentSkelName, // for callback after loading
|
const std::string &parentSkelName, // for callback after loading
|
||||||
const std::string &parentBoneName
|
const std::string &parentBoneName
|
||||||
);
|
);
|
||||||
void unstickPSFromSkeleton();
|
void unstickPSFromSkeleton();
|
||||||
private:
|
private:
|
||||||
|
@ -174,7 +215,7 @@ public:
|
||||||
typedef std::vector<NLMISC::CRefPtr<CWorkspaceNode> > TNodeVect;
|
typedef std::vector<NLMISC::CRefPtr<CWorkspaceNode> > TNodeVect;
|
||||||
typedef TNodeVect::iterator TPWNodeItr;
|
typedef TNodeVect::iterator TPWNodeItr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CParticleWorkspace
|
@class CParticleWorkspace
|
||||||
@author Nicolas Vizerie
|
@author Nicolas Vizerie
|
||||||
@author Nevrax France
|
@author Nevrax France
|
||||||
|
@ -182,11 +223,11 @@ typedef TNodeVect::iterator TPWNodeItr;
|
||||||
@brief A container containing all the loaded particle system.
|
@brief A container containing all the loaded particle system.
|
||||||
@details Allows you to load \ save in xml file list of systems of particles (the path to each file as well)
|
@details Allows you to load \ save in xml file list of systems of particles (the path to each file as well)
|
||||||
and additional parameters (skeleton model, and to which bone it is attached)
|
and additional parameters (skeleton model, and to which bone it is attached)
|
||||||
There is a feedback mechanism showed changes are being made with the container,with a particle system or connection to the skeleton.
|
There is a feedback mechanism showed changes are being made with the container,with a particle system or connection to the skeleton.
|
||||||
*/
|
*/
|
||||||
class CParticleWorkspace
|
class CParticleWorkspace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// callback to know when a workspace node has been modified
|
/// callback to know when a workspace node has been modified
|
||||||
struct IModificationCallback
|
struct IModificationCallback
|
||||||
{
|
{
|
||||||
|
@ -200,88 +241,115 @@ public:
|
||||||
~CParticleWorkspace();
|
~CParticleWorkspace();
|
||||||
|
|
||||||
/// Init the workspace for the given object viewer
|
/// Init the workspace for the given object viewer
|
||||||
/// must be called prior to other methods
|
/// must be called prior to other methods
|
||||||
void init(const std::string &filename);
|
void init(const std::string &filename);
|
||||||
|
|
||||||
/// Set a new name for the workspace (not its filename)
|
/// Set a new name for the workspace (not its filename)
|
||||||
void setName(const std::string &name);
|
void setName(const std::string &name);
|
||||||
|
|
||||||
/// Set a new file name for the workspace
|
/// Set a new file name for the workspace
|
||||||
void setFileName(const std::string &fileName);
|
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
|
/// Get the path in which workpsace is located with a trailing slash
|
||||||
std::string getPath() const;
|
std::string getPath() const;
|
||||||
std::string getFilename() const;
|
std::string getFilename() const;
|
||||||
|
|
||||||
/// Get Number of nodes in the workspace
|
/// 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
|
/// Get a node in workspace
|
||||||
/// Can keep pointer safely as long as the node is not deleted
|
/// 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
|
/// Get a node from a pointer on a particle system
|
||||||
CWorkspaceNode *getNodeFromPS(NL3D::CParticleSystem *ps) const;
|
CWorkspaceNode *getNodeFromPS(NL3D::CParticleSystem *ps) const;
|
||||||
|
|
||||||
/// Test if the workspace already contains a node with the given filename name
|
/// Test if the workspace already contains a node with the given filename name
|
||||||
/// NB : 2 node with the same name re not allowed, even if their path is different
|
/// NB : 2 node with the same name re not allowed, even if their path is different
|
||||||
bool containsFile(std::string filename) const;
|
bool containsFile(std::string filename) const;
|
||||||
|
|
||||||
/// Add a node in the workspace. Will succeed only if fx filename does not already exist in the workspace.
|
/// Add a node in the workspace. Will succeed only if fx filename does not already exist in the workspace.
|
||||||
/// The node is in the 'unloaded' state, so caller must load it afterward.
|
/// The node is in the 'unloaded' state, so caller must load it afterward.
|
||||||
/// NB : no lookup is done, full path must be provided.
|
/// NB : no lookup is done, full path must be provided.
|
||||||
/// @return pointer to new node, or NULL if already inserted
|
/// @return pointer to new node, or NULL if already inserted
|
||||||
CWorkspaceNode *addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception);
|
CWorkspaceNode *addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception);
|
||||||
|
|
||||||
/// Remove a node by it's index
|
/// Remove a node by it's index
|
||||||
void removeNode(uint index);
|
void removeNode(uint index);
|
||||||
|
|
||||||
/// Remove a node by it's pointer
|
/// Remove a node by it's pointer
|
||||||
void removeNode(CWorkspaceNode *ptr);
|
void removeNode(CWorkspaceNode *ptr);
|
||||||
|
|
||||||
/// Get index of a node from its pointer, or -1 if not found
|
/// Get index of a node from its pointer, or -1 if not found
|
||||||
sint getIndexFromNode(CWorkspaceNode *node) const;
|
sint getIndexFromNode(CWorkspaceNode *node) const;
|
||||||
|
|
||||||
/// Save the workspace structure. The target file is the one given when this object was created
|
/// Save the workspace structure. The target file is the one given when this object was created
|
||||||
/// NB : ps shape are not saved, only the structure is. To save the shapes, call CNode::save()
|
/// NB : ps shape are not saved, only the structure is. To save the shapes, call CNode::save()
|
||||||
void save() throw(NLMISC::EStream);
|
void save() throw(NLMISC::EStream);
|
||||||
|
|
||||||
/// Load the workspace structure. The target file is the one given when this object was created
|
/// Load the workspace structure. The target file is the one given when this object was created
|
||||||
/// All nodes are in the 'unloaded" state, so it is to the caller to load them by calling load() on their node
|
/// All nodes are in the 'unloaded" state, so it is to the caller to load them by calling load() on their node
|
||||||
void load() throw(NLMISC::EStream);
|
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)
|
/// 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
|
/// Test whether the content of the workspace has ben modified
|
||||||
bool isContentModified() const;
|
bool isContentModified() const;
|
||||||
void touch() { setModifiedFlag(true); }
|
void touch()
|
||||||
void clearModifiedFlag() { setModifiedFlag(false); }
|
{
|
||||||
|
setModifiedFlag(true);
|
||||||
|
}
|
||||||
|
void clearModifiedFlag()
|
||||||
|
{
|
||||||
|
setModifiedFlag(false);
|
||||||
|
}
|
||||||
|
|
||||||
/// Set a callback to know when a node is modified
|
/// Set a callback to know when a node is modified
|
||||||
void setModificationCallback(IModificationCallback *cb) { _ModificationCallback = cb; }
|
void setModificationCallback(IModificationCallback *cb)
|
||||||
IModificationCallback *getModificationCallback() const { return _ModificationCallback; }
|
{
|
||||||
|
_ModificationCallback = cb;
|
||||||
|
}
|
||||||
|
IModificationCallback *getModificationCallback() const
|
||||||
|
{
|
||||||
|
return _ModificationCallback;
|
||||||
|
}
|
||||||
|
|
||||||
/// Restick all objects, useful after loading
|
/// Restick all objects, useful after loading
|
||||||
void restickAllObjects();
|
void restickAllObjects();
|
||||||
|
|
||||||
TNodeVect& getNodeList() { return _Nodes; }
|
TNodeVect& getNodeList()
|
||||||
|
{
|
||||||
|
return _Nodes;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// use smart ptr to avoir prb wih resize
|
// use smart ptr to avoir prb wih resize
|
||||||
TNodeVect _Nodes;
|
TNodeVect _Nodes;
|
||||||
// path + name of workspace
|
// path + name of workspace
|
||||||
std::string _Filename;
|
std::string _Filename;
|
||||||
bool _Modified;
|
bool _Modified;
|
||||||
IModificationCallback *_ModificationCallback;
|
IModificationCallback *_ModificationCallback;
|
||||||
// workspace user name
|
// workspace user name
|
||||||
std::string _Name;
|
std::string _Name;
|
||||||
|
|
||||||
/// serial the object
|
/// serial the object
|
||||||
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
|
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
|
||||||
|
|
||||||
/// set the 'modified flag' and call the callback
|
/// set the 'modified flag' and call the callback
|
||||||
void setModifiedFlag(bool modified);
|
void setModifiedFlag(bool modified);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CPropertyDialog::CPropertyDialog(CParticleTreeModel *treeModel, QWidget *parent)
|
CPropertyDialog::CPropertyDialog(CParticleTreeModel *treeModel, QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
|
@ -41,19 +42,19 @@ CPropertyDialog::~CPropertyDialog()
|
||||||
void CPropertyDialog::setupUi()
|
void CPropertyDialog::setupUi()
|
||||||
{
|
{
|
||||||
setObjectName(QString::fromUtf8("CPropertyDialog"));
|
setObjectName(QString::fromUtf8("CPropertyDialog"));
|
||||||
|
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
icon.addFile(QString::fromUtf8(":/images/pqrticles.png"), QSize(), QIcon::Normal, QIcon::Off);
|
icon.addFile(QString::fromUtf8(":/images/pqrticles.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||||
setWindowIcon(icon);
|
setWindowIcon(icon);
|
||||||
|
|
||||||
_dockWidgetContents = new QWidget();
|
_dockWidgetContents = new QWidget();
|
||||||
_gridLayout = new QGridLayout(_dockWidgetContents);
|
_gridLayout = new QGridLayout(_dockWidgetContents);
|
||||||
_scrollArea = new QScrollArea(_dockWidgetContents);
|
_scrollArea = new QScrollArea(_dockWidgetContents);
|
||||||
_scrollArea->setWidgetResizable(true);
|
_scrollArea->setWidgetResizable(true);
|
||||||
_scrollAreaWidgetContents = new QWidget();
|
_scrollAreaWidgetContents = new QWidget();
|
||||||
|
|
||||||
_pagesGridLayout = new QGridLayout(_scrollAreaWidgetContents);
|
_pagesGridLayout = new QGridLayout(_scrollAreaWidgetContents);
|
||||||
|
|
||||||
_stackedWidget = new QStackedWidget(_scrollAreaWidgetContents);
|
_stackedWidget = new QStackedWidget(_scrollAreaWidgetContents);
|
||||||
|
|
||||||
_wpPage = new CWorkspacePage(_treeModel);
|
_wpPage = new CWorkspacePage(_treeModel);
|
||||||
|
@ -76,15 +77,15 @@ void CPropertyDialog::setupUi()
|
||||||
_stackedWidget->addWidget(_emitterPage);
|
_stackedWidget->addWidget(_emitterPage);
|
||||||
_psMoverPage = new CPSMoverPage(_stackedWidget);
|
_psMoverPage = new CPSMoverPage(_stackedWidget);
|
||||||
_stackedWidget->addWidget(_psMoverPage);
|
_stackedWidget->addWidget(_psMoverPage);
|
||||||
|
|
||||||
_pagesGridLayout->addWidget(_stackedWidget, 0, 0, 1, 1);
|
_pagesGridLayout->addWidget(_stackedWidget, 0, 0, 1, 1);
|
||||||
|
|
||||||
_scrollArea->setWidget(_scrollAreaWidgetContents);
|
_scrollArea->setWidget(_scrollAreaWidgetContents);
|
||||||
|
|
||||||
_gridLayout->addWidget(_scrollArea, 0, 0, 1, 1);
|
_gridLayout->addWidget(_scrollArea, 0, 0, 1, 1);
|
||||||
|
|
||||||
setWidget(_dockWidgetContents);
|
setWidget(_dockWidgetContents);
|
||||||
setWindowTitle(tr("Property editor"));
|
setWindowTitle(tr("Property editor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropertyDialog::setCurrentEditedElement(CParticleTreeItem *editedItem)
|
void CPropertyDialog::setCurrentEditedElement(CParticleTreeItem *editedItem)
|
||||||
|
@ -127,9 +128,9 @@ void CPropertyDialog::setCurrentEditedElement(CParticleTreeItem *editedItem)
|
||||||
case ItemType::LocatedInstance:
|
case ItemType::LocatedInstance:
|
||||||
_psMoverPage->setEditedItem(_treeModel->getOwnerNode(editedItem) ,editedItem->getLoc(), editedItem->getLocatedInstanceIndex());
|
_psMoverPage->setEditedItem(_treeModel->getOwnerNode(editedItem) ,editedItem->getLoc(), editedItem->getLocatedInstanceIndex());
|
||||||
_stackedWidget->setCurrentWidget(_psMoverPage);
|
_stackedWidget->setCurrentWidget(_psMoverPage);
|
||||||
_treeModel->getOwnerNode(editedItem)->getPSPointer()->setCurrentEditedElement(editedItem->getLoc(),
|
_treeModel->getOwnerNode(editedItem)->getPSPointer()->setCurrentEditedElement(editedItem->getLoc(),
|
||||||
editedItem->getLocatedInstanceIndex(),
|
editedItem->getLocatedInstanceIndex(),
|
||||||
_psMoverPage->getLocatedBindable());
|
_psMoverPage->getLocatedBindable());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_stackedWidget->setCurrentWidget(_wpPage);
|
_stackedWidget->setCurrentWidget(_wpPage);
|
||||||
|
|
|
@ -44,7 +44,8 @@
|
||||||
#include "particle_tree_model.h"
|
#include "particle_tree_model.h"
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CPropertyDialog: public QDockWidget
|
class CPropertyDialog: public QDockWidget
|
||||||
{
|
{
|
||||||
|
@ -52,21 +53,27 @@ class CPropertyDialog: public QDockWidget
|
||||||
public:
|
public:
|
||||||
CPropertyDialog(CParticleTreeModel *treeModel, QWidget *parent = 0);
|
CPropertyDialog(CParticleTreeModel *treeModel, QWidget *parent = 0);
|
||||||
~CPropertyDialog();
|
~CPropertyDialog();
|
||||||
|
|
||||||
void setCurrentEditedElement(CParticleTreeItem *editedItem);
|
void setCurrentEditedElement(CParticleTreeItem *editedItem);
|
||||||
|
|
||||||
CLocatedPage *getLocatedPage() const { return _locatedPage; };
|
CLocatedPage *getLocatedPage() const
|
||||||
CPSMoverPage *getMoverPage() const { return _psMoverPage; };
|
{
|
||||||
|
return _locatedPage;
|
||||||
|
};
|
||||||
|
CPSMoverPage *getMoverPage() const
|
||||||
|
{
|
||||||
|
return _psMoverPage;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUi();
|
void setupUi();
|
||||||
|
|
||||||
QWidget *_dockWidgetContents;
|
QWidget *_dockWidgetContents;
|
||||||
QGridLayout *_gridLayout;
|
QGridLayout *_gridLayout;
|
||||||
QGridLayout *_pagesGridLayout;
|
QGridLayout *_pagesGridLayout;
|
||||||
QScrollArea *_scrollArea;
|
QScrollArea *_scrollArea;
|
||||||
QWidget *_scrollAreaWidgetContents;
|
QWidget *_scrollAreaWidgetContents;
|
||||||
|
|
||||||
QStackedWidget *_stackedWidget;
|
QStackedWidget *_stackedWidget;
|
||||||
CWorkspacePage *_wpPage;
|
CWorkspacePage *_wpPage;
|
||||||
CParticleSystemPage *_psPage;
|
CParticleSystemPage *_psPage;
|
||||||
|
@ -80,7 +87,7 @@ private:
|
||||||
CPSMoverPage *_psMoverPage;
|
CPSMoverPage *_psMoverPage;
|
||||||
|
|
||||||
CParticleTreeModel *_treeModel;
|
CParticleTreeModel *_treeModel;
|
||||||
|
|
||||||
friend class CParticleWorkspaceDialog;
|
friend class CParticleWorkspaceDialog;
|
||||||
}; /* class CPropertyDialog */
|
}; /* class CPropertyDialog */
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,14 @@
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "sound_system.h"
|
#include "sound_system.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CSoundPage::CSoundPage(QWidget *parent)
|
CSoundPage::CSoundPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
// setup dialog the sounds gain
|
// setup dialog the sounds gain
|
||||||
_ui.gainWidget->setRange(0.f, 1.f);
|
_ui.gainWidget->setRange(0.f, 1.f);
|
||||||
_ui.gainWidget->setWrapper(&_GainWrapper);
|
_ui.gainWidget->setWrapper(&_GainWrapper);
|
||||||
|
@ -53,7 +54,7 @@ CSoundPage::CSoundPage(QWidget *parent)
|
||||||
|
|
||||||
// setup dialog the percent of sound emissions
|
// setup dialog the percent of sound emissions
|
||||||
_ui.emissionWidget->setRange(0.f, 1.f);
|
_ui.emissionWidget->setRange(0.f, 1.f);
|
||||||
|
|
||||||
connect(_ui.browsePushButton ,SIGNAL(clicked()), this, SLOT(browse()));
|
connect(_ui.browsePushButton ,SIGNAL(clicked()), this, SLOT(browse()));
|
||||||
connect(_ui.playPushButton ,SIGNAL(clicked()), this, SLOT(play()));
|
connect(_ui.playPushButton ,SIGNAL(clicked()), this, SLOT(play()));
|
||||||
connect(_ui.spawnCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setSpawn(bool)));
|
connect(_ui.spawnCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setSpawn(bool)));
|
||||||
|
@ -72,9 +73,9 @@ void CSoundPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab
|
||||||
{
|
{
|
||||||
_Sound = static_cast<NL3D::CPSSound *>(locatedBindable);
|
_Sound = static_cast<NL3D::CPSSound *>(locatedBindable);
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
|
|
||||||
nlassert(_Sound);
|
nlassert(_Sound);
|
||||||
|
|
||||||
_ui.emissionWidget->setValue(_Sound->getEmissionPercent(), false);
|
_ui.emissionWidget->setValue(_Sound->getEmissionPercent(), false);
|
||||||
|
|
||||||
_GainWrapper.S = _Sound;
|
_GainWrapper.S = _Sound;
|
||||||
|
@ -95,7 +96,7 @@ void CSoundPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindab
|
||||||
void CSoundPage::browse()
|
void CSoundPage::browse()
|
||||||
{
|
{
|
||||||
std::vector<NLMISC::TStringId> names;
|
std::vector<NLMISC::TStringId> names;
|
||||||
|
|
||||||
|
|
||||||
NLSOUND::UAudioMixer *audioMixer = Modules::sound().getAudioMixer();
|
NLSOUND::UAudioMixer *audioMixer = Modules::sound().getAudioMixer();
|
||||||
if (audioMixer)
|
if (audioMixer)
|
||||||
|
@ -106,14 +107,14 @@ void CSoundPage::browse()
|
||||||
// TODO: create CPickSound dialog
|
// TODO: create CPickSound dialog
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items << tr("");
|
items << tr("");
|
||||||
for(size_t i = 0; i < names.size(); ++i)
|
for(size_t i = 0; i < names.size(); ++i)
|
||||||
items << QString(names[i]->c_str());
|
items << QString(names[i]->c_str());
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QString item = QInputDialog::getItem(this, tr("Select your sound"),
|
QString item = QInputDialog::getItem(this, tr("Select your sound"),
|
||||||
tr("Sound:"), items, 0, false, &ok);
|
tr("Sound:"), items, 0, false, &ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
_ui.soundNameLineEdit->setText(item);
|
_ui.soundNameLineEdit->setText(item);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,19 +35,20 @@
|
||||||
|
|
||||||
namespace NLSOUND
|
namespace NLSOUND
|
||||||
{
|
{
|
||||||
class UAudioMixer;
|
class UAudioMixer;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CSoundPage
|
@class CSoundPage
|
||||||
@brief Page for QStackWidget, to edit sounds in a particle system
|
@brief Page for QStackWidget, to edit sounds in a particle system
|
||||||
*/
|
*/
|
||||||
class CSoundPage: public QWidget
|
class CSoundPage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSoundPage(QWidget *parent = 0);
|
CSoundPage(QWidget *parent = 0);
|
||||||
~CSoundPage();
|
~CSoundPage();
|
||||||
|
@ -65,36 +66,63 @@ private Q_SLOTS:
|
||||||
void setEmissionPercent(float value);
|
void setEmissionPercent(float value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// wrapper to set the gain of sounds
|
/// wrapper to set the gain of sounds
|
||||||
struct CGainWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CGainWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSSound *S;
|
NL3D::CPSSound *S;
|
||||||
float get(void) const { return S->getGain(); }
|
float get(void) const
|
||||||
void set(const float &v) { S->setGain(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return S->getGainScheme(); }
|
return S->getGain();
|
||||||
void setScheme(scheme_type *s) { S->setGainScheme(s); }
|
}
|
||||||
|
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;
|
} _GainWrapper;
|
||||||
|
|
||||||
/// wrapper to set the pitch of sounds
|
/// wrapper to set the pitch of sounds
|
||||||
struct CPitchWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
struct CPitchWrapper : public IPSWrapperFloat, IPSSchemeWrapperFloat
|
||||||
{
|
{
|
||||||
NL3D::CPSSound *S;
|
NL3D::CPSSound *S;
|
||||||
float get(void) const { return S->getPitch(); }
|
float get(void) const
|
||||||
void set(const float &v) { S->setPitch(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return S->getPitchScheme(); }
|
return S->getPitch();
|
||||||
void setScheme(scheme_type *s) { S->setPitchScheme(s); }
|
}
|
||||||
|
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;
|
} _PitchWrapper;
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
/// the sound being edited
|
/// the sound being edited
|
||||||
NL3D::CPSSound *_Sound;
|
NL3D::CPSSound *_Sound;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
Ui::CSoundPage _ui;
|
Ui::CSoundPage _ui;
|
||||||
|
|
||||||
}; /* class CSoundPage */
|
}; /* class CSoundPage */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -38,25 +38,26 @@
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
static void chooseGlobalUserParam(uint userParam, NL3D::CParticleSystem *ps, QWidget *parent)
|
static void chooseGlobalUserParam(uint userParam, NL3D::CParticleSystem *ps, QWidget *parent)
|
||||||
{
|
{
|
||||||
nlassert(ps);
|
nlassert(ps);
|
||||||
bool ok;
|
bool ok;
|
||||||
QString text = QInputDialog::getText(parent, "Choose Global User Param",
|
QString text = QInputDialog::getText(parent, "Choose Global User Param",
|
||||||
"User name:", QLineEdit::Normal,
|
"User name:", QLineEdit::Normal,
|
||||||
QString(ps->getGlobalValueName(userParam).c_str()), &ok);
|
QString(ps->getGlobalValueName(userParam).c_str()), &ok);
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
ps->bindGlobalValueToUserParam(text.toStdString(), userParam);
|
ps->bindGlobalValueToUserParam(text.toStdString(), userParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleSystemPage::CParticleSystemPage(QWidget *parent)
|
CParticleSystemPage::CParticleSystemPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.timeThresholdWidget->setRange(0.005f, 0.3f);
|
_ui.timeThresholdWidget->setRange(0.005f, 0.3f);
|
||||||
_ui.timeThresholdWidget->enableLowerBound(0, true);
|
_ui.timeThresholdWidget->enableLowerBound(0, true);
|
||||||
|
|
||||||
|
@ -81,11 +82,11 @@ CParticleSystemPage::CParticleSystemPage(QWidget *parent)
|
||||||
|
|
||||||
_ui.maxViewDistWidget->setRange(0, 400.f);
|
_ui.maxViewDistWidget->setRange(0, 400.f);
|
||||||
_ui.maxViewDistWidget->enableLowerBound(0, true);
|
_ui.maxViewDistWidget->enableLowerBound(0, true);
|
||||||
|
|
||||||
_ui.lodRatioWidget->setRange(0, 1.f);
|
_ui.lodRatioWidget->setRange(0, 1.f);
|
||||||
_ui.lodRatioWidget->enableLowerBound(0, true);
|
_ui.lodRatioWidget->enableLowerBound(0, true);
|
||||||
_ui.lodRatioWidget->enableUpperBound(1, true);
|
_ui.lodRatioWidget->enableUpperBound(1, true);
|
||||||
|
|
||||||
_ui.colorWidget->setSchemeWrapper(&_GlobalColorWrapper);
|
_ui.colorWidget->setSchemeWrapper(&_GlobalColorWrapper);
|
||||||
_ui.colorWidget->enableMemoryScheme(false);
|
_ui.colorWidget->enableMemoryScheme(false);
|
||||||
_ui.colorWidget->enableNbCycles(false);
|
_ui.colorWidget->enableNbCycles(false);
|
||||||
|
@ -93,27 +94,27 @@ CParticleSystemPage::CParticleSystemPage(QWidget *parent)
|
||||||
_ui.colorWidget->setEnabledConstantValue(false);
|
_ui.colorWidget->setEnabledConstantValue(false);
|
||||||
_ui.colorWidget->init();
|
_ui.colorWidget->init();
|
||||||
_ui.colorWidget->hide();
|
_ui.colorWidget->hide();
|
||||||
|
|
||||||
// Integration tab
|
// Integration tab
|
||||||
connect(_ui.loadBalancingCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setLoadBalancing(bool)));
|
connect(_ui.loadBalancingCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setLoadBalancing(bool)));
|
||||||
connect(_ui.integrationCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setIntegration(bool)));
|
connect(_ui.integrationCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setIntegration(bool)));
|
||||||
connect(_ui.motionSlowDownCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setMotionSlowDown(bool)));
|
connect(_ui.motionSlowDownCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setMotionSlowDown(bool)));
|
||||||
connect(_ui.lockPushButton ,SIGNAL(toggled(bool)), this, SLOT(setLock(bool)));
|
connect(_ui.lockPushButton ,SIGNAL(toggled(bool)), this, SLOT(setLock(bool)));
|
||||||
|
|
||||||
connect(_ui.timeThresholdWidget ,SIGNAL(valueChanged(float)), this, SLOT(setTimeThreshold(float)));
|
connect(_ui.timeThresholdWidget ,SIGNAL(valueChanged(float)), this, SLOT(setTimeThreshold(float)));
|
||||||
connect(_ui.maxStepsWidget ,SIGNAL(valueChanged(uint32)), this, SLOT(setMaxSteps(uint32)));
|
connect(_ui.maxStepsWidget ,SIGNAL(valueChanged(uint32)), this, SLOT(setMaxSteps(uint32)));
|
||||||
|
|
||||||
// User param tab
|
// User param tab
|
||||||
connect(_ui.globalPushButton_1 ,SIGNAL(clicked()), this, SLOT(setGloabal1()));
|
connect(_ui.globalPushButton_1 ,SIGNAL(clicked()), this, SLOT(setGloabal1()));
|
||||||
connect(_ui.globalPushButton_2 ,SIGNAL(clicked()), this, SLOT(setGloabal2()));
|
connect(_ui.globalPushButton_2 ,SIGNAL(clicked()), this, SLOT(setGloabal2()));
|
||||||
connect(_ui.globalPushButton_3 ,SIGNAL(clicked()), this, SLOT(setGloabal3()));
|
connect(_ui.globalPushButton_3 ,SIGNAL(clicked()), this, SLOT(setGloabal3()));
|
||||||
connect(_ui.globalPushButton_4 ,SIGNAL(clicked()), this, SLOT(setGloabal4()));
|
connect(_ui.globalPushButton_4 ,SIGNAL(clicked()), this, SLOT(setGloabal4()));
|
||||||
|
|
||||||
connect(_ui.userParamWidget_1 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam1(float)));
|
connect(_ui.userParamWidget_1 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam1(float)));
|
||||||
connect(_ui.userParamWidget_2 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam2(float)));
|
connect(_ui.userParamWidget_2 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam2(float)));
|
||||||
connect(_ui.userParamWidget_3 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam3(float)));
|
connect(_ui.userParamWidget_3 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam3(float)));
|
||||||
connect(_ui.userParamWidget_4 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam4(float)));
|
connect(_ui.userParamWidget_4 ,SIGNAL(valueChanged(float)), this, SLOT(setUserParam4(float)));
|
||||||
|
|
||||||
// BBox tab
|
// BBox tab
|
||||||
connect(_ui.enablePBBCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setEnableBbox(bool)));
|
connect(_ui.enablePBBCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setEnableBbox(bool)));
|
||||||
connect(_ui.autoCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setAutoBbox(bool)));
|
connect(_ui.autoCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setAutoBbox(bool)));
|
||||||
|
@ -123,7 +124,7 @@ CParticleSystemPage::CParticleSystemPage(QWidget *parent)
|
||||||
connect(_ui.xDoubleSpinBox ,SIGNAL(valueChanged(double)), this, SLOT(setXBbox(double)));
|
connect(_ui.xDoubleSpinBox ,SIGNAL(valueChanged(double)), this, SLOT(setXBbox(double)));
|
||||||
connect(_ui.yDoubleSpinBox ,SIGNAL(valueChanged(double)), this, SLOT(setYBbox(double)));
|
connect(_ui.yDoubleSpinBox ,SIGNAL(valueChanged(double)), this, SLOT(setYBbox(double)));
|
||||||
connect(_ui.zDoubleSpinBox ,SIGNAL(valueChanged(double)), this, SLOT(setZBbox(double)));
|
connect(_ui.zDoubleSpinBox ,SIGNAL(valueChanged(double)), this, SLOT(setZBbox(double)));
|
||||||
|
|
||||||
// LOD param tab
|
// LOD param tab
|
||||||
connect(_ui.sharableCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setSharable(bool)));
|
connect(_ui.sharableCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setSharable(bool)));
|
||||||
connect(_ui.autoLODCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setAutoLOD(bool)));
|
connect(_ui.autoLODCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setAutoLOD(bool)));
|
||||||
|
@ -131,11 +132,11 @@ CParticleSystemPage::CParticleSystemPage(QWidget *parent)
|
||||||
|
|
||||||
connect(_ui.maxViewDistWidget ,SIGNAL(valueChanged(float)), this, SLOT(setMaxViewDist(float)));
|
connect(_ui.maxViewDistWidget ,SIGNAL(valueChanged(float)), this, SLOT(setMaxViewDist(float)));
|
||||||
connect(_ui.lodRatioWidget ,SIGNAL(valueChanged(float)), this, SLOT(setLodRatio(float)));
|
connect(_ui.lodRatioWidget ,SIGNAL(valueChanged(float)), this, SLOT(setLodRatio(float)));
|
||||||
|
|
||||||
// Global color tab
|
// Global color tab
|
||||||
connect(_ui.editGlobalColorCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setEditGlobalColor(bool)));
|
connect(_ui.editGlobalColorCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setEditGlobalColor(bool)));
|
||||||
connect(_ui.globalLightCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setGlobalLight(bool)));
|
connect(_ui.globalLightCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setGlobalLight(bool)));
|
||||||
|
|
||||||
// Life mgt param tab
|
// Life mgt param tab
|
||||||
connect(_ui.presetBehaviourComboBox ,SIGNAL(currentIndexChanged(int)), this, SLOT(setPresetBehaviour(int)));
|
connect(_ui.presetBehaviourComboBox ,SIGNAL(currentIndexChanged(int)), this, SLOT(setPresetBehaviour(int)));
|
||||||
connect(_ui.modelRemovedCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setModelRemoved(bool)));
|
connect(_ui.modelRemovedCheckBox ,SIGNAL(toggled(bool)), this, SLOT(setModelRemoved(bool)));
|
||||||
|
@ -158,7 +159,7 @@ void CParticleSystemPage::setEditedParticleSystem(CWorkspaceNode *node)
|
||||||
{
|
{
|
||||||
_Node = node;
|
_Node = node;
|
||||||
enabledModifiedFlag = false;
|
enabledModifiedFlag = false;
|
||||||
|
|
||||||
NL3D::TAnimationTime t;
|
NL3D::TAnimationTime t;
|
||||||
uint32 max;
|
uint32 max;
|
||||||
bool csd;
|
bool csd;
|
||||||
|
@ -167,16 +168,16 @@ void CParticleSystemPage::setEditedParticleSystem(CWorkspaceNode *node)
|
||||||
|
|
||||||
// Update param Time threshold.
|
// Update param Time threshold.
|
||||||
_ui.timeThresholdWidget->setValue(t, false);
|
_ui.timeThresholdWidget->setValue(t, false);
|
||||||
|
|
||||||
// Update param Max steps.
|
// Update param Max steps.
|
||||||
_ui.maxStepsWidget->setValue(max, false);
|
_ui.maxStepsWidget->setValue(max, false);
|
||||||
|
|
||||||
// Update param User Param
|
// Update param User Param
|
||||||
_ui.userParamWidget_1->setValue(_Node->getPSPointer()->getUserParam(0) , false);
|
_ui.userParamWidget_1->setValue(_Node->getPSPointer()->getUserParam(0) , false);
|
||||||
_ui.userParamWidget_2->setValue(_Node->getPSPointer()->getUserParam(1) , false);
|
_ui.userParamWidget_2->setValue(_Node->getPSPointer()->getUserParam(1) , false);
|
||||||
_ui.userParamWidget_3->setValue(_Node->getPSPointer()->getUserParam(2) , false);
|
_ui.userParamWidget_3->setValue(_Node->getPSPointer()->getUserParam(2) , false);
|
||||||
_ui.userParamWidget_4->setValue(_Node->getPSPointer()->getUserParam(3) , false);
|
_ui.userParamWidget_4->setValue(_Node->getPSPointer()->getUserParam(3) , false);
|
||||||
|
|
||||||
// Update param Max view dist.
|
// Update param Max view dist.
|
||||||
_ui.maxViewDistWidget->setValue(_Node->getPSPointer()->getMaxViewDist(), false);
|
_ui.maxViewDistWidget->setValue(_Node->getPSPointer()->getMaxViewDist(), false);
|
||||||
|
|
||||||
|
@ -187,7 +188,7 @@ void CParticleSystemPage::setEditedParticleSystem(CWorkspaceNode *node)
|
||||||
_ui.integrationCheckBox->setChecked(_Node->getPSPointer()->isAccurateIntegrationEnabled());
|
_ui.integrationCheckBox->setChecked(_Node->getPSPointer()->isAccurateIntegrationEnabled());
|
||||||
_ui.loadBalancingCheckBox->setChecked(_Node->getPSPointer()->isLoadBalancingEnabled());
|
_ui.loadBalancingCheckBox->setChecked(_Node->getPSPointer()->isLoadBalancingEnabled());
|
||||||
_ui.motionSlowDownCheckBox->setChecked(csd);
|
_ui.motionSlowDownCheckBox->setChecked(csd);
|
||||||
|
|
||||||
// Precomputed Bbox
|
// Precomputed Bbox
|
||||||
_ui.enablePBBCheckBox->setChecked(!_Node->getPSPointer()->getAutoComputeBBox());
|
_ui.enablePBBCheckBox->setChecked(!_Node->getPSPointer()->getAutoComputeBBox());
|
||||||
|
|
||||||
|
@ -198,9 +199,9 @@ void CParticleSystemPage::setEditedParticleSystem(CWorkspaceNode *node)
|
||||||
_ui.colorWidget->setWorkspaceNode(_Node);
|
_ui.colorWidget->setWorkspaceNode(_Node);
|
||||||
int bGlobalColor = _Node->getPSPointer()->getColorAttenuationScheme() != NULL ? 1 : 0;
|
int bGlobalColor = _Node->getPSPointer()->getColorAttenuationScheme() != NULL ? 1 : 0;
|
||||||
_ui.editGlobalColorCheckBox->setChecked(bGlobalColor);
|
_ui.editGlobalColorCheckBox->setChecked(bGlobalColor);
|
||||||
if (bGlobalColor)
|
if (bGlobalColor)
|
||||||
_ui.colorWidget->updateUi();
|
_ui.colorWidget->updateUi();
|
||||||
|
|
||||||
// Life mgt parameters
|
// Life mgt parameters
|
||||||
_ui.presetBehaviourComboBox->setCurrentIndex(_Node->getPSPointer()->getBehaviourType());
|
_ui.presetBehaviourComboBox->setCurrentIndex(_Node->getPSPointer()->getBehaviourType());
|
||||||
_ui.sharableCheckBox->setChecked(_Node->getPSPointer()->isSharingEnabled());
|
_ui.sharableCheckBox->setChecked(_Node->getPSPointer()->isSharingEnabled());
|
||||||
|
@ -211,10 +212,10 @@ void CParticleSystemPage::setEditedParticleSystem(CWorkspaceNode *node)
|
||||||
_ui.noMaxNBStepsCheckBox->setChecked(_Node->getPSPointer()->getBypassMaxNumIntegrationSteps());
|
_ui.noMaxNBStepsCheckBox->setChecked(_Node->getPSPointer()->getBypassMaxNumIntegrationSteps());
|
||||||
|
|
||||||
_ui.lifeTimeUpdateCheckBox->setChecked(klt);
|
_ui.lifeTimeUpdateCheckBox->setChecked(klt);
|
||||||
_ui.dieComboBox->setCurrentIndex(_Node->getPSPointer()->getDestroyCondition());
|
_ui.dieComboBox->setCurrentIndex(_Node->getPSPointer()->getDestroyCondition());
|
||||||
_ui.animTypeComboBox->setCurrentIndex(_Node->getPSPointer()->getAnimType());
|
_ui.animTypeComboBox->setCurrentIndex(_Node->getPSPointer()->getAnimType());
|
||||||
_ui.autoDelayCheckBox->setChecked(_Node->getPSPointer()->getAutoComputeDelayBeforeDeathConditionTest());
|
_ui.autoDelayCheckBox->setChecked(_Node->getPSPointer()->getAutoComputeDelayBeforeDeathConditionTest());
|
||||||
|
|
||||||
enabledModifiedFlag = true;
|
enabledModifiedFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ void CParticleSystemPage::updateDieOnEventParams()
|
||||||
void CParticleSystemPage::updateLifeMgtPresets()
|
void CParticleSystemPage::updateLifeMgtPresets()
|
||||||
{
|
{
|
||||||
bool bEnable = _Node->getPSPointer()->getBehaviourType() == NL3D::CParticleSystem::UserBehaviour ? true : false;
|
bool bEnable = _Node->getPSPointer()->getBehaviourType() == NL3D::CParticleSystem::UserBehaviour ? true : false;
|
||||||
|
|
||||||
_ui.modelRemovedCheckBox->setEnabled(bEnable);
|
_ui.modelRemovedCheckBox->setEnabled(bEnable);
|
||||||
_ui.psResourceCheckBox->setEnabled(bEnable);
|
_ui.psResourceCheckBox->setEnabled(bEnable);
|
||||||
_ui.lifeTimeUpdateCheckBox->setEnabled(bEnable);
|
_ui.lifeTimeUpdateCheckBox->setEnabled(bEnable);
|
||||||
|
@ -269,8 +270,8 @@ void CParticleSystemPage::setLoadBalancing(bool state)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton reply;
|
QMessageBox::StandardButton reply;
|
||||||
reply = QMessageBox::question(this, tr("Are you sure?"),
|
reply = QMessageBox::question(this, tr("Are you sure?"),
|
||||||
tr("Load balancing on/off"),
|
tr("Load balancing on/off"),
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
if (reply == QMessageBox::Yes)
|
if (reply == QMessageBox::Yes)
|
||||||
_Node->getPSPointer()->enableLoadBalancing(false);
|
_Node->getPSPointer()->enableLoadBalancing(false);
|
||||||
else
|
else
|
||||||
|
@ -286,7 +287,7 @@ void CParticleSystemPage::setLoadBalancing(bool state)
|
||||||
void CParticleSystemPage::setIntegration(bool state)
|
void CParticleSystemPage::setIntegration(bool state)
|
||||||
{
|
{
|
||||||
// enable/disable accurate integration.
|
// enable/disable accurate integration.
|
||||||
if (state != _Node->getPSPointer()->isAccurateIntegrationEnabled())
|
if (state != _Node->getPSPointer()->isAccurateIntegrationEnabled())
|
||||||
{
|
{
|
||||||
_Node->getPSPointer()->enableAccurateIntegration(state);
|
_Node->getPSPointer()->enableAccurateIntegration(state);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -310,7 +311,7 @@ void CParticleSystemPage::setMotionSlowDown(bool state)
|
||||||
|
|
||||||
void CParticleSystemPage::setLock(bool checked)
|
void CParticleSystemPage::setLock(bool checked)
|
||||||
{
|
{
|
||||||
// Need frame delay dialog.
|
// Need frame delay dialog.
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSystemPage::setGloabal1()
|
void CParticleSystemPage::setGloabal1()
|
||||||
|
@ -322,19 +323,19 @@ void CParticleSystemPage::setGloabal1()
|
||||||
|
|
||||||
void CParticleSystemPage::setGloabal2()
|
void CParticleSystemPage::setGloabal2()
|
||||||
{
|
{
|
||||||
chooseGlobalUserParam(1, _Node->getPSPointer(), this);
|
chooseGlobalUserParam(1, _Node->getPSPointer(), this);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSystemPage::setGloabal3()
|
void CParticleSystemPage::setGloabal3()
|
||||||
{
|
{
|
||||||
chooseGlobalUserParam(2, _Node->getPSPointer(), this);
|
chooseGlobalUserParam(2, _Node->getPSPointer(), this);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSystemPage::setGloabal4()
|
void CParticleSystemPage::setGloabal4()
|
||||||
{
|
{
|
||||||
chooseGlobalUserParam(3, _Node->getPSPointer(), this);
|
chooseGlobalUserParam(3, _Node->getPSPointer(), this);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +346,7 @@ void CParticleSystemPage::setEnableBbox(bool state)
|
||||||
_Node->getPSPointer()->setAutoComputeBBox(!state);
|
_Node->getPSPointer()->setAutoComputeBBox(!state);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
updatePrecomputedBBoxParams();
|
updatePrecomputedBBoxParams();
|
||||||
else
|
else
|
||||||
|
@ -366,7 +367,7 @@ void CParticleSystemPage::resetBbox()
|
||||||
|
|
||||||
void CParticleSystemPage::incBbox()
|
void CParticleSystemPage::incBbox()
|
||||||
{
|
{
|
||||||
NLMISC::CAABBox b;
|
NLMISC::CAABBox b;
|
||||||
_Node->getPSPointer()->computeBBox(b);
|
_Node->getPSPointer()->computeBBox(b);
|
||||||
b.setHalfSize(1.1f * b.getHalfSize());
|
b.setHalfSize(1.1f * b.getHalfSize());
|
||||||
_Node->getPSPointer()->setPrecomputedBBox(b);
|
_Node->getPSPointer()->setPrecomputedBBox(b);
|
||||||
|
@ -421,7 +422,7 @@ void CParticleSystemPage::setZBbox(double value)
|
||||||
void CParticleSystemPage::setEditGlobalColor(bool state)
|
void CParticleSystemPage::setEditGlobalColor(bool state)
|
||||||
{
|
{
|
||||||
bool bGlobalColor = _Node->getPSPointer()->getColorAttenuationScheme() != NULL ? true : false;
|
bool bGlobalColor = _Node->getPSPointer()->getColorAttenuationScheme() != NULL ? true : false;
|
||||||
if (state != bGlobalColor)
|
if (state != bGlobalColor)
|
||||||
{
|
{
|
||||||
// if the system hasn't a global color scheme, add one.
|
// if the system hasn't a global color scheme, add one.
|
||||||
if (_Node->getPSPointer()->getColorAttenuationScheme() == NULL)
|
if (_Node->getPSPointer()->getColorAttenuationScheme() == NULL)
|
||||||
|
@ -444,7 +445,7 @@ void CParticleSystemPage::setPresetBehaviour(int index)
|
||||||
updateLifeMgtPresets();
|
updateLifeMgtPresets();
|
||||||
if (index == _Node->getPSPointer()->getBehaviourType()) return;
|
if (index == _Node->getPSPointer()->getBehaviourType()) return;
|
||||||
if (index == NL3D::CParticleSystem::SpellFX ||
|
if (index == NL3D::CParticleSystem::SpellFX ||
|
||||||
index == NL3D::CParticleSystem::SpawnedEnvironmentFX)
|
index == NL3D::CParticleSystem::SpawnedEnvironmentFX)
|
||||||
{
|
{
|
||||||
NL3D::CPSLocatedBindable *lb;
|
NL3D::CPSLocatedBindable *lb;
|
||||||
if (!_Node->getPSPointer()->canFinish(&lb))
|
if (!_Node->getPSPointer()->canFinish(&lb))
|
||||||
|
@ -455,13 +456,13 @@ void CParticleSystemPage::setPresetBehaviour(int index)
|
||||||
if (!lb)
|
if (!lb)
|
||||||
{
|
{
|
||||||
errorMessage->showMessage(tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
|
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();
|
errorMessage->exec();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errorMessage->showMessage(tr("The system must have a finite duration for this setting! Please check that the following object "
|
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();
|
errorMessage->exec();
|
||||||
}
|
}
|
||||||
delete errorMessage;
|
delete errorMessage;
|
||||||
|
@ -476,7 +477,7 @@ void CParticleSystemPage::setPresetBehaviour(int index)
|
||||||
void CParticleSystemPage::setSharable(bool state)
|
void CParticleSystemPage::setSharable(bool state)
|
||||||
{
|
{
|
||||||
if (state == _Node->getPSPointer()->isSharingEnabled()) return;
|
if (state == _Node->getPSPointer()->isSharingEnabled()) return;
|
||||||
_Node->getPSPointer()->enableSharing(state);
|
_Node->getPSPointer()->enableSharing(state);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +506,7 @@ void CParticleSystemPage::setModelRemoved(bool state)
|
||||||
|
|
||||||
void CParticleSystemPage::setPSResource(bool state)
|
void CParticleSystemPage::setPSResource(bool state)
|
||||||
{
|
{
|
||||||
if (state != _Node->getPSPointer()->doesDestroyWhenOutOfFrustum())
|
if (state != _Node->getPSPointer()->doesDestroyWhenOutOfFrustum())
|
||||||
{
|
{
|
||||||
_Node->getPSPointer()->destroyWhenOutOfFrustum(state);
|
_Node->getPSPointer()->destroyWhenOutOfFrustum(state);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
|
@ -530,7 +531,7 @@ void CParticleSystemPage::setNoMaxNBSteps(bool state)
|
||||||
_ui.maxStepsWidget->setEnabled(!state);
|
_ui.maxStepsWidget->setEnabled(!state);
|
||||||
if (state == _Node->getPSPointer()->getBypassMaxNumIntegrationSteps()) return;
|
if (state == _Node->getPSPointer()->getBypassMaxNumIntegrationSteps()) return;
|
||||||
if (state && !_Node->getPSPointer()->canFinish())
|
if (state && !_Node->getPSPointer()->canFinish())
|
||||||
{
|
{
|
||||||
QErrorMessage *errorMessage = new QErrorMessage();
|
QErrorMessage *errorMessage = new QErrorMessage();
|
||||||
errorMessage->setModal(true);
|
errorMessage->setModal(true);
|
||||||
errorMessage->showMessage(tr("The system must have a finite duration for this setting! Please check that."));
|
errorMessage->showMessage(tr("The system must have a finite duration for this setting! Please check that."));
|
||||||
|
@ -562,7 +563,7 @@ void CParticleSystemPage::setAnimType(int index)
|
||||||
void CParticleSystemPage::setDie(int index)
|
void CParticleSystemPage::setDie(int index)
|
||||||
{
|
{
|
||||||
if (index != _Node->getPSPointer()->getDestroyCondition())
|
if (index != _Node->getPSPointer()->getDestroyCondition())
|
||||||
{
|
{
|
||||||
_Node->getPSPointer()->setDestroyCondition((NL3D::CParticleSystem::TDieCondition) index);
|
_Node->getPSPointer()->setDestroyCondition((NL3D::CParticleSystem::TDieCondition) index);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
@ -578,7 +579,7 @@ void CParticleSystemPage::setAfterDelay(double value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CParticleSystemPage::setTimeThreshold(float value)
|
void CParticleSystemPage::setTimeThreshold(float value)
|
||||||
{
|
{
|
||||||
NL3D::TAnimationTime t;
|
NL3D::TAnimationTime t;
|
||||||
|
@ -586,7 +587,7 @@ void CParticleSystemPage::setTimeThreshold(float value)
|
||||||
bool csd;
|
bool csd;
|
||||||
bool klt;
|
bool klt;
|
||||||
_Node->getPSPointer()->getAccurateIntegrationParams(t, max, csd, klt);
|
_Node->getPSPointer()->getAccurateIntegrationParams(t, max, csd, klt);
|
||||||
_Node->getPSPointer()->setAccurateIntegrationParams(value, max, csd, klt);
|
_Node->getPSPointer()->setAccurateIntegrationParams(value, max, csd, klt);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,25 +598,25 @@ void CParticleSystemPage::setMaxSteps(uint32 value)
|
||||||
bool csd;
|
bool csd;
|
||||||
bool klt;
|
bool klt;
|
||||||
_Node->getPSPointer()->getAccurateIntegrationParams(t, max, csd, klt);
|
_Node->getPSPointer()->getAccurateIntegrationParams(t, max, csd, klt);
|
||||||
_Node->getPSPointer()->setAccurateIntegrationParams(t, value, csd, klt);
|
_Node->getPSPointer()->setAccurateIntegrationParams(t, value, csd, klt);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSystemPage::setUserParam1(float value)
|
void CParticleSystemPage::setUserParam1(float value)
|
||||||
{
|
{
|
||||||
_Node->getPSPointer()->setUserParam(0, value);
|
_Node->getPSPointer()->setUserParam(0, value);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSystemPage::setUserParam2(float value)
|
void CParticleSystemPage::setUserParam2(float value)
|
||||||
{
|
{
|
||||||
_Node->getPSPointer()->setUserParam(1, value);
|
_Node->getPSPointer()->setUserParam(1, value);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleSystemPage::setUserParam3(float value)
|
void CParticleSystemPage::setUserParam3(float value)
|
||||||
{
|
{
|
||||||
_Node->getPSPointer()->setUserParam(2, value);
|
_Node->getPSPointer()->setUserParam(2, value);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,19 +33,20 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "edit_range_widget.h"
|
#include "edit_range_widget.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
@class CParticleSystemPage
|
@class CParticleSystemPage
|
||||||
@brief Page for QStackWidget, to edit workspace node in a particle system
|
@brief Page for QStackWidget, to edit workspace node in a particle system
|
||||||
*/
|
*/
|
||||||
class CParticleSystemPage: public QWidget
|
class CParticleSystemPage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CParticleSystemPage(QWidget *parent = 0);
|
CParticleSystemPage(QWidget *parent = 0);
|
||||||
~CParticleSystemPage();
|
~CParticleSystemPage();
|
||||||
|
|
||||||
/// Set the workspace node to edit.
|
/// Set the workspace node to edit.
|
||||||
void setEditedParticleSystem(CWorkspaceNode *node);
|
void setEditedParticleSystem(CWorkspaceNode *node);
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ private Q_SLOTS:
|
||||||
void setIntegration(bool state);
|
void setIntegration(bool state);
|
||||||
void setMotionSlowDown(bool state);
|
void setMotionSlowDown(bool state);
|
||||||
void setLock(bool checked);
|
void setLock(bool checked);
|
||||||
|
|
||||||
void setTimeThreshold(float value);
|
void setTimeThreshold(float value);
|
||||||
void setMaxSteps(uint32 value);
|
void setMaxSteps(uint32 value);
|
||||||
|
|
||||||
|
@ -79,19 +80,19 @@ private Q_SLOTS:
|
||||||
void setXBbox(double value);
|
void setXBbox(double value);
|
||||||
void setYBbox(double value);
|
void setYBbox(double value);
|
||||||
void setZBbox(double value);
|
void setZBbox(double value);
|
||||||
|
|
||||||
// LOD Param
|
// LOD Param
|
||||||
void setSharable(bool state);
|
void setSharable(bool state);
|
||||||
void setAutoLOD(bool state);
|
void setAutoLOD(bool state);
|
||||||
void settings();
|
void settings();
|
||||||
|
|
||||||
void setMaxViewDist(float value);
|
void setMaxViewDist(float value);
|
||||||
void setLodRatio(float value);
|
void setLodRatio(float value);
|
||||||
|
|
||||||
// Global color tab
|
// Global color tab
|
||||||
void setGlobalLight(bool state);
|
void setGlobalLight(bool state);
|
||||||
void setEditGlobalColor(bool state);
|
void setEditGlobalColor(bool state);
|
||||||
|
|
||||||
// Life mgt param
|
// Life mgt param
|
||||||
void setPresetBehaviour(int index);
|
void setPresetBehaviour(int index);
|
||||||
void setModelRemoved(bool state);
|
void setModelRemoved(bool state);
|
||||||
|
@ -102,16 +103,19 @@ private Q_SLOTS:
|
||||||
void setAnimType(int index);
|
void setAnimType(int index);
|
||||||
void setDie(int index);
|
void setDie(int index);
|
||||||
void setAfterDelay(double value);
|
void setAfterDelay(double value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updatePrecomputedBBoxParams();
|
void updatePrecomputedBBoxParams();
|
||||||
void updateDieOnEventParams();
|
void updateDieOnEventParams();
|
||||||
void updateLifeMgtPresets();
|
void updateLifeMgtPresets();
|
||||||
|
|
||||||
bool enabledModifiedFlag;
|
bool enabledModifiedFlag;
|
||||||
|
|
||||||
void updateModifiedFlag() { if ((_Node) && (enabledModifiedFlag)) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if ((_Node) && (enabledModifiedFlag)) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
struct CGlobalColorWrapper : public IPSSchemeWrapperRGBA
|
struct CGlobalColorWrapper : public IPSSchemeWrapperRGBA
|
||||||
|
@ -121,9 +125,9 @@ private:
|
||||||
virtual void setScheme(scheme_type *s);
|
virtual void setScheme(scheme_type *s);
|
||||||
}
|
}
|
||||||
_GlobalColorWrapper;
|
_GlobalColorWrapper;
|
||||||
|
|
||||||
Ui::CParticleSystemPage _ui;
|
Ui::CParticleSystemPage _ui;
|
||||||
|
|
||||||
}; /* class CParticleSystemPage */
|
}; /* class CParticleSystemPage */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -31,20 +31,21 @@
|
||||||
#include "value_gradient_dialog.h"
|
#include "value_gradient_dialog.h"
|
||||||
#include "multi_tex_dialog.h"
|
#include "multi_tex_dialog.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CParticleTextureAnimWidget::CParticleTextureAnimWidget(QWidget *parent)
|
CParticleTextureAnimWidget::CParticleTextureAnimWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.texIndexWidget->setRange(0, 1);
|
_ui.texIndexWidget->setRange(0, 1);
|
||||||
_ui.texIndexWidget->setWrapper(&_TextureIndexWrapper );
|
_ui.texIndexWidget->setWrapper(&_TextureIndexWrapper );
|
||||||
_ui.texIndexWidget->setSchemeWrapper(&_TextureIndexWrapper );
|
_ui.texIndexWidget->setSchemeWrapper(&_TextureIndexWrapper );
|
||||||
_ui.texIndexWidget->init();
|
_ui.texIndexWidget->init();
|
||||||
|
|
||||||
_ui.texWidget->setWrapper(&_TextureWrapper);
|
_ui.texWidget->setWrapper(&_TextureWrapper);
|
||||||
|
|
||||||
connect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool)));
|
connect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool)));
|
||||||
connect(_ui.multitexturingCheckBox, SIGNAL(toggled(bool)), this, SLOT(setMultitexturing(bool)));
|
connect(_ui.multitexturingCheckBox, SIGNAL(toggled(bool)), this, SLOT(setMultitexturing(bool)));
|
||||||
connect(_ui.editPushButton, SIGNAL(clicked()), this, SLOT(editMultitexturing()));
|
connect(_ui.editPushButton, SIGNAL(clicked()), this, SLOT(editMultitexturing()));
|
||||||
|
@ -60,13 +61,13 @@ void CParticleTextureAnimWidget::setCurrentTextureAnim(NL3D::CPSTexturedParticle
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_EditedParticle = tp;
|
_EditedParticle = tp;
|
||||||
_MTP = mtp;
|
_MTP = mtp;
|
||||||
|
|
||||||
disconnect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool)));
|
disconnect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool)));
|
||||||
|
|
||||||
bool isAnimTex = _EditedParticle->getTextureGroup() ? true : false;
|
bool isAnimTex = _EditedParticle->getTextureGroup() ? true : false;
|
||||||
_ui.texAnimCheckBox->setChecked(isAnimTex);
|
_ui.texAnimCheckBox->setChecked(isAnimTex);
|
||||||
updateTexAnimState(isAnimTex);
|
updateTexAnimState(isAnimTex);
|
||||||
|
|
||||||
if (_MTP)
|
if (_MTP)
|
||||||
{
|
{
|
||||||
_ui.multitexturingCheckBox->setChecked(_MTP->isMultiTextureEnabled());
|
_ui.multitexturingCheckBox->setChecked(_MTP->isMultiTextureEnabled());
|
||||||
|
@ -74,20 +75,20 @@ void CParticleTextureAnimWidget::setCurrentTextureAnim(NL3D::CPSTexturedParticle
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_ui.multitexturingGroupBox->hide();
|
_ui.multitexturingGroupBox->hide();
|
||||||
|
|
||||||
connect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool)));
|
connect(_ui.texAnimCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnabledTexAnim(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParticleTextureAnimWidget::setEnabledTexAnim(bool state)
|
void CParticleTextureAnimWidget::setEnabledTexAnim(bool state)
|
||||||
{
|
{
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
if (_MTP)
|
if (_MTP)
|
||||||
_ui.multitexturingCheckBox->setChecked(false);
|
_ui.multitexturingCheckBox->setChecked(false);
|
||||||
|
|
||||||
// When you try to load a dummy texture, remove alternative paths, an assertion is thrown otherwise
|
// When you try to load a dummy texture, remove alternative paths, an assertion is thrown otherwise
|
||||||
NLMISC::CPath::removeAllAlternativeSearchPath();
|
NLMISC::CPath::removeAllAlternativeSearchPath();
|
||||||
|
|
||||||
// put a dummy texture as a first texture
|
// put a dummy texture as a first texture
|
||||||
NLMISC::CSmartPtr<NL3D::ITexture> tex = (NL3D::ITexture *) new NL3D::CTextureFile(std::string(""));
|
NLMISC::CSmartPtr<NL3D::ITexture> tex = (NL3D::ITexture *) new NL3D::CTextureFile(std::string(""));
|
||||||
NL3D::CTextureGrouped *tg = new NL3D::CTextureGrouped;
|
NL3D::CTextureGrouped *tg = new NL3D::CTextureGrouped;
|
||||||
|
|
|
@ -34,16 +34,17 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CPSTexturedParticle;
|
class CPSTexturedParticle;
|
||||||
class CPSMultiTexturedParticle;
|
class CPSMultiTexturedParticle;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CParticleTextureAnimWidget: public QWidget
|
class CParticleTextureAnimWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CParticleTextureAnimWidget(QWidget *parent = 0);
|
CParticleTextureAnimWidget(QWidget *parent = 0);
|
||||||
~CParticleTextureAnimWidget();
|
~CParticleTextureAnimWidget();
|
||||||
|
@ -55,34 +56,55 @@ private Q_SLOTS:
|
||||||
void setEnabledTexAnim(bool state);
|
void setEnabledTexAnim(bool state);
|
||||||
void setMultitexturing(bool enabled);
|
void setMultitexturing(bool enabled);
|
||||||
void editMultitexturing();
|
void editMultitexturing();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateTexAnimState(bool state);
|
void updateTexAnimState(bool state);
|
||||||
|
|
||||||
/// Wrapper for single texture
|
/// Wrapper for single texture
|
||||||
struct CTextureWrapper : public IPSWrapperTexture
|
struct CTextureWrapper : public IPSWrapperTexture
|
||||||
{
|
{
|
||||||
NL3D::CPSTexturedParticle *P;
|
NL3D::CPSTexturedParticle *P;
|
||||||
NL3D::ITexture *get(void) { return P->getTexture(); }
|
NL3D::ITexture *get(void)
|
||||||
void set(NL3D::ITexture *t) { P->setTexture(t); }
|
{
|
||||||
|
return P->getTexture();
|
||||||
|
}
|
||||||
|
void set(NL3D::ITexture *t)
|
||||||
|
{
|
||||||
|
P->setTexture(t);
|
||||||
|
}
|
||||||
} _TextureWrapper;
|
} _TextureWrapper;
|
||||||
|
|
||||||
/// Wrapper for texture anim sequence
|
/// Wrapper for texture anim sequence
|
||||||
struct CTextureIndexWrapper : public IPSWrapper<sint32>, IPSSchemeWrapper<sint32>
|
struct CTextureIndexWrapper : public IPSWrapper<sint32>, IPSSchemeWrapper<sint32>
|
||||||
{
|
{
|
||||||
NL3D::CPSTexturedParticle *P;
|
NL3D::CPSTexturedParticle *P;
|
||||||
sint32 get(void) const { return P->getTextureIndex(); }
|
sint32 get(void) const
|
||||||
void set(const sint32 &v) { P->setTextureIndex(v); }
|
{
|
||||||
scheme_type *getScheme(void) const { return P->getTextureIndexScheme(); }
|
return P->getTextureIndex();
|
||||||
void setScheme(scheme_type *s) { P->setTextureIndexScheme(s); }
|
}
|
||||||
|
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;
|
} _TextureIndexWrapper;
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
NL3D::CPSTexturedParticle *_EditedParticle;
|
NL3D::CPSTexturedParticle *_EditedParticle;
|
||||||
|
|
||||||
NL3D::CPSMultiTexturedParticle *_MTP;
|
NL3D::CPSMultiTexturedParticle *_MTP;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
Ui::CParticleTextureAnimWidget _ui;
|
Ui::CParticleTextureAnimWidget _ui;
|
||||||
|
|
|
@ -30,16 +30,17 @@
|
||||||
#include "nel/3d/ps_particle_basic.h"
|
#include "nel/3d/ps_particle_basic.h"
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CParticleTextureWidget::CParticleTextureWidget(QWidget *parent)
|
CParticleTextureWidget::CParticleTextureWidget(QWidget *parent)
|
||||||
: QWidget(parent), _Wrapper(NULL)
|
: QWidget(parent), _Wrapper(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.imageLabel->setScaledContents(true);
|
_ui.imageLabel->setScaledContents(true);
|
||||||
_ui.removePushButton->setVisible(false);
|
_ui.removePushButton->setVisible(false);
|
||||||
|
|
||||||
connect(_ui.chooseTexPushButton, SIGNAL(clicked()), this, SLOT(chooseTexture()));
|
connect(_ui.chooseTexPushButton, SIGNAL(clicked()), this, SLOT(chooseTexture()));
|
||||||
connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(removeTexture()));
|
connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(removeTexture()));
|
||||||
}
|
}
|
||||||
|
@ -51,7 +52,7 @@ CParticleTextureWidget::~CParticleTextureWidget()
|
||||||
void CParticleTextureWidget::updateUi()
|
void CParticleTextureWidget::updateUi()
|
||||||
{
|
{
|
||||||
nlassert(_Wrapper);
|
nlassert(_Wrapper);
|
||||||
|
|
||||||
_Texture = _Wrapper->get();
|
_Texture = _Wrapper->get();
|
||||||
|
|
||||||
updateTexture();
|
updateTexture();
|
||||||
|
@ -68,11 +69,11 @@ void CParticleTextureWidget::chooseTexture()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open texture file"), texName.c_str(),
|
tr("Open texture file"), texName.c_str(),
|
||||||
tr("Image file (*.tga *.png)"));
|
tr("Image file (*.tga *.png)"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
// Add search path for the texture
|
// Add search path for the texture
|
||||||
NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toStdString()));
|
NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toStdString()));
|
||||||
|
@ -89,7 +90,7 @@ void CParticleTextureWidget::chooseTexture()
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Texture loading error"), e.what(), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Texture loading error"), e.what(), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +109,7 @@ void CParticleTextureWidget::removeTexture()
|
||||||
|
|
||||||
void CParticleTextureWidget::updateTexture()
|
void CParticleTextureWidget::updateTexture()
|
||||||
{
|
{
|
||||||
if (!_Texture)
|
if (!_Texture)
|
||||||
{
|
{
|
||||||
_ui.imageLabel->setPixmap(QPixmap());
|
_ui.imageLabel->setPixmap(QPixmap());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -34,38 +34,45 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CParticleTextureWidget: public QWidget
|
class CParticleTextureWidget: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CParticleTextureWidget(QWidget *parent = 0);
|
CParticleTextureWidget(QWidget *parent = 0);
|
||||||
~CParticleTextureWidget();
|
~CParticleTextureWidget();
|
||||||
|
|
||||||
void updateUi();
|
void updateUi();
|
||||||
|
|
||||||
// set a wrapper to get the datas, called before setCurrentTextureNoAnim
|
// set a wrapper to get the datas, called before setCurrentTextureNoAnim
|
||||||
void setWrapper(IPSWrapperTexture *wrapper) { _Wrapper = wrapper ; }
|
void setWrapper(IPSWrapperTexture *wrapper)
|
||||||
|
{
|
||||||
void enableRemoveButton(bool enabled) { _ui.removePushButton->setVisible(enabled); }
|
_Wrapper = wrapper ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableRemoveButton(bool enabled)
|
||||||
|
{
|
||||||
|
_ui.removePushButton->setVisible(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void textureChanged(const QString &texName);
|
void textureChanged(const QString &texName);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void chooseTexture();
|
void chooseTexture();
|
||||||
void removeTexture();
|
void removeTexture();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateTexture();
|
void updateTexture();
|
||||||
|
|
||||||
IPSWrapperTexture *_Wrapper ;
|
IPSWrapperTexture *_Wrapper ;
|
||||||
|
|
||||||
// the current texture
|
// the current texture
|
||||||
NLMISC::CSmartPtr<NL3D::ITexture> _Texture ;
|
NLMISC::CSmartPtr<NL3D::ITexture> _Texture ;
|
||||||
|
|
||||||
Ui::CParticleTextureWidget _ui;
|
Ui::CParticleTextureWidget _ui;
|
||||||
}; /* class CParticleTextureWidget */
|
}; /* class CParticleTextureWidget */
|
||||||
|
|
||||||
|
|
|
@ -28,46 +28,47 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CParticleTreeItem::CParticleTreeItem(const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
|
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):
|
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);
|
nlassert(ws);
|
||||||
_WS = ws;
|
_WS = ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocated *loc, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
|
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);
|
nlassert(loc);
|
||||||
_Loc = loc;
|
_Loc = loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocated *loc, uint32 index, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
|
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);
|
nlassert(loc);
|
||||||
_Loc = loc;
|
_Loc = loc;
|
||||||
_LocatedInstanceIndex = index;
|
_LocatedInstanceIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleTreeItem::CParticleTreeItem(CWorkspaceNode *node, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
|
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;
|
_PS = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleTreeItem::CParticleTreeItem(NL3D::CPSLocatedBindable *lb, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent):
|
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()
|
CParticleTreeItem::~CParticleTreeItem()
|
||||||
|
@ -113,7 +114,7 @@ CParticleTreeItem *CParticleTreeItem::parent()
|
||||||
int CParticleTreeItem::row() const
|
int CParticleTreeItem::row() const
|
||||||
{
|
{
|
||||||
if (_parentItem)
|
if (_parentItem)
|
||||||
return _parentItem->_childItems.indexOf(const_cast<CParticleTreeItem*>(this));
|
return _parentItem->_childItems.indexOf(const_cast<CParticleTreeItem*>(this));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +161,7 @@ void CParticleTreeItem::setLocatedInstanceIndex(uint32 index)
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticleTreeModel::CParticleTreeModel(QObject *parent)
|
CParticleTreeModel::CParticleTreeModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
QList<QVariant> rootData;
|
QList<QVariant> rootData;
|
||||||
rootData << "Name";
|
rootData << "Name";
|
||||||
|
@ -175,27 +176,27 @@ CParticleTreeModel::~CParticleTreeModel()
|
||||||
int CParticleTreeModel::columnCount(const QModelIndex &parent) const
|
int CParticleTreeModel::columnCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return static_cast<CParticleTreeItem*>(parent.internalPointer())->columnCount();
|
return static_cast<CParticleTreeItem*>(parent.internalPointer())->columnCount();
|
||||||
else
|
else
|
||||||
return _rootItem->columnCount();
|
return _rootItem->columnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
|
QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
||||||
if (item->itemType() == ItemType::ParticleSystem)
|
if (item->itemType() == ItemType::ParticleSystem)
|
||||||
{
|
{
|
||||||
if (item->getNode()->isModified())
|
if (item->getNode()->isModified())
|
||||||
return "*" + item->data(index.column()).toString();
|
return "*" + item->data(index.column()).toString();
|
||||||
}
|
}
|
||||||
if (item->itemType() == ItemType::Workspace)
|
if (item->itemType() == ItemType::Workspace)
|
||||||
{
|
{
|
||||||
if (item->getPW()->isModified())
|
if (item->getPW()->isModified())
|
||||||
return "*" + item->data(index.column()).toString();
|
return "*" + item->data(index.column()).toString();
|
||||||
}
|
}
|
||||||
return item->data(index.column());
|
return item->data(index.column());
|
||||||
|
@ -210,8 +211,8 @@ QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
return QFont("SansSerif", 9, QFont::Normal);
|
return QFont("SansSerif", 9, QFont::Normal);
|
||||||
}
|
}
|
||||||
if (role == Qt::DecorationRole)
|
if (role == Qt::DecorationRole)
|
||||||
return qVariantFromValue(getIcon(index));
|
return qVariantFromValue(getIcon(index));
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -219,78 +220,78 @@ QVariant CParticleTreeModel::data(const QModelIndex &index, int role) const
|
||||||
Qt::ItemFlags CParticleTreeModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags CParticleTreeModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
Qt::ItemFlags itmFlags = Qt::NoItemFlags;
|
Qt::ItemFlags itmFlags = Qt::NoItemFlags;
|
||||||
|
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return itmFlags;
|
return itmFlags;
|
||||||
|
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
||||||
switch (item->itemType())
|
switch (item->itemType())
|
||||||
{
|
{
|
||||||
case ItemType::Particle:
|
case ItemType::Particle:
|
||||||
case ItemType::Emitter:
|
case ItemType::Emitter:
|
||||||
case ItemType::Force:
|
case ItemType::Force:
|
||||||
case ItemType::Light:
|
case ItemType::Light:
|
||||||
case ItemType::Sound:
|
case ItemType::Sound:
|
||||||
case ItemType::Located:
|
case ItemType::Located:
|
||||||
case ItemType::CollisionZone:
|
case ItemType::CollisionZone:
|
||||||
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
|
||||||
break;
|
break;
|
||||||
case ItemType::LocatedInstance:
|
case ItemType::LocatedInstance:
|
||||||
if (Modules::psEdit().isRunning())
|
if (Modules::psEdit().isRunning())
|
||||||
itmFlags = Qt::NoItemFlags;
|
itmFlags = Qt::NoItemFlags;
|
||||||
else
|
else
|
||||||
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CParticleWorkspaceDialog *pwsd = qobject_cast<CParticleWorkspaceDialog*>(QObject::parent());
|
//CParticleWorkspaceDialog *pwsd = qobject_cast<CParticleWorkspaceDialog*>(QObject::parent());
|
||||||
//pwsd->updateTreeView();
|
//pwsd->updateTreeView();
|
||||||
|
|
||||||
return itmFlags;
|
return itmFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CParticleTreeModel::headerData(int section, Qt::Orientation orientation,
|
QVariant CParticleTreeModel::headerData(int section, Qt::Orientation orientation,
|
||||||
int role) const
|
int role) const
|
||||||
{
|
{
|
||||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||||
return _rootItem->data(section);
|
return _rootItem->data(section);
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex CParticleTreeModel::index(int row, int column, const QModelIndex &parent)
|
QModelIndex CParticleTreeModel::index(int row, int column, const QModelIndex &parent)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if (!hasIndex(row, column, parent))
|
if (!hasIndex(row, column, parent))
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
CParticleTreeItem *parentItem;
|
CParticleTreeItem *parentItem;
|
||||||
|
|
||||||
if (!parent.isValid())
|
if (!parent.isValid())
|
||||||
parentItem = _rootItem;
|
parentItem = _rootItem;
|
||||||
else
|
else
|
||||||
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
||||||
|
|
||||||
CParticleTreeItem *childItem = parentItem->child(row);
|
CParticleTreeItem *childItem = parentItem->child(row);
|
||||||
if (childItem)
|
if (childItem)
|
||||||
return createIndex(row, column, childItem);
|
return createIndex(row, column, childItem);
|
||||||
else
|
else
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex CParticleTreeModel::parent(const QModelIndex &index) const
|
QModelIndex CParticleTreeModel::parent(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
CParticleTreeItem *childItem = static_cast<CParticleTreeItem*>(index.internalPointer());
|
CParticleTreeItem *childItem = static_cast<CParticleTreeItem*>(index.internalPointer());
|
||||||
CParticleTreeItem *parentItem = childItem->parent();
|
CParticleTreeItem *parentItem = childItem->parent();
|
||||||
|
|
||||||
if (parentItem == _rootItem)
|
if (parentItem == _rootItem)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
return createIndex(parentItem->row(), 0, parentItem);
|
return createIndex(parentItem->row(), 0, parentItem);
|
||||||
}
|
}
|
||||||
|
@ -299,28 +300,28 @@ int CParticleTreeModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
CParticleTreeItem *parentItem;
|
CParticleTreeItem *parentItem;
|
||||||
if (parent.column() > 0)
|
if (parent.column() > 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!parent.isValid())
|
if (!parent.isValid())
|
||||||
parentItem = _rootItem;
|
parentItem = _rootItem;
|
||||||
else
|
else
|
||||||
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
parentItem = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
||||||
|
|
||||||
return parentItem->childCount();
|
return parentItem->childCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CParticleTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool CParticleTreeModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
if (index.isValid() && role == Qt::EditRole)
|
if (index.isValid() && role == Qt::EditRole)
|
||||||
{
|
{
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
||||||
QList<QVariant> listData;
|
QList<QVariant> listData;
|
||||||
listData << value;
|
listData << value;
|
||||||
item->replace(listData);
|
item->replace(listData);
|
||||||
std::string name = value.toString().toStdString();
|
std::string name = value.toString().toStdString();
|
||||||
if (item->itemType() == ItemType::Located)
|
if (item->itemType() == ItemType::Located)
|
||||||
item->getLoc()->setName(name);
|
item->getLoc()->setName(name);
|
||||||
else
|
else
|
||||||
item->getBind()->setName(name);
|
item->getBind()->setName(name);
|
||||||
Q_EMIT dataChanged(index, index);
|
Q_EMIT dataChanged(index, index);
|
||||||
return true;
|
return true;
|
||||||
|
@ -333,30 +334,30 @@ QIcon CParticleTreeModel::getIcon(const QModelIndex &index) const
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(index.internalPointer());
|
||||||
switch (item->itemType())
|
switch (item->itemType())
|
||||||
{
|
{
|
||||||
case ItemType::Root:
|
case ItemType::Root:
|
||||||
break;
|
break;
|
||||||
case ItemType::Workspace:
|
case ItemType::Workspace:
|
||||||
return QIcon(":/images/Workspace.bmp");
|
return QIcon(":/images/Workspace.bmp");
|
||||||
case ItemType::ParticleSystem:
|
case ItemType::ParticleSystem:
|
||||||
return QIcon(":/images/ParticleSystem.bmp");
|
return QIcon(":/images/ParticleSystem.bmp");
|
||||||
case ItemType::Particle:
|
case ItemType::Particle:
|
||||||
return QIcon(":/images/Particle.bmp");
|
return QIcon(":/images/Particle.bmp");
|
||||||
case ItemType::Emitter:
|
case ItemType::Emitter:
|
||||||
return QIcon(":/images/Emitter.bmp");
|
return QIcon(":/images/Emitter.bmp");
|
||||||
case ItemType::Force:
|
case ItemType::Force:
|
||||||
return QIcon(":/images/Force.bmp");
|
return QIcon(":/images/Force.bmp");
|
||||||
case ItemType::Light:
|
case ItemType::Light:
|
||||||
return QIcon(":/images/Light.bmp");
|
return QIcon(":/images/Light.bmp");
|
||||||
case ItemType::Sound:
|
case ItemType::Sound:
|
||||||
return QIcon(":/images/Sound.bmp");
|
return QIcon(":/images/Sound.bmp");
|
||||||
case ItemType::Located:
|
case ItemType::Located:
|
||||||
return QIcon(":/images/Located.bmp");
|
return QIcon(":/images/Located.bmp");
|
||||||
case ItemType::CollisionZone:
|
case ItemType::CollisionZone:
|
||||||
return QIcon(":/images/CollisionZone.bmp");
|
return QIcon(":/images/CollisionZone.bmp");
|
||||||
case ItemType::LocatedInstance:
|
case ItemType::LocatedInstance:
|
||||||
return QIcon(":/images/LocatedInstance.bmp");
|
return QIcon(":/images/LocatedInstance.bmp");
|
||||||
case ItemType::ParticleSystemNotLoaded:
|
case ItemType::ParticleSystemNotLoaded:
|
||||||
return QIcon(":/images/ParticleSystemNotLoaded.bmp");
|
return QIcon(":/images/ParticleSystemNotLoaded.bmp");
|
||||||
}
|
}
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
@ -364,11 +365,11 @@ QIcon CParticleTreeModel::getIcon(const QModelIndex &index) const
|
||||||
bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QModelIndex &parent)
|
bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
||||||
|
|
||||||
beginInsertRows(parent, position, position);
|
beginInsertRows(parent, position, position);
|
||||||
setupModelFromPS(node, item);
|
setupModelFromPS(node, item);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
if (node->isLoaded())
|
if (node->isLoaded())
|
||||||
{
|
{
|
||||||
QModelIndex indexPS = index(item->childCount() - 1, 0, parent);
|
QModelIndex indexPS = index(item->childCount() - 1, 0, parent);
|
||||||
|
@ -384,9 +385,9 @@ bool CParticleTreeModel::insertRows(CWorkspaceNode *node, int position, const QM
|
||||||
bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const QModelIndex &parent)
|
bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer());
|
||||||
|
|
||||||
beginInsertRows(parent, position, position);
|
beginInsertRows(parent, position, position);
|
||||||
createItemFromLocated(loc, item);
|
createItemFromLocated(loc, item);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
QModelIndex indexLocated = index(item->childCount() - 1, 0, parent);
|
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)
|
bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
beginInsertRows(parent, position, position);
|
beginInsertRows(parent, position, position);
|
||||||
createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem*>(parent.internalPointer()));
|
createItemFromLocatedInstance(loc, index, static_cast<CParticleTreeItem*>(parent.internalPointer()));
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +415,7 @@ bool CParticleTreeModel::insertRow(NL3D::CPSLocatedBindable *lb, int position, c
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent)
|
bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer())->child(position);
|
CParticleTreeItem *item = static_cast<CParticleTreeItem*>(parent.internalPointer())->child(position);
|
||||||
|
@ -422,31 +423,31 @@ bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent)
|
||||||
removeRows(0, parent.child(position, 0));
|
removeRows(0, parent.child(position, 0));
|
||||||
|
|
||||||
beginRemoveRows(parent, position, position);
|
beginRemoveRows(parent, position, position);
|
||||||
static_cast<CParticleTreeItem*>(parent.internalPointer())->deleteChild(position);
|
static_cast<CParticleTreeItem*>(parent.internalPointer())->deleteChild(position);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorkspaceNode *CParticleTreeModel::getOwnerNode(CParticleTreeItem *item) const
|
CWorkspaceNode *CParticleTreeModel::getOwnerNode(CParticleTreeItem *item) const
|
||||||
{
|
{
|
||||||
CWorkspaceNode *node = NULL;
|
CWorkspaceNode *node = NULL;
|
||||||
switch (item->itemType())
|
switch (item->itemType())
|
||||||
{
|
{
|
||||||
case ItemType::ParticleSystem:
|
case ItemType::ParticleSystem:
|
||||||
node = item->getNode();
|
node = item->getNode();
|
||||||
break;
|
break;
|
||||||
case ItemType::Located:
|
case ItemType::Located:
|
||||||
node = item->parent()->getNode();
|
node = item->parent()->getNode();
|
||||||
break;
|
break;
|
||||||
case ItemType::LocatedInstance:
|
case ItemType::LocatedInstance:
|
||||||
case ItemType::Particle:
|
case ItemType::Particle:
|
||||||
case ItemType::Emitter:
|
case ItemType::Emitter:
|
||||||
case ItemType::Force:
|
case ItemType::Force:
|
||||||
case ItemType::Light:
|
case ItemType::Light:
|
||||||
case ItemType::Sound:
|
case ItemType::Sound:
|
||||||
case ItemType::CollisionZone:
|
case ItemType::CollisionZone:
|
||||||
node = item->parent()->parent()->getNode();
|
node = item->parent()->parent()->getNode();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -477,17 +478,17 @@ void CParticleTreeModel::setupModelFromWorkSpace()
|
||||||
QList<QVariant> workspaceData;
|
QList<QVariant> workspaceData;
|
||||||
CParticleWorkspace *workspace = Modules::psEdit().getParticleWorkspace();
|
CParticleWorkspace *workspace = Modules::psEdit().getParticleWorkspace();
|
||||||
|
|
||||||
if (workspace == NULL)
|
if (workspace == NULL)
|
||||||
{
|
{
|
||||||
endResetModel();
|
endResetModel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
workspaceData << workspace->getFilename().c_str();
|
workspaceData << workspace->getFilename().c_str();
|
||||||
CParticleTreeItem *parent = new CParticleTreeItem(workspace ,workspaceData, ItemType::Workspace, _rootItem);
|
CParticleTreeItem *parent = new CParticleTreeItem(workspace ,workspaceData, ItemType::Workspace, _rootItem);
|
||||||
_rootItem->appendChild(parent);
|
_rootItem->appendChild(parent);
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
QModelIndex rootIndex = index(0, 0);
|
QModelIndex rootIndex = index(0, 0);
|
||||||
uint numNode = workspace->getNumNode();
|
uint numNode = workspace->getNumNode();
|
||||||
for (uint i = 0; i < numNode; i++)
|
for (uint i = 0; i < numNode; i++)
|
||||||
|
@ -504,7 +505,7 @@ void CParticleTreeModel::setupModelFromPS(CWorkspaceNode *node, CParticleTreeIte
|
||||||
child = new CParticleTreeItem(node, particleSystemData, ItemType::ParticleSystem, parent);
|
child = new CParticleTreeItem(node, particleSystemData, ItemType::ParticleSystem, parent);
|
||||||
parent->appendChild(child);
|
parent->appendChild(child);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child = new CParticleTreeItem(node, particleSystemData, ItemType::ParticleSystemNotLoaded, parent);
|
child = new CParticleTreeItem(node, particleSystemData, ItemType::ParticleSystemNotLoaded, parent);
|
||||||
parent->appendChild(child);
|
parent->appendChild(child);
|
||||||
|
|
|
@ -34,8 +34,9 @@
|
||||||
// Projects includes
|
// Projects includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
struct ItemType
|
struct ItemType
|
||||||
{
|
{
|
||||||
enum List
|
enum List
|
||||||
|
@ -64,15 +65,15 @@ class CParticleTreeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CParticleTreeItem(const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent = 0);
|
CParticleTreeItem(const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent = 0);
|
||||||
|
|
||||||
CParticleTreeItem(CParticleWorkspace *ws, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent );
|
CParticleTreeItem(CParticleWorkspace *ws, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent );
|
||||||
|
|
||||||
CParticleTreeItem(NL3D::CPSLocated *loc, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
CParticleTreeItem(NL3D::CPSLocated *loc, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
||||||
|
|
||||||
CParticleTreeItem(NL3D::CPSLocated *loc, uint32 index, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
CParticleTreeItem(NL3D::CPSLocated *loc, uint32 index, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
||||||
|
|
||||||
CParticleTreeItem(CWorkspaceNode *node, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
CParticleTreeItem(CWorkspaceNode *node, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
||||||
|
|
||||||
CParticleTreeItem(NL3D::CPSLocatedBindable *lb, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
CParticleTreeItem(NL3D::CPSLocatedBindable *lb, const QList<QVariant> &data, const int typeItem, CParticleTreeItem *parent);
|
||||||
|
|
||||||
~CParticleTreeItem();
|
~CParticleTreeItem();
|
||||||
|
@ -94,7 +95,7 @@ public:
|
||||||
CWorkspaceNode *getNode() const;
|
CWorkspaceNode *getNode() const;
|
||||||
uint32 getLocatedInstanceIndex() const;
|
uint32 getLocatedInstanceIndex() const;
|
||||||
void setLocatedInstanceIndex(uint32 index);
|
void setLocatedInstanceIndex(uint32 index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
@ -103,16 +104,16 @@ private:
|
||||||
NL3D::CPSLocatedBindable *_Bind;
|
NL3D::CPSLocatedBindable *_Bind;
|
||||||
CWorkspaceNode *_PS;
|
CWorkspaceNode *_PS;
|
||||||
};
|
};
|
||||||
|
|
||||||
// for the located instance type, this is the index of the instance
|
// for the located instance type, this is the index of the instance
|
||||||
uint32 _LocatedInstanceIndex;
|
uint32 _LocatedInstanceIndex;
|
||||||
|
|
||||||
QList<CParticleTreeItem*> _childItems;
|
QList<CParticleTreeItem*> _childItems;
|
||||||
QList<QVariant> _itemData;
|
QList<QVariant> _itemData;
|
||||||
int _itemIconType;
|
int _itemIconType;
|
||||||
CParticleTreeItem *_parentItem;
|
CParticleTreeItem *_parentItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CParticleTreeModel
|
@class CParticleTreeModel
|
||||||
@brief Tree model particles workspace.
|
@brief Tree model particles workspace.
|
||||||
|
@ -128,9 +129,9 @@ public:
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation,
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||||||
int role = Qt::DisplayRole) const;
|
int role = Qt::DisplayRole) const;
|
||||||
QModelIndex index(int row, int column,
|
QModelIndex index(int row, int column,
|
||||||
const QModelIndex &parent = QModelIndex()) const;
|
const QModelIndex &parent = QModelIndex()) const;
|
||||||
QModelIndex parent(const QModelIndex &index) const;
|
QModelIndex parent(const QModelIndex &index) const;
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
@ -141,41 +142,41 @@ public:
|
||||||
|
|
||||||
/// Insert WorkspaceNode in model and add all its sub-item.
|
/// Insert WorkspaceNode in model and add all its sub-item.
|
||||||
bool insertRows(CWorkspaceNode *node, int position, const QModelIndex &parent = QModelIndex());
|
bool insertRows(CWorkspaceNode *node, int position, const QModelIndex &parent = QModelIndex());
|
||||||
|
|
||||||
/// Insert Located item in model and add all its sub-item.
|
/// Insert Located item in model and add all its sub-item.
|
||||||
bool insertRows(NL3D::CPSLocated *loc, int position, const QModelIndex &parent = QModelIndex());
|
bool insertRows(NL3D::CPSLocated *loc, int position, const QModelIndex &parent = QModelIndex());
|
||||||
|
|
||||||
/// Insert Located item in model.
|
/// Insert Located item in model.
|
||||||
bool insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent = QModelIndex());
|
bool insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent = QModelIndex());
|
||||||
|
|
||||||
/// Insert LocatedBindable item in model.
|
/// Insert LocatedBindable item in model.
|
||||||
bool insertRow(NL3D::CPSLocatedBindable *lb, int position, const QModelIndex &parent = QModelIndex());
|
bool insertRow(NL3D::CPSLocatedBindable *lb, int position, const QModelIndex &parent = QModelIndex());
|
||||||
|
|
||||||
/// Deletes a tree item and all its children.
|
/// Deletes a tree item and all its children.
|
||||||
bool removeRows(int position, const QModelIndex &parent = QModelIndex());
|
bool removeRows(int position, const QModelIndex &parent = QModelIndex());
|
||||||
|
|
||||||
/// Get the parent node in the workspace for the given element in the tree
|
/// Get the parent node in the workspace for the given element in the tree
|
||||||
CWorkspaceNode *getOwnerNode(CParticleTreeItem *item) const;
|
CWorkspaceNode *getOwnerNode(CParticleTreeItem *item) const;
|
||||||
|
|
||||||
/// Rebuild the located instance in the tree (after loading for example)
|
/// Rebuild the located instance in the tree (after loading for example)
|
||||||
void rebuildLocatedInstance(const QModelIndex &parent);
|
void rebuildLocatedInstance(const QModelIndex &parent);
|
||||||
|
|
||||||
/// Build the whole tree from a workspace
|
/// Build the whole tree from a workspace
|
||||||
void setupModelFromWorkSpace();
|
void setupModelFromWorkSpace();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Build a portion of the tree using the given particle system
|
/// Build a portion of the tree using the given particle system
|
||||||
void setupModelFromPS(CWorkspaceNode *node, CParticleTreeItem *parent);
|
void setupModelFromPS(CWorkspaceNode *node, CParticleTreeItem *parent);
|
||||||
|
|
||||||
/// Add item from the given located
|
/// Add item from the given located
|
||||||
void createItemFromLocated(NL3D::CPSLocated *loc, CParticleTreeItem *parent);
|
void createItemFromLocated(NL3D::CPSLocated *loc, CParticleTreeItem *parent);
|
||||||
|
|
||||||
/// Add item from the given located instance
|
/// Add item from the given located instance
|
||||||
void createItemFromLocatedInstance(NL3D::CPSLocated *loc, uint32 index, CParticleTreeItem *parent);
|
void createItemFromLocatedInstance(NL3D::CPSLocated *loc, uint32 index, CParticleTreeItem *parent);
|
||||||
|
|
||||||
/// Add item from the given located bindable
|
/// Add item from the given located bindable
|
||||||
void createItemFromLocatedBindable(NL3D::CPSLocatedBindable *lb, CParticleTreeItem *parent);
|
void createItemFromLocatedBindable(NL3D::CPSLocatedBindable *lb, CParticleTreeItem *parent);
|
||||||
|
|
||||||
CParticleTreeItem *_rootItem;
|
CParticleTreeItem *_rootItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,11 @@
|
||||||
#include "dup_ps.h"
|
#include "dup_ps.h"
|
||||||
#include "modules.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("Point"),
|
||||||
QT_TR_NOOP("LookAt"),
|
QT_TR_NOOP("LookAt"),
|
||||||
QT_TR_NOOP("FanLight"),
|
QT_TR_NOOP("FanLight"),
|
||||||
|
@ -121,13 +123,13 @@ struct Action
|
||||||
static std::map<std::string, uint> _PSElementIdentifiers;
|
static std::map<std::string, uint> _PSElementIdentifiers;
|
||||||
|
|
||||||
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||||
: QDockWidget(parent), _currentItem(NULL)
|
: QDockWidget(parent), _currentItem(NULL)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
connect(_ui.treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(clickedItem(QModelIndex)));
|
connect(_ui.treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(clickedItem(QModelIndex)));
|
||||||
connect(_ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenu()));
|
connect(_ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenu()));
|
||||||
|
|
||||||
// Init tree model
|
// Init tree model
|
||||||
_treeModel = new CParticleTreeModel(this);
|
_treeModel = new CParticleTreeModel(this);
|
||||||
_ui.treeView->setModel(_treeModel);
|
_ui.treeView->setModel(_treeModel);
|
||||||
|
@ -136,14 +138,14 @@ CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||||
_PropertyDialog = new CPropertyDialog(_treeModel, this);
|
_PropertyDialog = new CPropertyDialog(_treeModel, this);
|
||||||
|
|
||||||
_signalMapper = new QSignalMapper(this);
|
_signalMapper = new QSignalMapper(this);
|
||||||
|
|
||||||
_setActivePSAction = new QAction(tr("Set as active particle system"), this);
|
_setActivePSAction = new QAction(tr("Set as active particle system"), this);
|
||||||
_savePSAction = new QAction(tr("Save"), this);
|
_savePSAction = new QAction(tr("Save"), this);
|
||||||
_saveAsPSAction = new QAction(tr("Save as"), this);
|
_saveAsPSAction = new QAction(tr("Save as"), this);
|
||||||
_clearContentAction = new QAction(tr("Clear content"), this);
|
_clearContentAction = new QAction(tr("Clear content"), this);
|
||||||
_removeFromWSAction = new QAction(tr("Remove from workspace"), this);
|
_removeFromWSAction = new QAction(tr("Remove from workspace"), this);
|
||||||
_mergeAction = new QAction(tr("Merge"), this);
|
_mergeAction = new QAction(tr("Merge"), this);
|
||||||
|
|
||||||
_newLocatedAction = new QAction(tr("New located"), this);
|
_newLocatedAction = new QAction(tr("New located"), this);
|
||||||
_pasteLocatedAction = new QAction(tr("Paste located"), this);
|
_pasteLocatedAction = new QAction(tr("Paste located"), this);
|
||||||
|
|
||||||
|
@ -151,13 +153,13 @@ CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||||
_bindNewLocatedBindable[i] = new QAction(tr(LocatedBindable[i]), this);
|
_bindNewLocatedBindable[i] = new QAction(tr(LocatedBindable[i]), this);
|
||||||
|
|
||||||
_forceZBiasAction = new QAction(tr("Force ZBias"), this);
|
_forceZBiasAction = new QAction(tr("Force ZBias"), this);
|
||||||
|
|
||||||
_instanciateAction = new QAction(tr("Instanciate"), this);
|
_instanciateAction = new QAction(tr("Instanciate"), this);
|
||||||
_copyLocatedAction = new QAction(tr("Copy located"), this);
|
_copyLocatedAction = new QAction(tr("Copy located"), this);
|
||||||
_copyBindableAction = new QAction(tr("Copy bindable"), this);
|
_copyBindableAction = new QAction(tr("Copy bindable"), this);
|
||||||
_pasteBindableAction = new QAction(tr("Paste bindable"), this);
|
_pasteBindableAction = new QAction(tr("Paste bindable"), this);
|
||||||
_deleteAction = new QAction(tr("Delete"), this);
|
_deleteAction = new QAction(tr("Delete"), this);
|
||||||
|
|
||||||
_allLODAction = new QAction(tr("All LOD"), this);
|
_allLODAction = new QAction(tr("All LOD"), this);
|
||||||
_allLODAction->setCheckable(true);
|
_allLODAction->setCheckable(true);
|
||||||
_lod1Action = new QAction(tr("LOD 1"), this);
|
_lod1Action = new QAction(tr("LOD 1"), this);
|
||||||
|
@ -165,7 +167,7 @@ CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||||
_lod2Action = new QAction(tr("LOD 2"), this);
|
_lod2Action = new QAction(tr("LOD 2"), this);
|
||||||
_lod2Action->setCheckable(true);
|
_lod2Action->setCheckable(true);
|
||||||
_externIDAction = new QAction(tr("extern ID"), this);
|
_externIDAction = new QAction(tr("extern ID"), this);
|
||||||
|
|
||||||
connect(_setActivePSAction, SIGNAL(triggered()), this, SLOT(setActiveNode()));
|
connect(_setActivePSAction, SIGNAL(triggered()), this, SLOT(setActiveNode()));
|
||||||
connect(_savePSAction, SIGNAL(triggered()), this, SLOT(savePS()));
|
connect(_savePSAction, SIGNAL(triggered()), this, SLOT(savePS()));
|
||||||
connect(_saveAsPSAction, SIGNAL(triggered()), this, SLOT(saveAsPS()));
|
connect(_saveAsPSAction, SIGNAL(triggered()), this, SLOT(saveAsPS()));
|
||||||
|
@ -183,7 +185,7 @@ CParticleWorkspaceDialog::CParticleWorkspaceDialog(QWidget *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(_forceZBiasAction, SIGNAL(triggered()), this, SLOT(forceZBias()));
|
connect(_forceZBiasAction, SIGNAL(triggered()), this, SLOT(forceZBias()));
|
||||||
|
|
||||||
connect(_copyLocatedAction, SIGNAL(triggered()), this, SLOT(copyLocated()));
|
connect(_copyLocatedAction, SIGNAL(triggered()), this, SLOT(copyLocated()));
|
||||||
connect(_copyBindableAction, SIGNAL(triggered()), this, SLOT(copyBindable()));
|
connect(_copyBindableAction, SIGNAL(triggered()), this, SLOT(copyBindable()));
|
||||||
connect(_pasteBindableAction, SIGNAL(triggered()), this, SLOT(pasteBindable()));
|
connect(_pasteBindableAction, SIGNAL(triggered()), this, SLOT(pasteBindable()));
|
||||||
|
@ -215,14 +217,14 @@ void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index)
|
||||||
{
|
{
|
||||||
if (_currentItem != NULL)
|
if (_currentItem != NULL)
|
||||||
_treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL);
|
_treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL);
|
||||||
|
|
||||||
_currentItem = static_cast<CParticleTreeItem*>(index.internalPointer());
|
_currentItem = static_cast<CParticleTreeItem*>(index.internalPointer());
|
||||||
|
|
||||||
if (index.flags() != Qt::NoItemFlags)
|
if (index.flags() != Qt::NoItemFlags)
|
||||||
_PropertyDialog->setCurrentEditedElement(_currentItem);
|
_PropertyDialog->setCurrentEditedElement(_currentItem);
|
||||||
|
|
||||||
if ((_currentItem->itemType() == ItemType::Workspace) ||
|
if ((_currentItem->itemType() == ItemType::Workspace) ||
|
||||||
(_currentItem->itemType() == ItemType::ParticleSystemNotLoaded))
|
(_currentItem->itemType() == ItemType::ParticleSystemNotLoaded))
|
||||||
_currentItem = NULL;
|
_currentItem = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,56 +236,56 @@ void CParticleWorkspaceDialog::customContextMenu()
|
||||||
QMenu *popurMenu = new QMenu(this);
|
QMenu *popurMenu = new QMenu(this);
|
||||||
switch (_currentItem->itemType())
|
switch (_currentItem->itemType())
|
||||||
{
|
{
|
||||||
case ItemType::ParticleSystem:
|
case ItemType::ParticleSystem:
|
||||||
popurMenu->addAction(_setActivePSAction);
|
popurMenu->addAction(_setActivePSAction);
|
||||||
popurMenu->addAction(_savePSAction);
|
popurMenu->addAction(_savePSAction);
|
||||||
popurMenu->addAction(_saveAsPSAction);
|
popurMenu->addAction(_saveAsPSAction);
|
||||||
popurMenu->addAction(_clearContentAction);
|
popurMenu->addAction(_clearContentAction);
|
||||||
popurMenu->addAction(_removeFromWSAction);
|
popurMenu->addAction(_removeFromWSAction);
|
||||||
popurMenu->addAction(_mergeAction);
|
popurMenu->addAction(_mergeAction);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
popurMenu->addAction(_newLocatedAction);
|
popurMenu->addAction(_newLocatedAction);
|
||||||
popurMenu->addAction(_pasteLocatedAction);
|
popurMenu->addAction(_pasteLocatedAction);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
buildMenu(popurMenu);
|
buildMenu(popurMenu);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
popurMenu->addAction(_forceZBiasAction);
|
popurMenu->addAction(_forceZBiasAction);
|
||||||
break;
|
break;
|
||||||
case ItemType::Located:
|
case ItemType::Located:
|
||||||
popurMenu->addAction(_instanciateAction);
|
popurMenu->addAction(_instanciateAction);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
buildMenu(popurMenu);
|
buildMenu(popurMenu);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
popurMenu->addAction(_copyLocatedAction);
|
popurMenu->addAction(_copyLocatedAction);
|
||||||
popurMenu->addAction(_pasteBindableAction);
|
popurMenu->addAction(_pasteBindableAction);
|
||||||
popurMenu->addAction(_deleteAction);
|
popurMenu->addAction(_deleteAction);
|
||||||
break;
|
break;
|
||||||
case ItemType::Force:
|
case ItemType::Force:
|
||||||
case ItemType::Particle:
|
case ItemType::Particle:
|
||||||
case ItemType::Emitter:
|
case ItemType::Emitter:
|
||||||
case ItemType::Light:
|
case ItemType::Light:
|
||||||
case ItemType::CollisionZone:
|
case ItemType::CollisionZone:
|
||||||
case ItemType::Sound:
|
case ItemType::Sound:
|
||||||
popurMenu->addAction(_copyBindableAction);
|
popurMenu->addAction(_copyBindableAction);
|
||||||
popurMenu->addAction(_deleteAction);
|
popurMenu->addAction(_deleteAction);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
popurMenu->addAction(_allLODAction);
|
popurMenu->addAction(_allLODAction);
|
||||||
popurMenu->addAction(_lod1Action);
|
popurMenu->addAction(_lod1Action);
|
||||||
popurMenu->addAction(_lod2Action);
|
popurMenu->addAction(_lod2Action);
|
||||||
popurMenu->addSeparator();
|
popurMenu->addSeparator();
|
||||||
popurMenu->addAction(_externIDAction);
|
popurMenu->addAction(_externIDAction);
|
||||||
|
|
||||||
// check the menu to tell which lod is used for this located bindable
|
// check the menu to tell which lod is used for this located bindable
|
||||||
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1n2) _allLODAction->setChecked(true);
|
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1n2) _allLODAction->setChecked(true);
|
||||||
else _allLODAction->setChecked(false);
|
else _allLODAction->setChecked(false);
|
||||||
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1) _lod1Action->setChecked(true);
|
if (_currentItem->getBind()->getLOD() == NL3D::PSLod1) _lod1Action->setChecked(true);
|
||||||
else _lod1Action->setChecked(false);
|
else _lod1Action->setChecked(false);
|
||||||
if (_currentItem->getBind()->getLOD() == NL3D::PSLod2) _lod2Action->setChecked(true);
|
if (_currentItem->getBind()->getLOD() == NL3D::PSLod2) _lod2Action->setChecked(true);
|
||||||
else _lod2Action->setChecked(false);
|
else _lod2Action->setChecked(false);
|
||||||
break;
|
break;
|
||||||
case ItemType::LocatedInstance:
|
case ItemType::LocatedInstance:
|
||||||
popurMenu->addAction(_deleteAction);
|
popurMenu->addAction(_deleteAction);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stopped = Modules::psEdit().getState() == CParticleEditor::State::Stopped ? true : false;
|
bool stopped = Modules::psEdit().getState() == CParticleEditor::State::Stopped ? true : false;
|
||||||
|
@ -319,21 +321,21 @@ void CParticleWorkspaceDialog::saveAsPS()
|
||||||
//if (nt->PS->getResetAutoCountFlag() && nt->PS->getPSPointer()->getAutoCountFlag())
|
//if (nt->PS->getResetAutoCountFlag() && nt->PS->getPSPointer()->getAutoCountFlag())
|
||||||
if (node->getPSPointer()->getAutoCountFlag())
|
if (node->getPSPointer()->getAutoCountFlag())
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
QMessageBox::critical(this, tr("NeL particle system editor"),
|
||||||
QString(node->getFilename().c_str()) + tr(" uses auto count feature, and it has been modified. "
|
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. "
|
"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. "),
|
"If user params are used to modify system aspect, you should run the system for extreme cases before saving. "),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Modules::psEdit().stop();
|
Modules::psEdit().stop();
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as ps file"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as ps file"),
|
||||||
".",
|
".",
|
||||||
tr("ps files (*.ps)"));
|
tr("ps files (*.ps)"));
|
||||||
// after check
|
// after check
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
node->savePSAs(fileName.toStdString());
|
node->savePSAs(fileName.toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,8 +343,8 @@ void CParticleWorkspaceDialog::saveAsPS()
|
||||||
void CParticleWorkspaceDialog::clearContent()
|
void CParticleWorkspaceDialog::clearContent()
|
||||||
{
|
{
|
||||||
int ret = QMessageBox::question(this, tr("NeL particle system editor"),
|
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)
|
if (ret == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
CWorkspaceNode *node = _treeModel->getOwnerNode(_currentItem);
|
CWorkspaceNode *node = _treeModel->getOwnerNode(_currentItem);
|
||||||
|
@ -383,7 +385,7 @@ void CParticleWorkspaceDialog::pasteLocated()
|
||||||
_treeModel->getOwnerNode(_currentItem)->setModified(true);
|
_treeModel->getOwnerNode(_currentItem)->setModified(true);
|
||||||
|
|
||||||
Modules::psEdit().resetAutoCount(_treeModel->getOwnerNode(_currentItem));
|
Modules::psEdit().resetAutoCount(_treeModel->getOwnerNode(_currentItem));
|
||||||
|
|
||||||
NL3D::CPSLocated *copy = dynamic_cast<NL3D::CPSLocated *>(::DupPSLocated(_LocatedCopy.get()));
|
NL3D::CPSLocated *copy = dynamic_cast<NL3D::CPSLocated *>(::DupPSLocated(_LocatedCopy.get()));
|
||||||
if (!copy) return;
|
if (!copy) return;
|
||||||
if (_currentItem->getNode()->getPSPointer()->attach(copy))
|
if (_currentItem->getNode()->getPSPointer()->attach(copy))
|
||||||
|
@ -391,10 +393,10 @@ void CParticleWorkspaceDialog::pasteLocated()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete copy;
|
delete copy;
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
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', "
|
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."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,101 +405,101 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
|
||||||
NL3D::CPSLocatedBindable *toCreate = NULL;
|
NL3D::CPSLocatedBindable *toCreate = NULL;
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case Action::ParticlePoint:
|
case Action::ParticlePoint:
|
||||||
toCreate = new NL3D::CPSDot;
|
toCreate = new NL3D::CPSDot;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleLookAt:
|
case Action::ParticleLookAt:
|
||||||
toCreate = new NL3D::CPSFaceLookAt;
|
toCreate = new NL3D::CPSFaceLookAt;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleFanLight:
|
case Action::ParticleFanLight:
|
||||||
toCreate = new NL3D::CPSFanLight;
|
toCreate = new NL3D::CPSFanLight;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleRibbon:
|
case Action::ParticleRibbon:
|
||||||
toCreate = new NL3D::CPSRibbon;
|
toCreate = new NL3D::CPSRibbon;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleTailDot:
|
case Action::ParticleTailDot:
|
||||||
toCreate = new NL3D::CPSTailDot;
|
toCreate = new NL3D::CPSTailDot;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleMesh:
|
case Action::ParticleMesh:
|
||||||
toCreate = new NL3D::CPSMesh;
|
toCreate = new NL3D::CPSMesh;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleConstraintMesh:
|
case Action::ParticleConstraintMesh:
|
||||||
toCreate = new NL3D::CPSConstraintMesh;
|
toCreate = new NL3D::CPSConstraintMesh;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleFace:
|
case Action::ParticleFace:
|
||||||
toCreate = new NL3D::CPSFace;
|
toCreate = new NL3D::CPSFace;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleShockWave:
|
case Action::ParticleShockWave:
|
||||||
toCreate = new NL3D::CPSShockWave;
|
toCreate = new NL3D::CPSShockWave;
|
||||||
break;
|
break;
|
||||||
case Action::ParticleRibbonLookAt:
|
case Action::ParticleRibbonLookAt:
|
||||||
toCreate = new NL3D::CPSRibbonLookAt;
|
toCreate = new NL3D::CPSRibbonLookAt;
|
||||||
break;
|
break;
|
||||||
case Action::ForceGravity:
|
case Action::ForceGravity:
|
||||||
toCreate = new NL3D::CPSGravity;
|
toCreate = new NL3D::CPSGravity;
|
||||||
break;
|
break;
|
||||||
case Action::ForceDirectional:
|
case Action::ForceDirectional:
|
||||||
toCreate = new NL3D::CPSDirectionnalForce;
|
toCreate = new NL3D::CPSDirectionnalForce;
|
||||||
break;
|
break;
|
||||||
case Action::ForceSpring:
|
case Action::ForceSpring:
|
||||||
toCreate = new NL3D::CPSSpring;
|
toCreate = new NL3D::CPSSpring;
|
||||||
break;
|
break;
|
||||||
case Action::ForceFlyidFriction:
|
case Action::ForceFlyidFriction:
|
||||||
toCreate = new NL3D::CPSFluidFriction;
|
toCreate = new NL3D::CPSFluidFriction;
|
||||||
break;
|
break;
|
||||||
case Action::ForceCentralGravity:
|
case Action::ForceCentralGravity:
|
||||||
toCreate = new NL3D::CPSCentralGravity;
|
toCreate = new NL3D::CPSCentralGravity;
|
||||||
break;
|
break;
|
||||||
case Action::ForceCylindricVortex:
|
case Action::ForceCylindricVortex:
|
||||||
toCreate = new NL3D::CPSCylindricVortex;
|
toCreate = new NL3D::CPSCylindricVortex;
|
||||||
break;
|
break;
|
||||||
case Action::ForceBrownianMove:
|
case Action::ForceBrownianMove:
|
||||||
toCreate = new NL3D::CPSBrownianForce;
|
toCreate = new NL3D::CPSBrownianForce;
|
||||||
break;
|
break;
|
||||||
case Action::ForceMagnetic:
|
case Action::ForceMagnetic:
|
||||||
toCreate = new NL3D::CPSMagneticForce;
|
toCreate = new NL3D::CPSMagneticForce;
|
||||||
break;
|
break;
|
||||||
case Action::ZonePlane:
|
case Action::ZonePlane:
|
||||||
toCreate = new NL3D::CPSZonePlane;
|
toCreate = new NL3D::CPSZonePlane;
|
||||||
break;
|
break;
|
||||||
case Action::ZoneSphere:
|
case Action::ZoneSphere:
|
||||||
toCreate = new NL3D::CPSZoneSphere;
|
toCreate = new NL3D::CPSZoneSphere;
|
||||||
break;
|
break;
|
||||||
case Action::ZoneRectangle:
|
case Action::ZoneRectangle:
|
||||||
toCreate = new NL3D::CPSZoneRectangle;
|
toCreate = new NL3D::CPSZoneRectangle;
|
||||||
break;
|
break;
|
||||||
case Action::ZoneDisc:
|
case Action::ZoneDisc:
|
||||||
toCreate = new NL3D::CPSZoneDisc;
|
toCreate = new NL3D::CPSZoneDisc;
|
||||||
break;
|
break;
|
||||||
case Action::ZoneCylinder:
|
case Action::ZoneCylinder:
|
||||||
toCreate = new NL3D::CPSZoneCylinder;
|
toCreate = new NL3D::CPSZoneCylinder;
|
||||||
break;
|
break;
|
||||||
case Action::EmitterDirectional:
|
case Action::EmitterDirectional:
|
||||||
toCreate = new NL3D::CPSEmitterDirectionnal;
|
toCreate = new NL3D::CPSEmitterDirectionnal;
|
||||||
break;
|
break;
|
||||||
case Action::EmitterOmniDirectional:
|
case Action::EmitterOmniDirectional:
|
||||||
toCreate = new NL3D::CPSEmitterOmni;
|
toCreate = new NL3D::CPSEmitterOmni;
|
||||||
break;
|
break;
|
||||||
case Action::EmitterRectangle:
|
case Action::EmitterRectangle:
|
||||||
toCreate = new NL3D::CPSEmitterRectangle;
|
toCreate = new NL3D::CPSEmitterRectangle;
|
||||||
break;
|
break;
|
||||||
case Action::EmitterConic:
|
case Action::EmitterConic:
|
||||||
toCreate = new NL3D::CPSEmitterConic;
|
toCreate = new NL3D::CPSEmitterConic;
|
||||||
break;
|
break;
|
||||||
case Action::EmitterSpherical:
|
case Action::EmitterSpherical:
|
||||||
toCreate = new NL3D::CPSSphericalEmitter;
|
toCreate = new NL3D::CPSSphericalEmitter;
|
||||||
break;
|
break;
|
||||||
case Action::EmitterRadial:
|
case Action::EmitterRadial:
|
||||||
toCreate = new NL3D::CPSRadialEmitter;
|
toCreate = new NL3D::CPSRadialEmitter;
|
||||||
break;
|
break;
|
||||||
case Action::Sound:
|
case Action::Sound:
|
||||||
toCreate = new NL3D::CPSSound;
|
toCreate = new NL3D::CPSSound;
|
||||||
if (!Modules::psEdit().isRunning())
|
if (!Modules::psEdit().isRunning())
|
||||||
(static_cast<NL3D::CPSSound *>(toCreate))->stopSound();
|
(static_cast<NL3D::CPSSound *>(toCreate))->stopSound();
|
||||||
break;
|
break;
|
||||||
case Action::Light:
|
case Action::Light:
|
||||||
toCreate = new NL3D::CPSLight;
|
toCreate = new NL3D::CPSLight;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_treeModel->getOwnerNode(_currentItem)->setModified(true);
|
_treeModel->getOwnerNode(_currentItem)->setModified(true);
|
||||||
|
@ -510,7 +512,7 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
|
||||||
if (_treeModel->getOwnerNode(_currentItem)->getPSPointer()->getBypassMaxNumIntegrationSteps())
|
if (_treeModel->getOwnerNode(_currentItem)->getPSPointer()->getBypassMaxNumIntegrationSteps())
|
||||||
{
|
{
|
||||||
if (toCreate->getType() == NL3D::PSParticle || toCreate->getType() == NL3D::PSEmitter)
|
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
|
// object must have finite duration with that flag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,10 +521,10 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
|
||||||
|
|
||||||
if (!loc->bind(toCreate))
|
if (!loc->bind(toCreate))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
QMessageBox::critical(this, tr("NeL particle system editor"),
|
||||||
tr("The system is flagged with 'No max Nb steps', or uses the preset 'Spell FX'."
|
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."),
|
"System must have finite duration. Can't add object. To solve this, set a limited life time for the father."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
delete toCreate;
|
delete toCreate;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -535,7 +537,7 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
|
||||||
toCreate->setName(name);
|
toCreate->setName(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_PSElementIdentifiers[toCreate->getName()] = 0;
|
_PSElementIdentifiers[toCreate->getName()] = 0;
|
||||||
toCreate->setName(name + "0");
|
toCreate->setName(name + "0");
|
||||||
}
|
}
|
||||||
|
@ -543,7 +545,7 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id)
|
||||||
touchPSState(_currentItem);
|
touchPSState(_currentItem);
|
||||||
|
|
||||||
Modules::psEdit().resetAutoCount(_treeModel->getOwnerNode(_currentItem));
|
Modules::psEdit().resetAutoCount(_treeModel->getOwnerNode(_currentItem));
|
||||||
|
|
||||||
// update treeView
|
// update treeView
|
||||||
if (_currentItem->itemType() == ItemType::ParticleSystem)
|
if (_currentItem->itemType() == ItemType::ParticleSystem)
|
||||||
{
|
{
|
||||||
|
@ -592,10 +594,10 @@ void CParticleWorkspaceDialog::pasteBindable()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete copy;
|
delete copy;
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
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', "
|
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."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,50 +612,50 @@ void CParticleWorkspaceDialog::deleteItem()
|
||||||
clickedItem(index.parent());
|
clickedItem(index.parent());
|
||||||
switch(item->itemType())
|
switch(item->itemType())
|
||||||
{
|
{
|
||||||
case ItemType::Located:
|
case ItemType::Located:
|
||||||
{
|
{
|
||||||
NL3D::CPSLocated *loc = item->getLoc();
|
NL3D::CPSLocated *loc = item->getLoc();
|
||||||
touchPSState(item);
|
touchPSState(item);
|
||||||
ownerNode->setModified(true);
|
ownerNode->setModified(true);
|
||||||
// if the system is running, we must destroy initial infos about the located,
|
// 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
|
// as they won't need to be restored when the stop button will be pressed
|
||||||
ownerNode->removeLocated(loc);
|
ownerNode->removeLocated(loc);
|
||||||
|
|
||||||
Modules::psEdit().resetAutoCount(ownerNode);
|
Modules::psEdit().resetAutoCount(ownerNode);
|
||||||
|
|
||||||
ownerNode->getPSPointer()->remove(loc);
|
ownerNode->getPSPointer()->remove(loc);
|
||||||
_treeModel->removeRows(index.row(), index.parent());
|
_treeModel->removeRows(index.row(), index.parent());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ItemType::LocatedInstance:
|
case ItemType::LocatedInstance:
|
||||||
{
|
{
|
||||||
Modules::psEdit().resetAutoCount(ownerNode);
|
Modules::psEdit().resetAutoCount(ownerNode);
|
||||||
NL3D::CPSEmitter::setBypassEmitOnDeath(true);
|
NL3D::CPSEmitter::setBypassEmitOnDeath(true);
|
||||||
item->getLoc()->deleteElement(item->getLocatedInstanceIndex());
|
item->getLoc()->deleteElement(item->getLocatedInstanceIndex());
|
||||||
NL3D::CPSEmitter::setBypassEmitOnDeath(false);
|
NL3D::CPSEmitter::setBypassEmitOnDeath(false);
|
||||||
_treeModel->removeRows(index.row(), index.parent());
|
_treeModel->removeRows(index.row(), index.parent());
|
||||||
_treeModel->rebuildLocatedInstance(_ui.treeView->currentIndex());
|
_treeModel->rebuildLocatedInstance(_ui.treeView->currentIndex());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ItemType::Particle:
|
case ItemType::Particle:
|
||||||
case ItemType::Emitter:
|
case ItemType::Emitter:
|
||||||
case ItemType::Force:
|
case ItemType::Force:
|
||||||
case ItemType::Light:
|
case ItemType::Light:
|
||||||
case ItemType::Sound:
|
case ItemType::Sound:
|
||||||
case ItemType::CollisionZone:
|
case ItemType::CollisionZone:
|
||||||
{
|
{
|
||||||
NL3D::CPSLocatedBindable *lb = item->getBind();
|
NL3D::CPSLocatedBindable *lb = item->getBind();
|
||||||
touchPSState(item);
|
touchPSState(item);
|
||||||
// if the system is running, we must destroy initial infos
|
// 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
|
// that what saved about the located bindable, when the start button was pressed, as they won't need
|
||||||
// to be restored
|
// to be restored
|
||||||
ownerNode->removeLocatedBindable(lb);
|
ownerNode->removeLocatedBindable(lb);
|
||||||
ownerNode->setModified(true);
|
ownerNode->setModified(true);
|
||||||
Modules::psEdit().resetAutoCount(ownerNode);
|
Modules::psEdit().resetAutoCount(ownerNode);
|
||||||
lb->getOwner()->remove(lb);
|
lb->getOwner()->remove(lb);
|
||||||
_treeModel->removeRows(index.row(), index.parent());
|
_treeModel->removeRows(index.row(), index.parent());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,12 +664,12 @@ void CParticleWorkspaceDialog::setInstanciate()
|
||||||
_treeModel->getOwnerNode(_currentItem)->setModified(true);
|
_treeModel->getOwnerNode(_currentItem)->setModified(true);
|
||||||
|
|
||||||
Modules::psEdit().resetAutoCount(_treeModel->getOwnerNode(_currentItem));
|
Modules::psEdit().resetAutoCount(_treeModel->getOwnerNode(_currentItem));
|
||||||
|
|
||||||
if (_currentItem->getLoc()->getSize() == _currentItem->getLoc()->getMaxSize())
|
if (_currentItem->getLoc()->getSize() == _currentItem->getLoc()->getMaxSize())
|
||||||
_currentItem->getLoc()->resize(_currentItem->getLoc()->getMaxSize() + 1);
|
_currentItem->getLoc()->resize(_currentItem->getLoc()->getMaxSize() + 1);
|
||||||
|
|
||||||
sint32 objIndex = _currentItem->getLoc()->newElement(NLMISC::CVector::Null, NLMISC::CVector::Null,
|
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());
|
_treeModel->insertRow(_currentItem->getLoc(), objIndex, _currentItem->childCount(), _ui.treeView->currentIndex());
|
||||||
}
|
}
|
||||||
|
@ -694,8 +696,8 @@ void CParticleWorkspaceDialog::setExternID()
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int i = QInputDialog::getInt(this, tr("Set the extern ID"),
|
int i = QInputDialog::getInt(this, tr("Set the extern ID"),
|
||||||
tr("0 means no extern access."),
|
tr("0 means no extern access."),
|
||||||
_currentItem->getBind()->getExternID(), 0, 9999, 1, &ok);
|
_currentItem->getBind()->getExternID(), 0, 9999, 1, &ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
_currentItem->getBind()->setExternID(uint32(i));
|
_currentItem->getBind()->setExternID(uint32(i));
|
||||||
|
@ -727,7 +729,7 @@ void CParticleWorkspaceDialog::buildMenu(QMenu *menu)
|
||||||
menu->addAction(bindParticleMenu->menuAction());
|
menu->addAction(bindParticleMenu->menuAction());
|
||||||
for(int i = Action::ParticlePoint; i <= Action::ParticleRibbonLookAt; ++i)
|
for(int i = Action::ParticlePoint; i <= Action::ParticleRibbonLookAt; ++i)
|
||||||
bindParticleMenu->addAction(_bindNewLocatedBindable[i]);
|
bindParticleMenu->addAction(_bindNewLocatedBindable[i]);
|
||||||
|
|
||||||
QMenu *bindForceMenu = new QMenu(tr("Bind force..."), menu);
|
QMenu *bindForceMenu = new QMenu(tr("Bind force..."), menu);
|
||||||
menu->addAction(bindForceMenu->menuAction());
|
menu->addAction(bindForceMenu->menuAction());
|
||||||
for(int i = Action::ForceGravity; i <= Action::ForceMagnetic; ++i)
|
for(int i = Action::ForceGravity; i <= Action::ForceMagnetic; ++i)
|
||||||
|
@ -750,7 +752,7 @@ void CParticleWorkspaceDialog::buildMenu(QMenu *menu)
|
||||||
NL3D::CPSLocated *CParticleWorkspaceDialog::createLocated(NL3D::CParticleSystem *ps)
|
NL3D::CPSLocated *CParticleWorkspaceDialog::createLocated(NL3D::CParticleSystem *ps)
|
||||||
{
|
{
|
||||||
// build new name
|
// build new name
|
||||||
std::string name;
|
std::string name;
|
||||||
if (_PSElementIdentifiers.count(std::string("located")))
|
if (_PSElementIdentifiers.count(std::string("located")))
|
||||||
name = (QString("located %1").arg(++_PSElementIdentifiers[std::string("located")])).toStdString();
|
name = (QString("located %1").arg(++_PSElementIdentifiers[std::string("located")])).toStdString();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
#include "particle_tree_model.h"
|
#include "particle_tree_model.h"
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class ParticleWorkspaceDialog
|
@class ParticleWorkspaceDialog
|
||||||
|
@ -46,18 +47,21 @@ class CParticleWorkspaceDialog: public QDockWidget
|
||||||
public:
|
public:
|
||||||
CParticleWorkspaceDialog(QWidget *parent = 0);
|
CParticleWorkspaceDialog(QWidget *parent = 0);
|
||||||
~CParticleWorkspaceDialog();
|
~CParticleWorkspaceDialog();
|
||||||
|
|
||||||
void touchPSState(CParticleTreeItem *item);
|
void touchPSState(CParticleTreeItem *item);
|
||||||
CPropertyDialog *getPropertyDialog() const { return _PropertyDialog; }
|
CPropertyDialog *getPropertyDialog() const
|
||||||
|
{
|
||||||
|
return _PropertyDialog;
|
||||||
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/// Emits change active particle system node.
|
/// Emits change active particle system node.
|
||||||
void changeActiveNode();
|
void changeActiveNode();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void clickedItem(const QModelIndex & index);
|
void clickedItem(const QModelIndex & index);
|
||||||
void customContextMenu();
|
void customContextMenu();
|
||||||
|
|
||||||
void setActiveNode();
|
void setActiveNode();
|
||||||
void savePS();
|
void savePS();
|
||||||
void saveAsPS();
|
void saveAsPS();
|
||||||
|
@ -71,32 +75,32 @@ private Q_SLOTS:
|
||||||
void bindNewLocatedBindable(int id);
|
void bindNewLocatedBindable(int id);
|
||||||
|
|
||||||
void forceZBias();
|
void forceZBias();
|
||||||
|
|
||||||
void copyLocated();
|
void copyLocated();
|
||||||
void copyBindable();
|
void copyBindable();
|
||||||
void pasteBindable();
|
void pasteBindable();
|
||||||
void deleteItem();
|
void deleteItem();
|
||||||
|
|
||||||
void setInstanciate();
|
void setInstanciate();
|
||||||
void setAllLOD();
|
void setAllLOD();
|
||||||
void setLOD1();
|
void setLOD1();
|
||||||
void setLOD2();
|
void setLOD2();
|
||||||
|
|
||||||
void setExternID();
|
void setExternID();
|
||||||
|
|
||||||
void setNewState();
|
void setNewState();
|
||||||
|
|
||||||
void updateTreeView();
|
void updateTreeView();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buildMenu(QMenu *menu);
|
void buildMenu(QMenu *menu);
|
||||||
NL3D::CPSLocated *createLocated(NL3D::CParticleSystem *ps);
|
NL3D::CPSLocated *createLocated(NL3D::CParticleSystem *ps);
|
||||||
|
|
||||||
CPropertyDialog *_PropertyDialog;
|
CPropertyDialog *_PropertyDialog;
|
||||||
CParticleTreeModel *_treeModel;
|
CParticleTreeModel *_treeModel;
|
||||||
|
|
||||||
QSignalMapper *_signalMapper;
|
QSignalMapper *_signalMapper;
|
||||||
|
|
||||||
QAction *_setActivePSAction;
|
QAction *_setActivePSAction;
|
||||||
QAction *_savePSAction;
|
QAction *_savePSAction;
|
||||||
QAction *_saveAsPSAction;
|
QAction *_saveAsPSAction;
|
||||||
|
@ -107,23 +111,23 @@ private:
|
||||||
QAction *_pasteLocatedAction;
|
QAction *_pasteLocatedAction;
|
||||||
QAction *_bindNewLocatedBindable[32];
|
QAction *_bindNewLocatedBindable[32];
|
||||||
QAction *_forceZBiasAction;
|
QAction *_forceZBiasAction;
|
||||||
|
|
||||||
QAction *_instanciateAction;
|
QAction *_instanciateAction;
|
||||||
QAction *_copyLocatedAction;
|
QAction *_copyLocatedAction;
|
||||||
QAction *_copyBindableAction;
|
QAction *_copyBindableAction;
|
||||||
QAction *_pasteBindableAction;
|
QAction *_pasteBindableAction;
|
||||||
QAction *_deleteAction;
|
QAction *_deleteAction;
|
||||||
|
|
||||||
QAction *_allLODAction;
|
QAction *_allLODAction;
|
||||||
QAction *_lod1Action;
|
QAction *_lod1Action;
|
||||||
QAction *_lod2Action;
|
QAction *_lod2Action;
|
||||||
QAction *_externIDAction;
|
QAction *_externIDAction;
|
||||||
|
|
||||||
std::auto_ptr<NL3D::CPSLocated> _LocatedCopy;
|
std::auto_ptr<NL3D::CPSLocated> _LocatedCopy;
|
||||||
std::auto_ptr<NL3D::CPSLocatedBindable> _LocatedBindableCopy;
|
std::auto_ptr<NL3D::CPSLocatedBindable> _LocatedBindableCopy;
|
||||||
|
|
||||||
CParticleTreeItem *_currentItem;
|
CParticleTreeItem *_currentItem;
|
||||||
|
|
||||||
Ui::CParticleWorkspaceDialog _ui;
|
Ui::CParticleWorkspaceDialog _ui;
|
||||||
friend class CMainWindow;
|
friend class CMainWindow;
|
||||||
}; /* class CParticleWorkspaceDialog */
|
}; /* class CParticleWorkspaceDialog */
|
||||||
|
|
|
@ -24,19 +24,20 @@
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CWorkspacePage::CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent)
|
CWorkspacePage::CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_treeModel = treeModel;
|
_treeModel = treeModel;
|
||||||
|
|
||||||
connect(_ui.newToolButton, SIGNAL(clicked()), this, SLOT(newWP()));
|
connect(_ui.newToolButton, SIGNAL(clicked()), this, SLOT(newWP()));
|
||||||
|
@ -57,9 +58,9 @@ void CWorkspacePage::newWP()
|
||||||
//checkModifiedWorkSpace();
|
//checkModifiedWorkSpace();
|
||||||
// ask name of the new workspace to create
|
// ask name of the new workspace to create
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Create new pws file"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Create new pws file"),
|
||||||
".",
|
".",
|
||||||
tr("pws files (*.pws)"));
|
tr("pws files (*.pws)"));
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
Modules::psEdit().createNewWorkspace(fileName.toStdString());
|
Modules::psEdit().createNewWorkspace(fileName.toStdString());
|
||||||
_treeModel->setupModelFromWorkSpace();
|
_treeModel->setupModelFromWorkSpace();
|
||||||
|
@ -75,11 +76,11 @@ void CWorkspacePage::loadWP()
|
||||||
{
|
{
|
||||||
//checkModifiedWorkSpace();
|
//checkModifiedWorkSpace();
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open NeL data file"), ".",
|
tr("Open NeL data file"), ".",
|
||||||
tr("Particle Workspace file (*.pws);;"));
|
tr("Particle Workspace file (*.pws);;"));
|
||||||
|
|
||||||
setCursor(Qt::WaitCursor);
|
setCursor(Qt::WaitCursor);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
Modules::psEdit().loadWorkspace(fileName.toStdString());
|
Modules::psEdit().loadWorkspace(fileName.toStdString());
|
||||||
_treeModel->setupModelFromWorkSpace();
|
_treeModel->setupModelFromWorkSpace();
|
||||||
|
@ -102,9 +103,9 @@ void CWorkspacePage::saveWP()
|
||||||
void CWorkspacePage::saveAsWP()
|
void CWorkspacePage::saveAsWP()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as pws file"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as pws file"),
|
||||||
".",
|
".",
|
||||||
tr("pws files (*.pws)"));
|
tr("pws files (*.pws)"));
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
Modules::psEdit().getParticleWorkspace()->setFileName(fileName.toStdString());
|
Modules::psEdit().getParticleWorkspace()->setFileName(fileName.toStdString());
|
||||||
Modules::psEdit().saveWorkspaceStructure();
|
Modules::psEdit().saveWorkspaceStructure();
|
||||||
|
@ -116,10 +117,10 @@ void CWorkspacePage::saveAsWP()
|
||||||
void CWorkspacePage::insertPS()
|
void CWorkspacePage::insertPS()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open NeL data file"), ".",
|
tr("Open NeL data file"), ".",
|
||||||
tr("Particle System file (*.ps);;"));
|
tr("Particle System file (*.ps);;"));
|
||||||
|
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
// TODO: create method particle editor insertNewPS and multiple add
|
// TODO: create method particle editor insertNewPS and multiple add
|
||||||
CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString()));
|
CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString()));
|
||||||
|
@ -131,11 +132,11 @@ void CWorkspacePage::insertPS()
|
||||||
}
|
}
|
||||||
catch(NLMISC::EStream &e)
|
catch(NLMISC::EStream &e)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
QMessageBox::critical(this, tr("NeL particle system editor"),
|
||||||
QString(e.what()),
|
QString(e.what()),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
if (!node->isLoaded())
|
if (!node->isLoaded())
|
||||||
Modules::psEdit().getParticleWorkspace()->removeNode(Modules::psEdit().getParticleWorkspace()->getNumNode() - 1);
|
Modules::psEdit().getParticleWorkspace()->removeNode(Modules::psEdit().getParticleWorkspace()->getNumNode() - 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -149,17 +150,17 @@ void CWorkspacePage::insertPS()
|
||||||
void CWorkspacePage::createPS()
|
void CWorkspacePage::createPS()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Create new particle system file"),
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Create new particle system file"),
|
||||||
".",
|
".",
|
||||||
tr("ps files (*.ps)"));
|
tr("ps files (*.ps)"));
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: create method particle editor createNewPS
|
// TODO: create method particle editor createNewPS
|
||||||
if (Modules::psEdit().getParticleWorkspace()->containsFile(NLMISC::CFile::getFilename(fileName.toStdString())))
|
if (Modules::psEdit().getParticleWorkspace()->containsFile(NLMISC::CFile::getFilename(fileName.toStdString())))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
QMessageBox::critical(this, tr("NeL particle system editor"),
|
||||||
tr("Failed to create new particle system"),
|
tr("Failed to create new particle system"),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString()));
|
CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString()));
|
||||||
|
@ -173,10 +174,10 @@ void CWorkspacePage::createPS()
|
||||||
}
|
}
|
||||||
catch (NLMISC::Exception &e)
|
catch (NLMISC::Exception &e)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("NeL particle system editor"),
|
QMessageBox::critical(this, tr("NeL particle system editor"),
|
||||||
QString(e.what()),
|
QString(e.what()),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QModelIndex index = _treeModel->index(0, 0);
|
QModelIndex index = _treeModel->index(0, 0);
|
||||||
_treeModel->insertRows(node, static_cast<CParticleTreeItem*>(index.internalPointer())->childCount(), index);
|
_treeModel->insertRows(node, static_cast<CParticleTreeItem*>(index.internalPointer())->childCount(), index);
|
||||||
|
@ -190,7 +191,7 @@ void CWorkspacePage::removeAllPS()
|
||||||
uint numNodes = Modules::psEdit().getParticleWorkspace()->getNumNode();
|
uint numNodes = Modules::psEdit().getParticleWorkspace()->getNumNode();
|
||||||
for(uint k = 0; k < numNodes; ++k)
|
for(uint k = 0; k < numNodes; ++k)
|
||||||
Modules::psEdit().getParticleWorkspace()->removeNode((uint) 0);
|
Modules::psEdit().getParticleWorkspace()->removeNode((uint) 0);
|
||||||
|
|
||||||
_treeModel->setupModelFromWorkSpace();
|
_treeModel->setupModelFromWorkSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "particle_tree_model.h"
|
#include "particle_tree_model.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CWorkspacePage
|
@class CWorkspacePage
|
||||||
|
@ -39,12 +40,12 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CWorkspacePage: public QWidget
|
class CWorkspacePage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent = 0);
|
CWorkspacePage(CParticleTreeModel *treeModel, QWidget *parent = 0);
|
||||||
~CWorkspacePage();
|
~CWorkspacePage();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void newWP();
|
void newWP();
|
||||||
void loadWP();
|
void loadWP();
|
||||||
|
@ -53,9 +54,9 @@ private Q_SLOTS:
|
||||||
void insertPS();
|
void insertPS();
|
||||||
void createPS();
|
void createPS();
|
||||||
void removeAllPS();
|
void removeAllPS();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::CWorkspacePage _ui;
|
Ui::CWorkspacePage _ui;
|
||||||
|
|
||||||
CParticleTreeModel *_treeModel;
|
CParticleTreeModel *_treeModel;
|
||||||
|
|
|
@ -28,15 +28,16 @@
|
||||||
#include "particle_force_page.h"
|
#include "particle_force_page.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CZonePage::CZonePage(QWidget *parent)
|
CZonePage::CZonePage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.bounceFactorWidget->setRange(0.f, 1.f);
|
_ui.bounceFactorWidget->setRange(0.f, 1.f);
|
||||||
|
|
||||||
connect(_ui.toTargetsPushButton, SIGNAL(clicked()), this, SLOT(addTarget()));
|
connect(_ui.toTargetsPushButton, SIGNAL(clicked()), this, SLOT(addTarget()));
|
||||||
connect(_ui.toAvaibleTargetsPushButton, SIGNAL(clicked()), this, SLOT(removeTarget()));
|
connect(_ui.toAvaibleTargetsPushButton, SIGNAL(clicked()), this, SLOT(removeTarget()));
|
||||||
connect(_ui.bounceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setBounce(int)));
|
connect(_ui.bounceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setBounce(int)));
|
||||||
|
@ -50,10 +51,10 @@ CZonePage::~CZonePage()
|
||||||
|
|
||||||
void CZonePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
|
void CZonePage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable)
|
||||||
{
|
{
|
||||||
_Node = ownerNode;
|
_Node = ownerNode;
|
||||||
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
|
_LBTarget = static_cast<NL3D::CPSTargetLocatedBindable *>(locatedBindable);
|
||||||
_Zone = dynamic_cast<NL3D::CPSZone *>(_LBTarget);
|
_Zone = dynamic_cast<NL3D::CPSZone *>(_LBTarget);
|
||||||
|
|
||||||
updateTargets();
|
updateTargets();
|
||||||
_ui.bounceFactorWidget->setValue(_Zone->getBounceFactor() ,false);
|
_ui.bounceFactorWidget->setValue(_Zone->getBounceFactor() ,false);
|
||||||
_ui.bounceComboBox->setCurrentIndex( _Zone->getCollisionBehaviour());
|
_ui.bounceComboBox->setCurrentIndex( _Zone->getCollisionBehaviour());
|
||||||
|
@ -66,15 +67,15 @@ void CZonePage::addTarget()
|
||||||
if ((totalCount == 0) || (_ui.avaibleTargetsListWidget->currentRow() == -1)) return;
|
if ((totalCount == 0) || (_ui.avaibleTargetsListWidget->currentRow() == -1)) return;
|
||||||
|
|
||||||
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.avaibleTargetsListWidget->currentItem());
|
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.avaibleTargetsListWidget->currentItem());
|
||||||
|
|
||||||
NL3D::CPSLocated *loc = item->getUserData();
|
NL3D::CPSLocated *loc = item->getUserData();
|
||||||
nlassert(loc);
|
nlassert(loc);
|
||||||
|
|
||||||
_LBTarget->attachTarget(loc);
|
_LBTarget->attachTarget(loc);
|
||||||
|
|
||||||
_ui.avaibleTargetsListWidget->takeItem(_ui.avaibleTargetsListWidget->currentRow());
|
_ui.avaibleTargetsListWidget->takeItem(_ui.avaibleTargetsListWidget->currentRow());
|
||||||
_ui.targetsListWidget->addItem(item);
|
_ui.targetsListWidget->addItem(item);
|
||||||
|
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ void CZonePage::removeTarget()
|
||||||
if ((totalCount == 0) || (_ui.targetsListWidget->currentRow() == -1)) return;
|
if ((totalCount == 0) || (_ui.targetsListWidget->currentRow() == -1)) return;
|
||||||
|
|
||||||
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.targetsListWidget->takeItem(_ui.targetsListWidget->currentRow()));
|
CLocatedItem *item = dynamic_cast<CLocatedItem *>(_ui.targetsListWidget->takeItem(_ui.targetsListWidget->currentRow()));
|
||||||
|
|
||||||
NL3D::CPSLocated *loc = item->getUserData();
|
NL3D::CPSLocated *loc = item->getUserData();
|
||||||
nlassert(loc);
|
nlassert(loc);
|
||||||
|
|
||||||
|
@ -97,9 +98,9 @@ void CZonePage::removeTarget()
|
||||||
|
|
||||||
void CZonePage::setBounce(int index)
|
void CZonePage::setBounce(int index)
|
||||||
{
|
{
|
||||||
if (_Zone->getCollisionBehaviour() != index)
|
if (_Zone->getCollisionBehaviour() != index)
|
||||||
_Zone->setCollisionBehaviour( (NL3D::CPSZone::TCollisionBehaviour) index);
|
_Zone->setCollisionBehaviour( (NL3D::CPSZone::TCollisionBehaviour) index);
|
||||||
|
|
||||||
_ui.bounceFactorWidget->setEnabled(_Zone->getCollisionBehaviour() == NL3D::CPSZone::bounce ? true : false);
|
_ui.bounceFactorWidget->setEnabled(_Zone->getCollisionBehaviour() == NL3D::CPSZone::bounce ? true : false);
|
||||||
Modules::psEdit().resetAutoCount(_Node);
|
Modules::psEdit().resetAutoCount(_Node);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +108,7 @@ void CZonePage::setBounce(int index)
|
||||||
void CZonePage::setBounceFactor(float value)
|
void CZonePage::setBounceFactor(float value)
|
||||||
{
|
{
|
||||||
_Zone->setBounceFactor(value);
|
_Zone->setBounceFactor(value);
|
||||||
updateModifiedFlag();
|
updateModifiedFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CZonePage::updateTargets()
|
void CZonePage::updateTargets()
|
||||||
|
@ -116,14 +117,14 @@ void CZonePage::updateTargets()
|
||||||
uint nbTarg = _LBTarget->getNbTargets();
|
uint nbTarg = _LBTarget->getNbTargets();
|
||||||
|
|
||||||
_ui.targetsListWidget->clear();
|
_ui.targetsListWidget->clear();
|
||||||
|
|
||||||
std::set<NL3D::CPSLocated *> targetSet;
|
std::set<NL3D::CPSLocated *> targetSet;
|
||||||
|
|
||||||
// fill the box thta tells us what the target are
|
// fill the box thta tells us what the target are
|
||||||
for(k = 0; k < nbTarg; ++k)
|
for(k = 0; k < nbTarg; ++k)
|
||||||
{
|
{
|
||||||
CLocatedItem *item = new CLocatedItem(QString(_LBTarget->getTarget(k)->getName().c_str()),
|
CLocatedItem *item = new CLocatedItem(QString(_LBTarget->getTarget(k)->getName().c_str()),
|
||||||
_ui.targetsListWidget);
|
_ui.targetsListWidget);
|
||||||
item->setUserData(_LBTarget->getTarget(k));
|
item->setUserData(_LBTarget->getTarget(k));
|
||||||
targetSet.insert(_LBTarget->getTarget(k));
|
targetSet.insert(_LBTarget->getTarget(k));
|
||||||
};
|
};
|
||||||
|
@ -134,7 +135,7 @@ void CZonePage::updateTargets()
|
||||||
uint nbLocated = ps->getNbProcess();
|
uint nbLocated = ps->getNbProcess();
|
||||||
|
|
||||||
_ui.avaibleTargetsListWidget->clear();
|
_ui.avaibleTargetsListWidget->clear();
|
||||||
|
|
||||||
for (k = 0; k < nbLocated; ++k)
|
for (k = 0; k < nbLocated; ++k)
|
||||||
{
|
{
|
||||||
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
|
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
|
||||||
|
@ -142,8 +143,8 @@ void CZonePage::updateTargets()
|
||||||
{
|
{
|
||||||
if (targetSet.find(loc) == targetSet.end())
|
if (targetSet.find(loc) == targetSet.end())
|
||||||
{
|
{
|
||||||
CLocatedItem *item = new CLocatedItem(QString(loc->getName().c_str()),
|
CLocatedItem *item = new CLocatedItem(QString(loc->getName().c_str()),
|
||||||
_ui.avaibleTargetsListWidget);
|
_ui.avaibleTargetsListWidget);
|
||||||
item->setUserData(loc);
|
item->setUserData(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,16 +31,17 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
class CZonePage: public QWidget
|
class CZonePage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CZonePage(QWidget *parent = 0);
|
CZonePage(QWidget *parent = 0);
|
||||||
virtual ~CZonePage();
|
virtual ~CZonePage();
|
||||||
|
|
||||||
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable);
|
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocatedBindable *locatedBindable);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
@ -53,18 +54,21 @@ private Q_SLOTS:
|
||||||
private:
|
private:
|
||||||
void updateTargets();
|
void updateTargets();
|
||||||
|
|
||||||
void updateModifiedFlag() { if (_Node) _Node->setModified(true); }
|
void updateModifiedFlag()
|
||||||
|
{
|
||||||
|
if (_Node) _Node->setModified(true);
|
||||||
|
}
|
||||||
|
|
||||||
/// the target we're focusing on
|
/// the target we're focusing on
|
||||||
NL3D::CPSTargetLocatedBindable *_LBTarget;
|
NL3D::CPSTargetLocatedBindable *_LBTarget;
|
||||||
|
|
||||||
/// the collision zone being edited
|
/// the collision zone being edited
|
||||||
NL3D::CPSZone *_Zone ;
|
NL3D::CPSZone *_Zone ;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
Ui::CZonePage _ui;
|
Ui::CZonePage _ui;
|
||||||
|
|
||||||
}; /* class CZonePage */
|
}; /* class CZonePage */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "ps_initial_pos.h"
|
#include "ps_initial_pos.h"
|
||||||
|
|
||||||
#include "nel/3d/particle_system.h"
|
#include "nel/3d/particle_system.h"
|
||||||
|
@ -23,7 +23,8 @@
|
||||||
#include "nel/3d/ps_edit.h"
|
#include "nel/3d/ps_edit.h"
|
||||||
#include "nel/3d/ps_emitter.h"
|
#include "nel/3d/ps_emitter.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
void CPSInitialPos::reset()
|
void CPSInitialPos::reset()
|
||||||
{
|
{
|
||||||
|
@ -38,7 +39,7 @@ void CPSInitialPos::copySystemInitialPos(NL3D::CParticleSystem *ps)
|
||||||
reset();
|
reset();
|
||||||
uint32 nbLocated = ps->getNbProcess();
|
uint32 nbLocated = ps->getNbProcess();
|
||||||
|
|
||||||
_PS = ps;
|
_PS = ps;
|
||||||
for(uint32 k = 0; k < nbLocated; ++k)
|
for(uint32 k = 0; k < nbLocated; ++k)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ void CPSInitialPos::copySystemInitialPos(NL3D::CParticleSystem *ps)
|
||||||
ii.Pos = loc->getPos()[l];
|
ii.Pos = loc->getPos()[l];
|
||||||
ii.Speed = loc->getSpeed()[l];
|
ii.Speed = loc->getSpeed()[l];
|
||||||
_InitInfoVect.push_back(ii);
|
_InitInfoVect.push_back(ii);
|
||||||
|
|
||||||
for (uint32 m = 0; m < loc->getNbBoundObjects(); ++m)
|
for (uint32 m = 0; m < loc->getNbBoundObjects(); ++m)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -67,14 +68,14 @@ void CPSInitialPos::copySystemInitialPos(NL3D::CParticleSystem *ps)
|
||||||
rsi.LB = loc->getBoundObject(m);
|
rsi.LB = loc->getBoundObject(m);
|
||||||
rsi.Index = l;
|
rsi.Index = l;
|
||||||
rsi.Psm = dynamic_cast<NL3D::IPSMover *>(loc->getBoundObject(m));
|
rsi.Psm = dynamic_cast<NL3D::IPSMover *>(loc->getBoundObject(m));
|
||||||
rsi.Scale = rsi.Psm->getScale(l);
|
rsi.Scale = rsi.Psm->getScale(l);
|
||||||
rsi.Rot = rsi.Psm->getMatrix(l);
|
rsi.Rot = rsi.Psm->getMatrix(l);
|
||||||
_RotScaleInfoVect.push_back(rsi);
|
_RotScaleInfoVect.push_back(rsi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,19 +88,28 @@ struct CRemoveLocatedPred
|
||||||
// private : predicate to remove located from a CPSInitialPos::TInitialLocatedSizeVect vector
|
// private : predicate to remove located from a CPSInitialPos::TInitialLocatedSizeVect vector
|
||||||
struct CRemoveLocatedFromLocatedSizePred : public CRemoveLocatedPred
|
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
|
// private : predicate to remove located from a PSInitialPos::CInitPSInstanceInfo vector
|
||||||
struct CRemoveLocatedFromInitPSInstanceInfoVectPred : public CRemoveLocatedPred
|
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
|
// private : predicate to remove located from a PSInitialPos::CRotScaleInfo vector
|
||||||
struct CRemoveLocatedFromRotScaleInfoVectPred : public CRemoveLocatedPred
|
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
|
// private : predicate to remove located bindable pointers in a TRotScaleInfoVect vect
|
||||||
|
@ -107,18 +117,21 @@ struct CRemoveLocatedBindableFromRotScaleInfoVectPred
|
||||||
{
|
{
|
||||||
// the located bindable taht has been removed
|
// the located bindable taht has been removed
|
||||||
NL3D::CPSLocatedBindable *LB;
|
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)
|
void CPSInitialPos::removeLocated(NL3D::CPSLocated *loc)
|
||||||
{
|
{
|
||||||
// in each container, we delete every element that has a pointer over lthe located loc
|
// in each container, we delete every element that has a pointer over lthe located loc
|
||||||
// , by using the dedicated predicate.
|
// , by using the dedicated predicate.
|
||||||
|
|
||||||
CRemoveLocatedFromLocatedSizePred p;
|
CRemoveLocatedFromLocatedSizePred p;
|
||||||
p.Loc = loc;
|
p.Loc = loc;
|
||||||
_InitialSizeVect.erase(std::remove_if(_InitialSizeVect.begin(), _InitialSizeVect.end(), p)
|
_InitialSizeVect.erase(std::remove_if(_InitialSizeVect.begin(), _InitialSizeVect.end(), p)
|
||||||
, _InitialSizeVect.end() );
|
, _InitialSizeVect.end() );
|
||||||
|
|
||||||
CRemoveLocatedFromInitPSInstanceInfoVectPred p2;
|
CRemoveLocatedFromInitPSInstanceInfoVectPred p2;
|
||||||
p2.Loc = loc;
|
p2.Loc = loc;
|
||||||
|
@ -128,12 +141,12 @@ void CPSInitialPos::removeLocated(NL3D::CPSLocated *loc)
|
||||||
CRemoveLocatedFromRotScaleInfoVectPred p3;
|
CRemoveLocatedFromRotScaleInfoVectPred p3;
|
||||||
p3.Loc = loc;
|
p3.Loc = loc;
|
||||||
_RotScaleInfoVect.erase(std::remove_if(_RotScaleInfoVect.begin(), _RotScaleInfoVect.end(), p3)
|
_RotScaleInfoVect.erase(std::remove_if(_RotScaleInfoVect.begin(), _RotScaleInfoVect.end(), p3)
|
||||||
, _RotScaleInfoVect.end());
|
, _RotScaleInfoVect.end());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPSInitialPos::removeLocatedBindable(NL3D::CPSLocatedBindable *lb)
|
void CPSInitialPos::removeLocatedBindable(NL3D::CPSLocatedBindable *lb)
|
||||||
{
|
{
|
||||||
CRemoveLocatedBindableFromRotScaleInfoVectPred p;
|
CRemoveLocatedBindableFromRotScaleInfoVectPred p;
|
||||||
p.LB = lb;
|
p.LB = lb;
|
||||||
_RotScaleInfoVect.erase(std::remove_if(_RotScaleInfoVect.begin(), _RotScaleInfoVect.end(), p), _RotScaleInfoVect.end() );
|
_RotScaleInfoVect.erase(std::remove_if(_RotScaleInfoVect.begin(), _RotScaleInfoVect.end(), p), _RotScaleInfoVect.end() );
|
||||||
|
@ -158,11 +171,11 @@ void CPSInitialPos::restoreSystem()
|
||||||
|
|
||||||
nlassert(loc->getSize() == 0);
|
nlassert(loc->getSize() == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// recreate the initial number of instances
|
// recreate the initial number of instances
|
||||||
for (TInitialLocatedSizeVect ::iterator itSize = _InitialSizeVect.begin(); itSize != _InitialSizeVect.end(); ++itSize)
|
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)
|
for (uint l = 0; l < itSize->second; ++l)
|
||||||
{
|
{
|
||||||
itSize->first->newElement(NLMISC::CVector::Null, NLMISC::CVector::Null, NULL, 0, itSize->first->getMatrixMode(), 0.f);
|
itSize->first->newElement(NLMISC::CVector::Null, NLMISC::CVector::Null, NULL, 0, itSize->first->getMatrixMode(), 0.f);
|
||||||
|
@ -170,7 +183,7 @@ void CPSInitialPos::restoreSystem()
|
||||||
|
|
||||||
uint realSize = itSize->first->getSize();
|
uint realSize = itSize->first->getSize();
|
||||||
uint size = itSize->second;
|
uint size = itSize->second;
|
||||||
|
|
||||||
}
|
}
|
||||||
NL3D::CPSEmitter::setBypassEmitOnDeath(false);
|
NL3D::CPSEmitter::setBypassEmitOnDeath(false);
|
||||||
for (TInitInfoVect::iterator it = _InitInfoVect.begin(); it != _InitInfoVect.end(); ++it)
|
for (TInitInfoVect::iterator it = _InitInfoVect.begin(); it != _InitInfoVect.end(); ++it)
|
||||||
|
@ -185,7 +198,7 @@ void CPSInitialPos::restoreSystem()
|
||||||
it->Loc->getParametricInfos()[it->Index].Pos = it->Pos;
|
it->Loc->getParametricInfos()[it->Index].Pos = it->Pos;
|
||||||
it->Loc->getParametricInfos()[it->Index].Speed = it->Speed;
|
it->Loc->getParametricInfos()[it->Index].Speed = it->Speed;
|
||||||
it->Loc->getParametricInfos()[it->Index].Date = 0.f;
|
it->Loc->getParametricInfos()[it->Index].Date = 0.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (TRotScaleInfoVect::iterator it2 = _RotScaleInfoVect.begin(); it2 != _RotScaleInfoVect.end(); ++it2)
|
for (TRotScaleInfoVect::iterator it2 = _RotScaleInfoVect.begin(); it2 != _RotScaleInfoVect.end(); ++it2)
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
|
|
||||||
namespace NL3D
|
namespace NL3D
|
||||||
{
|
{
|
||||||
class CParticleSystem;
|
class CParticleSystem;
|
||||||
class CPSLocated;
|
class CPSLocated;
|
||||||
class CPSLocatedBindable;
|
class CPSLocatedBindable;
|
||||||
struct IPSMover;
|
struct IPSMover;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
@class CPSInitialPos
|
@class CPSInitialPos
|
||||||
This class helps to copy the position of initial instances in a particle
|
This class helps to copy the position of initial instances in a particle
|
||||||
|
@ -41,35 +42,35 @@ class CPSInitialPos
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CPSInitialPos() : _PS(NULL) {}
|
CPSInitialPos() : _PS(NULL) {}
|
||||||
|
|
||||||
/// construct this by copying the datas of the system
|
/// construct this by copying the datas of the system
|
||||||
void copySystemInitialPos(NL3D::CParticleSystem *ps);
|
void copySystemInitialPos(NL3D::CParticleSystem *ps);
|
||||||
|
|
||||||
/// reinitialize the system with its initial instances positions
|
/// reinitialize the system with its initial instances positions
|
||||||
/// Works only once per copySystemInitialPos() call
|
/// Works only once per copySystemInitialPos() call
|
||||||
void restoreSystem();
|
void restoreSystem();
|
||||||
|
|
||||||
/// send back true when bbox display is enabled
|
/// send back true when bbox display is enabled
|
||||||
bool isBBoxDisplayEnabled();
|
bool isBBoxDisplayEnabled();
|
||||||
|
|
||||||
/// update data when a located in a particle system has been removed
|
/// update data when a located in a particle system has been removed
|
||||||
void removeLocated(NL3D::CPSLocated *loc);
|
void removeLocated(NL3D::CPSLocated *loc);
|
||||||
|
|
||||||
/// update data when a located bindable in a particle system has been removed
|
/// update data when a located bindable in a particle system has been removed
|
||||||
void removeLocatedBindable(NL3D::CPSLocatedBindable *lb);
|
void removeLocatedBindable(NL3D::CPSLocatedBindable *lb);
|
||||||
|
|
||||||
/// initial position and speed of a located instance in a particle system
|
/// initial position and speed of a located instance in a particle system
|
||||||
struct CInitPSInstanceInfo
|
struct CInitPSInstanceInfo
|
||||||
{
|
{
|
||||||
uint32 Index;
|
uint32 Index;
|
||||||
NL3D::CPSLocated *Loc;
|
NL3D::CPSLocated *Loc;
|
||||||
NLMISC::CVector Speed;
|
NLMISC::CVector Speed;
|
||||||
NLMISC::CVector Pos;
|
NLMISC::CVector Pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// rotation and scale of an element
|
/// rotation and scale of an element
|
||||||
struct CRotScaleInfo
|
struct CRotScaleInfo
|
||||||
{
|
{
|
||||||
uint32 Index;
|
uint32 Index;
|
||||||
NL3D::CPSLocated *Loc;
|
NL3D::CPSLocated *Loc;
|
||||||
NL3D::CPSLocatedBindable *LB;
|
NL3D::CPSLocatedBindable *LB;
|
||||||
|
@ -77,9 +78,18 @@ public:
|
||||||
NLMISC::CMatrix Rot;
|
NLMISC::CMatrix Rot;
|
||||||
NLMISC::CVector Scale;
|
NLMISC::CVector Scale;
|
||||||
};
|
};
|
||||||
NL3D::CParticleSystem *getPS() { return _PS; }
|
NL3D::CParticleSystem *getPS()
|
||||||
const NL3D::CParticleSystem *getPS() const { return _PS; }
|
{
|
||||||
bool isStateMemorized() const { return _PS != NULL; }
|
return _PS;
|
||||||
|
}
|
||||||
|
const NL3D::CParticleSystem *getPS() const
|
||||||
|
{
|
||||||
|
return _PS;
|
||||||
|
}
|
||||||
|
bool isStateMemorized() const
|
||||||
|
{
|
||||||
|
return _PS != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<CInitPSInstanceInfo> TInitInfoVect;
|
typedef std::vector<CInitPSInstanceInfo> TInitInfoVect;
|
||||||
|
@ -87,13 +97,13 @@ private:
|
||||||
typedef std::vector< std::pair<NL3D::CPSLocated *, uint32> > TInitialLocatedSizeVect;
|
typedef std::vector< std::pair<NL3D::CPSLocated *, uint32> > TInitialLocatedSizeVect;
|
||||||
TInitInfoVect _InitInfoVect;
|
TInitInfoVect _InitInfoVect;
|
||||||
TRotScaleInfoVect _RotScaleInfoVect;
|
TRotScaleInfoVect _RotScaleInfoVect;
|
||||||
|
|
||||||
/// initial number of instances for each located
|
/// initial number of instances for each located
|
||||||
TInitialLocatedSizeVect _InitialSizeVect;
|
TInitialLocatedSizeVect _InitialSizeVect;
|
||||||
NL3D::CParticleSystem *_PS;
|
NL3D::CParticleSystem *_PS;
|
||||||
|
|
||||||
/// reset all initial infos
|
/// reset all initial infos
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -27,15 +27,16 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
const float epsilon = 10E-3f;
|
const float epsilon = 10E-3f;
|
||||||
|
|
||||||
CPSMoverPage::CPSMoverPage(QWidget *parent)
|
CPSMoverPage::CPSMoverPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
_ui.setupUi(this);
|
||||||
|
|
||||||
_ui.scaleWidget->setRange(0.f, 4.f);
|
_ui.scaleWidget->setRange(0.f, 4.f);
|
||||||
_ui.scaleWidget->setWrapper(&_UniformScaleWrapper);
|
_ui.scaleWidget->setWrapper(&_UniformScaleWrapper);
|
||||||
|
|
||||||
|
@ -49,15 +50,15 @@ CPSMoverPage::CPSMoverPage(QWidget *parent)
|
||||||
_ui.scaleZWidget->setWrapper(&_ZScaleWrapper);
|
_ui.scaleZWidget->setWrapper(&_ZScaleWrapper);
|
||||||
|
|
||||||
//_ui.directionWidget->setWrapper(&_DirectionWrapper);
|
//_ui.directionWidget->setWrapper(&_DirectionWrapper);
|
||||||
|
|
||||||
connect(_ui.xDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setXPosition(double)));
|
connect(_ui.xDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setXPosition(double)));
|
||||||
connect(_ui.yDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setYPosition(double)));
|
connect(_ui.yDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setYPosition(double)));
|
||||||
connect(_ui.zDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZPosition(double)));
|
connect(_ui.zDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setZPosition(double)));
|
||||||
|
|
||||||
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector)));
|
connect(_ui.directionWidget, SIGNAL(valueChanged(NLMISC::CVector)), this, SLOT(setDir(NLMISC::CVector)));
|
||||||
|
|
||||||
connect(_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
connect(_ui.listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
|
||||||
this, SLOT(changeSubComponent()));
|
this, SLOT(changeSubComponent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPSMoverPage::~CPSMoverPage()
|
CPSMoverPage::~CPSMoverPage()
|
||||||
|
@ -71,20 +72,20 @@ void CPSMoverPage::setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *lo
|
||||||
_EditedLocatedIndex = editedLocatedIndex;
|
_EditedLocatedIndex = editedLocatedIndex;
|
||||||
|
|
||||||
updatePosition();
|
updatePosition();
|
||||||
|
|
||||||
_ui.listWidget->clear();
|
_ui.listWidget->clear();
|
||||||
hideAdditionalWidget();
|
hideAdditionalWidget();
|
||||||
|
|
||||||
uint numBound = _EditedLocated->getNbBoundObjects();
|
uint numBound = _EditedLocated->getNbBoundObjects();
|
||||||
|
|
||||||
uint nbCandidates = 0;
|
uint nbCandidates = 0;
|
||||||
|
|
||||||
for (uint k = 0; k < numBound; ++k)
|
for (uint k = 0; k < numBound; ++k)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k)))
|
if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k)))
|
||||||
{
|
{
|
||||||
CLocatedBindableItem *item = new CLocatedBindableItem(QString(_EditedLocated->getBoundObject(k)->getName().c_str()),
|
CLocatedBindableItem *item = new CLocatedBindableItem(QString(_EditedLocated->getBoundObject(k)->getName().c_str()),
|
||||||
_ui.listWidget);
|
_ui.listWidget);
|
||||||
item->setUserData(_EditedLocated->getBoundObject(k));
|
item->setUserData(_EditedLocated->getBoundObject(k));
|
||||||
++nbCandidates;
|
++nbCandidates;
|
||||||
}
|
}
|
||||||
|
@ -118,15 +119,15 @@ void CPSMoverPage::hideAdditionalWidget()
|
||||||
|
|
||||||
void CPSMoverPage::updateListener(void)
|
void CPSMoverPage::updateListener(void)
|
||||||
{
|
{
|
||||||
/* if(_ParticleDlg->MainFrame->isMoveElement())
|
/* if(_ParticleDlg->MainFrame->isMoveElement())
|
||||||
{
|
{
|
||||||
const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
|
const NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
|
||||||
NLMISC::CMatrix m;
|
NLMISC::CMatrix m;
|
||||||
m = _MouseListener->getModelMatrix();
|
m = _MouseListener->getModelMatrix();
|
||||||
m.setPos(pos);
|
m.setPos(pos);
|
||||||
_MouseListener->setModelMatrix(m);
|
_MouseListener->setModelMatrix(m);
|
||||||
_Node->setModified(true);
|
_Node->setModified(true);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPSMoverPage::setXPosition(double value)
|
void CPSMoverPage::setXPosition(double value)
|
||||||
|
@ -167,17 +168,17 @@ void CPSMoverPage::changeSubComponent()
|
||||||
hideAdditionalWidget();
|
hideAdditionalWidget();
|
||||||
NL3D::IPSMover *m = getMoverInterface();
|
NL3D::IPSMover *m = getMoverInterface();
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
|
|
||||||
_Node->getPSPointer()->setCurrentEditedElement(NULL);
|
_Node->getPSPointer()->setCurrentEditedElement(NULL);
|
||||||
_Node->getPSPointer()->setCurrentEditedElement(_EditedLocated, _EditedLocatedIndex, getLocatedBindable());
|
_Node->getPSPointer()->setCurrentEditedElement(_EditedLocated, _EditedLocatedIndex, getLocatedBindable());
|
||||||
|
|
||||||
|
|
||||||
if (m->supportUniformScaling() && ! m->supportNonUniformScaling() )
|
if (m->supportUniformScaling() && ! m->supportNonUniformScaling() )
|
||||||
{
|
{
|
||||||
_UniformScaleWrapper.OwnerNode = _Node;
|
_UniformScaleWrapper.OwnerNode = _Node;
|
||||||
_UniformScaleWrapper.M = m;
|
_UniformScaleWrapper.M = m;
|
||||||
_UniformScaleWrapper.Index = _EditedLocatedIndex;
|
_UniformScaleWrapper.Index = _EditedLocatedIndex;
|
||||||
|
|
||||||
_ui.scaleWidget->updateUi();
|
_ui.scaleWidget->updateUi();
|
||||||
_ui.scaleLabel->show();
|
_ui.scaleLabel->show();
|
||||||
_ui.scaleWidget->show();
|
_ui.scaleWidget->show();
|
||||||
|
@ -188,31 +189,31 @@ void CPSMoverPage::changeSubComponent()
|
||||||
_XScaleWrapper.OwnerNode = _Node;
|
_XScaleWrapper.OwnerNode = _Node;
|
||||||
_XScaleWrapper.M = m;
|
_XScaleWrapper.M = m;
|
||||||
_XScaleWrapper.Index = _EditedLocatedIndex;
|
_XScaleWrapper.Index = _EditedLocatedIndex;
|
||||||
|
|
||||||
_ui.scaleXWidget->updateUi();
|
_ui.scaleXWidget->updateUi();
|
||||||
_ui.scaleXLabel->show();
|
_ui.scaleXLabel->show();
|
||||||
_ui.scaleXWidget->show();
|
_ui.scaleXWidget->show();
|
||||||
|
|
||||||
// dialog for edition of y scale
|
// dialog for edition of y scale
|
||||||
_YScaleWrapper.OwnerNode = _Node;
|
_YScaleWrapper.OwnerNode = _Node;
|
||||||
_YScaleWrapper.M = m;
|
_YScaleWrapper.M = m;
|
||||||
_YScaleWrapper.Index = _EditedLocatedIndex;
|
_YScaleWrapper.Index = _EditedLocatedIndex;
|
||||||
|
|
||||||
_ui.scaleYWidget->updateUi();
|
_ui.scaleYWidget->updateUi();
|
||||||
_ui.scaleYLabel->show();
|
_ui.scaleYLabel->show();
|
||||||
_ui.scaleYWidget->show();
|
_ui.scaleYWidget->show();
|
||||||
|
|
||||||
// dialog for edition of x scale
|
// dialog for edition of x scale
|
||||||
_ZScaleWrapper.OwnerNode = _Node;
|
_ZScaleWrapper.OwnerNode = _Node;
|
||||||
_ZScaleWrapper.M = m;
|
_ZScaleWrapper.M = m;
|
||||||
_ZScaleWrapper.Index = _EditedLocatedIndex;
|
_ZScaleWrapper.Index = _EditedLocatedIndex;
|
||||||
|
|
||||||
_ui.scaleZWidget->updateUi();
|
_ui.scaleZWidget->updateUi();
|
||||||
_ui.scaleZLabel->show();
|
_ui.scaleZLabel->show();
|
||||||
_ui.scaleZWidget->show();
|
_ui.scaleZWidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m->onlyStoreNormal())
|
if (m->onlyStoreNormal())
|
||||||
{
|
{
|
||||||
_ui.directionWidget->setValue(getMoverInterface()->getNormal(getLocatedIndex()), false);
|
_ui.directionWidget->setValue(getMoverInterface()->getNormal(getLocatedIndex()), false);
|
||||||
|
@ -231,7 +232,7 @@ NL3D::IPSMover *CPSMoverPage::getMoverInterface(void)
|
||||||
nlassert(_EditedLocated);
|
nlassert(_EditedLocated);
|
||||||
sint currIndex = _ui.listWidget->currentRow();
|
sint currIndex = _ui.listWidget->currentRow();
|
||||||
if (currIndex == -1) return NULL;
|
if (currIndex == -1) return NULL;
|
||||||
|
|
||||||
CLocatedBindableItem *item = dynamic_cast<CLocatedBindableItem *>(_ui.listWidget->currentItem());
|
CLocatedBindableItem *item = dynamic_cast<CLocatedBindableItem *>(_ui.listWidget->currentItem());
|
||||||
return dynamic_cast<NL3D::IPSMover *>(item->getUserData());
|
return dynamic_cast<NL3D::IPSMover *>(item->getUserData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "ps_wrapper.h"
|
#include "ps_wrapper.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CLocatedBindableItem
|
@class CLocatedBindableItem
|
||||||
|
@ -44,14 +45,20 @@ namespace NLQT {
|
||||||
class CLocatedBindableItem: public QListWidgetItem
|
class CLocatedBindableItem: public QListWidgetItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLocatedBindableItem ( const QString & text, QListWidget * parent = 0, int type = UserType ):
|
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;}
|
void setUserData(NL3D::CPSLocatedBindable *loc)
|
||||||
NL3D::CPSLocatedBindable *getUserData() const { return _lb;}
|
{
|
||||||
|
_lb = loc;
|
||||||
|
}
|
||||||
|
NL3D::CPSLocatedBindable *getUserData() const
|
||||||
|
{
|
||||||
|
return _lb;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
NL3D::CPSLocatedBindable *_lb;
|
NL3D::CPSLocatedBindable *_lb;
|
||||||
}; /* class CTargetItem */
|
}; /* class CTargetItem */
|
||||||
|
|
||||||
|
@ -61,15 +68,15 @@ private:
|
||||||
*/
|
*/
|
||||||
class CPSMoverPage: public QWidget
|
class CPSMoverPage: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPSMoverPage(QWidget *parent = 0);
|
CPSMoverPage(QWidget *parent = 0);
|
||||||
~CPSMoverPage();
|
~CPSMoverPage();
|
||||||
|
|
||||||
/// Set the instance to edit.
|
/// Set the instance to edit.
|
||||||
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *located, uint32 editedLocatedIndex);
|
void setEditedItem(CWorkspaceNode *ownerNode, NL3D::CPSLocated *located, uint32 editedLocatedIndex);
|
||||||
|
|
||||||
/// position has to be updated (for mouse edition)
|
/// position has to be updated (for mouse edition)
|
||||||
void updatePosition(void) ;
|
void updatePosition(void) ;
|
||||||
|
|
||||||
|
@ -77,11 +84,20 @@ public:
|
||||||
NL3D::IPSMover *getMoverInterface(void) ;
|
NL3D::IPSMover *getMoverInterface(void) ;
|
||||||
|
|
||||||
/// get the located being edited
|
/// get the located being edited
|
||||||
NL3D::CPSLocated *getLocated(void) { return _EditedLocated ; }
|
NL3D::CPSLocated *getLocated(void)
|
||||||
const NL3D::CPSLocated *getLocated(void) const { return _EditedLocated ; }
|
{
|
||||||
|
return _EditedLocated ;
|
||||||
|
}
|
||||||
|
const NL3D::CPSLocated *getLocated(void) const
|
||||||
|
{
|
||||||
|
return _EditedLocated ;
|
||||||
|
}
|
||||||
|
|
||||||
/// get the index of the current edited item
|
/// 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
|
/// ghet the current located bindable being edited, or null
|
||||||
NL3D::CPSLocatedBindable *getLocatedBindable(void) ;
|
NL3D::CPSLocatedBindable *getLocatedBindable(void) ;
|
||||||
|
@ -91,18 +107,24 @@ private Q_SLOTS:
|
||||||
void setYPosition(double value);
|
void setYPosition(double value);
|
||||||
void setZPosition(double value);
|
void setZPosition(double value);
|
||||||
void changeSubComponent();
|
void changeSubComponent();
|
||||||
|
|
||||||
void setDir(const NLMISC::CVector &value);
|
void setDir(const NLMISC::CVector &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// wrappers to scale objects
|
/// wrappers to scale objects
|
||||||
struct CUniformScaleWrapper : public IPSWrapperFloat
|
struct CUniformScaleWrapper : public IPSWrapperFloat
|
||||||
{
|
{
|
||||||
uint32 Index ;
|
uint32 Index ;
|
||||||
NL3D::IPSMover *M ;
|
NL3D::IPSMover *M ;
|
||||||
float get(void) const { return M->getScale(Index).x ; }
|
float get(void) const
|
||||||
void set(const float &v) { M->setScale(Index, v) ; }
|
{
|
||||||
|
return M->getScale(Index).x ;
|
||||||
|
}
|
||||||
|
void set(const float &v)
|
||||||
|
{
|
||||||
|
M->setScale(Index, v) ;
|
||||||
|
}
|
||||||
} _UniformScaleWrapper ;
|
} _UniformScaleWrapper ;
|
||||||
|
|
||||||
/// wrapper to scale the X coordinate
|
/// wrapper to scale the X coordinate
|
||||||
|
@ -110,11 +132,14 @@ private:
|
||||||
{
|
{
|
||||||
uint32 Index ;
|
uint32 Index ;
|
||||||
NL3D::IPSMover *M ;
|
NL3D::IPSMover *M ;
|
||||||
float get(void) const { return M->getScale(Index).x ; }
|
float get(void) const
|
||||||
void set(const float &s)
|
{
|
||||||
{
|
return M->getScale(Index).x ;
|
||||||
|
}
|
||||||
|
void set(const float &s)
|
||||||
|
{
|
||||||
NLMISC::CVector v = M->getScale(Index) ;
|
NLMISC::CVector v = M->getScale(Index) ;
|
||||||
M->setScale(Index, NLMISC::CVector(s, v.y, v.z)) ;
|
M->setScale(Index, NLMISC::CVector(s, v.y, v.z)) ;
|
||||||
}
|
}
|
||||||
} _XScaleWrapper ;
|
} _XScaleWrapper ;
|
||||||
|
|
||||||
|
@ -123,11 +148,14 @@ private:
|
||||||
{
|
{
|
||||||
uint32 Index ;
|
uint32 Index ;
|
||||||
NL3D::IPSMover *M ;
|
NL3D::IPSMover *M ;
|
||||||
float get(void) const { return M->getScale(Index).y ; }
|
float get(void) const
|
||||||
void set(const float &s)
|
{
|
||||||
{
|
return M->getScale(Index).y ;
|
||||||
|
}
|
||||||
|
void set(const float &s)
|
||||||
|
{
|
||||||
NLMISC::CVector v = M->getScale(Index) ;
|
NLMISC::CVector v = M->getScale(Index) ;
|
||||||
M->setScale(Index, NLMISC::CVector(v.x, s, v.z) ) ;
|
M->setScale(Index, NLMISC::CVector(v.x, s, v.z) ) ;
|
||||||
}
|
}
|
||||||
} _YScaleWrapper ;
|
} _YScaleWrapper ;
|
||||||
|
|
||||||
|
@ -136,27 +164,33 @@ private:
|
||||||
{
|
{
|
||||||
uint32 Index ;
|
uint32 Index ;
|
||||||
NL3D::IPSMover *M ;
|
NL3D::IPSMover *M ;
|
||||||
float get(void) const { return M->getScale(Index).z ; }
|
float get(void) const
|
||||||
void set(const float &s)
|
{
|
||||||
{
|
return M->getScale(Index).z ;
|
||||||
|
}
|
||||||
|
void set(const float &s)
|
||||||
|
{
|
||||||
NLMISC::CVector v = M->getScale(Index) ;
|
NLMISC::CVector v = M->getScale(Index) ;
|
||||||
M->setScale(Index, NLMISC::CVector(v.x, v.y, s) ) ;
|
M->setScale(Index, NLMISC::CVector(v.x, v.y, s) ) ;
|
||||||
}
|
}
|
||||||
} _ZScaleWrapper ;
|
} _ZScaleWrapper ;
|
||||||
|
|
||||||
void hideAdditionalWidget();
|
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
|
/// update the mouse listener position when the user entered a value with the keyboard
|
||||||
void updateListener(void) ;
|
void updateListener(void) ;
|
||||||
|
|
||||||
CWorkspaceNode *_Node;
|
CWorkspaceNode *_Node;
|
||||||
|
|
||||||
NL3D::CPSLocated *_EditedLocated ;
|
NL3D::CPSLocated *_EditedLocated ;
|
||||||
|
|
||||||
uint32 _EditedLocatedIndex ;
|
uint32 _EditedLocatedIndex ;
|
||||||
|
|
||||||
Ui::CPSMoverPage _ui;
|
Ui::CPSMoverPage _ui;
|
||||||
|
|
||||||
}; /* class CPSMoverPage */
|
}; /* class CPSMoverPage */
|
||||||
|
|
|
@ -30,8 +30,9 @@
|
||||||
//
|
//
|
||||||
#include "particle_node.h"
|
#include "particle_node.h"
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/// Wrapper to read/write a value of type T
|
/// Wrapper to read/write a value of type T
|
||||||
template <class T> class IPSWrapper
|
template <class T> class IPSWrapper
|
||||||
{
|
{
|
||||||
|
@ -66,7 +67,7 @@ public:
|
||||||
IPSSchemeWrapper() : OwnerNode(NULL) {}
|
IPSSchemeWrapper() : OwnerNode(NULL) {}
|
||||||
typedef NL3D::CPSAttribMaker<T> scheme_type;
|
typedef NL3D::CPSAttribMaker<T> scheme_type;
|
||||||
virtual scheme_type *getScheme(void) const = 0;
|
virtual scheme_type *getScheme(void) const = 0;
|
||||||
void setSchemeAndUpdateModifiedFlag(scheme_type *s)
|
void setSchemeAndUpdateModifiedFlag(scheme_type *s)
|
||||||
{
|
{
|
||||||
if (OwnerNode)
|
if (OwnerNode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,13 +34,14 @@
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CSettingsDialog::CSettingsDialog(QWidget *parent)
|
CSettingsDialog::CSettingsDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
loadGraphicsSettings();
|
loadGraphicsSettings();
|
||||||
loadSoundSettings();
|
loadSoundSettings();
|
||||||
loadPathsSettings();
|
loadPathsSettings();
|
||||||
|
@ -49,19 +50,19 @@ CSettingsDialog::CSettingsDialog(QWidget *parent)
|
||||||
connect(ui.enableBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableBloom(bool)));
|
connect(ui.enableBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableBloom(bool)));
|
||||||
connect(ui.squareBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableSquareBloon(bool)));
|
connect(ui.squareBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableSquareBloon(bool)));
|
||||||
connect(ui.bloomDensityHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setDensityBloom(int)));
|
connect(ui.bloomDensityHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setDensityBloom(int)));
|
||||||
|
|
||||||
connect(ui.addToolButton, SIGNAL(clicked()), this, SLOT(addPath()));
|
connect(ui.addToolButton, SIGNAL(clicked()), this, SLOT(addPath()));
|
||||||
connect(ui.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
|
connect(ui.removeToolButton, SIGNAL(clicked()), this, SLOT(removePath()));
|
||||||
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
connect(ui.upToolButton, SIGNAL(clicked()), this, SLOT(upPath()));
|
||||||
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
connect(ui.downToolButton, SIGNAL(clicked()), this, SLOT(downPath()));
|
||||||
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyPressed()));
|
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyPressed()));
|
||||||
|
|
||||||
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
|
||||||
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
|
||||||
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
|
||||||
connect(ui.addZoneToolButton, SIGNAL(clicked()), this, SLOT(addZone()));
|
connect(ui.addZoneToolButton, SIGNAL(clicked()), this, SLOT(addZone()));
|
||||||
connect(ui.removeZoneToolButton, SIGNAL(clicked()), this, SLOT(removeZone()));
|
connect(ui.removeZoneToolButton, SIGNAL(clicked()), this, SLOT(removeZone()));
|
||||||
|
|
||||||
#ifdef NL_OS_UNIX
|
#ifdef NL_OS_UNIX
|
||||||
ui.driverGraphComboBox->setEnabled(false);
|
ui.driverGraphComboBox->setEnabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,7 +80,7 @@ void CSettingsDialog::addPath()
|
||||||
{
|
{
|
||||||
QListWidgetItem *newItem = new QListWidgetItem;
|
QListWidgetItem *newItem = new QListWidgetItem;
|
||||||
QString newPath = QFileDialog::getExistingDirectory(this);
|
QString newPath = QFileDialog::getExistingDirectory(this);
|
||||||
if (!(newPath == ""))
|
if (!(newPath == ""))
|
||||||
{
|
{
|
||||||
newItem->setText(newPath);
|
newItem->setText(newPath);
|
||||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
|
@ -99,7 +100,7 @@ void CSettingsDialog::upPath()
|
||||||
if (!(currentRow == 0))
|
if (!(currentRow == 0))
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui.pathsListWidget->takeItem(currentRow);
|
QListWidgetItem *item = ui.pathsListWidget->takeItem(currentRow);
|
||||||
ui.pathsListWidget->insertItem(--currentRow, item);
|
ui.pathsListWidget->insertItem(--currentRow, item);
|
||||||
ui.pathsListWidget->setCurrentRow(currentRow);
|
ui.pathsListWidget->setCurrentRow(currentRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,20 +111,20 @@ void CSettingsDialog::downPath()
|
||||||
if (!(currentRow == ui.pathsListWidget->count()-1))
|
if (!(currentRow == ui.pathsListWidget->count()-1))
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = ui.pathsListWidget->takeItem(currentRow);
|
QListWidgetItem *item = ui.pathsListWidget->takeItem(currentRow);
|
||||||
ui.pathsListWidget->insertItem(++currentRow, item);
|
ui.pathsListWidget->insertItem(++currentRow, item);
|
||||||
ui.pathsListWidget->setCurrentRow(currentRow);
|
ui.pathsListWidget->setCurrentRow(currentRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsDialog::applyPressed()
|
void CSettingsDialog::applyPressed()
|
||||||
{
|
{
|
||||||
|
|
||||||
// settings take after restart the program
|
// settings take after restart the program
|
||||||
QMessageBox::warning(this, tr("Settings"),
|
QMessageBox::warning(this, tr("Settings"),
|
||||||
tr("Graphics and sound settings "
|
tr("Graphics and sound settings "
|
||||||
"take after restart the program"),
|
"take after restart the program"),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
|
||||||
saveGraphicsSettings();
|
saveGraphicsSettings();
|
||||||
saveSoundSettings();
|
saveSoundSettings();
|
||||||
savePathsSettings();
|
savePathsSettings();
|
||||||
|
@ -131,7 +132,7 @@ void CSettingsDialog::applyPressed()
|
||||||
|
|
||||||
// save config file
|
// save config file
|
||||||
Modules::config().getConfigFile().save();
|
Modules::config().getConfigFile().save();
|
||||||
|
|
||||||
// reload search paths
|
// reload search paths
|
||||||
Modules::config().configSearchPaths();
|
Modules::config().configSearchPaths();
|
||||||
}
|
}
|
||||||
|
@ -139,9 +140,9 @@ void CSettingsDialog::applyPressed()
|
||||||
void CSettingsDialog::setTileBank()
|
void CSettingsDialog::setTileBank()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile bank"),
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile bank"),
|
||||||
ui.tileBankLineEdit->text(),
|
ui.tileBankLineEdit->text(),
|
||||||
tr("Tile Bank file (*.smallbank *.bank);;"));
|
tr("Tile Bank file (*.smallbank *.bank);;"));
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
ui.tileBankLineEdit->setText(fileName);
|
ui.tileBankLineEdit->setText(fileName);
|
||||||
}
|
}
|
||||||
|
@ -149,10 +150,10 @@ void CSettingsDialog::setTileBank()
|
||||||
|
|
||||||
void CSettingsDialog::setTileFarBank()
|
void CSettingsDialog::setTileFarBank()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile far bank"),
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile far bank"),
|
||||||
ui.tileFarBankLineEdit->text(),
|
ui.tileFarBankLineEdit->text(),
|
||||||
tr("Tile Far Bank file (*.farbank);;"));
|
tr("Tile Far Bank file (*.farbank);;"));
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
ui.tileFarBankLineEdit->setText(fileName);
|
ui.tileFarBankLineEdit->setText(fileName);
|
||||||
}
|
}
|
||||||
|
@ -161,9 +162,9 @@ void CSettingsDialog::setTileFarBank()
|
||||||
void CSettingsDialog::setTextureVegetable()
|
void CSettingsDialog::setTextureVegetable()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Set MicroVegetable texture"),
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Set MicroVegetable texture"),
|
||||||
ui.vegetTextureLineEdit->text(),
|
ui.vegetTextureLineEdit->text(),
|
||||||
tr("Texture file (*.tga *.png *.jpg *.dds);;"));
|
tr("Texture file (*.tga *.png *.jpg *.dds);;"));
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
{
|
{
|
||||||
ui.vegetTextureLineEdit->setText(fileName);
|
ui.vegetTextureLineEdit->setText(fileName);
|
||||||
}
|
}
|
||||||
|
@ -172,21 +173,21 @@ void CSettingsDialog::setTextureVegetable()
|
||||||
void CSettingsDialog::addZone()
|
void CSettingsDialog::addZone()
|
||||||
{
|
{
|
||||||
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
||||||
tr("Add zone files"), ".",
|
tr("Add zone files"), ".",
|
||||||
tr("Zonel files (*.zonel);;"));
|
tr("Zonel files (*.zonel);;"));
|
||||||
|
|
||||||
if (!fileNames.isEmpty())
|
if (!fileNames.isEmpty())
|
||||||
{
|
{
|
||||||
QStringList list = fileNames;
|
QStringList list = fileNames;
|
||||||
QStringList::Iterator it = list.begin();
|
QStringList::Iterator it = list.begin();
|
||||||
while(it != list.end())
|
while(it != list.end())
|
||||||
{
|
{
|
||||||
QListWidgetItem *newItem = new QListWidgetItem;
|
QListWidgetItem *newItem = new QListWidgetItem;
|
||||||
newItem->setText(*it);
|
newItem->setText(*it);
|
||||||
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||||
ui.zonesListWidget->addItem(newItem);
|
ui.zonesListWidget->addItem(newItem);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,11 +216,11 @@ void CSettingsDialog::cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var)
|
||||||
{
|
{
|
||||||
while (ui.driverGraphComboBox->count())
|
while (ui.driverGraphComboBox->count())
|
||||||
ui.driverGraphComboBox->removeItem(0);
|
ui.driverGraphComboBox->removeItem(0);
|
||||||
|
|
||||||
// load types graphics driver from the config file
|
// load types graphics driver from the config file
|
||||||
for (uint i = 0; i < var.size(); ++i)
|
for (uint i = 0; i < var.size(); ++i)
|
||||||
ui.driverGraphComboBox->addItem(var.asString(i).c_str());
|
ui.driverGraphComboBox->addItem(var.asString(i).c_str());
|
||||||
|
|
||||||
// set graphics driver from the config file
|
// set graphics driver from the config file
|
||||||
QString value = Modules::config().getValue("GraphicsDriver",std::string("OpenGL")).c_str();
|
QString value = Modules::config().getValue("GraphicsDriver",std::string("OpenGL")).c_str();
|
||||||
QString dn = value.toLower();
|
QString dn = value.toLower();
|
||||||
|
@ -237,11 +238,11 @@ void CSettingsDialog::cfcbSoundDrivers(NLMISC::CConfigFile::CVar& var)
|
||||||
{
|
{
|
||||||
while (ui.driverSndComboBox->count())
|
while (ui.driverSndComboBox->count())
|
||||||
ui.driverSndComboBox->removeItem(0);
|
ui.driverSndComboBox->removeItem(0);
|
||||||
|
|
||||||
// load types sound driver from the config file
|
// load types sound driver from the config file
|
||||||
for (uint i = 0; i < var.size(); ++i)
|
for (uint i = 0; i < var.size(); ++i)
|
||||||
ui.driverSndComboBox->addItem(var.asString(i).c_str());
|
ui.driverSndComboBox->addItem(var.asString(i).c_str());
|
||||||
|
|
||||||
// set sound driver from the config file
|
// set sound driver from the config file
|
||||||
QString value = Modules::config().getValue("SoundDriver",std::string("Auto")).c_str();
|
QString value = Modules::config().getValue("SoundDriver",std::string("Auto")).c_str();
|
||||||
QString dn = value.toLower();
|
QString dn = value.toLower();
|
||||||
|
@ -260,7 +261,7 @@ void CSettingsDialog::cfcbSearchPaths(NLMISC::CConfigFile::CVar &var)
|
||||||
/// TODO: create custom widget add/insert/del/up/down paths (also this is use landscape zones)
|
/// TODO: create custom widget add/insert/del/up/down paths (also this is use landscape zones)
|
||||||
|
|
||||||
ui.pathsListWidget->clear();
|
ui.pathsListWidget->clear();
|
||||||
|
|
||||||
// load search paths from the config file
|
// load search paths from the config file
|
||||||
for (uint i = 0; i < var.size(); ++i)
|
for (uint i = 0; i < var.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -305,7 +306,7 @@ void CSettingsDialog::loadVegetableSettings()
|
||||||
ui.tileBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileBank").asString().c_str());
|
ui.tileBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileBank").asString().c_str());
|
||||||
ui.tileFarBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileFarBank").asString().c_str());
|
ui.tileFarBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileFarBank").asString().c_str());
|
||||||
ui.vegetTextureLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTexture").asString().c_str());
|
ui.vegetTextureLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTexture").asString().c_str());
|
||||||
|
|
||||||
ui.zonesListWidget->clear();
|
ui.zonesListWidget->clear();
|
||||||
|
|
||||||
// load vegetable landscape zone paths from config file
|
// load vegetable landscape zone paths from config file
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class CSettingsDialog
|
@class CSettingsDialog
|
||||||
|
@ -38,7 +39,7 @@ namespace NLQT {
|
||||||
*/
|
*/
|
||||||
class CSettingsDialog: public QDialog
|
class CSettingsDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSettingsDialog(QWidget *parent = 0);
|
CSettingsDialog(QWidget *parent = 0);
|
||||||
|
@ -65,7 +66,7 @@ private:
|
||||||
void cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var);
|
void cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbSoundDrivers(NLMISC::CConfigFile::CVar &var);
|
void cfcbSoundDrivers(NLMISC::CConfigFile::CVar &var);
|
||||||
void cfcbSearchPaths(NLMISC::CConfigFile::CVar &var);
|
void cfcbSearchPaths(NLMISC::CConfigFile::CVar &var);
|
||||||
|
|
||||||
void loadGraphicsSettings();
|
void loadGraphicsSettings();
|
||||||
void loadSoundSettings();
|
void loadSoundSettings();
|
||||||
void loadPathsSettings();
|
void loadPathsSettings();
|
||||||
|
@ -74,7 +75,7 @@ private:
|
||||||
void saveSoundSettings();
|
void saveSoundSettings();
|
||||||
void savePathsSettings();
|
void savePathsSettings();
|
||||||
void saveVegetableSettings();
|
void saveVegetableSettings();
|
||||||
|
|
||||||
Ui::CSettingsDialog ui;
|
Ui::CSettingsDialog ui;
|
||||||
|
|
||||||
}; /* class CSettingsDialog */
|
}; /* class CSettingsDialog */
|
||||||
|
|
|
@ -34,18 +34,19 @@
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
namespace NLQT {
|
namespace NLQT
|
||||||
|
{
|
||||||
|
|
||||||
CSetupFog::CSetupFog(QWidget *parent)
|
CSetupFog::CSetupFog(QWidget *parent)
|
||||||
: QDockWidget(parent)
|
: QDockWidget(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
// load fog value from config file
|
// load fog value from config file
|
||||||
ui.startDoubleSpinBox->setValue(Modules::config().getValue("FogStart", 0.0));
|
ui.startDoubleSpinBox->setValue(Modules::config().getValue("FogStart", 0.0));
|
||||||
ui.endDoubleSpinBox->setValue(Modules::config().getValue("FogEnd", 0.0));
|
ui.endDoubleSpinBox->setValue(Modules::config().getValue("FogEnd", 0.0));
|
||||||
colorFog = Modules::config().getValue("FogColor",CRGBA(0.0, 0.0, 0.0));
|
colorFog = Modules::config().getValue("FogColor",CRGBA(0.0, 0.0, 0.0));
|
||||||
|
|
||||||
connect(ui.applyPushButton, SIGNAL(clicked()), this, SLOT(apply()));
|
connect(ui.applyPushButton, SIGNAL(clicked()), this, SLOT(apply()));
|
||||||
connect(ui.colorPushButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
connect(ui.colorPushButton, SIGNAL(clicked()), this, SLOT(setColor()));
|
||||||
}
|
}
|
||||||
|
@ -63,17 +64,17 @@ CSetupFog::~CSetupFog()
|
||||||
|
|
||||||
void CSetupFog::apply()
|
void CSetupFog::apply()
|
||||||
{
|
{
|
||||||
Modules::objView().getDriver()->setupFog(ui.startDoubleSpinBox->value(),
|
Modules::objView().getDriver()->setupFog(ui.startDoubleSpinBox->value(),
|
||||||
ui.endDoubleSpinBox->value(),
|
ui.endDoubleSpinBox->value(),
|
||||||
colorFog);
|
colorFog);
|
||||||
Modules::objView().getDriver()->enableFog(ui.enableFogCheckBox->isChecked());
|
Modules::objView().getDriver()->enableFog(ui.enableFogCheckBox->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSetupFog::setColor()
|
void CSetupFog::setColor()
|
||||||
{
|
{
|
||||||
QColor color = QColorDialog::getColor(QColor(colorFog.R,
|
QColor color = QColorDialog::getColor(QColor(colorFog.R,
|
||||||
colorFog.G,
|
colorFog.G,
|
||||||
colorFog.B));
|
colorFog.B));
|
||||||
colorFog.set(color.red(), color.green(), color.blue());
|
colorFog.set(color.red(), color.green(), color.blue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue