mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 17:20:12 +02:00
Merge pull request #15003 from SamGondelman/nametag
Case 21397: Fix nametag rotation
This commit is contained in:
commit
4f0911bd29
1 changed files with 36 additions and 0 deletions
|
@ -563,6 +563,42 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
|
|||
SET_OVERLAY_PROP_DEFAULT(textures, PathUtils::resourcesUrl() + "images/whitePixel.png");
|
||||
}
|
||||
|
||||
{ // Overlays did this conversion for rotation
|
||||
auto iter = overlayProps.find("rotation");
|
||||
if (iter != overlayProps.end() && !overlayProps.contains("localRotation")) {
|
||||
QUuid parentID;
|
||||
{
|
||||
auto iter = overlayProps.find("parentID");
|
||||
if (iter != overlayProps.end()) {
|
||||
parentID = iter.value().toUuid();
|
||||
} else if (!add) {
|
||||
EntityPropertyFlags desiredProperties;
|
||||
desiredProperties += PROP_PARENT_ID;
|
||||
parentID = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getParentID();
|
||||
}
|
||||
}
|
||||
|
||||
int parentJointIndex = -1;
|
||||
{
|
||||
auto iter = overlayProps.find("parentJointIndex");
|
||||
if (iter != overlayProps.end()) {
|
||||
parentJointIndex = iter.value().toInt();
|
||||
} else if (!add) {
|
||||
EntityPropertyFlags desiredProperties;
|
||||
desiredProperties += PROP_PARENT_JOINT_INDEX;
|
||||
parentJointIndex = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getParentJointIndex();
|
||||
}
|
||||
}
|
||||
|
||||
glm::quat rotation = quatFromVariant(iter.value());
|
||||
bool success = false;
|
||||
glm::quat localRotation = SpatiallyNestable::worldToLocal(rotation, parentID, parentJointIndex, false, success);
|
||||
if (success) {
|
||||
overlayProps["rotation"] = quatToVariant(localRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == "Text" || type == "Image" || type == "Grid" || type == "Web") {
|
||||
glm::quat originalRotation = ENTITY_ITEM_DEFAULT_ROTATION;
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue