mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 19:53:30 +02:00
hook the DataServerScriptingInterface to the ScriptEngine
This commit is contained in:
parent
e08f4d2eba
commit
aa9f7ff31d
3 changed files with 12 additions and 0 deletions
|
@ -17,6 +17,8 @@ class DataServerScriptingInterface : public QObject {
|
|||
Q_OBJECT
|
||||
public:
|
||||
DataServerScriptingInterface();
|
||||
|
||||
void refreshUUID() { _uuid = QUuid::createUuid(); }
|
||||
public slots:
|
||||
void setValueForKey(const QString& key, const QString& value);
|
||||
private:
|
||||
|
|
|
@ -119,6 +119,8 @@ void ScriptEngine::init() {
|
|||
|
||||
QScriptValue audioScriptingInterfaceValue = _engine.newQObject(&_audioScriptingInterface);
|
||||
_engine.globalObject().setProperty("Audio", audioScriptingInterfaceValue);
|
||||
|
||||
registerGlobalObject("Data", &_dataServerScriptingInterface);
|
||||
|
||||
if (_controllerScriptingInterface) {
|
||||
QScriptValue controllerScripterValue = _engine.newQObject(_controllerScriptingInterface);
|
||||
|
@ -140,6 +142,10 @@ void ScriptEngine::registerGlobalObject(const QString& name, QObject* object) {
|
|||
_engine.globalObject().setProperty(name, value);
|
||||
}
|
||||
|
||||
void ScriptEngine::preEvaluateReset() {
|
||||
_dataServerScriptingInterface.refreshUUID();
|
||||
}
|
||||
|
||||
void ScriptEngine::evaluate() {
|
||||
if (!_isInitialized) {
|
||||
init();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
class ParticlesScriptingInterface;
|
||||
|
||||
#include "AbstractControllerScriptingInterface.h"
|
||||
#include "DataServerScriptingInterface.h"
|
||||
|
||||
const QString NO_SCRIPT("");
|
||||
|
||||
|
@ -61,6 +62,8 @@ signals:
|
|||
void finished();
|
||||
|
||||
protected:
|
||||
void preEvaluateReset();
|
||||
|
||||
QString _scriptContents;
|
||||
bool _isFinished;
|
||||
bool _isRunning;
|
||||
|
@ -72,6 +75,7 @@ private:
|
|||
static ParticlesScriptingInterface _particlesScriptingInterface;
|
||||
AbstractControllerScriptingInterface* _controllerScriptingInterface;
|
||||
AudioScriptingInterface _audioScriptingInterface;
|
||||
DataServerScriptingInterface _dataServerScriptingInterface;
|
||||
bool _wantMenuItems;
|
||||
QString _scriptMenuName;
|
||||
AbstractMenuInterface* _menu;
|
||||
|
|
Loading…
Reference in a new issue