mirror of
https://github.com/overte-org/overte.git
synced 2025-06-19 08:20:13 +02:00
hook the user's avatar object into the Interface ScriptEngine
This commit is contained in:
parent
98c25aa3ee
commit
6b44172467
4 changed files with 8 additions and 5 deletions
|
@ -101,7 +101,7 @@ void Agent::run() {
|
||||||
scriptedAvatar.setUUID(_scriptEngine.getDataServerScriptingInterface().getUUID());
|
scriptedAvatar.setUUID(_scriptEngine.getDataServerScriptingInterface().getUUID());
|
||||||
|
|
||||||
// give this AvatarData object to the script engine
|
// give this AvatarData object to the script engine
|
||||||
_scriptEngine.setAvatarData(&scriptedAvatar);
|
_scriptEngine.setAvatarData(&scriptedAvatar, "Avatar");
|
||||||
|
|
||||||
_scriptEngine.setScriptContents(scriptContents);
|
_scriptEngine.setScriptContents(scriptContents);
|
||||||
_scriptEngine.run();
|
_scriptEngine.run();
|
||||||
|
|
|
@ -4262,6 +4262,9 @@ void Application::loadScript(const QString& fileNameString){
|
||||||
scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender);
|
scriptEngine->getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender);
|
||||||
scriptEngine->getParticlesScriptingInterface()->setPacketSender(&_particleEditSender);
|
scriptEngine->getParticlesScriptingInterface()->setPacketSender(&_particleEditSender);
|
||||||
|
|
||||||
|
// hook our avatar object into this script engine
|
||||||
|
scriptEngine->setAvatarData(&_myAvatar, "MyAvatar");
|
||||||
|
|
||||||
QThread* workerThread = new QThread(this);
|
QThread* workerThread = new QThread(this);
|
||||||
|
|
||||||
// when the worker thread is started, call our engine's run..
|
// when the worker thread is started, call our engine's run..
|
||||||
|
|
|
@ -71,14 +71,14 @@ ScriptEngine::~ScriptEngine() {
|
||||||
//printf("ScriptEngine::~ScriptEngine()...\n");
|
//printf("ScriptEngine::~ScriptEngine()...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::setAvatarData(AvatarData* avatarData) {
|
void ScriptEngine::setAvatarData(AvatarData* avatarData, char* objectName) {
|
||||||
_avatarData = avatarData;
|
_avatarData = avatarData;
|
||||||
|
|
||||||
// remove the old Avatar property, if it exists
|
// remove the old Avatar property, if it exists
|
||||||
_engine.globalObject().setProperty("Avatar", QScriptValue());
|
_engine.globalObject().setProperty(objectName, QScriptValue());
|
||||||
|
|
||||||
// give the script engine the new Avatar script property
|
// give the script engine the new Avatar script property
|
||||||
registerGlobalObject("Avatar", _avatarData);
|
registerGlobalObject(objectName, _avatarData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::setupMenuItems() {
|
void ScriptEngine::setupMenuItems() {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
void setIsAvatar(bool isAvatar) { _isAvatar = isAvatar; }
|
void setIsAvatar(bool isAvatar) { _isAvatar = isAvatar; }
|
||||||
bool isAvatar() const { return _isAvatar; }
|
bool isAvatar() const { return _isAvatar; }
|
||||||
|
|
||||||
void setAvatarData(AvatarData* avatarData);
|
void setAvatarData(AvatarData* avatarData, char* objectName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void init();
|
void init();
|
||||||
|
|
Loading…
Reference in a new issue