Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 463 files). Show all
Unified · Split
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include "ZoneEntityItem.h" |
| 28 | 28 | #include "WebEntityItem.h" |
| 29 | 29 | #include <EntityScriptClient.h> |
| 30 | +#include <Profile.h> | |
| 30 | 31 | |
| 31 | 32 | |
| 32 | 33 | EntityScriptingInterface::EntityScriptingInterface(bool bidOnSimulationOwnership) : |
| @@ -178,6 +179,8 @@ EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperti · 145 unmodified lines | ||
| 178 | 179 | |
| 179 | 180 | |
| 180 | 181 | QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, bool clientOnly) { |
| 182 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 183 | + | |
| 181 | 184 | _activityTracking.addedEntityCount++; |
| 182 | 185 | |
| 183 | 186 | EntityItemProperties propertiesWithSimID = convertLocationFromScriptSemantics(properties); |
| @@ -259,6 +262,8 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit · 75 unmodified lines | ||
| 259 | 262 | } |
| 260 | 263 | |
| 261 | 264 | EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identity, EntityPropertyFlags desiredProperties) { |
| 265 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 266 | + | |
| 262 | 267 | EntityItemProperties results; |
| 263 | 268 | if (_entityTree) { |
| 264 | 269 | _entityTree->withReadLock([&] { |
| @@ -280,7 +285,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit · 15 unmodified lines | ||
| 280 | 285 | desiredProperties = entity->getEntityProperties(params); |
| 281 | 286 | desiredProperties.setHasProperty(PROP_LOCAL_POSITION); |
| 282 | 287 | desiredProperties.setHasProperty(PROP_LOCAL_ROTATION); |
| 283 | − } | |
| 288 | + } | |
| 284 | 289 | |
| 285 | 290 | results = entity->getProperties(desiredProperties); |
| 286 | 291 | |
| @@ -305,6 +310,8 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit · 18 unmodified lines | ||
| 305 | 310 | } |
| 306 | 311 | |
| 307 | 312 | QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) { |
| 313 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 314 | + | |
| 308 | 315 | _activityTracking.editedEntityCount++; |
| 309 | 316 | |
| 310 | 317 | EntityItemProperties properties = scriptSideProperties; |
| @@ -456,6 +463,8 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 145 unmodified lines | ||
| 456 | 463 | } |
| 457 | 464 | |
| 458 | 465 | void EntityScriptingInterface::deleteEntity(QUuid id) { |
| 466 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 467 | + | |
| 459 | 468 | _activityTracking.deletedEntityCount++; |
| 460 | 469 | |
| 461 | 470 | EntityItemID entityID(id); |
| @@ -511,6 +520,8 @@ void EntityScriptingInterface::setEntitiesScriptEngine(EntitiesScriptEngineProvi · 49 unmodified lines | ||
| 511 | 520 | } |
| 512 | 521 | |
| 513 | 522 | void EntityScriptingInterface::callEntityMethod(QUuid id, const QString& method, const QStringList& params) { |
| 523 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 524 | + | |
| 514 | 525 | std::lock_guard<std::recursive_mutex> lock(_entitiesScriptEngineLock); |
| 515 | 526 | if (_entitiesScriptEngine) { |
| 516 | 527 | EntityItemID entityID{ id }; |
| @@ -519,6 +530,8 @@ void EntityScriptingInterface::callEntityMethod(QUuid id, const QString& method, · 2 unmodified lines | ||
| 519 | 530 | } |
| 520 | 531 | |
| 521 | 532 | QUuid EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float radius) const { |
| 533 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 534 | + | |
| 522 | 535 | EntityItemID result; |
| 523 | 536 | if (_entityTree) { |
| 524 | 537 | EntityItemPointer closestEntity; |
| @@ -542,6 +555,8 @@ void EntityScriptingInterface::dumpTree() const { · 17 unmodified lines | ||
| 542 | 555 | } |
| 543 | 556 | |
| 544 | 557 | QVector<QUuid> EntityScriptingInterface::findEntities(const glm::vec3& center, float radius) const { |
| 558 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 559 | + | |
| 545 | 560 | QVector<QUuid> result; |
| 546 | 561 | if (_entityTree) { |
| 547 | 562 | QVector<EntityItemPointer> entities; |
| @@ -557,6 +572,8 @@ QVector<QUuid> EntityScriptingInterface::findEntities(const glm::vec3& center, f · 9 unmodified lines | ||
| 557 | 572 | } |
| 558 | 573 | |
| 559 | 574 | QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corner, const glm::vec3& dimensions) const { |
| 575 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 576 | + | |
| 560 | 577 | QVector<QUuid> result; |
| 561 | 578 | if (_entityTree) { |
| 562 | 579 | QVector<EntityItemPointer> entities; |
| @@ -573,6 +590,8 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn · 10 unmodified lines | ||
| 573 | 590 | } |
| 574 | 591 | |
| 575 | 592 | QVector<QUuid> EntityScriptingInterface::findEntitiesInFrustum(QVariantMap frustum) const { |
| 593 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 594 | + | |
| 576 | 595 | QVector<QUuid> result; |
| 577 | 596 | |
| 578 | 597 | const QString POSITION_PROPERTY = "position"; |
| @@ -616,6 +635,7 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInFrustum(QVariantMap frust · 37 unmodified lines | ||
| 616 | 635 | |
| 617 | 636 | RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking, |
| 618 | 637 | const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard, bool visibleOnly, bool collidableOnly) { |
| 638 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 619 | 639 | |
| 620 | 640 | QVector<EntityItemID> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude); |
| 621 | 641 | QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard); |
| @@ -664,22 +684,8 @@ bool EntityScriptingInterface::getServerScriptStatus(QUuid entityID, QScriptValu · 42 unmodified lines | ||
| 664 | 684 | auto client = DependencyManager::get<EntityScriptClient>(); |
| 665 | 685 | auto request = client->createScriptStatusRequest(entityID); |
| 666 | 686 | connect(request, &GetScriptStatusRequest::finished, callback.engine(), [callback](GetScriptStatusRequest* request) mutable { |
| 667 | − QString statusString; | |
| 668 | − switch (request->getStatus()) { | |
| 669 | − case RUNNING: | |
| 670 | − statusString = "running"; | |
| 671 | − break; | |
| 672 | − case ERROR_LOADING_SCRIPT: | |
| 673 | − statusString = "error_loading_script"; | |
| 674 | − break; | |
| 675 | − case ERROR_RUNNING_SCRIPT: | |
| 676 | − statusString = "error_running_script"; | |
| 677 | − break; | |
| 678 | − default: | |
| 679 | − statusString = ""; | |
| 680 | − break; | |
| 681 | − } | |
| 682 | − QScriptValueList args { request->getResponseReceived(), request->getIsRunning(), statusString, request->getErrorInfo() }; | |
| 687 | + QString statusString = EntityScriptStatus_::valueToKey(request->getStatus());; | |
| 688 | + QScriptValueList args { request->getResponseReceived(), request->getIsRunning(), statusString.toLower(), request->getErrorInfo() }; | |
| 683 | 689 | callback.call(QScriptValue(), args); |
| 684 | 690 | request->deleteLater(); |
| 685 | 691 | }); |
| @@ -723,6 +729,8 @@ RayToEntityIntersectionResult::RayToEntityIntersectionResult() : · 37 unmodified lines | ||
| 723 | 729 | } |
| 724 | 730 | |
| 725 | 731 | QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, const RayToEntityIntersectionResult& value) { |
| 732 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 733 | + | |
| 726 | 734 | QScriptValue obj = engine->newObject(); |
| 727 | 735 | obj.setProperty("intersects", value.intersects); |
| 728 | 736 | obj.setProperty("accurate", value.accurate); |
| @@ -770,6 +778,8 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c · 41 unmodified lines | ||
| 770 | 778 | } |
| 771 | 779 | |
| 772 | 780 | void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, RayToEntityIntersectionResult& value) { |
| 781 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 782 | + | |
| 773 | 783 | value.intersects = object.property("intersects").toVariant().toBool(); |
| 774 | 784 | value.accurate = object.property("accurate").toVariant().toBool(); |
| 775 | 785 | QScriptValue entityIDValue = object.property("entityID"); |
| @@ -806,13 +816,15 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra · 30 unmodified lines | ||
| 806 | 816 | } |
| 807 | 817 | |
| 808 | 818 | bool EntityScriptingInterface::polyVoxWorker(QUuid entityID, std::function<bool(PolyVoxEntityItem&)> actor) { |
| 819 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 820 | + | |
| 809 | 821 | if (!_entityTree) { |
| 810 | 822 | return false; |
| 811 | 823 | } |
| 812 | 824 | |
| 813 | 825 | EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); |
| 814 | 826 | if (!entity) { |
| 815 | − qCDebug(entities) << "EntityScriptingInterface::setVoxelSphere no entity with ID" << entityID; | |
| 827 | + qCDebug(entities) << "EntityScriptingInterface::setVoxels no entity with ID" << entityID; | |
| 816 | 828 | return false; |
| 817 | 829 | } |
| 818 | 830 | |
| @@ -830,6 +842,8 @@ bool EntityScriptingInterface::polyVoxWorker(QUuid entityID, std::function<bool( · 11 unmodified lines | ||
| 830 | 842 | } |
| 831 | 843 | |
| 832 | 844 | bool EntityScriptingInterface::setPoints(QUuid entityID, std::function<bool(LineEntityItem&)> actor) { |
| 845 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 846 | + | |
| 833 | 847 | if (!_entityTree) { |
| 834 | 848 | return false; |
| 835 | 849 | } |
| @@ -869,18 +883,41 @@ bool EntityScriptingInterface::setPoints(QUuid entityID, std::function<bool(Line · 33 unmodified lines | ||
| 869 | 883 | |
| 870 | 884 | |
| 871 | 885 | bool EntityScriptingInterface::setVoxelSphere(QUuid entityID, const glm::vec3& center, float radius, int value) { |
| 886 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 872 | 887 | return polyVoxWorker(entityID, [center, radius, value](PolyVoxEntityItem& polyVoxEntity) { |
| 873 | 888 | return polyVoxEntity.setSphere(center, radius, value); |
| 874 | 889 | }); |
| 875 | 890 | } |
| 876 | 891 | |
| 877 | 892 | bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& position, int value) { |
| 893 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 894 | + | |
| 878 | 895 | return polyVoxWorker(entityID, [position, value](PolyVoxEntityItem& polyVoxEntity) { |
| 896 | + return polyVoxEntity.setSphere(center, radius, value); | |
| 897 | + }); | |
| 898 | +} | |
| 899 | + | |
| 900 | +bool EntityScriptingInterface::setVoxelCapsule(QUuid entityID, | |
| 901 | + const glm::vec3& start, const glm::vec3& end, | |
| 902 | + float radius, int value) { | |
| 903 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 904 | + | |
| 905 | + return setVoxels(entityID, [start, end, radius, value](PolyVoxEntityItem& polyVoxEntity) { | |
| 906 | + return polyVoxEntity.setCapsule(start, end, radius, value); | |
| 907 | + }); | |
| 908 | +} | |
| 909 | + | |
| 910 | +bool EntityScriptingInterface::setVoxel(QUuid entityID, const glm::vec3& position, int value) { | |
| 911 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 912 | + | |
| 913 | + return setVoxels(entityID, [position, value](PolyVoxEntityItem& polyVoxEntity) { | |
| 879 | 914 | return polyVoxEntity.setVoxelInVolume(position, value); |
| 880 | 915 | }); |
| 881 | 916 | } |
| 882 | 917 | |
| 883 | 918 | bool EntityScriptingInterface::setAllVoxels(QUuid entityID, int value) { |
| 919 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 920 | + | |
| 884 | 921 | return polyVoxWorker(entityID, [value](PolyVoxEntityItem& polyVoxEntity) { |
| 885 | 922 | return polyVoxEntity.setAll(value); |
| 886 | 923 | }); |
| @@ -888,12 +925,16 @@ bool EntityScriptingInterface::setAllVoxels(QUuid entityID, int value) { · 1 unmodified line | ||
| 888 | 925 | |
| 889 | 926 | bool EntityScriptingInterface::setVoxelsInCuboid(QUuid entityID, const glm::vec3& lowPosition, |
| 890 | 927 | const glm::vec3& cuboidSize, int value) { |
| 928 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 929 | + | |
| 891 | 930 | return polyVoxWorker(entityID, [lowPosition, cuboidSize, value](PolyVoxEntityItem& polyVoxEntity) { |
| 892 | 931 | return polyVoxEntity.setCuboid(lowPosition, cuboidSize, value); |
| 893 | 932 | }); |
| 894 | 933 | } |
| 895 | 934 | |
| 896 | 935 | void EntityScriptingInterface::voxelsToMesh(QUuid entityID, QScriptValue callback) { |
| 936 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 937 | + | |
| 897 | 938 | polyVoxWorker(entityID, [callback](PolyVoxEntityItem& polyVoxEntity) mutable { |
| 898 | 939 | QScriptValue mesh; |
| 899 | 940 | polyVoxEntity.getMeshAsScriptValue(callback.engine(), mesh); |
| @@ -904,6 +945,8 @@ void EntityScriptingInterface::voxelsToMesh(QUuid entityID, QScriptValue callbac · 4 unmodified lines | ||
| 904 | 945 | } |
| 905 | 946 | |
| 906 | 947 | bool EntityScriptingInterface::setAllPoints(QUuid entityID, const QVector<glm::vec3>& points) { |
| 948 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 949 | + | |
| 907 | 950 | EntityItemPointer entity = static_cast<EntityItemPointer>(_entityTree->findEntityByEntityItemID(entityID)); |
| 908 | 951 | if (!entity) { |
| 909 | 952 | qCDebug(entities) << "EntityScriptingInterface::setPoints no entity with ID" << entityID; |
| @@ -922,6 +965,8 @@ bool EntityScriptingInterface::setAllPoints(QUuid entityID, const QVector<glm::v · 12 unmodified lines | ||
| 922 | 965 | } |
| 923 | 966 | |
| 924 | 967 | bool EntityScriptingInterface::appendPoint(QUuid entityID, const glm::vec3& point) { |
| 968 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 969 | + | |
| 925 | 970 | EntityItemPointer entity = static_cast<EntityItemPointer>(_entityTree->findEntityByEntityItemID(entityID)); |
| 926 | 971 | if (!entity) { |
| 927 | 972 | qCDebug(entities) << "EntityScriptingInterface::setPoints no entity with ID" << entityID; |
| @@ -997,29 +1042,31 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID, · 69 unmodified lines | ||
| 997 | 1042 | QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, |
| 998 | 1043 | const QUuid& entityID, |
| 999 | 1044 | const QVariantMap& arguments) { |
| 1045 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 1046 | + | |
| 1000 | 1047 | QUuid actionID = QUuid::createUuid(); |
| 1001 | 1048 | auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>(); |
| 1002 | 1049 | bool success = false; |
| 1003 | 1050 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 1004 | − // create this action even if the entity doesn't have physics info. it will often be the | |
| 1005 | − // case that a script adds an action immediately after an object is created, and the physicsInfo | |
| 1006 | − // is computed asynchronously. | |
| 1007 | − // if (!entity->getPhysicsInfo()) { | |
| 1008 | − // return false; | |
| 1009 | − // } | |
| 1010 | − EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString); | |
| 1011 | − if (actionType == ACTION_TYPE_NONE) { | |
| 1012 | − return false; | |
| 1013 | − } | |
| 1014 | − EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments); | |
| 1015 | − if (!action) { | |
| 1016 | − return false; | |
| 1017 | − } | |
| 1018 | − action->setIsMine(true); | |
| 1019 | − success = entity->addAction(simulation, action); | |
| 1020 | − entity->grabSimulationOwnership(); | |
| 1021 | − return false; // Physics will cause a packet to be sent, so don't send from here. | |
| 1022 | − }); | |
| 1051 | + // create this action even if the entity doesn't have physics info. it will often be the | |
| 1052 | + // case that a script adds an action immediately after an object is created, and the physicsInfo | |
| 1053 | + // is computed asynchronously. | |
| 1054 | + // if (!entity->getPhysicsInfo()) { | |
| 1055 | + // return false; | |
| 1056 | + // } | |
| 1057 | + EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString); | |
| 1058 | + if (actionType == ACTION_TYPE_NONE) { | |
| 1059 | + return false; | |
| 1060 | + } | |
| 1061 | + EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments); | |
| 1062 | + if (!action) { | |
| 1063 | + return false; | |
| 1064 | + } | |
| 1065 | + action->setIsMine(true); | |
| 1066 | + success = entity->addAction(simulation, action); | |
| 1067 | + entity->grabSimulationOwnership(); | |
| 1068 | + return false; // Physics will cause a packet to be sent, so don't send from here. | |
| 1069 | + }); | |
| 1023 | 1070 | if (success) { |
| 1024 | 1071 | return actionID; |
| 1025 | 1072 | } |
| @@ -1028,44 +1075,52 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 2 unmodified lines | ||
| 1028 | 1075 | |
| 1029 | 1076 | |
| 1030 | 1077 | bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& actionID, const QVariantMap& arguments) { |
| 1078 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 1079 | + | |
| 1031 | 1080 | return actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 1032 | − bool success = entity->updateAction(simulation, actionID, arguments); | |
| 1033 | − if (success) { | |
| 1034 | − entity->grabSimulationOwnership(); | |
| 1035 | − } | |
| 1036 | − return success; | |
| 1037 | − }); | |
| 1081 | + bool success = entity->updateAction(simulation, actionID, arguments); | |
| 1082 | + if (success) { | |
| 1083 | + entity->grabSimulationOwnership(); | |
| 1084 | + } | |
| 1085 | + return success; | |
| 1086 | + }); | |
| 1038 | 1087 | } |
| 1039 | 1088 | |
| 1040 | 1089 | bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) { |
| 1090 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 1091 | + | |
| 1041 | 1092 | bool success = false; |
| 1042 | 1093 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 1043 | − success = entity->removeAction(simulation, actionID); | |
| 1044 | − if (success) { | |
| 1045 | − // reduce from grab to poke | |
| 1046 | − entity->pokeSimulationOwnership(); | |
| 1047 | − } | |
| 1048 | − return false; // Physics will cause a packet to be sent, so don't send from here. | |
| 1049 | − }); | |
| 1094 | + success = entity->removeAction(simulation, actionID); | |
| 1095 | + if (success) { | |
| 1096 | + // reduce from grab to poke | |
| 1097 | + entity->pokeSimulationOwnership(); | |
| 1098 | + } | |
| 1099 | + return false; // Physics will cause a packet to be sent, so don't send from here. | |
| 1100 | + }); | |
| 1050 | 1101 | return success; |
| 1051 | 1102 | } |
| 1052 | 1103 | |
| 1053 | 1104 | QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) { |
| 1105 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 1106 | + | |
| 1054 | 1107 | QVector<QUuid> result; |
| 1055 | 1108 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 1056 | − QList<QUuid> actionIDs = entity->getActionIDs(); | |
| 1057 | − result = QVector<QUuid>::fromList(actionIDs); | |
| 1058 | − return false; // don't send an edit packet | |
| 1059 | − }); | |
| 1109 | + QList<QUuid> actionIDs = entity->getActionIDs(); | |
| 1110 | + result = QVector<QUuid>::fromList(actionIDs); | |
| 1111 | + return false; // don't send an edit packet | |
| 1112 | + }); | |
| 1060 | 1113 | return result; |
| 1061 | 1114 | } |
| 1062 | 1115 | |
| 1063 | 1116 | QVariantMap EntityScriptingInterface::getActionArguments(const QUuid& entityID, const QUuid& actionID) { |
| 1117 | + PROFILE_RANGE(script_entities, __FUNCTION__); | |
| 1118 | + | |
| 1064 | 1119 | QVariantMap result; |
| 1065 | 1120 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 1066 | − result = entity->getActionArguments(actionID); | |
| 1067 | − return false; // don't send an edit packet | |
| 1068 | − }); | |
| 1121 | + result = entity->getActionArguments(actionID); | |
| 1122 | + return false; // don't send an edit packet | |
| 1123 | + }); | |
| 1069 | 1124 | return result; |
| 1070 | 1125 | } |
| 1071 | 1126 | |
| @@ -1392,8 +1447,7 @@ QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& pare · 320 unmodified lines | ||
| 1392 | 1447 | return; |
| 1393 | 1448 | } |
| 1394 | 1449 | parent->forEachChild([&](SpatiallyNestablePointer child) { |
| 1395 | − if (child->getParentJointIndex() == jointIndex && | |
| 1396 | − child->getNestableType() != NestableType::Overlay) { | |
| 1450 | + if (child->getParentJointIndex() == jointIndex) { | |
| 1397 | 1451 | result.push_back(child->getID()); |
| 1398 | 1452 | } |
| 1399 | 1453 | }); |
| @@ -1497,3 +1551,11 @@ QObject* EntityScriptingInterface::getWebViewRoot(const QUuid& entityID) { · 97 unmodified lines | ||
| 1497 | 1551 | return nullptr; |
| 1498 | 1552 | } |
| 1499 | 1553 | } |
| 1554 | + | |
| 1555 | +// TODO move this someplace that makes more sense... | |
| 1556 | +bool EntityScriptingInterface::AABoxIntersectsCapsule(const glm::vec3& low, const glm::vec3& dimensions, | |
| 1557 | + const glm::vec3& start, const glm::vec3& end, float radius) { | |
| 1558 | + glm::vec3 penetration; | |
| 1559 | + AABox aaBox(low, dimensions); | |
| 1560 | + return aaBox.findCapsulePenetration(start, end, radius, penetration); | |
| 1561 | +} | |