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
301301
302302 entityScriptingInterface->setEntityTree(_entityViewer.getTree());
303303
304− DependencyManager::set<AssignmentParentFinder>(_entityViewer.getTree());
305−
304+ auto treePtr = _entityViewer.getTree();
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+ }
306313
307− auto tree = _entityViewer.getTree().get();
314+ auto tree = treePtr.get();
308315 connect(tree, &EntityTree::deletingEntity, this, &EntityScriptServer::deletingEntity, Qt::QueuedConnection);
309316 connect(tree, &EntityTree::addingEntity, this, &EntityScriptServer::addingEntity, Qt::QueuedConnection);
310317 connect(tree, &EntityTree::entityServerScriptChanging, this, &EntityScriptServer::entityServerScriptChanging, Qt::QueuedConnection);
@@ -451,6 +458,7 @@ void EntityScriptServer::resetEntitiesScriptEngine() { · 140 unmodified lines
451458
452459 connect(newEngine.data(), &ScriptEngine::update, this, [this] {
453460 _entityViewer.queryOctree();
461+ _entityViewer.getTree()->preUpdate();
454462 _entityViewer.getTree()->update();
455463 });
456464