History

SimulationOwner as one property

Andrew Meadows committed 11 years ago

Commit 12fc1801 parent b6d5ada12 files · +435 −332Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 12 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+12−9
@@ -9,18 +9,21 @@ · 8 unmodified lines
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10//10//
11 11
12#include <iostream> // adebug
13#include "EntityScriptingInterface.h"
14
12#include <VariantMapToScriptValue.h>15#include <VariantMapToScriptValue.h>
13 16
17#include "EntitiesLogging.h"
18#include "EntityActionFactoryInterface.h"
19#include "EntityActionInterface.h"
20#include "EntitySimulation.h"
14#include "EntityTree.h"21#include "EntityTree.h"
15#include "LightEntityItem.h"22#include "LightEntityItem.h"
16#include "ModelEntityItem.h"23#include "ModelEntityItem.h"
24#include "SimulationOwner.h"
17#include "ZoneEntityItem.h"25#include "ZoneEntityItem.h"
18#include "EntitiesLogging.h"
19#include "EntitySimulation.h"
20#include "EntityActionInterface.h"
21#include "EntityActionFactoryInterface.h"
22 26
23#include "EntityScriptingInterface.h"
24 27
25EntityScriptingInterface::EntityScriptingInterface() :28EntityScriptingInterface::EntityScriptingInterface() :
26 _entityTree(NULL)29 _entityTree(NULL)
@@ -76,10 +79,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 49 unmodified lines
76 // This Node is creating a new object. If it's in motion, set this Node as the simulator.79 // This Node is creating a new object. If it's in motion, set this Node as the simulator.
77 auto nodeList = DependencyManager::get<NodeList>();80 auto nodeList = DependencyManager::get<NodeList>();
78 const QUuid myNodeID = nodeList->getSessionUUID();81 const QUuid myNodeID = nodeList->getSessionUUID();
79 propertiesWithSimID.setSimulatorOwnership(myNodeID, SCRIPT_EDIT_SIMULATOR_PRIORITY);82 propertiesWithSimID.setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATOR_PRIORITY);
80 83
81 // and make note of it now, so we can act on it right away.84 // and make note of it now, so we can act on it right away.
82 entity->setSimulatorID(propertiesWithSimID.getSimulatorID());85 entity->setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATOR_PRIORITY);
83 86
84 entity->setLastBroadcast(usecTimestampNow());87 entity->setLastBroadcast(usecTimestampNow());
85 } else {88 } else {
@@ -160,11 +163,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties proper · 74 unmodified lines
160 // simulation.163 // simulation.
161 164
162 // we re-assert our simulation ownership165 // we re-assert our simulation ownership
163 properties.setSimulatorOwnership(myNodeID, 166 properties.setSimulationOwner(myNodeID,
164 glm::max(entity->getSimulatorPriority(), SCRIPT_EDIT_SIMULATOR_PRIORITY));167 glm::max(entity->getSimulatorPriority(), SCRIPT_EDIT_SIMULATOR_PRIORITY));
165 } else {168 } else {
166 // we make a bid for simulation ownership169 // we make a bid for simulation ownership
167 properties.setSimulatorOwnership(myNodeID, SCRIPT_EDIT_SIMULATOR_PRIORITY);170 properties.setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATOR_PRIORITY);
168 entity->flagForOwnership();171 entity->flagForOwnership();
169 }172 }
170 }173 }