mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 09:03:55 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into red
This commit is contained in:
commit
a997f9bb1b
5 changed files with 61 additions and 4 deletions
50
examples/disableAvatarAnimations.js
Normal file
50
examples/disableAvatarAnimations.js
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
//
|
||||||
|
// disableAvatarAnimations.js
|
||||||
|
// examples
|
||||||
|
//
|
||||||
|
// Copyright 2016 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// When launched, it will replace all of the avatars animations with a single frame idle pose.
|
||||||
|
// full body IK and hand grabbing animations will still continue to function, but all other
|
||||||
|
// animations will be replaced.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
var skeletonModelURL = "";
|
||||||
|
var jointCount = 0;
|
||||||
|
|
||||||
|
var excludedRoles = ["rightHandGraspOpen", "rightHandGraspClosed", "leftHandGraspOpen", "leftHandGraspClosed"];
|
||||||
|
var IDLE_URL = "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims_160127/idle.fbx";
|
||||||
|
|
||||||
|
function overrideAnims() {
|
||||||
|
var roles = MyAvatar.getAnimationRoles();
|
||||||
|
var i, l = roles.length;
|
||||||
|
for (i = 0; i < l; i++) {
|
||||||
|
if (excludedRoles.indexOf(roles[i]) == -1) {
|
||||||
|
MyAvatar.overrideRoleAnimation(roles[i], IDLE_URL, 30, false, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreAnims() {
|
||||||
|
var roles = MyAvatar.getAnimationRoles();
|
||||||
|
var i, l = roles.length;
|
||||||
|
for (i = 0; i < l; i++) {
|
||||||
|
if (excludedRoles.indexOf(roles[i]) == -1) {
|
||||||
|
MyAvatar.restoreRoleAnimation(roles[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
overrideAnims();
|
||||||
|
|
||||||
|
MyAvatar.onLoadComplete.connect(function () {
|
||||||
|
overrideAnims();
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function () {
|
||||||
|
restoreAnims();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,8 @@ MyAvatar::MyAvatar(RigPointer rig) :
|
||||||
_headData->setLookAtPosition(headData->getLookAtPosition());
|
_headData->setLookAtPosition(headData->getLookAtPosition());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(rig.get(), SIGNAL(onLoadComplete()), this, SIGNAL(onLoadComplete()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MyAvatar::~MyAvatar() {
|
MyAvatar::~MyAvatar() {
|
||||||
|
@ -1576,6 +1578,7 @@ glm::vec3 MyAvatar::applyKeyboardMotor(float deltaTime, const glm::vec3& localVe
|
||||||
float speedIncreaseFactor = 1.8f;
|
float speedIncreaseFactor = 1.8f;
|
||||||
motorSpeed *= 1.0f + glm::clamp(deltaTime / speedGrowthTimescale , 0.0f, 1.0f) * speedIncreaseFactor;
|
motorSpeed *= 1.0f + glm::clamp(deltaTime / speedGrowthTimescale , 0.0f, 1.0f) * speedIncreaseFactor;
|
||||||
const float maxBoostSpeed = getUniformScale() * MAX_BOOST_SPEED;
|
const float maxBoostSpeed = getUniformScale() * MAX_BOOST_SPEED;
|
||||||
|
|
||||||
if (motorSpeed < maxBoostSpeed) {
|
if (motorSpeed < maxBoostSpeed) {
|
||||||
// an active keyboard motor should never be slower than this
|
// an active keyboard motor should never be slower than this
|
||||||
float boostCoefficient = (maxBoostSpeed - motorSpeed) / maxBoostSpeed;
|
float boostCoefficient = (maxBoostSpeed - motorSpeed) / maxBoostSpeed;
|
||||||
|
@ -2090,7 +2093,7 @@ float MyAvatar::getAccelerationEnergy() {
|
||||||
int changeInVelocity = abs(velocity.length() - priorVelocity.length());
|
int changeInVelocity = abs(velocity.length() - priorVelocity.length());
|
||||||
float changeInEnergy = priorVelocity.length() * changeInVelocity * AVATAR_MOVEMENT_ENERGY_CONSTANT;
|
float changeInEnergy = priorVelocity.length() * changeInVelocity * AVATAR_MOVEMENT_ENERGY_CONSTANT;
|
||||||
priorVelocity = velocity;
|
priorVelocity = velocity;
|
||||||
|
|
||||||
return changeInEnergy;
|
return changeInEnergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2112,4 +2115,3 @@ bool MyAvatar::didTeleport() {
|
||||||
lastPosition = pos;
|
lastPosition = pos;
|
||||||
return (changeInPosition.length() > MAX_AVATAR_MOVEMENT_PER_FRAME);
|
return (changeInPosition.length() > MAX_AVATAR_MOVEMENT_PER_FRAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ signals:
|
||||||
void collisionWithEntity(const Collision& collision);
|
void collisionWithEntity(const Collision& collision);
|
||||||
void energyChanged(float newEnergy);
|
void energyChanged(float newEnergy);
|
||||||
void positionGoneTo();
|
void positionGoneTo();
|
||||||
|
void onLoadComplete();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -1161,6 +1161,7 @@ void Rig::initAnimGraph(const QUrl& url) {
|
||||||
overrideAnimation(origState.url, origState.fps, origState.loop, origState.firstFrame, origState.lastFrame);
|
overrideAnimation(origState.url, origState.fps, origState.loop, origState.firstFrame, origState.lastFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit onLoadComplete();
|
||||||
});
|
});
|
||||||
connect(_animLoader.get(), &AnimNodeLoader::error, [url](int error, QString str) {
|
connect(_animLoader.get(), &AnimNodeLoader::error, [url](int error, QString str) {
|
||||||
qCCritical(animation) << "Error loading" << url.toDisplayString() << "code = " << error << "str =" << str;
|
qCCritical(animation) << "Error loading" << url.toDisplayString() << "code = " << error << "str =" << str;
|
||||||
|
|
|
@ -32,6 +32,7 @@ typedef std::shared_ptr<Rig> RigPointer;
|
||||||
// However only specific methods thread-safe. Noted below.
|
// However only specific methods thread-safe. Noted below.
|
||||||
|
|
||||||
class Rig : public QObject, public std::enable_shared_from_this<Rig> {
|
class Rig : public QObject, public std::enable_shared_from_this<Rig> {
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
struct StateHandler {
|
struct StateHandler {
|
||||||
AnimVariantMap results;
|
AnimVariantMap results;
|
||||||
|
@ -223,7 +224,10 @@ public:
|
||||||
|
|
||||||
const glm::mat4& getGeometryToRigTransform() const { return _geometryToRigTransform; }
|
const glm::mat4& getGeometryToRigTransform() const { return _geometryToRigTransform; }
|
||||||
|
|
||||||
protected:
|
signals:
|
||||||
|
void onLoadComplete();
|
||||||
|
|
||||||
|
protected:
|
||||||
bool isIndexValid(int index) const { return _animSkeleton && index >= 0 && index < _animSkeleton->getNumJoints(); }
|
bool isIndexValid(int index) const { return _animSkeleton && index >= 0 && index < _animSkeleton->getNumJoints(); }
|
||||||
void updateAnimationStateHandlers();
|
void updateAnimationStateHandlers();
|
||||||
void applyOverridePoses();
|
void applyOverridePoses();
|
||||||
|
|
Loading…
Reference in a new issue