History

remove overlays from application.cpp

SamGondelman committed 7 years ago

Commit 0bfcde61 parent a75fe4b13 files · +585 −544Browse files

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

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+59−22
@@ -571,7 +571,7 @@ QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QStrin · 570 unmodified lines
571571 return addEntity(properties);
572572 }
573573
574−QUuid EntityScriptingInterface::cloneEntity(QUuid entityIDToClone) {
574+QUuid EntityScriptingInterface::cloneEntity(const QUuid& entityIDToClone) {
575575 EntityItemID newEntityID;
576576 EntityItemProperties properties = getEntityProperties(entityIDToClone);
577577 bool cloneAvatarEntity = properties.getCloneAvatarEntity();
@@ -596,12 +596,12 @@ QUuid EntityScriptingInterface::cloneEntity(QUuid entityIDToClone) { · 18 unmodified lines
596596 }
597597 }
598598
599−EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid entityID) {
599+EntityItemProperties EntityScriptingInterface::getEntityProperties(const QUuid& entityID) {
600600 const EntityPropertyFlags noSpecificProperties;
601601 return getEntityProperties(entityID, noSpecificProperties);
602602 }
603603
604−EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid entityID, EntityPropertyFlags desiredProperties) {
604+EntityItemProperties EntityScriptingInterface::getEntityProperties(const QUuid& entityID, EntityPropertyFlags desiredProperties) {
605605 PROFILE_RANGE(script_entities, __FUNCTION__);
606606
607607 bool scalesWithParent { false };
@@ -775,7 +775,7 @@ QScriptValue EntityScriptingInterface::getMultipleEntityPropertiesInternal(QScri · 167 unmodified lines
775775 return finalResult;
776776 }
777777
778−QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
778+QUuid EntityScriptingInterface::editEntity(const QUuid& id, const EntityItemProperties& scriptSideProperties) {
779779 PROFILE_RANGE(script_entities, __FUNCTION__);
780780
781781 _activityTracking.editedEntityCount++;
@@ -960,7 +960,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 178 unmodified lines
960960 return id;
961961 }
962962
963−void EntityScriptingInterface::deleteEntity(QUuid id) {
963+void EntityScriptingInterface::deleteEntity(const QUuid& id) {
964964 PROFILE_RANGE(script_entities, __FUNCTION__);
965965
966966 _activityTracking.deletedEntityCount++;
@@ -1005,12 +1005,49 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 38 unmodified lines
10051005 }
10061006 }
10071007
1008+QString EntityScriptingInterface::getEntityType(const QUuid& entityID) {
1009+ QString toReturn;
1010+ _entityTree->withReadLock([&] {
1011+ EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
1012+ if (entity) {
1013+ toReturn = EntityTypes::getEntityTypeName(entity->getType());
1014+ }
1015+ });
1016+ return toReturn;
1017+}
1018+
1019+QObject* EntityScriptingInterface::getEntityObject(const QUuid& id) {
1020+ QObject* toReturn { nullptr };
1021+ _entityTree->withReadLock([&] {
1022+ EntityItemPointer entity = _entityTree->findEntityByEntityItemID(id);
1023+ if (entity) {
1024+ toReturn = qobject_cast<QObject*>(&(*entity));
1025+ }
1026+ });
1027+ return toReturn;
1028+}
1029+
1030+bool EntityScriptingInterface::isLoaded(const QUuid& id) {
1031+ bool toReturn = false;
1032+ _entityTree->withReadLock([&] {
1033+ EntityItemPointer entity = _entityTree->findEntityByEntityItemID(id);
1034+ if (entity) {
1035+ toReturn = entity->isVisuallyReady();
1036+ }
1037+ });
1038+ return toReturn;
1039+}
1040+
1041+QSizeF EntityScriptingInterface::textSize(const QUuid& id, const QString& text) {
1042+ return EntityTree::textSize(id, text);
1043+}
1044+
10081045 void EntityScriptingInterface::setEntitiesScriptEngine(QSharedPointer<EntitiesScriptEngineProvider> engine) {
10091046 std::lock_guard<std::recursive_mutex> lock(_entitiesScriptEngineLock);
10101047 _entitiesScriptEngine = engine;
10111048 }
10121049
1013−void EntityScriptingInterface::callEntityMethod(QUuid id, const QString& method, const QStringList& params) {
1050+void EntityScriptingInterface::callEntityMethod(const QUuid& id, const QString& method, const QStringList& params) {
10141051 PROFILE_RANGE(script_entities, __FUNCTION__);
10151052
10161053 std::lock_guard<std::recursive_mutex> lock(_entitiesScriptEngineLock);
@@ -1020,12 +1057,12 @@ void EntityScriptingInterface::callEntityMethod(QUuid id, const QString& method, · 3 unmodified lines
10201057 }
10211058 }
10221059
1023−void EntityScriptingInterface::callEntityServerMethod(QUuid id, const QString& method, const QStringList& params) {
1060+void EntityScriptingInterface::callEntityServerMethod(const QUuid& id, const QString& method, const QStringList& params) {
10241061 PROFILE_RANGE(script_entities, __FUNCTION__);
10251062 DependencyManager::get<EntityScriptClient>()->callEntityServerMethod(id, method, params);
10261063 }
10271064
1028−void EntityScriptingInterface::callEntityClientMethod(QUuid clientSessionID, QUuid entityID, const QString& method, const QStringList& params) {
1065+void EntityScriptingInterface::callEntityClientMethod(const QUuid& clientSessionID, const QUuid& entityID, const QString& method, const QStringList& params) {
10291066 PROFILE_RANGE(script_entities, __FUNCTION__);
10301067 auto scriptServerServices = DependencyManager::get<EntityScriptServerServices>();
10311068
@@ -1262,7 +1299,7 @@ ParabolaToEntityIntersectionResult EntityScriptingInterface::evalParabolaInterse · 230 unmodified lines
12621299 return result;
12631300 }
12641301
1265−bool EntityScriptingInterface::reloadServerScripts(QUuid entityID) {
1302+bool EntityScriptingInterface::reloadServerScripts(const QUuid& entityID) {
12661303 auto client = DependencyManager::get<EntityScriptClient>();
12671304 return client->reloadServerScript(entityID);
12681305 }
@@ -1335,7 +1372,7 @@ bool EntityPropertyMetadataRequest::serverScripts(EntityItemID entityID, QScript · 66 unmodified lines
13351372 return true;
13361373 }
13371374
1338−bool EntityScriptingInterface::queryPropertyMetadata(QUuid entityID, QScriptValue property, QScriptValue scopeOrCallback, QScriptValue methodOrName) {
1375+bool EntityScriptingInterface::queryPropertyMetadata(const QUuid& entityID, QScriptValue property, QScriptValue scopeOrCallback, QScriptValue methodOrName) {
13391376 auto name = property.toString();
13401377 auto handler = makeScopedHandlerObject(scopeOrCallback, methodOrName);
13411378 QPointer<BaseScriptEngine> engine = dynamic_cast<BaseScriptEngine*>(handler.engine());
@@ -1379,7 +1416,7 @@ bool EntityScriptingInterface::queryPropertyMetadata(QUuid entityID, QScriptValu · 37 unmodified lines
13791416 }
13801417 }
13811418
1382−bool EntityScriptingInterface::getServerScriptStatus(QUuid entityID, QScriptValue callback) {
1419+bool EntityScriptingInterface::getServerScriptStatus(const QUuid& entityID, QScriptValue callback) {
13831420 auto client = DependencyManager::get<EntityScriptClient>();
13841421 auto request = client->createScriptStatusRequest(entityID);
13851422 connect(request, &GetScriptStatusRequest::finished, callback.engine(), [callback](GetScriptStatusRequest* request) mutable {
@@ -1518,14 +1555,14 @@ bool EntityScriptingInterface::setPoints(QUuid entityID, std::function<bool(Line · 132 unmodified lines
15181555 return success;
15191556 }
15201557
1521−bool EntityScriptingInterface::setVoxelSphere(QUuid entityID, const glm::vec3& center, float radius, int value) {
1558+bool EntityScriptingInterface::setVoxelSphere(const QUuid& entityID, const glm::vec3& center, float radius, int value) {
15221559 PROFILE_RANGE(script_entities, __FUNCTION__);
15231560 return polyVoxWorker(entityID, [center, radius, value](PolyVoxEntityItem& polyVoxEntity) {
15241561 return polyVoxEntity.setSphere(center, radius, value);
15251562 });
15261563 }
15271564
1528−bool EntityScriptingInterface::setVoxelCapsule(QUuid entityID,
1565+bool EntityScriptingInterface::setVoxelCapsule(const QUuid& entityID,
15291566 const glm::vec3& start, const glm::vec3& end,
15301567 float radius, int value) {
15311568 PROFILE_RANGE(script_entities, __FUNCTION__);
@@ -1535,7 +1572,7 @@ bool EntityScriptingInterface::setVoxelCapsule(QUuid entityID, · 3 unmodified lines
15351572 });
15361573 }
15371574
1538−bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& position, int value) {
1575+bool EntityScriptingInterface::setVoxel(const QUuid& entityID, const glm::vec3& position, int value) {
15391576 PROFILE_RANGE(script_entities, __FUNCTION__);
15401577
15411578 return polyVoxWorker(entityID, [position, value](PolyVoxEntityItem& polyVoxEntity) {
@@ -1543,7 +1580,7 @@ bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& positio · 1 unmodified line
15431580 });
15441581 }
15451582
1546−bool EntityScriptingInterface::setAllVoxels(QUuid entityID, int value) {
1583+bool EntityScriptingInterface::setAllVoxels(const QUuid& entityID, int value) {
15471584 PROFILE_RANGE(script_entities, __FUNCTION__);
15481585
15491586 return polyVoxWorker(entityID, [value](PolyVoxEntityItem& polyVoxEntity) {
@@ -1551,7 +1588,7 @@ bool EntityScriptingInterface::setAllVoxels(QUuid entityID, int value) { · 1 unmodified line
15511588 });
15521589 }
15531590
1554−bool EntityScriptingInterface::setVoxelsInCuboid(QUuid entityID, const glm::vec3& lowPosition,
1591+bool EntityScriptingInterface::setVoxelsInCuboid(const QUuid& entityID, const glm::vec3& lowPosition,
15551592 const glm::vec3& cuboidSize, int value) {
15561593 PROFILE_RANGE(script_entities, __FUNCTION__);
15571594
@@ -1560,7 +1597,7 @@ bool EntityScriptingInterface::setVoxelsInCuboid(QUuid entityID, const glm::vec3 · 2 unmodified lines
15601597 });
15611598 }
15621599
1563−bool EntityScriptingInterface::setAllPoints(QUuid entityID, const QVector<glm::vec3>& points) {
1600+bool EntityScriptingInterface::setAllPoints(const QUuid& entityID, const QVector<glm::vec3>& points) {
15641601 PROFILE_RANGE(script_entities, __FUNCTION__);
15651602
15661603 EntityItemPointer entity = static_cast<EntityItemPointer>(_entityTree->findEntityByEntityItemID(entityID));
@@ -1580,7 +1617,7 @@ bool EntityScriptingInterface::setAllPoints(QUuid entityID, const QVector<glm::v · 13 unmodified lines
15801617 return false;
15811618 }
15821619
1583−bool EntityScriptingInterface::appendPoint(QUuid entityID, const glm::vec3& point) {
1620+bool EntityScriptingInterface::appendPoint(const QUuid& entityID, const glm::vec3& point) {
15841621 PROFILE_RANGE(script_entities, __FUNCTION__);
15851622
15861623 EntityItemPointer entity = static_cast<EntityItemPointer>(_entityTree->findEntityByEntityItemID(entityID));
@@ -2040,7 +2077,7 @@ QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) { · 453 unmodified lines
20402077 return result;
20412078 }
20422079
2043−bool EntityScriptingInterface::isChildOfParent(QUuid childID, QUuid parentID) {
2080+bool EntityScriptingInterface::isChildOfParent(const QUuid& childID, const QUuid& parentID) {
20442081 bool isChild = false;
20452082
20462083 if (!_entityTree) {
@@ -2062,7 +2099,7 @@ bool EntityScriptingInterface::isChildOfParent(QUuid childID, QUuid parentID) { · 15 unmodified lines
20622099 return isChild;
20632100 }
20642101
2065−QString EntityScriptingInterface::getNestableType(QUuid id) {
2102+QString EntityScriptingInterface::getNestableType(const QUuid& id) {
20662103 QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
20672104 if (!parentFinder) {
20682105 return "unknown";
@@ -2164,7 +2201,7 @@ void EntityScriptingInterface::sendHoverLeaveEntity(const EntityItemID& id, cons · 95 unmodified lines
21642201 emit hoverLeaveEntity(id, event);
21652202 }
21662203
2167−bool EntityScriptingInterface::wantsHandControllerPointerEvents(QUuid id) {
2204+bool EntityScriptingInterface::wantsHandControllerPointerEvents(const QUuid& id) {
21682205 bool result = false;
21692206 if (_entityTree) {
21702207 _entityTree->withReadLock([&] {
@@ -2196,7 +2233,7 @@ bool EntityScriptingInterface::AABoxIntersectsCapsule(const glm::vec3& low, cons · 25 unmodified lines
21962233 return aaBox.findCapsulePenetration(start, end, radius, penetration);
21972234 }
21982235
2199−void EntityScriptingInterface::getMeshes(QUuid entityID, QScriptValue callback) {
2236+void EntityScriptingInterface::getMeshes(const QUuid& entityID, QScriptValue callback) {
22002237 PROFILE_RANGE(script_entities, __FUNCTION__);
22012238
22022239 EntityItemPointer entity = static_cast<EntityItemPointer>(_entityTree->findEntityByEntityItemID(entityID));