Esempio n. 1
0
void EntityScriptServer::aboutToFinish() {
    shutdownScriptEngine();

    auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
    // our entity tree is going to go away so tell that to the EntityScriptingInterface
    entityScriptingInterface->setEntityTree(nullptr);

    // Should always be true as they are singletons.
    if (entityScriptingInterface->getPacketSender() == &_entityEditSender) {
        // The packet sender is about to go away.
        entityScriptingInterface->setPacketSender(nullptr);
    }

    DependencyManager::get<ResourceManager>()->cleanup();

    // cleanup the AudioInjectorManager (and any still running injectors)
    DependencyManager::destroy<AudioInjectorManager>();
    DependencyManager::destroy<ScriptEngines>();
    DependencyManager::destroy<EntityScriptServerServices>();

    // cleanup codec & encoder
    if (_codec && _encoder) {
        _codec->releaseEncoder(_encoder);
        _encoder = nullptr;
    }
}
Esempio n. 2
0
void EntityScriptServer::shutdownScriptEngine() {
    if (_entitiesScriptEngine) {
        _entitiesScriptEngine->disconnectNonEssentialSignals(); // disconnect all slots/signals from the script engine, except essential
    }
    _shuttingDown = true;

    clear(); // always clear() on shutdown

    auto scriptEngines = DependencyManager::get<ScriptEngines>();
    scriptEngines->shutdownScripting();

    _entitiesScriptEngine.clear();

    auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
    // our entity tree is going to go away so tell that to the EntityScriptingInterface
    entityScriptingInterface->setEntityTree(nullptr);

    // Should always be true as they are singletons.
    if (entityScriptingInterface->getPacketSender() == &_entityEditSender) {
        // The packet sender is about to go away.
        entityScriptingInterface->setPacketSender(nullptr);
    }
}