mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 18:06:57 +02:00
Merge branch 'master' into docs/deb-rpm-package-instructions
This commit is contained in:
commit
274ea26df0
18 changed files with 247 additions and 122 deletions
9
BUILD.md
9
BUILD.md
|
@ -73,11 +73,14 @@ Where `/path/to/directory` is the path to a directory where you wish the build f
|
||||||
// The identifying tag of the release.
|
// The identifying tag of the release.
|
||||||
CMAKE_BACKTRACE_TOKEN
|
CMAKE_BACKTRACE_TOKEN
|
||||||
|
|
||||||
// The release version. (e.g. 2021.4.2-Osiris)
|
// The release version, e.g., 2021.3.2.
|
||||||
RELEASE_NUMBER
|
RELEASE_NUMBER
|
||||||
// Typically, this is the build commit short hash. (e.g. f1576ab)
|
// The release name, e.g., Eos.
|
||||||
|
RELEASE_NAME
|
||||||
|
// The build commit, e.g., use a Git hash for the most recent commit in the branch - fd6973b.
|
||||||
|
|
||||||
BUILD_NUMBER
|
BUILD_NUMBER
|
||||||
|
|
||||||
// The type of release.
|
// The type of release.
|
||||||
RELEASE_TYPE=PRODUCTION|PR|DEV
|
RELEASE_TYPE=PRODUCTION|PR|DEV
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
# Created by Leonardo Murillo on 12/16/2015.
|
# Created by Leonardo Murillo on 12/16/2015.
|
||||||
# Copyright 2015 High Fidelity, Inc.
|
# Copyright 2015 High Fidelity, Inc.
|
||||||
|
# Copyright 2021 Vircadia contributors.
|
||||||
#
|
#
|
||||||
# Distributed under the Apache License, Version 2.0.
|
# Distributed under the Apache License, Version 2.0.
|
||||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -31,7 +32,7 @@ macro(GENERATE_INSTALLERS)
|
||||||
set(CPACK_PACKAGE_NAME ${_DISPLAY_NAME})
|
set(CPACK_PACKAGE_NAME ${_DISPLAY_NAME})
|
||||||
set(CPACK_PACKAGE_VENDOR "Vircadia")
|
set(CPACK_PACKAGE_VENDOR "Vircadia")
|
||||||
set(CPACK_PACKAGE_VERSION ${BUILD_VERSION})
|
set(CPACK_PACKAGE_VERSION ${BUILD_VERSION})
|
||||||
set(CPACK_PACKAGE_FILE_NAME "Vircadia${_PACKAGE_NAME_EXTRA}-${BUILD_VERSION}")
|
set(CPACK_PACKAGE_FILE_NAME "Vircadia${_PACKAGE_NAME_EXTRA}-${BUILD_VERSION}-${RELEASE_NAME}")
|
||||||
set(CPACK_NSIS_DISPLAY_NAME ${_DISPLAY_NAME})
|
set(CPACK_NSIS_DISPLAY_NAME ${_DISPLAY_NAME})
|
||||||
set(CPACK_NSIS_PACKAGE_NAME ${_DISPLAY_NAME})
|
set(CPACK_NSIS_PACKAGE_NAME ${_DISPLAY_NAME})
|
||||||
if (PR_BUILD)
|
if (PR_BUILD)
|
||||||
|
|
|
@ -112,8 +112,7 @@ MessageBox {
|
||||||
popup.button1text = 'CANCEL'
|
popup.button1text = 'CANCEL'
|
||||||
popup.titleText = 'Get Avatars'
|
popup.titleText = 'Get Avatars'
|
||||||
|
|
||||||
popup.bodyText = 'Get avatars from <b><a href="app://marketplace">Marketplace.</a></b>' + '<br/>' +
|
popup.bodyText = 'Get avatars from the Community Bazaar. (Coming soon!)'
|
||||||
'Wear avatars in <b><a href="app://purchases">Inventory.</a></b>'
|
|
||||||
|
|
||||||
popup.onLinkClicked = function(link) {
|
popup.onLinkClicked = function(link) {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
|
@ -4,6 +4,56 @@
|
||||||
"/": "/0.155245,-0.941538,23.9289/0,0.791589,0,0.611053"
|
"/": "/0.155245,-0.941538,23.9289/0,0.791589,0,0.611053"
|
||||||
},
|
},
|
||||||
"Entities": [
|
"Entities": [
|
||||||
|
{
|
||||||
|
"id": "{0a199807-4a83-4286-b09c-f21124627c3e}",
|
||||||
|
"type": "Box",
|
||||||
|
"name": "Config Wizard Loader",
|
||||||
|
"lastEdited": 1613737207915514,
|
||||||
|
"visible": false,
|
||||||
|
"position": {
|
||||||
|
"x": -1.2722,
|
||||||
|
"y": 0.4266,
|
||||||
|
"z": 24.2307
|
||||||
|
},
|
||||||
|
"dimensions": {
|
||||||
|
"x": 0.20000000298023224,
|
||||||
|
"y": 0.20000000298023224,
|
||||||
|
"z": 0.20000000298023224
|
||||||
|
},
|
||||||
|
"rotation": {
|
||||||
|
"x": 0,
|
||||||
|
"y": -0.7660443782806396,
|
||||||
|
"z": 0,
|
||||||
|
"w": -0.6427876949310303
|
||||||
|
},
|
||||||
|
"created": 1613736996738696,
|
||||||
|
"lastEditedBy": "{ff9b500e-e450-4127-b41f-1c42be16f71b}",
|
||||||
|
"queryAACube": {
|
||||||
|
"x": -0.17320507764816284,
|
||||||
|
"y": -0.17320507764816284,
|
||||||
|
"z": -0.17320507764816284,
|
||||||
|
"scale": 0.3464101552963257
|
||||||
|
},
|
||||||
|
"grab": {
|
||||||
|
"grabbable": false
|
||||||
|
},
|
||||||
|
"damping": 0,
|
||||||
|
"angularDamping": 0,
|
||||||
|
"collisionless": true,
|
||||||
|
"ignoreForCollisions": true,
|
||||||
|
"script": "https://cdn-1.vircadia.com/us-e-1/DomainContent/Tutorial/Apps/configWizard/dist/wizardLoader.js",
|
||||||
|
"color": {
|
||||||
|
"red": 0,
|
||||||
|
"green": 180,
|
||||||
|
"blue": 239
|
||||||
|
},
|
||||||
|
"shape": "Cube",
|
||||||
|
"clientOnly": false,
|
||||||
|
"avatarEntity": false,
|
||||||
|
"localEntity": false,
|
||||||
|
"faceCamera": false,
|
||||||
|
"isFacingAvatar": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "{eb485a2d-2040-42f6-a960-51c88e2434b9}",
|
"id": "{eb485a2d-2040-42f6-a960-51c88e2434b9}",
|
||||||
"type": "Box",
|
"type": "Box",
|
||||||
|
|
|
@ -2989,6 +2989,8 @@ Application::~Application() {
|
||||||
qInstallMessageHandler(LogHandler::verboseMessageHandler);
|
qInstallMessageHandler(LogHandler::verboseMessageHandler);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
// 26 Feb 2021 - Tried re-enabling this call but OSX still crashes on exit.
|
||||||
|
//
|
||||||
// 10/16/2019 - Disabling this call. This causes known crashes (A), and it is not
|
// 10/16/2019 - Disabling this call. This causes known crashes (A), and it is not
|
||||||
// fully understood whether it might cause other unknown crashes (B).
|
// fully understood whether it might cause other unknown crashes (B).
|
||||||
//
|
//
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "AnimationLogging.h"
|
#include "AnimationLogging.h"
|
||||||
#include "CubicHermiteSpline.h"
|
#include "CubicHermiteSpline.h"
|
||||||
#include "AnimUtil.h"
|
#include "AnimUtil.h"
|
||||||
|
#include "AnimSkeleton.h"
|
||||||
|
|
||||||
static const int MAX_TARGET_MARKERS = 30;
|
static const int MAX_TARGET_MARKERS = 30;
|
||||||
static const float JOINT_CHAIN_INTERP_TIME = 0.5f;
|
static const float JOINT_CHAIN_INTERP_TIME = 0.5f;
|
||||||
|
@ -66,7 +67,7 @@ AnimInverseKinematics::IKTargetVar::IKTargetVar(const QString& jointNameIn, cons
|
||||||
poleVectorVar(poleVectorVarIn),
|
poleVectorVar(poleVectorVarIn),
|
||||||
weight(weightIn),
|
weight(weightIn),
|
||||||
numFlexCoefficients(flexCoefficientsIn.size()),
|
numFlexCoefficients(flexCoefficientsIn.size()),
|
||||||
jointIndex(-1)
|
jointIndex(AnimSkeleton::INVALID_JOINT_INDEX)
|
||||||
{
|
{
|
||||||
numFlexCoefficients = std::min(numFlexCoefficients, (size_t)MAX_FLEX_COEFFICIENTS);
|
numFlexCoefficients = std::min(numFlexCoefficients, (size_t)MAX_FLEX_COEFFICIENTS);
|
||||||
for (size_t i = 0; i < numFlexCoefficients; i++) {
|
for (size_t i = 0; i < numFlexCoefficients; i++) {
|
||||||
|
@ -172,14 +173,14 @@ bool debounceJointWarnings() {
|
||||||
|
|
||||||
void AnimInverseKinematics::computeTargets(const AnimVariantMap& animVars, std::vector<IKTarget>& targets, const AnimPoseVec& underPoses) {
|
void AnimInverseKinematics::computeTargets(const AnimVariantMap& animVars, std::vector<IKTarget>& targets, const AnimPoseVec& underPoses) {
|
||||||
|
|
||||||
_hipsTargetIndex = -1;
|
_hipsTargetIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
|
|
||||||
targets.reserve(_targetVarVec.size());
|
targets.reserve(_targetVarVec.size());
|
||||||
|
|
||||||
for (auto& targetVar : _targetVarVec) {
|
for (auto& targetVar : _targetVarVec) {
|
||||||
|
|
||||||
// update targetVar jointIndex cache
|
// update targetVar jointIndex cache
|
||||||
if (targetVar.jointIndex == -1) {
|
if (targetVar.jointIndex == AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
int jointIndex = _skeleton->nameToJointIndex(targetVar.jointName);
|
int jointIndex = _skeleton->nameToJointIndex(targetVar.jointName);
|
||||||
if (jointIndex >= 0) {
|
if (jointIndex >= 0) {
|
||||||
// this targetVar has a valid joint --> cache the indices
|
// this targetVar has a valid joint --> cache the indices
|
||||||
|
@ -190,7 +191,7 @@ void AnimInverseKinematics::computeTargets(const AnimVariantMap& animVars, std::
|
||||||
}
|
}
|
||||||
|
|
||||||
IKTarget target;
|
IKTarget target;
|
||||||
if (targetVar.jointIndex != -1) {
|
if (targetVar.jointIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
target.setType(animVars.lookup(targetVar.typeVar, (int)IKTarget::Type::RotationAndPosition));
|
target.setType(animVars.lookup(targetVar.typeVar, (int)IKTarget::Type::RotationAndPosition));
|
||||||
target.setIndex(targetVar.jointIndex);
|
target.setIndex(targetVar.jointIndex);
|
||||||
if (target.getType() != IKTarget::Type::Unknown) {
|
if (target.getType() != IKTarget::Type::Unknown) {
|
||||||
|
@ -329,7 +330,7 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector<
|
||||||
// update the absolutePoses
|
// update the absolutePoses
|
||||||
for (int i = 0; i < (int)_relativePoses.size(); ++i) {
|
for (int i = 0; i < (int)_relativePoses.size(); ++i) {
|
||||||
auto parentIndex = _skeleton->getParentIndex((int)i);
|
auto parentIndex = _skeleton->getParentIndex((int)i);
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
absolutePoses[i] = absolutePoses[parentIndex] * _relativePoses[i];
|
absolutePoses[i] = absolutePoses[parentIndex] * _relativePoses[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,12 +352,12 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector<
|
||||||
// finally set the relative rotation of each tip to agree with absolute target rotation
|
// finally set the relative rotation of each tip to agree with absolute target rotation
|
||||||
for (auto& target: targets) {
|
for (auto& target: targets) {
|
||||||
int tipIndex = target.getIndex();
|
int tipIndex = target.getIndex();
|
||||||
int parentIndex = (tipIndex >= 0) ? _skeleton->getParentIndex(tipIndex) : -1;
|
int parentIndex = (tipIndex >= 0) ? _skeleton->getParentIndex(tipIndex) : AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
int chainIndex = targetToChainMap[tipIndex];
|
int chainIndex = targetToChainMap[tipIndex];
|
||||||
bool needsInterpolation = _prevJointChainInfoVec[chainIndex].timer > 0.0f;
|
bool needsInterpolation = _prevJointChainInfoVec[chainIndex].timer > 0.0f;
|
||||||
float alpha = needsInterpolation ? getInterpolationAlpha(_prevJointChainInfoVec[chainIndex].timer) : 0.0f;
|
float alpha = needsInterpolation ? getInterpolationAlpha(_prevJointChainInfoVec[chainIndex].timer) : 0.0f;
|
||||||
// update rotationOnly targets that don't lie on the ik chain of other ik targets.
|
// update rotationOnly targets that don't lie on the ik chain of other ik targets.
|
||||||
if (parentIndex != -1 && !_rotationAccumulators[tipIndex].isDirty() &&
|
if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX && !_rotationAccumulators[tipIndex].isDirty() &&
|
||||||
(target.getType() == IKTarget::Type::RotationOnly || target.getType() == IKTarget::Type::Unknown)) {
|
(target.getType() == IKTarget::Type::RotationOnly || target.getType() == IKTarget::Type::Unknown)) {
|
||||||
if (target.getType() == IKTarget::Type::RotationOnly) {
|
if (target.getType() == IKTarget::Type::RotationOnly) {
|
||||||
const glm::quat& targetRotation = target.getRotation();
|
const glm::quat& targetRotation = target.getRotation();
|
||||||
|
@ -434,11 +435,11 @@ void AnimInverseKinematics::solveTargetWithCCD(const AnimContext& context, const
|
||||||
|
|
||||||
int tipIndex = target.getIndex();
|
int tipIndex = target.getIndex();
|
||||||
int pivotIndex = _skeleton->getParentIndex(tipIndex);
|
int pivotIndex = _skeleton->getParentIndex(tipIndex);
|
||||||
if (pivotIndex == -1 || pivotIndex == _hipsIndex) {
|
if (pivotIndex == AnimSkeleton::INVALID_JOINT_INDEX || pivotIndex == _hipsIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pivotsParentIndex = _skeleton->getParentIndex(pivotIndex);
|
int pivotsParentIndex = _skeleton->getParentIndex(pivotIndex);
|
||||||
if (pivotsParentIndex == -1) {
|
if (pivotsParentIndex == AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
// TODO?: handle case where tip's parent is root?
|
// TODO?: handle case where tip's parent is root?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +486,7 @@ void AnimInverseKinematics::solveTargetWithCCD(const AnimContext& context, const
|
||||||
chainDepth++;
|
chainDepth++;
|
||||||
|
|
||||||
// descend toward root, pivoting each joint to get tip closer to target position
|
// descend toward root, pivoting each joint to get tip closer to target position
|
||||||
while (pivotIndex != _hipsIndex && pivotsParentIndex != -1) {
|
while (pivotIndex != _hipsIndex && pivotsParentIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
|
|
||||||
assert(chainDepth < jointChainInfoOut.jointInfoVec.size());
|
assert(chainDepth < jointChainInfoOut.jointInfoVec.size());
|
||||||
|
|
||||||
|
@ -579,12 +580,12 @@ void AnimInverseKinematics::solveTargetWithCCD(const AnimContext& context, const
|
||||||
if (target.getPoleVectorEnabled()) {
|
if (target.getPoleVectorEnabled()) {
|
||||||
int topJointIndex = target.getIndex();
|
int topJointIndex = target.getIndex();
|
||||||
int midJointIndex = _skeleton->getParentIndex(topJointIndex);
|
int midJointIndex = _skeleton->getParentIndex(topJointIndex);
|
||||||
if (midJointIndex != -1) {
|
if (midJointIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
int baseJointIndex = _skeleton->getParentIndex(midJointIndex);
|
int baseJointIndex = _skeleton->getParentIndex(midJointIndex);
|
||||||
if (baseJointIndex != -1) {
|
if (baseJointIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
int baseParentJointIndex = _skeleton->getParentIndex(baseJointIndex);
|
int baseParentJointIndex = _skeleton->getParentIndex(baseJointIndex);
|
||||||
AnimPose topPose, midPose, basePose;
|
AnimPose topPose, midPose, basePose;
|
||||||
int topChainIndex = -1, baseChainIndex = -1;
|
int topChainIndex = AnimSkeleton::INVALID_JOINT_INDEX, baseChainIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
const size_t MAX_CHAIN_DEPTH = 30;
|
const size_t MAX_CHAIN_DEPTH = 30;
|
||||||
AnimPose postAbsPoses[MAX_CHAIN_DEPTH];
|
AnimPose postAbsPoses[MAX_CHAIN_DEPTH];
|
||||||
AnimPose accum = absolutePoses[_hipsIndex];
|
AnimPose accum = absolutePoses[_hipsIndex];
|
||||||
|
@ -756,7 +757,7 @@ void AnimInverseKinematics::computeAndCacheSplineJointInfosForIKTarget(const Ani
|
||||||
|
|
||||||
int index = target.getIndex();
|
int index = target.getIndex();
|
||||||
int endIndex = _skeleton->getParentIndex(_hipsIndex);
|
int endIndex = _skeleton->getParentIndex(_hipsIndex);
|
||||||
while (index != endIndex) {
|
while (index != endIndex && index != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
AnimPose defaultPose = _skeleton->getAbsoluteDefaultPose(index);
|
AnimPose defaultPose = _skeleton->getAbsoluteDefaultPose(index);
|
||||||
|
|
||||||
float ratio = glm::dot(defaultPose.trans() - basePose.trans(), baseToTipNormal) / baseToTipLength;
|
float ratio = glm::dot(defaultPose.trans() - basePose.trans(), baseToTipNormal) / baseToTipLength;
|
||||||
|
@ -1460,7 +1461,7 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele
|
||||||
|
|
||||||
// invalidate all targetVars
|
// invalidate all targetVars
|
||||||
for (auto& targetVar: _targetVarVec) {
|
for (auto& targetVar: _targetVarVec) {
|
||||||
targetVar.jointIndex = -1;
|
targetVar.jointIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& accumulator: _rotationAccumulators) {
|
for (auto& accumulator: _rotationAccumulators) {
|
||||||
|
@ -1480,18 +1481,18 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele
|
||||||
if (_hipsIndex >= 0) {
|
if (_hipsIndex >= 0) {
|
||||||
_hipsParentIndex = _skeleton->getParentIndex(_hipsIndex);
|
_hipsParentIndex = _skeleton->getParentIndex(_hipsIndex);
|
||||||
} else {
|
} else {
|
||||||
_hipsParentIndex = -1;
|
_hipsParentIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
_leftHandIndex = _skeleton->nameToJointIndex("LeftHand");
|
_leftHandIndex = _skeleton->nameToJointIndex("LeftHand");
|
||||||
_rightHandIndex = _skeleton->nameToJointIndex("RightHand");
|
_rightHandIndex = _skeleton->nameToJointIndex("RightHand");
|
||||||
} else {
|
} else {
|
||||||
clearConstraints();
|
clearConstraints();
|
||||||
_headIndex = -1;
|
_headIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
_hipsIndex = -1;
|
_hipsIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
_hipsParentIndex = -1;
|
_hipsParentIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
_leftHandIndex = -1;
|
_leftHandIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
_rightHandIndex = -1;
|
_rightHandIndex = AnimSkeleton::INVALID_JOINT_INDEX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1531,7 +1532,7 @@ void AnimInverseKinematics::debugDrawRelativePoses(const AnimContext& context) c
|
||||||
|
|
||||||
// draw line to parent
|
// draw line to parent
|
||||||
int parentIndex = _skeleton->getParentIndex(i);
|
int parentIndex = _skeleton->getParentIndex(i);
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
glm::vec3 parentPos = transformPoint(geomToWorldMatrix, poses[parentIndex].trans());
|
glm::vec3 parentPos = transformPoint(geomToWorldMatrix, poses[parentIndex].trans());
|
||||||
DebugDraw::getInstance().drawRay(pos, parentPos, GRAY);
|
DebugDraw::getInstance().drawRay(pos, parentPos, GRAY);
|
||||||
}
|
}
|
||||||
|
@ -1580,7 +1581,7 @@ void AnimInverseKinematics::debugDrawIKChain(const JointChainInfo& jointChainInf
|
||||||
DebugDraw::getInstance().drawRay(pos, pos + AXIS_LENGTH * zAxis, BLUE);
|
DebugDraw::getInstance().drawRay(pos, pos + AXIS_LENGTH * zAxis, BLUE);
|
||||||
|
|
||||||
// draw line to parent
|
// draw line to parent
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
glm::vec3 parentPos = transformPoint(geomToWorldMatrix, poses[parentIndex].trans());
|
glm::vec3 parentPos = transformPoint(geomToWorldMatrix, poses[parentIndex].trans());
|
||||||
glm::vec4 color = GRAY;
|
glm::vec4 color = GRAY;
|
||||||
|
|
||||||
|
@ -1629,13 +1630,13 @@ void AnimInverseKinematics::debugDrawConstraints(const AnimContext& context) con
|
||||||
|
|
||||||
// draw line to parent
|
// draw line to parent
|
||||||
int parentIndex = _skeleton->getParentIndex(i);
|
int parentIndex = _skeleton->getParentIndex(i);
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
glm::vec3 parentPos = transformPoint(geomToWorldMatrix, poses[parentIndex].trans());
|
glm::vec3 parentPos = transformPoint(geomToWorldMatrix, poses[parentIndex].trans());
|
||||||
DebugDraw::getInstance().drawRay(pos, parentPos, GRAY);
|
DebugDraw::getInstance().drawRay(pos, parentPos, GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat parentAbsRot;
|
glm::quat parentAbsRot;
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX) {
|
||||||
parentAbsRot = poses[parentIndex].rot();
|
parentAbsRot = poses[parentIndex].rot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1733,7 +1734,7 @@ void AnimInverseKinematics::preconditionRelativePosesToAvoidLimbLock(const AnimC
|
||||||
const float MIN_AXIS_LENGTH = 1.0e-4f;
|
const float MIN_AXIS_LENGTH = 1.0e-4f;
|
||||||
|
|
||||||
for (auto& target : targets) {
|
for (auto& target : targets) {
|
||||||
if (target.getIndex() != -1 && target.getType() == IKTarget::Type::RotationAndPosition) {
|
if (target.getIndex() != AnimSkeleton::INVALID_JOINT_INDEX && target.getType() == IKTarget::Type::RotationAndPosition) {
|
||||||
for (int i = 0; i < NUM_LIMBS; i++) {
|
for (int i = 0; i < NUM_LIMBS; i++) {
|
||||||
if (limbs[i].first == target.getIndex()) {
|
if (limbs[i].first == target.getIndex()) {
|
||||||
int tipIndex = limbs[i].first;
|
int tipIndex = limbs[i].first;
|
||||||
|
|
|
@ -66,7 +66,7 @@ int AnimSkeleton::nameToJointIndex(const QString& jointName) const {
|
||||||
if (_jointIndicesByName.end() != itr) {
|
if (_jointIndicesByName.end() != itr) {
|
||||||
return itr.value();
|
return itr.value();
|
||||||
}
|
}
|
||||||
return -1;
|
return INVALID_JOINT_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AnimSkeleton::getNumJoints() const {
|
int AnimSkeleton::getNumJoints() const {
|
||||||
|
@ -80,7 +80,7 @@ int AnimSkeleton::getChainDepth(int jointIndex) const {
|
||||||
do {
|
do {
|
||||||
chainDepth++;
|
chainDepth++;
|
||||||
index = _parentIndices[index];
|
index = _parentIndices[index];
|
||||||
} while (index != -1);
|
} while (index != INVALID_JOINT_INDEX);
|
||||||
return chainDepth;
|
return chainDepth;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -108,7 +108,7 @@ const AnimPose& AnimSkeleton::getPostRotationPose(int jointIndex) const {
|
||||||
std::vector<int> AnimSkeleton::getChildrenOfJoint(int jointIndex) const {
|
std::vector<int> AnimSkeleton::getChildrenOfJoint(int jointIndex) const {
|
||||||
// Children and grandchildren, etc.
|
// Children and grandchildren, etc.
|
||||||
std::vector<int> result;
|
std::vector<int> result;
|
||||||
if (jointIndex != -1) {
|
if (jointIndex != INVALID_JOINT_INDEX) {
|
||||||
for (int i = jointIndex + 1; i < (int)_parentIndices.size(); i++) {
|
for (int i = jointIndex + 1; i < (int)_parentIndices.size(); i++) {
|
||||||
if (_parentIndices[i] == jointIndex || (std::find(result.begin(), result.end(), _parentIndices[i]) != result.end())) {
|
if (_parentIndices[i] == jointIndex || (std::find(result.begin(), result.end(), _parentIndices[i]) != result.end())) {
|
||||||
result.push_back(i);
|
result.push_back(i);
|
||||||
|
@ -135,7 +135,7 @@ void AnimSkeleton::convertRelativePosesToAbsolute(AnimPoseVec& poses) const {
|
||||||
int lastIndex = std::min((int)poses.size(), _jointsSize);
|
int lastIndex = std::min((int)poses.size(), _jointsSize);
|
||||||
for (int i = 0; i < lastIndex; ++i) {
|
for (int i = 0; i < lastIndex; ++i) {
|
||||||
int parentIndex = _parentIndices[i];
|
int parentIndex = _parentIndices[i];
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != INVALID_JOINT_INDEX) {
|
||||||
poses[i] = poses[parentIndex] * poses[i];
|
poses[i] = poses[parentIndex] * poses[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ void AnimSkeleton::convertAbsolutePosesToRelative(AnimPoseVec& poses) const {
|
||||||
int lastIndex = std::min((int)poses.size(), _jointsSize);
|
int lastIndex = std::min((int)poses.size(), _jointsSize);
|
||||||
for (int i = lastIndex - 1; i >= 0; --i) {
|
for (int i = lastIndex - 1; i >= 0; --i) {
|
||||||
int parentIndex = _parentIndices[i];
|
int parentIndex = _parentIndices[i];
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != INVALID_JOINT_INDEX) {
|
||||||
poses[i] = poses[parentIndex].inverse() * poses[i];
|
poses[i] = poses[parentIndex].inverse() * poses[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void AnimSkeleton::convertRelativeRotationsToAbsolute(std::vector<glm::quat>& ro
|
||||||
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
||||||
for (int i = 0; i < lastIndex; ++i) {
|
for (int i = 0; i < lastIndex; ++i) {
|
||||||
int parentIndex = _parentIndices[i];
|
int parentIndex = _parentIndices[i];
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != INVALID_JOINT_INDEX) {
|
||||||
rotations[i] = rotations[parentIndex] * rotations[i];
|
rotations[i] = rotations[parentIndex] * rotations[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ void AnimSkeleton::convertAbsoluteRotationsToRelative(std::vector<glm::quat>& ro
|
||||||
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
int lastIndex = std::min((int)rotations.size(), _jointsSize);
|
||||||
for (int i = lastIndex - 1; i >= 0; --i) {
|
for (int i = lastIndex - 1; i >= 0; --i) {
|
||||||
int parentIndex = _parentIndices[i];
|
int parentIndex = _parentIndices[i];
|
||||||
if (parentIndex != -1) {
|
if (parentIndex != INVALID_JOINT_INDEX) {
|
||||||
rotations[i] = glm::inverse(rotations[parentIndex]) * rotations[i];
|
rotations[i] = glm::inverse(rotations[parentIndex]) * rotations[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ void AnimSkeleton::buildSkeletonFromJoints(const std::vector<HFMJoint>& joints,
|
||||||
// so we can restore them after a future mirror operation
|
// so we can restore them after a future mirror operation
|
||||||
_nonMirroredIndices.push_back(i);
|
_nonMirroredIndices.push_back(i);
|
||||||
}
|
}
|
||||||
int mirrorJointIndex = -1;
|
int mirrorJointIndex = INVALID_JOINT_INDEX;
|
||||||
if (_joints[i].name.startsWith("Left")) {
|
if (_joints[i].name.startsWith("Left")) {
|
||||||
QString mirrorJointName = QString(_joints[i].name).replace(0, 4, "Right");
|
QString mirrorJointName = QString(_joints[i].name).replace(0, 4, "Right");
|
||||||
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
mirrorJointIndex = nameToJointIndex(mirrorJointName);
|
||||||
|
@ -350,7 +350,7 @@ std::vector<int> AnimSkeleton::lookUpJointIndices(const std::vector<QString>& jo
|
||||||
result.reserve(jointNames.size());
|
result.reserve(jointNames.size());
|
||||||
for (auto& name : jointNames) {
|
for (auto& name : jointNames) {
|
||||||
int index = nameToJointIndex(name);
|
int index = nameToJointIndex(name);
|
||||||
if (index == -1) {
|
if (index == INVALID_JOINT_INDEX) {
|
||||||
qWarning(animation) << "AnimSkeleton::lookUpJointIndices(): could not find bone with name " << name;
|
qWarning(animation) << "AnimSkeleton::lookUpJointIndices(): could not find bone with name " << name;
|
||||||
}
|
}
|
||||||
result.push_back(index);
|
result.push_back(index);
|
||||||
|
|
|
@ -30,6 +30,8 @@ public:
|
||||||
const QString& getJointName(int jointIndex) const;
|
const QString& getJointName(int jointIndex) const;
|
||||||
int getNumJoints() const;
|
int getNumJoints() const;
|
||||||
int getChainDepth(int jointIndex) const;
|
int getChainDepth(int jointIndex) const;
|
||||||
|
|
||||||
|
static const int INVALID_JOINT_INDEX { -1 };
|
||||||
|
|
||||||
// the default poses are the orientations of the joints on frame 0.
|
// the default poses are the orientations of the joints on frame 0.
|
||||||
const AnimPose& getRelativeDefaultPose(int jointIndex) const;
|
const AnimPose& getRelativeDefaultPose(int jointIndex) const;
|
||||||
|
|
|
@ -470,7 +470,10 @@ void ScriptEngine::waitTillDoneRunning(bool shutdown) {
|
||||||
// We should never be waiting (blocking) on our own thread
|
// We should never be waiting (blocking) on our own thread
|
||||||
assert(workerThread != QThread::currentThread());
|
assert(workerThread != QThread::currentThread());
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#if 0
|
||||||
|
// 26 Feb 2021 - Disabled this OSX-specific code because it causes OSX to crash on shutdown; without this code, OSX
|
||||||
|
// doesn't crash on shutdown. Qt 5.12.3 and Qt 5.15.2.
|
||||||
|
//
|
||||||
// On mac, don't call QCoreApplication::processEvents() here. This is to prevent
|
// On mac, don't call QCoreApplication::processEvents() here. This is to prevent
|
||||||
// [NSApplication terminate:] from prematurely destroying the static destructors
|
// [NSApplication terminate:] from prematurely destroying the static destructors
|
||||||
// while we are waiting for the scripts to shutdown. We will pump the message
|
// while we are waiting for the scripts to shutdown. We will pump the message
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
Collection of scripts to create server distribution packages. Most of these scripts assume
|
|
||||||
use of the build script at https://github.com/vircadia/vircadia-builder, specifically that
|
|
||||||
the following directory structure exists
|
|
||||||
|
|
||||||
base folder/
|
|
||||||
source/ git checkout
|
|
||||||
build/ result of cmake build
|
|
||||||
qt5-install/ installed or built Qt5 installation
|
|
||||||
|
|
||||||
These scripts assume that the current directory is the pkg-scripts folder inside of the source directory
|
|
||||||
and that the base folder can be reached by going to "../..". This may not work if pkg-scripts is a symlink;
|
|
||||||
adding an VIRCADIA=~/Vircadia to the beginning of the commandline will override where it looks for the base folder
|
|
||||||
|
|
||||||
Ubuntu:
|
|
||||||
DEBEMAIL="your-email@somewhere.com" DEBFULLNAME="Your Full Name" ./make-deb-server
|
|
||||||
|
|
||||||
This script will retrieve the current git commit date and hash and assemble a version from it.
|
|
||||||
It will attempt construct a .deb file in the pkg-scripts folder
|
|
||||||
|
|
||||||
Amazon Linux 2:
|
|
||||||
./make-rpm-server
|
|
||||||
|
|
||||||
This script will retrieve the current git commit date and hash and assemble a version from it.
|
|
||||||
It will attempt construct an .rpm file in the pkg-scripts folder
|
|
||||||
|
|
||||||
Docker:
|
|
||||||
./make-docker-server
|
|
||||||
|
|
||||||
This script will attempt to create a docker container
|
|
||||||
|
|
||||||
Results:
|
|
||||||
The following directory structure is created for binaries:
|
|
||||||
/opt/vircadia - executables
|
|
||||||
/opt/vircadia/lib - private shared libraries required for executables
|
|
||||||
/opt/vircadia/resources - files required by domain-server administrative website
|
|
||||||
/opt/vircadia/plugins - files required by assignment-client, mainly for audio codecs
|
|
||||||
|
|
||||||
The following systemd services are installed in /usr/lib/systemd/system:
|
|
||||||
vircadia-assignment-client.service
|
|
||||||
vircadia-domain-server.service
|
|
||||||
vircadia-server.target - used to launch/shutdown the two prior services
|
|
||||||
vircadia-assignment-client@.service
|
|
||||||
vircadia-domain-server@.service
|
|
||||||
vircadia-server@.target - used to launch/shutdown the two prior services
|
|
||||||
|
|
||||||
The top three services in this list are the "normal" services that launch Vircadia
|
|
||||||
in the typical fashion. The bottom three services are "template" services designed
|
|
||||||
to permit multiple services to be installed and running on a single machine.
|
|
||||||
|
|
||||||
The script "/opt/vircadia/new-server serverName basePort" will do the necessary
|
|
||||||
setup for a new domain with the specified server name and port. Upon installation
|
|
||||||
the package will create and launch a domain named "default" at base port 40100.
|
|
||||||
The domain name here has nothing to do with the name people will use to find your
|
|
||||||
domain and has nothing to do with "place names", it is only used to locate the files
|
|
||||||
used to configure and run the domain on your server.
|
|
||||||
|
|
||||||
The server stores its files in the following locations:
|
|
||||||
/var/lib/vircadia/.local - "unnamed" services (the default location for Vircadia servers)
|
|
||||||
/var/lib/vircadia/serverName - "named" (template) domains
|
|
||||||
/etc/opt/vircadia - environment variables when launching named domains
|
|
88
pkg-scripts/README.md
Normal file
88
pkg-scripts/README.md
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# Vircadia Server Packaging Scripts
|
||||||
|
|
||||||
|
Collection of scripts to create server distribution packages. Most of these scripts assume
|
||||||
|
use of the build script at https://github.com/vircadia/vircadia-builder, specifically that
|
||||||
|
the following directory structure exists:
|
||||||
|
|
||||||
|
```
|
||||||
|
base folder/
|
||||||
|
source/ git checkout
|
||||||
|
build/ result of cmake build
|
||||||
|
qt5-install/ installed or built Qt5 installation
|
||||||
|
```
|
||||||
|
|
||||||
|
These scripts assume that the current directory is the pkg-scripts folder inside of the source directory
|
||||||
|
and that the base folder can be reached by going to `../..`. This may not work if pkg-scripts is a symlink; adding an VIRCADIA=~/Vircadia to the beginning of the commandline will override where it looks for the base folder.
|
||||||
|
|
||||||
|
## Ubuntu
|
||||||
|
```
|
||||||
|
DEBVERSION="Semver e.g. 2021.1.0" DEBEMAIL="your-email@somewhere.com" DEBFULLNAME="Your Full Name" ./make-deb-server
|
||||||
|
```
|
||||||
|
|
||||||
|
This script will retrieve the current git commit date and hash and append it to your specified version.
|
||||||
|
It will attempt construct a .deb file in the pkg-scripts folder
|
||||||
|
|
||||||
|
## Amazon Linux 2
|
||||||
|
|
||||||
|
You will need to install `rpm-build` if you have not already.
|
||||||
|
```
|
||||||
|
sudo yum install rpm-build
|
||||||
|
```
|
||||||
|
Then, run the build script.
|
||||||
|
```
|
||||||
|
RPMVERSION="Semver e.g. 2021.1.0" ./make-rpm-server
|
||||||
|
```
|
||||||
|
|
||||||
|
This script will retrieve the current git commit date and hash and append it to your specified version.
|
||||||
|
It will attempt construct an .rpm file in the pkg-scripts folder
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
```
|
||||||
|
./make-docker-server
|
||||||
|
```
|
||||||
|
|
||||||
|
This script will attempt to create a docker container.
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
### Binaries
|
||||||
|
|
||||||
|
The following directory structure is created for binaries:
|
||||||
|
```
|
||||||
|
/opt/vircadia - executables
|
||||||
|
/opt/vircadia/lib - private shared libraries required for executables
|
||||||
|
/opt/vircadia/resources - files required by domain-server administrative website
|
||||||
|
/opt/vircadia/plugins - files required by assignment-client, mainly for audio codecs
|
||||||
|
```
|
||||||
|
|
||||||
|
### Services
|
||||||
|
|
||||||
|
The following systemd services are installed in `/usr/lib/systemd/system`:
|
||||||
|
```
|
||||||
|
vircadia-assignment-client.service
|
||||||
|
vircadia-domain-server.service
|
||||||
|
vircadia-server.target - used to launch/shutdown the two prior services
|
||||||
|
vircadia-assignment-client@.service
|
||||||
|
vircadia-domain-server@.service
|
||||||
|
vircadia-server@.target - used to launch/shutdown the two prior services
|
||||||
|
```
|
||||||
|
|
||||||
|
The top three services in this list are the "normal" services that launch Vircadia
|
||||||
|
in the typical fashion. The bottom three services are "template" services designed
|
||||||
|
to permit multiple services to be installed and running on a single machine.
|
||||||
|
|
||||||
|
The script `/opt/vircadia/new-server serverName basePort` will do the necessary
|
||||||
|
setup for a new domain with the specified server name and port. Upon installation
|
||||||
|
the package will create and launch a domain named "default" at base port 40100.
|
||||||
|
The domain name here has nothing to do with the name people will use to find your
|
||||||
|
domain and has nothing to do with "place names", it is only used to locate the files
|
||||||
|
used to configure and run the domain on your server.
|
||||||
|
|
||||||
|
### Stored Files
|
||||||
|
|
||||||
|
The server stores its files in the following locations:
|
||||||
|
```
|
||||||
|
/var/lib/vircadia/.local - "unnamed" services (the default location for Vircadia servers)
|
||||||
|
/var/lib/vircadia/serverName - "named" (template) domains
|
||||||
|
/etc/opt/vircadia - environment variables when launching named domains
|
||||||
|
```
|
|
@ -6,11 +6,11 @@ fi
|
||||||
|
|
||||||
GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"`
|
GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"`
|
||||||
GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7`
|
GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7`
|
||||||
VERSION=2020.2.0-asteria-$GITDATE-$GITCOMMIT
|
VERSION=$DEBVERSION-$GITDATE-$GITCOMMIT
|
||||||
|
|
||||||
sudo apt-get install chrpath binutils dh-make
|
sudo apt-get install chrpath binutils dh-make
|
||||||
|
|
||||||
DEB_BUILD_ROOT=temp-make-deb/vircadia-server-$VERSION-0ubuntu1
|
DEB_BUILD_ROOT=temp-make-deb/vircadia-server_$VERSION-0ubuntu1
|
||||||
rm -r temp-make-deb
|
rm -r temp-make-deb
|
||||||
mkdir -p $DEB_BUILD_ROOT
|
mkdir -p $DEB_BUILD_ROOT
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ "$VIRCADIA" = "" ]; then
|
||||||
fi
|
fi
|
||||||
GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"`
|
GITDATE=`git -C $VIRCADIA/source log -n 1 --format=raw | grep author | cut -d">" -f 2 | cut -d" " -f 2 | xargs -I {} date -d @{} +"%Y%m%d"`
|
||||||
GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7`
|
GITCOMMIT=`git -C $VIRCADIA/source rev-parse HEAD | cut -c 1-7`
|
||||||
VERSION=2020.2.0_ASTERIA_${GITDATE}_${GITCOMMIT}
|
VERSION=${RPMVERSION}_${GITDATE}_${GITCOMMIT}
|
||||||
|
|
||||||
SOFILES=`ls \
|
SOFILES=`ls \
|
||||||
$VIRCADIA/build/libraries/*/*.so \
|
$VIRCADIA/build/libraries/*/*.so \
|
||||||
|
|
|
@ -36,6 +36,7 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/inspect.js",
|
"system/inspect.js",
|
||||||
"system/keyboardShortcuts/keyboardShortcuts.js",
|
"system/keyboardShortcuts/keyboardShortcuts.js",
|
||||||
"system/checkForUpdates.js",
|
"system/checkForUpdates.js",
|
||||||
|
"system/onEscape.js",
|
||||||
"system/onFirstRun.js",
|
"system/onFirstRun.js",
|
||||||
"system/appreciate/appreciate_app.js"
|
"system/appreciate/appreciate_app.js"
|
||||||
];
|
];
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
//
|
//
|
||||||
// away.js
|
// away.js
|
||||||
//
|
//
|
||||||
// examples
|
|
||||||
//
|
|
||||||
// Created by Howard Stearns 11/3/15
|
// Created by Howard Stearns 11/3/15
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
// Copyright 2021 Vircadia contributors.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -255,17 +254,6 @@ function setActiveProperties() {
|
||||||
Script.clearInterval(avatarMovedInterval);
|
Script.clearInterval(avatarMovedInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeGoActive(event) {
|
|
||||||
if (event.isAutoRepeat) { // isAutoRepeat is true when held down (or when Windows feels like it)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!isAway && (event.text === 'ESC')) {
|
|
||||||
goAway();
|
|
||||||
} else {
|
|
||||||
goActive();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var wasHmdActive = HMD.active;
|
var wasHmdActive = HMD.active;
|
||||||
var wasMouseCaptured = Reticle.mouseCaptured;
|
var wasMouseCaptured = Reticle.mouseCaptured;
|
||||||
|
|
||||||
|
@ -329,12 +317,24 @@ var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable";
|
||||||
var handleMessage = function(channel, message, sender) {
|
var handleMessage = function(channel, message, sender) {
|
||||||
if (channel === CHANNEL_AWAY_ENABLE && sender === MyAvatar.sessionUUID) {
|
if (channel === CHANNEL_AWAY_ENABLE && sender === MyAvatar.sessionUUID) {
|
||||||
print("away.js | Got message on Hifi-Away-Enable: ", message);
|
print("away.js | Got message on Hifi-Away-Enable: ", message);
|
||||||
setEnabled(message === 'enable');
|
if (message === 'enable') {
|
||||||
|
setEnabled(true);
|
||||||
|
} else if (message === 'toggle') {
|
||||||
|
toggleAway();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Messages.subscribe(CHANNEL_AWAY_ENABLE);
|
Messages.subscribe(CHANNEL_AWAY_ENABLE);
|
||||||
Messages.messageReceived.connect(handleMessage);
|
Messages.messageReceived.connect(handleMessage);
|
||||||
|
|
||||||
|
function toggleAway() {
|
||||||
|
if (!isAway) {
|
||||||
|
goAway();
|
||||||
|
} else {
|
||||||
|
goActive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var maybeIntervalTimer = Script.setInterval(function() {
|
var maybeIntervalTimer = Script.setInterval(function() {
|
||||||
maybeMoveOverlay();
|
maybeMoveOverlay();
|
||||||
maybeGoAway();
|
maybeGoAway();
|
||||||
|
@ -343,7 +343,6 @@ var maybeIntervalTimer = Script.setInterval(function() {
|
||||||
|
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(goActive);
|
Controller.mousePressEvent.connect(goActive);
|
||||||
Controller.keyPressEvent.connect(maybeGoActive);
|
|
||||||
// Note peek() so as to not interfere with other mappings.
|
// Note peek() so as to not interfere with other mappings.
|
||||||
eventMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(goActive);
|
eventMapping.from(Controller.Standard.LeftPrimaryThumb).peek().to(goActive);
|
||||||
eventMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(goActive);
|
eventMapping.from(Controller.Standard.RightPrimaryThumb).peek().to(goActive);
|
||||||
|
@ -371,7 +370,6 @@ Script.scriptEnding.connect(function () {
|
||||||
HMD.awayStateWhenFocusLostInVRChanged.disconnect(awayStateWhenFocusLostInVRChanged);
|
HMD.awayStateWhenFocusLostInVRChanged.disconnect(awayStateWhenFocusLostInVRChanged);
|
||||||
Controller.disableMapping(eventMappingName);
|
Controller.disableMapping(eventMappingName);
|
||||||
Controller.mousePressEvent.disconnect(goActive);
|
Controller.mousePressEvent.disconnect(goActive);
|
||||||
Controller.keyPressEvent.disconnect(maybeGoActive);
|
|
||||||
Messages.messageReceived.disconnect(handleMessage);
|
Messages.messageReceived.disconnect(handleMessage);
|
||||||
Messages.unsubscribe(CHANNEL_AWAY_ENABLE);
|
Messages.unsubscribe(CHANNEL_AWAY_ENABLE);
|
||||||
});
|
});
|
||||||
|
|
|
@ -587,7 +587,7 @@
|
||||||
"tooltip": "The mode in which to draw an entity, either \"Solid\" or \"Wireframe\"."
|
"tooltip": "The mode in which to draw an entity, either \"Solid\" or \"Wireframe\"."
|
||||||
},
|
},
|
||||||
"billboardMode": {
|
"billboardMode": {
|
||||||
"tooltip": "Determines if and how the entity will face the camera.",
|
"tooltip": "Determines if and how the entity will face the camera."
|
||||||
},
|
},
|
||||||
"renderWithZones": {
|
"renderWithZones": {
|
||||||
"tooltip": "If set, this entity will only render when your avatar is inside of a zone in this list."
|
"tooltip": "If set, this entity will only render when your avatar is inside of a zone in this list."
|
||||||
|
|
34
scripts/system/onEscape.js
Normal file
34
scripts/system/onEscape.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
//
|
||||||
|
// onEscape.js
|
||||||
|
//
|
||||||
|
// Created by Kalila L. on Feb 3 2021.
|
||||||
|
// Copyright 2021 Vircadia contributors.
|
||||||
|
//
|
||||||
|
// This script manages actions when the user triggers an "escape" key or action.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
|
function maybeEscapeKeyPressed (event) {
|
||||||
|
if (event.isAutoRepeat) { // isAutoRepeat is true when held down (or when Windows feels like it)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.text === 'ESC') {
|
||||||
|
var CHANNEL_AWAY_ENABLE = 'Hifi-Away-Enable';
|
||||||
|
Messages.sendMessage(CHANNEL_AWAY_ENABLE, 'toggle', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.keyPressEvent.connect(maybeEscapeKeyPressed);
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function () {
|
||||||
|
Controller.keyPressEvent.disconnect(maybeEscapeKeyPressed);
|
||||||
|
});
|
||||||
|
|
||||||
|
}());
|
|
@ -13,6 +13,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
// Check to see if we should run this script or bail...
|
||||||
var SETTING_TO_CHECK = 'firstRun';
|
var SETTING_TO_CHECK = 'firstRun';
|
||||||
var DEFAULT_DISPLAY_NAME = '';
|
var DEFAULT_DISPLAY_NAME = '';
|
||||||
|
|
||||||
|
@ -20,6 +21,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this is our first run, then proceed...
|
||||||
|
|
||||||
if (MyAvatar.displayName === '') {
|
if (MyAvatar.displayName === '') {
|
||||||
var selectedDisplayName = Window.prompt('Enter a display name.', MyAvatar.displayName);
|
var selectedDisplayName = Window.prompt('Enter a display name.', MyAvatar.displayName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue