Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -831,18 +831,40 @@ bool EntityScriptingInterface::setAbsoluteJointTranslationInObjectFrame(const QU · 830 unmodified lines | ||
| 831 | 831 | int jointIndex, glm::vec3 translation) { |
| 832 | 832 | if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { |
| 833 | 833 | auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity); |
| 834 | − return modelEntity->setAbsoluteJointTranslationInObjectFrame(jointIndex, translation); | |
| 835 | − } else { | |
| 836 | − return false; | |
| 834 | + bool result = modelEntity->setAbsoluteJointTranslationInObjectFrame(jointIndex, translation); | |
| 835 | + if (result) { | |
| 836 | + EntityItemProperties properties; | |
| 837 | + _entityTree->withReadLock([&] { | |
| 838 | + properties = entity->getProperties(); | |
| 839 | + }); | |
| 840 | + | |
| 841 | + properties.setJointTranslationsDirty(); | |
| 842 | + auto now = usecTimestampNow(); | |
| 843 | + properties.setLastEdited(now); | |
| 844 | + queueEntityMessage(PacketType::EntityEdit, entityID, properties); | |
| 845 | + return true; | |
| 846 | + } | |
| 837 | 847 | } |
| 848 | + return false; | |
| 838 | 849 | } |
| 839 | 850 | |
| 840 | 851 | bool EntityScriptingInterface::setAbsoluteJointRotationInObjectFrame(const QUuid& entityID, |
| 841 | 852 | int jointIndex, glm::quat rotation) { |
| 842 | 853 | if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { |
| 843 | 854 | auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity); |
| 844 | − return modelEntity->setAbsoluteJointRotationInObjectFrame(jointIndex, rotation); | |
| 845 | − } else { | |
| 846 | − return false; | |
| 855 | + bool result = modelEntity->setAbsoluteJointRotationInObjectFrame(jointIndex, rotation); | |
| 856 | + if (result) { | |
| 857 | + EntityItemProperties properties; | |
| 858 | + _entityTree->withReadLock([&] { | |
| 859 | + properties = entity->getProperties(); | |
| 860 | + }); | |
| 861 | + | |
| 862 | + properties.setJointRotationsDirty(); | |
| 863 | + auto now = usecTimestampNow(); | |
| 864 | + properties.setLastEdited(now); | |
| 865 | + queueEntityMessage(PacketType::EntityEdit, entityID, properties); | |
| 866 | + return true; | |
| 867 | + } | |
| 847 | 868 | } |
| 869 | + return false; | |
| 848 | 870 | } |