mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
Revert "Job #19766 BUG: Stop or reload all scripts crashes interface fix, part 2."
This reverts commit b4e9840865
.
This commit is contained in:
parent
b4e9840865
commit
a48f38b1d2
4 changed files with 14 additions and 11 deletions
|
@ -3492,8 +3492,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript
|
|||
scriptEngine = new ScriptEngine(NO_SCRIPT, "", &_controllerScriptingInterface);
|
||||
} else {
|
||||
// start the script on a new thread...
|
||||
scriptEngine = new ScriptEngine(scriptName, &_controllerScriptingInterface);
|
||||
_scriptEnginesHash.insert(scriptName, scriptEngine);
|
||||
QUrl scriptUrl(scriptName);
|
||||
scriptEngine = new ScriptEngine(scriptUrl, &_controllerScriptingInterface);
|
||||
_scriptEnginesHash.insert(scriptUrl.toString(), scriptEngine);
|
||||
|
||||
if (!scriptEngine->hasScript()) {
|
||||
qDebug() << "Application::loadScript(), script failed to load...";
|
||||
|
|
|
@ -873,7 +873,7 @@ void Particle::endParticleScriptContext(ScriptEngine& engine, ParticleScriptObje
|
|||
void Particle::executeUpdateScripts() {
|
||||
// Only run this particle script if there's a script attached directly to the particle.
|
||||
if (!_script.isEmpty()) {
|
||||
ScriptEngine engine(_script, QString(""));
|
||||
ScriptEngine engine(_script);
|
||||
ParticleScriptObject particleScriptable(this);
|
||||
startParticleScriptContext(engine, particleScriptable);
|
||||
particleScriptable.emitUpdate();
|
||||
|
@ -884,7 +884,7 @@ void Particle::executeUpdateScripts() {
|
|||
void Particle::collisionWithParticle(Particle* other, const glm::vec3& penetration) {
|
||||
// Only run this particle script if there's a script attached directly to the particle.
|
||||
if (!_script.isEmpty()) {
|
||||
ScriptEngine engine(_script, QString(""));
|
||||
ScriptEngine engine(_script);
|
||||
ParticleScriptObject particleScriptable(this);
|
||||
startParticleScriptContext(engine, particleScriptable);
|
||||
ParticleScriptObject otherParticleScriptable(other);
|
||||
|
@ -896,7 +896,7 @@ void Particle::collisionWithParticle(Particle* other, const glm::vec3& penetrati
|
|||
void Particle::collisionWithVoxel(VoxelDetail* voxelDetails, const glm::vec3& penetration) {
|
||||
// Only run this particle script if there's a script attached directly to the particle.
|
||||
if (!_script.isEmpty()) {
|
||||
ScriptEngine engine(_script, QString(""));
|
||||
ScriptEngine engine(_script);
|
||||
ParticleScriptObject particleScriptable(this);
|
||||
startParticleScriptContext(engine, particleScriptable);
|
||||
particleScriptable.emitCollisionWithVoxel(*voxelDetails, penetration);
|
||||
|
|
|
@ -93,7 +93,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam
|
|||
{
|
||||
}
|
||||
|
||||
ScriptEngine::ScriptEngine(const QString& fileNameString,
|
||||
ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
||||
AbstractControllerScriptingInterface* controllerScriptingInterface) :
|
||||
_scriptContents(),
|
||||
_isFinished(false),
|
||||
|
@ -110,19 +110,21 @@ ScriptEngine::ScriptEngine(const QString& fileNameString,
|
|||
_controllerScriptingInterface(controllerScriptingInterface),
|
||||
_avatarData(NULL),
|
||||
_scriptName(),
|
||||
_fileNameString(fileNameString),
|
||||
_fileNameString(),
|
||||
_quatLibrary(),
|
||||
_vec3Library(),
|
||||
_uuidLibrary(),
|
||||
_animationCache(this)
|
||||
{
|
||||
QUrl url(fileNameString);
|
||||
QString scriptUrlString = url.toString();
|
||||
QString scriptURLString = scriptURL.toString();
|
||||
_fileNameString = scriptURLString;
|
||||
|
||||
QUrl url(scriptURL);
|
||||
|
||||
// if the scheme length is one or lower, maybe they typed in a file, let's try
|
||||
const int WINDOWS_DRIVE_LETTER_SIZE = 1;
|
||||
if (url.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) {
|
||||
url = QUrl::fromLocalFile(scriptUrlString);
|
||||
url = QUrl::fromLocalFile(scriptURLString);
|
||||
}
|
||||
|
||||
// ok, let's see if it's valid... and if so, load it
|
||||
|
|
|
@ -40,7 +40,7 @@ const unsigned int SCRIPT_DATA_CALLBACK_USECS = floor(((1.0 / 60.0f) * 1000 * 10
|
|||
class ScriptEngine : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScriptEngine(const QString& fileNameString,
|
||||
ScriptEngine(const QUrl& scriptURL,
|
||||
AbstractControllerScriptingInterface* controllerScriptingInterface = NULL);
|
||||
|
||||
ScriptEngine(const QString& scriptContents = NO_SCRIPT,
|
||||
|
|
Loading…
Reference in a new issue