mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-14 06:36:38 +02:00
allow agent to create and get avatar entities from script
This commit is contained in:
parent
e6b419d283
commit
a56e9b0860
3 changed files with 31 additions and 0 deletions
|
@ -365,6 +365,8 @@ void Agent::executeScript() {
|
||||||
// setup an Avatar for the script to use
|
// setup an Avatar for the script to use
|
||||||
auto scriptedAvatar = DependencyManager::get<ScriptableAvatar>();
|
auto scriptedAvatar = DependencyManager::get<ScriptableAvatar>();
|
||||||
|
|
||||||
|
scriptedAvatar->setID(getSessionUUID());
|
||||||
|
|
||||||
connect(_scriptEngine.data(), SIGNAL(update(float)),
|
connect(_scriptEngine.data(), SIGNAL(update(float)),
|
||||||
scriptedAvatar.data(), SLOT(update(float)), Qt::ConnectionType::QueuedConnection);
|
scriptedAvatar.data(), SLOT(update(float)), Qt::ConnectionType::QueuedConnection);
|
||||||
scriptedAvatar->setForceFaceTrackerConnected(true);
|
scriptedAvatar->setForceFaceTrackerConnected(true);
|
||||||
|
@ -606,6 +608,11 @@ void Agent::setIsAvatar(bool isAvatar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QMetaObject::invokeMethod(&_avatarAudioTimer, "stop");
|
QMetaObject::invokeMethod(&_avatarAudioTimer, "stop");
|
||||||
|
|
||||||
|
_entityEditSender.setMyAvatar(nullptr);
|
||||||
|
} else {
|
||||||
|
auto scriptableAvatar = DependencyManager::get<ScriptableAvatar>();
|
||||||
|
_entityEditSender.setMyAvatar(scriptableAvatar.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,26 @@ QVector<AttachmentData> ScriptAvatarData::getAttachmentData() const {
|
||||||
// END
|
// END
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if PR_BUILD || DEV_BUILD
|
||||||
|
//
|
||||||
|
// ENTITY PROPERTIES
|
||||||
|
// START
|
||||||
|
//
|
||||||
|
AvatarEntityMap ScriptAvatarData::getAvatarEntities() const {
|
||||||
|
AvatarEntityMap scriptEntityData;
|
||||||
|
|
||||||
|
if (AvatarSharedPointer sharedAvatarData = _avatarData.lock()) {
|
||||||
|
return sharedAvatarData->getAvatarEntityData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return scriptEntityData;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// ENTITY PROPERTIES
|
||||||
|
// END
|
||||||
|
//
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// AUDIO PROPERTIES
|
// AUDIO PROPERTIES
|
||||||
|
|
|
@ -116,6 +116,10 @@ public:
|
||||||
Q_INVOKABLE QStringList getJointNames() const;
|
Q_INVOKABLE QStringList getJointNames() const;
|
||||||
Q_INVOKABLE QVector<AttachmentData> getAttachmentData() const;
|
Q_INVOKABLE QVector<AttachmentData> getAttachmentData() const;
|
||||||
|
|
||||||
|
#if DEV_BUILD || PR_BUILD
|
||||||
|
Q_INVOKABLE AvatarEntityMap getAvatarEntities() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// AUDIO PROPERTIES
|
// AUDIO PROPERTIES
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue