mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:17:01 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into Case21467
This commit is contained in:
commit
365be5f74c
3 changed files with 44 additions and 33 deletions
|
@ -124,41 +124,45 @@ void AnimClip::copyFromNetworkAnim() {
|
||||||
_anim.resize(animFrameCount);
|
_anim.resize(animFrameCount);
|
||||||
|
|
||||||
// find the size scale factor for translation in the animation.
|
// find the size scale factor for translation in the animation.
|
||||||
const int avatarHipsParentIndex = avatarSkeleton->getParentIndex(avatarSkeleton->nameToJointIndex("Hips"));
|
|
||||||
const int animHipsParentIndex = animSkeleton.getParentIndex(animSkeleton.nameToJointIndex("Hips"));
|
|
||||||
const AnimPose& avatarHipsAbsoluteDefaultPose = avatarSkeleton->getAbsoluteDefaultPose(avatarSkeleton->nameToJointIndex("Hips"));
|
|
||||||
const AnimPose& animHipsAbsoluteDefaultPose = animSkeleton.getAbsoluteDefaultPose(animSkeleton.nameToJointIndex("Hips"));
|
|
||||||
|
|
||||||
// the get the units and the heights for the animation and the avatar
|
|
||||||
const float avatarUnitScale = extractScale(avatarSkeleton->getGeometryOffset()).y;
|
|
||||||
const float animationUnitScale = extractScale(animModel.offset).y;
|
|
||||||
const float avatarHeightInMeters = avatarUnitScale * avatarHipsAbsoluteDefaultPose.trans().y;
|
|
||||||
const float animHeightInMeters = animationUnitScale * animHipsAbsoluteDefaultPose.trans().y;
|
|
||||||
|
|
||||||
// get the parent scales for the avatar and the animation
|
|
||||||
float avatarHipsParentScale = 1.0f;
|
|
||||||
if (avatarHipsParentIndex >= 0) {
|
|
||||||
const AnimPose& avatarHipsParentAbsoluteDefaultPose = avatarSkeleton->getAbsoluteDefaultPose(avatarHipsParentIndex);
|
|
||||||
avatarHipsParentScale = avatarHipsParentAbsoluteDefaultPose.scale().y;
|
|
||||||
}
|
|
||||||
float animHipsParentScale = 1.0f;
|
|
||||||
if (animHipsParentIndex >= 0) {
|
|
||||||
const AnimPose& animationHipsParentAbsoluteDefaultPose = animSkeleton.getAbsoluteDefaultPose(animHipsParentIndex);
|
|
||||||
animHipsParentScale = animationHipsParentAbsoluteDefaultPose.scale().y;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float EPSILON = 0.0001f;
|
|
||||||
float boneLengthScale = 1.0f;
|
float boneLengthScale = 1.0f;
|
||||||
// compute the ratios for the units, the heights in meters, and the parent scales
|
const int avatarHipsIndex = avatarSkeleton->nameToJointIndex("Hips");
|
||||||
if ((fabsf(animHeightInMeters) > EPSILON) && (animationUnitScale > EPSILON) && (animHipsParentScale > EPSILON)) {
|
const int animHipsIndex = animSkeleton.nameToJointIndex("Hips");
|
||||||
const float avatarToAnimationHeightRatio = avatarHeightInMeters / animHeightInMeters;
|
if (avatarHipsIndex != -1 && animHipsIndex != -1) {
|
||||||
const float unitsRatio = 1.0f / (avatarUnitScale / animationUnitScale);
|
const int avatarHipsParentIndex = avatarSkeleton->getParentIndex(avatarHipsIndex);
|
||||||
const float parentScaleRatio = 1.0f / (avatarHipsParentScale / animHipsParentScale);
|
const int animHipsParentIndex = animSkeleton.getParentIndex(animHipsIndex);
|
||||||
|
|
||||||
boneLengthScale = avatarToAnimationHeightRatio * unitsRatio * parentScaleRatio;
|
const AnimPose& avatarHipsAbsoluteDefaultPose = avatarSkeleton->getAbsoluteDefaultPose(avatarHipsIndex);
|
||||||
|
const AnimPose& animHipsAbsoluteDefaultPose = animSkeleton.getAbsoluteDefaultPose(animHipsIndex);
|
||||||
|
|
||||||
|
// the get the units and the heights for the animation and the avatar
|
||||||
|
const float avatarUnitScale = extractScale(avatarSkeleton->getGeometryOffset()).y;
|
||||||
|
const float animationUnitScale = extractScale(animModel.offset).y;
|
||||||
|
const float avatarHeightInMeters = avatarUnitScale * avatarHipsAbsoluteDefaultPose.trans().y;
|
||||||
|
const float animHeightInMeters = animationUnitScale * animHipsAbsoluteDefaultPose.trans().y;
|
||||||
|
|
||||||
|
// get the parent scales for the avatar and the animation
|
||||||
|
float avatarHipsParentScale = 1.0f;
|
||||||
|
if (avatarHipsParentIndex != -1) {
|
||||||
|
const AnimPose& avatarHipsParentAbsoluteDefaultPose = avatarSkeleton->getAbsoluteDefaultPose(avatarHipsParentIndex);
|
||||||
|
avatarHipsParentScale = avatarHipsParentAbsoluteDefaultPose.scale().y;
|
||||||
|
}
|
||||||
|
float animHipsParentScale = 1.0f;
|
||||||
|
if (animHipsParentIndex != -1) {
|
||||||
|
const AnimPose& animationHipsParentAbsoluteDefaultPose = animSkeleton.getAbsoluteDefaultPose(animHipsParentIndex);
|
||||||
|
animHipsParentScale = animationHipsParentAbsoluteDefaultPose.scale().y;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float EPSILON = 0.0001f;
|
||||||
|
// compute the ratios for the units, the heights in meters, and the parent scales
|
||||||
|
if ((fabsf(animHeightInMeters) > EPSILON) && (animationUnitScale > EPSILON) && (animHipsParentScale > EPSILON)) {
|
||||||
|
const float avatarToAnimationHeightRatio = avatarHeightInMeters / animHeightInMeters;
|
||||||
|
const float unitsRatio = 1.0f / (avatarUnitScale / animationUnitScale);
|
||||||
|
const float parentScaleRatio = 1.0f / (avatarHipsParentScale / animHipsParentScale);
|
||||||
|
|
||||||
|
boneLengthScale = avatarToAnimationHeightRatio * unitsRatio * parentScaleRatio;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int frame = 0; frame < animFrameCount; frame++) {
|
for (int frame = 0; frame < animFrameCount; frame++) {
|
||||||
const HFMAnimationFrame& animFrame = animModel.animationFrames[frame];
|
const HFMAnimationFrame& animFrame = animModel.animationFrames[frame];
|
||||||
|
|
||||||
|
|
|
@ -459,7 +459,7 @@ function loaded() {
|
||||||
isRenameFieldBeingMoved = true;
|
isRenameFieldBeingMoved = true;
|
||||||
document.body.appendChild(elRenameInput);
|
document.body.appendChild(elRenameInput);
|
||||||
// keep the focus
|
// keep the focus
|
||||||
elRenameInput.select();
|
elRenameInput.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ function loaded() {
|
||||||
elCell.innerHTML = "";
|
elCell.innerHTML = "";
|
||||||
elCell.appendChild(elRenameInput);
|
elCell.appendChild(elRenameInput);
|
||||||
// keep the focus
|
// keep the focus
|
||||||
elRenameInput.select();
|
elRenameInput.focus();
|
||||||
isRenameFieldBeingMoved = false;
|
isRenameFieldBeingMoved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3325,6 +3325,13 @@ function loaded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let hasSelectedEntityChanged = lastEntityID !== '"' + selectedEntityProperties.id + '"';
|
let hasSelectedEntityChanged = lastEntityID !== '"' + selectedEntityProperties.id + '"';
|
||||||
|
|
||||||
|
if (!hasSelectedEntityChanged && document.hasFocus()) {
|
||||||
|
// in case the selection has not changed and we still have focus on the properties page,
|
||||||
|
// we will ignore the event.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let doSelectElement = !hasSelectedEntityChanged;
|
let doSelectElement = !hasSelectedEntityChanged;
|
||||||
|
|
||||||
// the event bridge and json parsing handle our avatar id string differently.
|
// the event bridge and json parsing handle our avatar id string differently.
|
||||||
|
|
Loading…
Reference in a new issue