Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -934,11 +934,7 @@ void EntityScriptingInterface::voxelsToMesh(QUuid entityID, QScriptValue callbac · 933 unmodified lines | |||
| 934 | QScriptValue mesh { false }; | 934 | QScriptValue mesh { false }; |
| 935 | 935 | ||
| 936 | polyVoxWorker(entityID, [&](PolyVoxEntityItem& polyVoxEntity) mutable { | 936 | polyVoxWorker(entityID, [&](PolyVoxEntityItem& polyVoxEntity) mutable { |
| 937 | if (polyVoxEntity.getOnCount() == 0) { | 937 | success = polyVoxEntity.getMeshAsScriptValue(callback.engine(), mesh); |
| 938 | success = true; | ||
| 939 | } else { | ||
| 940 | success = polyVoxEntity.getMeshAsScriptValue(callback.engine(), mesh); | ||
| 941 | } | ||
| 942 | return true; | 938 | return true; |
| 943 | }); | 939 | }); |
| 944 | 940 | ||
| @@ -1578,3 +1574,20 @@ glm::mat4 EntityScriptingInterface::getEntityTransform(const QUuid& entityID) { · 633 unmodified lines | |||
| 1578 | } | 1574 | } |
| 1579 | return result; | 1575 | return result; |
| 1580 | } | 1576 | } |
| 1577 | |||
| 1578 | glm::mat4 EntityScriptingInterface::getEntityLocalTransform(const QUuid& entityID) { | ||
| 1579 | glm::mat4 result; | ||
| 1580 | if (_entityTree) { | ||
| 1581 | _entityTree->withReadLock([&] { | ||
| 1582 | EntityItemPointer entity = _entityTree->findEntityByEntityItemID(EntityItemID(entityID)); | ||
| 1583 | if (entity) { | ||
| 1584 | glm::mat4 translation = glm::translate(entity->getLocalPosition()); | ||
| 1585 | glm::mat4 rotation = glm::mat4_cast(entity->getLocalOrientation()); | ||
| 1586 | glm::mat4 registration = glm::translate(ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - | ||
| 1587 | entity->getRegistrationPoint()); | ||
| 1588 | result = translation * rotation * registration; | ||
| 1589 | } | ||
| 1590 | }); | ||
| 1591 | } | ||
| 1592 | return result; | ||
| 1593 | } | ||