mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
optionally add an AvatarHashMap instance to the ScriptEngine
This commit is contained in:
parent
f8106e5063
commit
75f35c5858
3 changed files with 11 additions and 0 deletions
|
@ -202,6 +202,7 @@ void Agent::run() {
|
|||
|
||||
// give this AvatarData object to the script engine
|
||||
_scriptEngine.setAvatarData(&scriptedAvatar, "Avatar");
|
||||
_scriptEngine.setAvatarHashMap(&_avatarHashMap, "AvatarHash");
|
||||
|
||||
// register ourselves to the script engine
|
||||
_scriptEngine.registerGlobalObject("Agent", this);
|
||||
|
|
|
@ -156,6 +156,14 @@ void ScriptEngine::setAvatarData(AvatarData* avatarData, const QString& objectNa
|
|||
registerGlobalObject(objectName, _avatarData);
|
||||
}
|
||||
|
||||
void ScriptEngine::setAvatarHashMap(AvatarHashMap* avatarHashMap, const QString& objectName) {
|
||||
// remove the old Avatar property, if it exists
|
||||
_engine.globalObject().setProperty(objectName, QScriptValue());
|
||||
|
||||
// give the script engine the new avatar hash map
|
||||
registerGlobalObject(objectName, avatarHashMap);
|
||||
}
|
||||
|
||||
bool ScriptEngine::setScriptContents(const QString& scriptContents, const QString& fileNameString) {
|
||||
if (_isRunning) {
|
||||
return false;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <VoxelsScriptingInterface.h>
|
||||
|
||||
#include <AvatarData.h>
|
||||
#include <AvatarHashMap.h>
|
||||
|
||||
#include "AnimationCache.h"
|
||||
#include "AbstractControllerScriptingInterface.h"
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
bool isAvatar() const { return _isAvatar; }
|
||||
|
||||
void setAvatarData(AvatarData* avatarData, const QString& objectName);
|
||||
void setAvatarHashMap(AvatarHashMap* avatarHashMap, const QString& objectName);
|
||||
|
||||
bool isListeningToAudioStream() const { return _isListeningToAudioStream; }
|
||||
void setIsListeningToAudioStream(bool isListeningToAudioStream) { _isListeningToAudioStream = isListeningToAudioStream; }
|
||||
|
|
Loading…
Reference in a new issue