mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
added requested changes
This commit is contained in:
parent
2ac7fcadd2
commit
689fbd2da0
6 changed files with 29 additions and 31 deletions
|
@ -1231,7 +1231,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
|
||||
connect(scriptEngines, &ScriptEngines::scriptsReloading, scriptEngines, [this] {
|
||||
getEntities()->reloadEntityScripts();
|
||||
loadAvatarScripts(getMyAvatar()->getSkeletonModel()->getFBXGeometry().scripts);
|
||||
loadAvatarScripts(getMyAvatar()->getScriptUrls());
|
||||
}, Qt::QueuedConnection);
|
||||
|
||||
connect(scriptEngines, &ScriptEngines::scriptLoadError,
|
||||
|
@ -4728,7 +4728,6 @@ void Application::init() {
|
|||
}
|
||||
|
||||
void Application::loadAvatarScripts(const QVector<QString>& urls) {
|
||||
if (urls.size() > 0) {
|
||||
auto scriptEngines = DependencyManager::get<ScriptEngines>();
|
||||
auto runningScripts = scriptEngines->getRunningScripts();
|
||||
for (auto url : urls) {
|
||||
|
@ -4741,12 +4740,10 @@ void Application::loadAvatarScripts(const QVector<QString>& urls) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::unloadAvatarScripts() {
|
||||
auto scriptEngines = DependencyManager::get<ScriptEngines>();
|
||||
auto urls = scriptEngines->getRunningScripts();
|
||||
if (urls.size() > 0) {
|
||||
for (auto url : urls) {
|
||||
auto scriptEngine = scriptEngines->getScriptEngine(url);
|
||||
if (scriptEngine->getType() == ScriptEngine::Type::AVATAR) {
|
||||
|
@ -4754,7 +4751,6 @@ void Application::unloadAvatarScripts() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::updateLOD(float deltaTime) const {
|
||||
PerformanceTimer perfTimer("LOD");
|
||||
|
|
|
@ -210,7 +210,6 @@ bool ModelPackager::zipModel() {
|
|||
_mapping[TEXDIR_FIELD] = tempDir.relativeFilePath(texDir.path());
|
||||
|
||||
for (auto multi : _mapping.values(SCRIPT_FIELD)) {
|
||||
|
||||
multi.fromValue(tempDir.relativeFilePath(scriptDir.path()) + multi.toString());
|
||||
}
|
||||
// Copy FST
|
||||
|
|
|
@ -2852,6 +2852,11 @@ void MyAvatar::setWalkSpeed(float value) {
|
|||
_walkSpeed.set(value);
|
||||
}
|
||||
|
||||
QVector<QString> MyAvatar::getScriptUrls() {
|
||||
QVector<QString> scripts = _skeletonModel->isLoaded() ? _skeletonModel->getFBXGeometry().scripts : QVector<QString>();
|
||||
return scripts;
|
||||
}
|
||||
|
||||
glm::vec3 MyAvatar::getPositionForAudio() {
|
||||
glm::vec3 result;
|
||||
switch (_audioListenerMode) {
|
||||
|
|
|
@ -594,6 +594,8 @@ public:
|
|||
void setWalkSpeed(float value);
|
||||
float getWalkSpeed() const;
|
||||
|
||||
QVector<QString> getScriptUrls();
|
||||
|
||||
public slots:
|
||||
void increaseSize();
|
||||
void decreaseSize();
|
||||
|
|
|
@ -193,7 +193,6 @@ QVector<QString> FSTReader::getScripts(const QUrl& url, const QVariantHash& mapp
|
|||
QVector<QString> scriptPaths;
|
||||
if (!fstMapping.value(SCRIPT_FIELD).isNull()) {
|
||||
auto scripts = fstMapping.values(SCRIPT_FIELD).toVector();
|
||||
if (scripts.size() > 0) {
|
||||
for (auto &script : scripts) {
|
||||
QString scriptPath = script.toString();
|
||||
if (QUrl(scriptPath).isRelative()) {
|
||||
|
@ -205,7 +204,6 @@ QVector<QString> FSTReader::getScripts(const QUrl& url, const QVariantHash& mapp
|
|||
scriptPaths.push_back(scriptPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return scriptPaths;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,12 +221,10 @@ void GeometryReader::run() {
|
|||
// Add scripts to fbxgeometry
|
||||
if (!_mapping.value(SCRIPT_FIELD).isNull()) {
|
||||
QVariantList scripts = _mapping.values(SCRIPT_FIELD);
|
||||
if (scripts.size() > 0) {
|
||||
for (auto &script : scripts) {
|
||||
fbxGeometry->scripts.push_back(script.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the resource has not been deleted
|
||||
auto resource = _resource.toStrongRef();
|
||||
|
|
Loading…
Reference in a new issue