forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'zini/master' into animation2
Conflicts: apps/openmw/mwrender/npcanimation.cpp apps/openmw/mwrender/npcanimation.hpp
This commit is contained in:
commit
0148db8ccf
18 changed files with 212 additions and 67 deletions
|
@ -20,6 +20,7 @@ void CSMDoc::Document::load (const std::vector<boost::filesystem::path>::const_i
|
||||||
getData().loadFile (*end2, false);
|
getData().loadFile (*end2, false);
|
||||||
|
|
||||||
addOptionalGmsts();
|
addOptionalGmsts();
|
||||||
|
addOptionalGlobals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Document::addOptionalGmsts()
|
void CSMDoc::Document::addOptionalGmsts()
|
||||||
|
@ -139,6 +140,26 @@ void CSMDoc::Document::addOptionalGmsts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMDoc::Document::addOptionalGlobals()
|
||||||
|
{
|
||||||
|
static const char *sGlobals[] =
|
||||||
|
{
|
||||||
|
"dayspassed",
|
||||||
|
"pcwerewolf",
|
||||||
|
"pcyear",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i=0; sGlobals[i]; ++i)
|
||||||
|
{
|
||||||
|
ESM::Global global;
|
||||||
|
global.mId = sGlobals[i];
|
||||||
|
global.mType = ESM::VT_Int;
|
||||||
|
global.mValue = 0;
|
||||||
|
addOptionalGlobal (global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
|
void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
|
||||||
{
|
{
|
||||||
if (getData().getGmsts().searchId (gmst.mId)==-1)
|
if (getData().getGmsts().searchId (gmst.mId)==-1)
|
||||||
|
@ -150,6 +171,17 @@ void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global)
|
||||||
|
{
|
||||||
|
if (getData().getGlobals().searchId (global.mId)==-1)
|
||||||
|
{
|
||||||
|
CSMWorld::Record<ESM::Global> record;
|
||||||
|
record.mBase = global;
|
||||||
|
record.mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||||
|
getData().getGlobals().appendRecord (record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSMDoc::Document::createBase()
|
void CSMDoc::Document::createBase()
|
||||||
{
|
{
|
||||||
static const char *sGlobals[] =
|
static const char *sGlobals[] =
|
||||||
|
@ -249,6 +281,7 @@ void CSMDoc::Document::abortOperation (int type)
|
||||||
|
|
||||||
if (type==State_Saving)
|
if (type==State_Saving)
|
||||||
{
|
{
|
||||||
|
mSaveCount=0;
|
||||||
mSaveTimer.stop();
|
mSaveTimer.stop();
|
||||||
emit stateChanged (getState(), this);
|
emit stateChanged (getState(), this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ class QAbstractItemModel;
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
struct GameSetting;
|
struct GameSetting;
|
||||||
|
struct Global;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
|
@ -53,8 +54,12 @@ namespace CSMDoc
|
||||||
|
|
||||||
void addOptionalGmsts();
|
void addOptionalGmsts();
|
||||||
|
|
||||||
|
void addOptionalGlobals();
|
||||||
|
|
||||||
void addOptionalGmst (const ESM::GameSetting& gmst);
|
void addOptionalGmst (const ESM::GameSetting& gmst);
|
||||||
|
|
||||||
|
void addOptionalGlobal (const ESM::Global& global);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Document (const std::vector<boost::filesystem::path>& files, bool new_);
|
Document (const std::vector<boost::filesystem::path>& files, bool new_);
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace CSMWorld
|
||||||
record2.mModified = record;
|
record2.mModified = record;
|
||||||
|
|
||||||
mRecords.push_back (record2);
|
mRecords.push_back (record2);
|
||||||
mIndex.insert (std::make_pair (id, mRecords.size()-1));
|
mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (id), mRecords.size()-1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -306,7 +306,7 @@ namespace CSMWorld
|
||||||
void IdCollection<ESXRecordT>::appendRecord (const RecordBase& record)
|
void IdCollection<ESXRecordT>::appendRecord (const RecordBase& record)
|
||||||
{
|
{
|
||||||
mRecords.push_back (dynamic_cast<const Record<ESXRecordT>&> (record));
|
mRecords.push_back (dynamic_cast<const Record<ESXRecordT>&> (record));
|
||||||
mIndex.insert (std::make_pair (getId (record), mRecords.size()-1));
|
mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (getId (record)), mRecords.size()-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ESXRecordT>
|
template<typename ESXRecordT>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
|
|
||||||
#include "operation.hpp"
|
#include "operation.hpp"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QProgressBar>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
|
|
||||||
void CSVDoc::Operation::updateLabel (int threads)
|
void CSVDoc::Operation::updateLabel (int threads)
|
||||||
|
@ -28,24 +31,44 @@ void CSVDoc::Operation::updateLabel (int threads)
|
||||||
stream << name << " (%p%)";
|
stream << name << " (%p%)";
|
||||||
}
|
}
|
||||||
|
|
||||||
setFormat (stream.str().c_str());
|
mProgressBar->setFormat (stream.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVDoc::Operation::Operation (int type) : mType (type), mStalling (false)
|
CSVDoc::Operation::Operation (int type, QWidget* parent) : mType (type), mStalling (false)
|
||||||
{
|
{
|
||||||
/// \todo Add a cancel button or a pop up menu with a cancel item
|
/// \todo Add a cancel button or a pop up menu with a cancel item
|
||||||
|
initWidgets();
|
||||||
setBarColor( type);
|
setBarColor( type);
|
||||||
updateLabel();
|
updateLabel();
|
||||||
|
|
||||||
/// \todo assign different progress bar colours to allow the user to distinguish easily between operation types
|
/// \todo assign different progress bar colours to allow the user to distinguish easily between operation types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSVDoc::Operation::~Operation()
|
||||||
|
{
|
||||||
|
delete mLayout;
|
||||||
|
delete mProgressBar;
|
||||||
|
delete mAbortButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVDoc::Operation::initWidgets()
|
||||||
|
{
|
||||||
|
mProgressBar = new QProgressBar ();
|
||||||
|
mAbortButton = new QPushButton("Abort");
|
||||||
|
mLayout = new QHBoxLayout();
|
||||||
|
|
||||||
|
mLayout->addWidget (mProgressBar);
|
||||||
|
mLayout->addWidget (mAbortButton);
|
||||||
|
|
||||||
|
connect (mAbortButton, SIGNAL (clicked()), this, SLOT (abortOperation()));
|
||||||
|
}
|
||||||
|
|
||||||
void CSVDoc::Operation::setProgress (int current, int max, int threads)
|
void CSVDoc::Operation::setProgress (int current, int max, int threads)
|
||||||
{
|
{
|
||||||
updateLabel (threads);
|
updateLabel (threads);
|
||||||
setRange (0, max);
|
mProgressBar->setRange (0, max);
|
||||||
setValue (current);
|
mProgressBar->setValue (current);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSVDoc::Operation::getType() const
|
int CSVDoc::Operation::getType() const
|
||||||
|
@ -64,8 +87,6 @@ void CSVDoc::Operation::setBarColor (int type)
|
||||||
"margin: 2px 1px 1p 2px;"
|
"margin: 2px 1px 1p 2px;"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
// "QProgressBar::chunk {background-color: %1;}";
|
|
||||||
|
|
||||||
QString topColor = "#F2F6F8";
|
QString topColor = "#F2F6F8";
|
||||||
QString bottomColor = "#E0EFF9";
|
QString bottomColor = "#E0EFF9";
|
||||||
QString midTopColor = "#D8E1E7";
|
QString midTopColor = "#D8E1E7";
|
||||||
|
@ -82,7 +103,7 @@ void CSVDoc::Operation::setBarColor (int type)
|
||||||
midTopColor = "#F17432";
|
midTopColor = "#F17432";
|
||||||
midBottomColor = "#EA5507";
|
midBottomColor = "#EA5507";
|
||||||
bottomColor = "#FB955E"; // red gloss #2
|
bottomColor = "#FB955E"; // red gloss #2
|
||||||
//break;
|
break;
|
||||||
|
|
||||||
case CSMDoc::State_Searching:
|
case CSMDoc::State_Searching:
|
||||||
|
|
||||||
|
@ -90,7 +111,7 @@ void CSVDoc::Operation::setBarColor (int type)
|
||||||
midTopColor = "#ABD3EE";
|
midTopColor = "#ABD3EE";
|
||||||
midBottomColor = "#89C3EB";
|
midBottomColor = "#89C3EB";
|
||||||
bottomColor = "#D5EBFB"; //blue gloss #4
|
bottomColor = "#D5EBFB"; //blue gloss #4
|
||||||
//break;
|
break;
|
||||||
|
|
||||||
case CSMDoc::State_Verifying:
|
case CSMDoc::State_Verifying:
|
||||||
|
|
||||||
|
@ -98,7 +119,7 @@ void CSVDoc::Operation::setBarColor (int type)
|
||||||
midTopColor = "#8EB92A";
|
midTopColor = "#8EB92A";
|
||||||
midBottomColor = "#72AA00";
|
midBottomColor = "#72AA00";
|
||||||
bottomColor = "#9ECB2D"; //green gloss
|
bottomColor = "#9ECB2D"; //green gloss
|
||||||
//break;
|
break;
|
||||||
|
|
||||||
case CSMDoc::State_Compiling:
|
case CSMDoc::State_Compiling:
|
||||||
|
|
||||||
|
@ -106,7 +127,7 @@ void CSVDoc::Operation::setBarColor (int type)
|
||||||
midTopColor = "#C19E67";
|
midTopColor = "#C19E67";
|
||||||
midBottomColor = "#B68D4C";
|
midBottomColor = "#B68D4C";
|
||||||
bottomColor = "#E9D4B3"; //l Brown 3D
|
bottomColor = "#E9D4B3"; //l Brown 3D
|
||||||
//break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
@ -116,5 +137,15 @@ void CSVDoc::Operation::setBarColor (int type)
|
||||||
midBottomColor = "#B5C6D0"; // gray gloss for undefined ops
|
midBottomColor = "#B5C6D0"; // gray gloss for undefined ops
|
||||||
}
|
}
|
||||||
|
|
||||||
setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor));
|
mProgressBar->setStyleSheet(style.arg(topColor).arg(midTopColor).arg(midBottomColor).arg(bottomColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
QHBoxLayout *CSVDoc::Operation::getLayout() const
|
||||||
|
{
|
||||||
|
return mLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVDoc::Operation::abortOperation()
|
||||||
|
{
|
||||||
|
emit abortOperation (mType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,23 @@
|
||||||
#ifndef CSV_DOC_OPERATION_H
|
#ifndef CSV_DOC_OPERATION_H
|
||||||
#define CSV_DOC_OPERATION_H
|
#define CSV_DOC_OPERATION_H
|
||||||
|
|
||||||
#include <QProgressBar>
|
#include <QObject>
|
||||||
|
|
||||||
|
class QHBoxLayout;
|
||||||
|
class QPushButton;
|
||||||
|
class QProgressBar;
|
||||||
|
|
||||||
namespace CSVDoc
|
namespace CSVDoc
|
||||||
{
|
{
|
||||||
class Operation : public QProgressBar
|
class Operation : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
int mType;
|
int mType;
|
||||||
bool mStalling;
|
bool mStalling;
|
||||||
|
QProgressBar *mProgressBar;
|
||||||
|
QPushButton *mAbortButton;
|
||||||
|
QHBoxLayout *mLayout;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
Operation (const Operation&);
|
Operation (const Operation&);
|
||||||
|
@ -20,15 +27,26 @@ namespace CSVDoc
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Operation (int type);
|
Operation (int type, QWidget *parent);
|
||||||
|
~Operation();
|
||||||
|
|
||||||
void setProgress (int current, int max, int threads);
|
void setProgress (int current, int max, int threads);
|
||||||
|
|
||||||
int getType() const;
|
int getType() const;
|
||||||
|
QHBoxLayout *getLayout() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setBarColor (int type);
|
void setBarColor (int type);
|
||||||
|
void initWidgets();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void abortOperation (int type);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void abortOperation();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
#include "operations.hpp"
|
#include "operations.hpp"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
#include "operation.hpp"
|
#include "operation.hpp"
|
||||||
|
|
||||||
|
@ -11,12 +11,14 @@ CSVDoc::Operations::Operations()
|
||||||
|
|
||||||
setFeatures (QDockWidget::NoDockWidgetFeatures);
|
setFeatures (QDockWidget::NoDockWidgetFeatures);
|
||||||
|
|
||||||
QWidget *widget = new QWidget;
|
QWidget *widgetContainer = new QWidget (this);
|
||||||
setWidget (widget);
|
|
||||||
|
|
||||||
mLayout = new QVBoxLayout;
|
mLayout = new QVBoxLayout;
|
||||||
|
|
||||||
widget->setLayout (mLayout);
|
widgetContainer->setLayout (mLayout);
|
||||||
|
setWidget (widgetContainer);
|
||||||
|
|
||||||
|
setFixedHeight (widgetContainer->height());
|
||||||
|
setTitleBarWidget (new QWidget (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::Operations::setProgress (int current, int max, int type, int threads)
|
void CSVDoc::Operations::setProgress (int current, int max, int type, int threads)
|
||||||
|
@ -28,11 +30,18 @@ void CSVDoc::Operations::setProgress (int current, int max, int type, int thread
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Operation *operation = new Operation (type);
|
int oldCount = mOperations.size();
|
||||||
|
int newCount = oldCount + 1;
|
||||||
|
|
||||||
mLayout->addWidget (operation);
|
Operation *operation = new Operation (type, this);
|
||||||
|
connect (operation, SIGNAL (abortOperation (int)), this, SIGNAL (abortOperation (int)));
|
||||||
|
|
||||||
|
mLayout->addLayout (operation->getLayout());
|
||||||
mOperations.push_back (operation);
|
mOperations.push_back (operation);
|
||||||
operation->setProgress (current, max, threads);
|
operation->setProgress (current, max, threads);
|
||||||
|
|
||||||
|
if ( oldCount > 0)
|
||||||
|
setFixedHeight (height()/oldCount * newCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVDoc::Operations::quitOperation (int type)
|
void CSVDoc::Operations::quitOperation (int type)
|
||||||
|
@ -40,8 +49,17 @@ void CSVDoc::Operations::quitOperation (int type)
|
||||||
for (std::vector<Operation *>::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter)
|
for (std::vector<Operation *>::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter)
|
||||||
if ((*iter)->getType()==type)
|
if ((*iter)->getType()==type)
|
||||||
{
|
{
|
||||||
|
int oldCount = mOperations.size();
|
||||||
|
int newCount = oldCount - 1;
|
||||||
|
|
||||||
|
mLayout->removeItem ((*iter)->getLayout());
|
||||||
|
|
||||||
delete *iter;
|
delete *iter;
|
||||||
mOperations.erase (iter);
|
mOperations.erase (iter);
|
||||||
|
|
||||||
|
if (oldCount > 1)
|
||||||
|
setFixedHeight (height() / oldCount * newCount);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,6 +31,10 @@ namespace CSVDoc
|
||||||
|
|
||||||
void quitOperation (int type);
|
void quitOperation (int type);
|
||||||
///< Calling this function for an operation that is not running is a no-op.
|
///< Calling this function for an operation that is not running is a no-op.
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void abortOperation (int type);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include "subview.hpp"
|
#include "subview.hpp"
|
||||||
|
|
||||||
CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) : mUniversalId (id)
|
CSVDoc::SubView::SubView (const CSMWorld::UniversalId& id) : mUniversalId (id)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include "view.hpp"
|
#include "view.hpp"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -7,6 +6,7 @@
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
|
#include <QDockWidget>
|
||||||
|
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
|
|
||||||
|
@ -117,13 +117,16 @@ void CSVDoc::View::updateActions()
|
||||||
mVerify->setEnabled (!(mDocument->getState() & CSMDoc::State_Verifying));
|
mVerify->setEnabled (!(mDocument->getState() & CSMDoc::State_Verifying));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
|
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews, QMainWindow *viewParent)
|
||||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews)
|
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews), QMainWindow (viewParent)
|
||||||
{
|
{
|
||||||
setDockOptions (QMainWindow::AllowNestedDocks);
|
setDockOptions (QMainWindow::AllowNestedDocks);
|
||||||
|
|
||||||
resize (300, 300); /// \todo get default size from settings and set reasonable minimal size
|
resize (300, 300); /// \todo get default size from settings and set reasonable minimal size
|
||||||
|
|
||||||
|
mSubViewWindow = new QMainWindow();
|
||||||
|
setCentralWidget (mSubViewWindow);
|
||||||
|
|
||||||
mOperations = new Operations;
|
mOperations = new Operations;
|
||||||
addDockWidget (Qt::BottomDockWidgetArea, mOperations);
|
addDockWidget (Qt::BottomDockWidgetArea, mOperations);
|
||||||
|
|
||||||
|
@ -133,6 +136,8 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to
|
||||||
|
|
||||||
CSVWorld::addSubViewFactories (mSubViewFactory);
|
CSVWorld::addSubViewFactories (mSubViewFactory);
|
||||||
CSVTools::addSubViewFactories (mSubViewFactory);
|
CSVTools::addSubViewFactories (mSubViewFactory);
|
||||||
|
|
||||||
|
connect (mOperations, SIGNAL (abortOperation (int)), this, SLOT (abortOperation (int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVDoc::View::~View()
|
CSVDoc::View::~View()
|
||||||
|
@ -171,7 +176,7 @@ void CSVDoc::View::updateDocumentState()
|
||||||
|
|
||||||
for (int i=0; operations[i]!=-1; ++i)
|
for (int i=0; operations[i]!=-1; ++i)
|
||||||
if (!(state & operations[i]))
|
if (!(state & operations[i]))
|
||||||
mOperations->quitOperation (operations[i]);
|
mOperations->quitOperation (operations[i]);
|
||||||
|
|
||||||
QList<CSVDoc::SubView *> subViews = findChildren<CSVDoc::SubView *>();
|
QList<CSVDoc::SubView *> subViews = findChildren<CSVDoc::SubView *>();
|
||||||
|
|
||||||
|
@ -195,7 +200,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id)
|
||||||
/// \todo add an user setting to reuse sub views (on a per document basis or on a per top level view basis)
|
/// \todo add an user setting to reuse sub views (on a per document basis or on a per top level view basis)
|
||||||
|
|
||||||
SubView *view = mSubViewFactory.makeSubView (id, *mDocument);
|
SubView *view = mSubViewFactory.makeSubView (id, *mDocument);
|
||||||
addDockWidget (Qt::TopDockWidgetArea, view);
|
mSubViewWindow->addDockWidget (Qt::TopDockWidgetArea, view);
|
||||||
|
|
||||||
connect (view, SIGNAL (focusId (const CSMWorld::UniversalId&)), this,
|
connect (view, SIGNAL (focusId (const CSMWorld::UniversalId&)), this,
|
||||||
SLOT (addSubView (const CSMWorld::UniversalId&)));
|
SLOT (addSubView (const CSMWorld::UniversalId&)));
|
||||||
|
@ -227,3 +232,14 @@ void CSVDoc::View::addGmstsSubView()
|
||||||
{
|
{
|
||||||
addSubView (CSMWorld::UniversalId::Type_Gmsts);
|
addSubView (CSMWorld::UniversalId::Type_Gmsts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVDoc::View::abortOperation (int type)
|
||||||
|
{
|
||||||
|
mDocument->abortOperation (type);
|
||||||
|
updateActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDockWidget *CSVDoc::View::getOperations() const
|
||||||
|
{
|
||||||
|
return mOperations;
|
||||||
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "subviewfactory.hpp"
|
#include "subviewfactory.hpp"
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QDockWidget;
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,7 @@ namespace CSVDoc
|
||||||
std::vector<QAction *> mEditingActions;
|
std::vector<QAction *> mEditingActions;
|
||||||
Operations *mOperations;
|
Operations *mOperations;
|
||||||
SubViewFactoryManager mSubViewFactory;
|
SubViewFactoryManager mSubViewFactory;
|
||||||
|
QMainWindow* mSubViewWindow;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
View (const View&);
|
View (const View&);
|
||||||
|
@ -65,7 +67,7 @@ namespace CSVDoc
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews);
|
View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews, QMainWindow *viewParent);
|
||||||
///< The ownership of \a document is not transferred to *this.
|
///< The ownership of \a document is not transferred to *this.
|
||||||
|
|
||||||
virtual ~View();
|
virtual ~View();
|
||||||
|
@ -80,6 +82,8 @@ namespace CSVDoc
|
||||||
|
|
||||||
void updateProgress (int current, int max, int type, int threads);
|
void updateProgress (int current, int max, int type, int threads);
|
||||||
|
|
||||||
|
QDockWidget *getOperations() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void newDocumentRequest();
|
void newDocumentRequest();
|
||||||
|
@ -101,6 +105,8 @@ namespace CSVDoc
|
||||||
void addGlobalsSubView();
|
void addGlobalsSubView();
|
||||||
|
|
||||||
void addGmstsSubView();
|
void addGmstsSubView();
|
||||||
|
|
||||||
|
void abortOperation (int type);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,9 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document)
|
||||||
this, SLOT (progress (int, int, int, int, CSMDoc::Document *)));
|
this, SLOT (progress (int, int, int, int, CSMDoc::Document *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
View *view = new View (*this, document, countViews (document)+1);
|
QMainWindow *mainWindow = new QMainWindow;
|
||||||
|
|
||||||
|
View *view = new View (*this, document, countViews (document)+1, mainWindow);
|
||||||
|
|
||||||
mViews.push_back (view);
|
mViews.push_back (view);
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
|
|
||||||
#include "inventorywindow.hpp"
|
#include "inventorywindow.hpp"
|
||||||
|
|
||||||
static const float BALANCE_CHANGE_INITIAL_PAUSE = 0.5; // in seconds
|
|
||||||
static const float BALANCE_CHANGE_INTERVAL = 0.1; // in seconds
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
const float TradeWindow::sBalanceChangeInitialPause = 0.5;
|
||||||
|
const float TradeWindow::sBalanceChangeInterval = 0.1;
|
||||||
|
|
||||||
TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) :
|
TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) :
|
||||||
WindowBase("openmw_trade_window.layout", parWindowManager)
|
WindowBase("openmw_trade_window.layout", parWindowManager)
|
||||||
, ContainerBase(NULL) // no drag&drop
|
, ContainerBase(NULL) // no drag&drop
|
||||||
|
@ -157,7 +157,7 @@ namespace MWGui
|
||||||
|
|
||||||
mBalanceChangePause -= frameDuration;
|
mBalanceChangePause -= frameDuration;
|
||||||
if (mBalanceChangePause < 0.0) {
|
if (mBalanceChangePause < 0.0) {
|
||||||
mBalanceChangePause += BALANCE_CHANGE_INTERVAL;
|
mBalanceChangePause += sBalanceChangeInterval;
|
||||||
if (mBalanceButtonsState == BBS_Increase)
|
if (mBalanceButtonsState == BBS_Increase)
|
||||||
onIncreaseButtonTriggered();
|
onIncreaseButtonTriggered();
|
||||||
else if (mBalanceButtonsState == BBS_Decrease)
|
else if (mBalanceButtonsState == BBS_Decrease)
|
||||||
|
@ -296,14 +296,14 @@ namespace MWGui
|
||||||
void TradeWindow::onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
void TradeWindow::onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
||||||
{
|
{
|
||||||
mBalanceButtonsState = BBS_Increase;
|
mBalanceButtonsState = BBS_Increase;
|
||||||
mBalanceChangePause = BALANCE_CHANGE_INITIAL_PAUSE;
|
mBalanceChangePause = sBalanceChangeInitialPause;
|
||||||
onIncreaseButtonTriggered();
|
onIncreaseButtonTriggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
void TradeWindow::onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
||||||
{
|
{
|
||||||
mBalanceButtonsState = BBS_Decrease;
|
mBalanceButtonsState = BBS_Decrease;
|
||||||
mBalanceChangePause = BALANCE_CHANGE_INITIAL_PAUSE;
|
mBalanceChangePause = sBalanceChangeInitialPause;
|
||||||
onDecreaseButtonTriggered();
|
onDecreaseButtonTriggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@ namespace MWGui
|
||||||
void onFrame(float frameDuration);
|
void onFrame(float frameDuration);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
static const float sBalanceChangeInitialPause; // in seconds
|
||||||
|
static const float sBalanceChangeInterval; // in seconds
|
||||||
|
|
||||||
MyGUI::Button* mFilterAll;
|
MyGUI::Button* mFilterAll;
|
||||||
MyGUI::Button* mFilterWeapon;
|
MyGUI::Button* mFilterWeapon;
|
||||||
MyGUI::Button* mFilterApparel;
|
MyGUI::Button* mFilterApparel;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <OgreSceneManager.h>
|
#include <OgreSceneManager.h>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "animation.hpp"
|
#include "animation.hpp"
|
||||||
#include "activatoranimation.hpp"
|
#include "activatoranimation.hpp"
|
||||||
|
@ -168,7 +169,9 @@ void Actors::updateObjectCell(const MWWorld::Ptr &ptr)
|
||||||
{
|
{
|
||||||
/// \note Update key (Ptr's are compared only with refdata so mCell
|
/// \note Update key (Ptr's are compared only with refdata so mCell
|
||||||
/// on key is outdated), maybe redundant
|
/// on key is outdated), maybe redundant
|
||||||
Animation *anim = iter->second;
|
NpcAnimation *anim = static_cast<NpcAnimation *>(iter->second);
|
||||||
|
anim->updateParts(MWWorld::Class::get(ptr).getInventoryStore(ptr));
|
||||||
|
|
||||||
mAllActors.erase(iter);
|
mAllActors.erase(iter);
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,22 +54,22 @@ NpcAnimation::~NpcAnimation()
|
||||||
|
|
||||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& inv, int visibilityFlags)
|
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& inv, int visibilityFlags)
|
||||||
: Animation(ptr),
|
: Animation(ptr),
|
||||||
mInv(inv),
|
mInv(&inv),
|
||||||
mStateID(-1),
|
mStateID(-1),
|
||||||
mTimeToChange(0),
|
mTimeToChange(0),
|
||||||
mVisibilityFlags(visibilityFlags),
|
mVisibilityFlags(visibilityFlags),
|
||||||
mRobe(mInv.end()),
|
mRobe(mInv->end()),
|
||||||
mHelmet(mInv.end()),
|
mHelmet(mInv->end()),
|
||||||
mShirt(mInv.end()),
|
mShirt(mInv->end()),
|
||||||
mCuirass(mInv.end()),
|
mCuirass(mInv->end()),
|
||||||
mGreaves(mInv.end()),
|
mGreaves(mInv->end()),
|
||||||
mPauldronL(mInv.end()),
|
mPauldronL(mInv->end()),
|
||||||
mPauldronR(mInv.end()),
|
mPauldronR(mInv->end()),
|
||||||
mBoots(mInv.end()),
|
mBoots(mInv->end()),
|
||||||
mPants(mInv.end()),
|
mPants(mInv->end()),
|
||||||
mGloveL(mInv.end()),
|
mGloveL(mInv->end()),
|
||||||
mGloveR(mInv.end()),
|
mGloveR(mInv->end()),
|
||||||
mSkirtIter(mInv.end())
|
mSkirtIter(mInv->end())
|
||||||
{
|
{
|
||||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
|
|
||||||
for(size_t i = 0;!forceupdate && i < slotlistsize;i++)
|
for(size_t i = 0;!forceupdate && i < slotlistsize;i++)
|
||||||
{
|
{
|
||||||
MWWorld::ContainerStoreIterator iter = mInv.getSlot(slotlist[i].slot);
|
MWWorld::ContainerStoreIterator iter = mInv->getSlot(slotlist[i].slot);
|
||||||
if(this->*slotlist[i].part != iter)
|
if(this->*slotlist[i].part != iter)
|
||||||
{
|
{
|
||||||
forceupdate = true;
|
forceupdate = true;
|
||||||
|
@ -227,12 +227,12 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
|
|
||||||
for(size_t i = 0;i < slotlistsize;i++)
|
for(size_t i = 0;i < slotlistsize;i++)
|
||||||
{
|
{
|
||||||
MWWorld::ContainerStoreIterator iter = mInv.getSlot(slotlist[i].slot);
|
MWWorld::ContainerStoreIterator iter = mInv->getSlot(slotlist[i].slot);
|
||||||
|
|
||||||
this->*slotlist[i].part = iter;
|
this->*slotlist[i].part = iter;
|
||||||
removePartGroup(slotlist[i].slot);
|
removePartGroup(slotlist[i].slot);
|
||||||
|
|
||||||
if(this->*slotlist[i].part == mInv.end())
|
if(this->*slotlist[i].part == mInv->end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(int rem = 0;rem < slotlist[i].numRemoveParts;rem++)
|
for(int rem = 0;rem < slotlist[i].numRemoveParts;rem++)
|
||||||
|
|
|
@ -26,7 +26,7 @@ private:
|
||||||
static const size_t sPartListSize = 27;
|
static const size_t sPartListSize = 27;
|
||||||
static const PartInfo sPartList[sPartListSize];
|
static const PartInfo sPartList[sPartListSize];
|
||||||
|
|
||||||
MWWorld::InventoryStore& mInv;
|
MWWorld::InventoryStore *mInv;
|
||||||
int mStateID;
|
int mStateID;
|
||||||
|
|
||||||
// Bounded Parts
|
// Bounded Parts
|
||||||
|
@ -57,7 +57,9 @@ private:
|
||||||
int mPartPriorities[sPartListSize];
|
int mPartPriorities[sPartListSize];
|
||||||
|
|
||||||
NifOgre::EntityList insertBoundedPart(const std::string &mesh, int group, const std::string &bonename);
|
NifOgre::EntityList insertBoundedPart(const std::string &mesh, int group, const std::string &bonename);
|
||||||
|
|
||||||
void updateParts(bool forceupdate = false);
|
void updateParts(bool forceupdate = false);
|
||||||
|
|
||||||
void removeEntities(NifOgre::EntityList &entities);
|
void removeEntities(NifOgre::EntityList &entities);
|
||||||
void removeIndividualPart(int type);
|
void removeIndividualPart(int type);
|
||||||
void reserveIndividualPart(int type, int group, int priority);
|
void reserveIndividualPart(int type, int group, int priority);
|
||||||
|
@ -73,6 +75,11 @@ public:
|
||||||
|
|
||||||
virtual Ogre::Vector3 runAnimation(float timepassed);
|
virtual Ogre::Vector3 runAnimation(float timepassed);
|
||||||
|
|
||||||
|
void updateParts(MWWorld::InventoryStore &inventory)
|
||||||
|
{
|
||||||
|
mInv = &inventory;
|
||||||
|
updateParts(true);
|
||||||
|
}
|
||||||
void forceUpdate()
|
void forceUpdate()
|
||||||
{ updateParts(true); }
|
{ updateParts(true); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -545,9 +545,5 @@ void Objects::updateObjectCell(const MWWorld::Ptr &ptr)
|
||||||
node = mCellSceneNodes[newCell];
|
node = mCellSceneNodes[newCell];
|
||||||
}
|
}
|
||||||
node->addChild(ptr.getRefData().getBaseNode());
|
node->addChild(ptr.getRefData().getBaseNode());
|
||||||
|
|
||||||
/// \note Still unaware how to move aabb and static w/o full rebuild,
|
|
||||||
/// moving static objects may cause problems
|
|
||||||
insertMesh(ptr, MWWorld::Class::get(ptr).getModel(ptr));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,11 @@ namespace MWWorld
|
||||||
copyObjectToCell(ptr, newCell, pos);
|
copyObjectToCell(ptr, newCell, pos);
|
||||||
else if (!mWorldScene->isCellActive(newCell))
|
else if (!mWorldScene->isCellActive(newCell))
|
||||||
{
|
{
|
||||||
MWWorld::Class::get(ptr).copyToCell(ptr, newCell);
|
MWWorld::Class::get(ptr)
|
||||||
|
.copyToCell(ptr, newCell)
|
||||||
|
.getRefData()
|
||||||
|
.setBaseNode(0);
|
||||||
|
|
||||||
mWorldScene->removeObjectFromScene(ptr);
|
mWorldScene->removeObjectFromScene(ptr);
|
||||||
mLocalScripts.remove(ptr);
|
mLocalScripts.remove(ptr);
|
||||||
removeContainerScripts (ptr);
|
removeContainerScripts (ptr);
|
||||||
|
|
Loading…
Reference in a new issue