| 342 | } |
| 343 | |
| 344 | Mat3F NetworkedAnimator::partTransformation(String const& partName) const { |
| 345 | auto const& part = m_animatedParts.activePart(partName); |
| 346 | Mat3F transformation = Mat3F::identity(); |
| 347 | |
| 348 | if (auto offset = part.properties.value("offset").opt().apply(jsonToVec2F)) |
| 349 | transformation = Mat3F::translation(*offset) * transformation; |
| 350 | |
| 351 | auto transformationGroups = jsonToStringList(part.properties.value("transformationGroups", JsonArray())); |
| 352 | transformation = groupTransformation(transformationGroups) * transformation; |
| 353 | |
| 354 | if (auto rotationGroupName = part.properties.value("rotationGroup").optString()) { |
| 355 | auto const& rotationGroup = m_rotationGroups.get(*rotationGroupName); |
| 356 | Vec2F rotationCenter = part.properties.value("rotationCenter").opt().apply(jsonToVec2F).value(rotationGroup.rotationCenter); |
| 357 | transformation = Mat3F::rotation(rotationGroup.currentAngle, rotationCenter) * transformation; |
| 358 | } |
| 359 | |
| 360 | if (auto anchorPart = part.properties.ptr("anchorPart")) |
| 361 | transformation = partTransformation(anchorPart->toString()) * transformation; |
| 362 | |
| 363 | return transformation; |
| 364 | } |
| 365 | |
| 366 | Mat3F NetworkedAnimator::finalPartTransformation(String const& partName) const { |
| 367 | return globalTransformation() * partTransformation(partName); |
no test coverage detected