Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 8 files). Show all
Unified · Split
| @@ -1110,12 +1110,11 @@ glm::quat EntityScriptingInterface::getAbsoluteJointRotationInObjectFrame(const · 1109 unmodified lines | ||
| 1110 | 1110 | } |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | −bool EntityScriptingInterface::setAbsoluteJointTranslationInObjectFrame(const QUuid& entityID, | |
| 1114 | − int jointIndex, glm::vec3 translation) { | |
| 1113 | +bool EntityScriptingInterface::setLocalJointTranslation(const QUuid& entityID, int jointIndex, glm::vec3 translation) { | |
| 1115 | 1114 | if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { |
| 1116 | 1115 | auto now = usecTimestampNow(); |
| 1117 | 1116 | auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity); |
| 1118 | − bool result = modelEntity->setAbsoluteJointTranslationInObjectFrame(jointIndex, translation); | |
| 1117 | + bool result = modelEntity->setLocalJointTranslation(jointIndex, translation); | |
| 1119 | 1118 | if (result) { |
| 1120 | 1119 | EntityItemProperties properties; |
| 1121 | 1120 | _entityTree->withWriteLock([&] { |
| @@ -1132,12 +1131,11 @@ bool EntityScriptingInterface::setAbsoluteJointTranslationInObjectFrame(const QU · 10 unmodified lines | ||
| 1132 | 1131 | return false; |
| 1133 | 1132 | } |
| 1134 | 1133 | |
| 1135 | −bool EntityScriptingInterface::setAbsoluteJointRotationInObjectFrame(const QUuid& entityID, | |
| 1136 | − int jointIndex, glm::quat rotation) { | |
| 1134 | +bool EntityScriptingInterface::setLocalJointRotation(const QUuid& entityID, int jointIndex, glm::quat rotation) { | |
| 1137 | 1135 | if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { |
| 1138 | 1136 | auto now = usecTimestampNow(); |
| 1139 | 1137 | auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity); |
| 1140 | − bool result = modelEntity->setAbsoluteJointRotationInObjectFrame(jointIndex, rotation); | |
| 1138 | + bool result = modelEntity->setLocalJointRotation(jointIndex, rotation); | |
| 1141 | 1139 | if (result) { |
| 1142 | 1140 | EntityItemProperties properties; |
| 1143 | 1141 | _entityTree->withWriteLock([&] { |
| @@ -1156,15 +1154,14 @@ bool EntityScriptingInterface::setAbsoluteJointRotationInObjectFrame(const QUuid · 12 unmodified lines | ||
| 1156 | 1154 | |
| 1157 | 1155 | |
| 1158 | 1156 | |
| 1159 | −bool EntityScriptingInterface::setAbsoluteJointRotationsInObjectFrame(const QUuid& entityID, | |
| 1160 | − const QVector<glm::quat>& rotations) { | |
| 1157 | +bool EntityScriptingInterface::setLocalJointRotations(const QUuid& entityID, const QVector<glm::quat>& rotations) { | |
| 1161 | 1158 | if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { |
| 1162 | 1159 | auto now = usecTimestampNow(); |
| 1163 | 1160 | auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity); |
| 1164 | 1161 | |
| 1165 | 1162 | bool result = false; |
| 1166 | 1163 | for (int index = 0; index < rotations.size(); index++) { |
| 1167 | − result |= modelEntity->setAbsoluteJointRotationInObjectFrame(index, rotations[index]); | |
| 1164 | + result |= modelEntity->setLocalJointRotation(index, rotations[index]); | |
| 1168 | 1165 | } |
| 1169 | 1166 | if (result) { |
| 1170 | 1167 | EntityItemProperties properties; |
| @@ -1184,15 +1181,14 @@ bool EntityScriptingInterface::setAbsoluteJointRotationsInObjectFrame(const QUui · 13 unmodified lines | ||
| 1184 | 1181 | } |
| 1185 | 1182 | |
| 1186 | 1183 | |
| 1187 | −bool EntityScriptingInterface::setAbsoluteJointTranslationsInObjectFrame(const QUuid& entityID, | |
| 1188 | − const QVector<glm::vec3>& translations) { | |
| 1184 | +bool EntityScriptingInterface::setLocalJointTranslations(const QUuid& entityID, const QVector<glm::vec3>& translations) { | |
| 1189 | 1185 | if (auto entity = checkForTreeEntityAndTypeMatch(entityID, EntityTypes::Model)) { |
| 1190 | 1186 | auto now = usecTimestampNow(); |
| 1191 | 1187 | auto modelEntity = std::dynamic_pointer_cast<ModelEntityItem>(entity); |
| 1192 | 1188 | |
| 1193 | 1189 | bool result = false; |
| 1194 | 1190 | for (int index = 0; index < translations.size(); index++) { |
| 1195 | − result |= modelEntity->setAbsoluteJointTranslationInObjectFrame(index, translations[index]); | |
| 1191 | + result |= modelEntity->setLocalJointTranslation(index, translations[index]); | |
| 1196 | 1192 | } |
| 1197 | 1193 | if (result) { |
| 1198 | 1194 | EntityItemProperties properties; |
| @@ -1211,12 +1207,12 @@ bool EntityScriptingInterface::setAbsoluteJointTranslationsInObjectFrame(const Q · 12 unmodified lines | ||
| 1211 | 1207 | return false; |
| 1212 | 1208 | } |
| 1213 | 1209 | |
| 1214 | −bool EntityScriptingInterface::setAbsoluteJointsDataInObjectFrame(const QUuid& entityID, | |
| 1215 | − const QVector<glm::quat>& rotations, | |
| 1216 | − const QVector<glm::vec3>& translations) { | |
| 1210 | +bool EntityScriptingInterface::setLocalJointsData(const QUuid& entityID, | |
| 1211 | + const QVector<glm::quat>& rotations, | |
| 1212 | + const QVector<glm::vec3>& translations) { | |
| 1217 | 1213 | // for a model with 80 joints, sending both these in one edit packet causes the packet to be too large. |
| 1218 | − return setAbsoluteJointRotationsInObjectFrame(entityID, rotations) || | |
| 1219 | − setAbsoluteJointTranslationsInObjectFrame(entityID, translations); | |
| 1214 | + return setLocalJointRotations(entityID, rotations) || | |
| 1215 | + setLocalJointTranslations(entityID, translations); | |
| 1220 | 1216 | } |
| 1221 | 1217 | |
| 1222 | 1218 | int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString& name) { |