mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 01:23:17 +02:00
put Agent AssetClient on sep thread, cleanup
This commit is contained in:
parent
d941be8d0b
commit
5908f2d398
1 changed files with 15 additions and 1 deletions
|
@ -44,7 +44,14 @@ Agent::Agent(NLPacket& packet) :
|
||||||
{
|
{
|
||||||
DependencyManager::get<EntityScriptingInterface>()->setPacketSender(&_entityEditSender);
|
DependencyManager::get<EntityScriptingInterface>()->setPacketSender(&_entityEditSender);
|
||||||
|
|
||||||
DependencyManager::set<AssetClient>();
|
auto assetClient = DependencyManager::set<AssetClient>();
|
||||||
|
|
||||||
|
QThread* assetThread = new QThread;
|
||||||
|
assetThread->setObjectName("Asset Thread");
|
||||||
|
assetClient->moveToThread(assetThread);
|
||||||
|
connect(assetThread, &QThread::started, assetClient.data(), &AssetClient::init);
|
||||||
|
assetThread->start();
|
||||||
|
|
||||||
DependencyManager::set<ResourceCacheSharedItems>();
|
DependencyManager::set<ResourceCacheSharedItems>();
|
||||||
DependencyManager::set<SoundCache>();
|
DependencyManager::set<SoundCache>();
|
||||||
|
|
||||||
|
@ -371,6 +378,7 @@ void Agent::processAgentAvatarAndAudio(float deltaTime) {
|
||||||
|
|
||||||
void Agent::aboutToFinish() {
|
void Agent::aboutToFinish() {
|
||||||
setIsAvatar(false);// will stop timers for sending billboards and identity packets
|
setIsAvatar(false);// will stop timers for sending billboards and identity packets
|
||||||
|
|
||||||
if (_scriptEngine) {
|
if (_scriptEngine) {
|
||||||
_scriptEngine->stop();
|
_scriptEngine->stop();
|
||||||
}
|
}
|
||||||
|
@ -382,6 +390,12 @@ void Agent::aboutToFinish() {
|
||||||
|
|
||||||
// our entity tree is going to go away so tell that to the EntityScriptingInterface
|
// our entity tree is going to go away so tell that to the EntityScriptingInterface
|
||||||
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL);
|
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL);
|
||||||
|
|
||||||
|
// cleanup the AssetClient thread
|
||||||
|
QThread* assetThread = DependencyManager::get<AssetClient>()->thread();
|
||||||
|
DependencyManager::destroy<AssetClient>();
|
||||||
|
assetThread->quit();
|
||||||
|
assetThread->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agent::sendPingRequests() {
|
void Agent::sendPingRequests() {
|
||||||
|
|
Loading…
Reference in a new issue