History

give entity-script-server a simulation

Andrew Meadows committed 7 years ago

Commit 0a8c6401 parent 6e35c8b2 files · +13 −3Browse files

Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 2 files). Show all

Unified · Split

assignment-client/src/scripts/EntityScriptServer.cpp+11−3
@@ -301,10 +301,17 @@ void EntityScriptServer::run() { · 300 unmodified lines
301 301
302 entityScriptingInterface->setEntityTree(_entityViewer.getTree());302 entityScriptingInterface->setEntityTree(_entityViewer.getTree());
303 303
304 DependencyManager::set<AssignmentParentFinder>(_entityViewer.getTree());304 auto treePtr = _entityViewer.getTree();
305 305 DependencyManager::set<AssignmentParentFinder>(treePtr);
306
307 if (!_entitySimulation) {
308 SimpleEntitySimulationPointer simpleSimulation { new SimpleEntitySimulation() };
309 simpleSimulation->setEntityTree(treePtr);
310 treePtr->setSimulation(simpleSimulation);
311 _entitySimulation = simpleSimulation;
312 }
306 313
307 auto tree = _entityViewer.getTree().get();314 auto tree = treePtr.get();
308 connect(tree, &EntityTree::deletingEntity, this, &EntityScriptServer::deletingEntity, Qt::QueuedConnection);315 connect(tree, &EntityTree::deletingEntity, this, &EntityScriptServer::deletingEntity, Qt::QueuedConnection);
309 connect(tree, &EntityTree::addingEntity, this, &EntityScriptServer::addingEntity, Qt::QueuedConnection);316 connect(tree, &EntityTree::addingEntity, this, &EntityScriptServer::addingEntity, Qt::QueuedConnection);
310 connect(tree, &EntityTree::entityServerScriptChanging, this, &EntityScriptServer::entityServerScriptChanging, Qt::QueuedConnection);317 connect(tree, &EntityTree::entityServerScriptChanging, this, &EntityScriptServer::entityServerScriptChanging, Qt::QueuedConnection);
@@ -451,6 +458,7 @@ void EntityScriptServer::resetEntitiesScriptEngine() { · 140 unmodified lines
451 458
452 connect(newEngine.data(), &ScriptEngine::update, this, [this] {459 connect(newEngine.data(), &ScriptEngine::update, this, [this] {
453 _entityViewer.queryOctree();460 _entityViewer.queryOctree();
461 _entityViewer.getTree()->preUpdate();
454 _entityViewer.getTree()->update();462 _entityViewer.getTree()->update();
455 });463 });
456 464