mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:23:39 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into tablet-ui-edit-js
This commit is contained in:
commit
66d44ac6f0
3 changed files with 48 additions and 48 deletions
|
@ -2000,6 +2000,11 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto currentBasis = getRecordingBasis();
|
||||||
|
if (!currentBasis) {
|
||||||
|
currentBasis = std::make_shared<Transform>(Transform::fromJson(json[JSON_AVATAR_BASIS]));
|
||||||
|
}
|
||||||
|
|
||||||
if (json.contains(JSON_AVATAR_RELATIVE)) {
|
if (json.contains(JSON_AVATAR_RELATIVE)) {
|
||||||
// During playback you can either have the recording basis set to the avatar current state
|
// During playback you can either have the recording basis set to the avatar current state
|
||||||
// meaning that all playback is relative to this avatars starting position, or
|
// meaning that all playback is relative to this avatars starting position, or
|
||||||
|
@ -2008,15 +2013,14 @@ void AvatarData::fromJson(const QJsonObject& json, bool useFrameSkeleton) {
|
||||||
// The first is more useful for playing back recordings on your own avatar, while
|
// The first is more useful for playing back recordings on your own avatar, while
|
||||||
// the latter is more useful for playing back other avatars within your scene.
|
// the latter is more useful for playing back other avatars within your scene.
|
||||||
|
|
||||||
auto currentBasis = getRecordingBasis();
|
|
||||||
if (!currentBasis) {
|
|
||||||
currentBasis = std::make_shared<Transform>(Transform::fromJson(json[JSON_AVATAR_BASIS]));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto relativeTransform = Transform::fromJson(json[JSON_AVATAR_RELATIVE]);
|
auto relativeTransform = Transform::fromJson(json[JSON_AVATAR_RELATIVE]);
|
||||||
auto worldTransform = currentBasis->worldTransform(relativeTransform);
|
auto worldTransform = currentBasis->worldTransform(relativeTransform);
|
||||||
setPosition(worldTransform.getTranslation());
|
setPosition(worldTransform.getTranslation());
|
||||||
setOrientation(worldTransform.getRotation());
|
setOrientation(worldTransform.getRotation());
|
||||||
|
} else {
|
||||||
|
// We still set the position in the case that there is no movement.
|
||||||
|
setPosition(currentBasis->getTranslation());
|
||||||
|
setOrientation(currentBasis->getRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json.contains(JSON_AVATAR_SCALE)) {
|
if (json.contains(JSON_AVATAR_SCALE)) {
|
||||||
|
|
|
@ -2702,31 +2702,29 @@ function MyController(hand) {
|
||||||
var userData = JSON.parse(grabbedProperties.userData);
|
var userData = JSON.parse(grabbedProperties.userData);
|
||||||
var grabInfo = userData.grabbableKey;
|
var grabInfo = userData.grabbableKey;
|
||||||
if (grabInfo && grabInfo.cloneable) {
|
if (grabInfo && grabInfo.cloneable) {
|
||||||
// Check if
|
var worldEntities = Entities.findEntities(MyAvatar.position, 50);
|
||||||
var worldEntities = Entities.findEntitiesInBox(Vec3.subtract(MyAvatar.position, {x:25,y:25, z:25}), {x:50, y: 50, z: 50})
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
worldEntities.forEach(function(item) {
|
worldEntities.forEach(function(item) {
|
||||||
var item = Entities.getEntityProperties(item, ["name"]);
|
var item = Entities.getEntityProperties(item, ["name"]);
|
||||||
if (item.name === grabbedProperties.name) {
|
if (item.name.indexOf('-clone-' + grabbedProperties.id) !== -1) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var limit = grabInfo.cloneLimit ? grabInfo.cloneLimit : 0;
|
||||||
|
if (count >= limit && limit !== 0) {
|
||||||
|
delete limit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var cloneableProps = Entities.getEntityProperties(grabbedProperties.id);
|
var cloneableProps = Entities.getEntityProperties(grabbedProperties.id);
|
||||||
|
cloneableProps.name = cloneableProps.name + '-clone-' + grabbedProperties.id;
|
||||||
var lifetime = grabInfo.cloneLifetime ? grabInfo.cloneLifetime : 300;
|
var lifetime = grabInfo.cloneLifetime ? grabInfo.cloneLifetime : 300;
|
||||||
var limit = grabInfo.cloneLimit ? grabInfo.cloneLimit : 10;
|
|
||||||
var dynamic = grabInfo.cloneDynamic ? grabInfo.cloneDynamic : false;
|
var dynamic = grabInfo.cloneDynamic ? grabInfo.cloneDynamic : false;
|
||||||
var cUserData = Object.assign({}, userData);
|
var cUserData = Object.assign({}, userData);
|
||||||
var cProperties = Object.assign({}, cloneableProps);
|
var cProperties = Object.assign({}, cloneableProps);
|
||||||
isClone = true;
|
isClone = true;
|
||||||
|
|
||||||
if (count > limit) {
|
|
||||||
delete cloneableProps;
|
|
||||||
delete lifetime;
|
|
||||||
delete cUserData;
|
|
||||||
delete cProperties;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete cUserData.grabbableKey.cloneLifetime;
|
delete cUserData.grabbableKey.cloneLifetime;
|
||||||
delete cUserData.grabbableKey.cloneable;
|
delete cUserData.grabbableKey.cloneable;
|
||||||
delete cUserData.grabbableKey.cloneDynamic;
|
delete cUserData.grabbableKey.cloneDynamic;
|
||||||
|
|
|
@ -879,7 +879,7 @@ function loaded() {
|
||||||
elCloneable.checked = false;
|
elCloneable.checked = false;
|
||||||
elCloneableDynamic.checked = false;
|
elCloneableDynamic.checked = false;
|
||||||
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
|
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
|
||||||
elCloneableLimit.value = 10;
|
elCloneableLimit.value = 0;
|
||||||
elCloneableLifetime.value = 300;
|
elCloneableLifetime.value = 300;
|
||||||
|
|
||||||
var parsedUserData = {}
|
var parsedUserData = {}
|
||||||
|
@ -899,8 +899,6 @@ function loaded() {
|
||||||
if ("cloneable" in parsedUserData["grabbableKey"]) {
|
if ("cloneable" in parsedUserData["grabbableKey"]) {
|
||||||
elCloneable.checked = parsedUserData["grabbableKey"].cloneable;
|
elCloneable.checked = parsedUserData["grabbableKey"].cloneable;
|
||||||
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
|
elCloneableGroup.style.display = elCloneable.checked ? "block": "none";
|
||||||
elCloneableLimit.value = elCloneable.checked ? 10: 0;
|
|
||||||
elCloneableLifetime.value = elCloneable.checked ? 300: 0;
|
|
||||||
elCloneableDynamic.checked = parsedUserData["grabbableKey"].cloneDynamic ? parsedUserData["grabbableKey"].cloneDynamic : properties.dynamic;
|
elCloneableDynamic.checked = parsedUserData["grabbableKey"].cloneDynamic ? parsedUserData["grabbableKey"].cloneDynamic : properties.dynamic;
|
||||||
elDynamic.checked = elCloneable.checked ? false: properties.dynamic;
|
elDynamic.checked = elCloneable.checked ? false: properties.dynamic;
|
||||||
if (elCloneable.checked) {
|
if (elCloneable.checked) {
|
||||||
|
@ -908,7 +906,7 @@ function loaded() {
|
||||||
elCloneableLifetime.value = parsedUserData["grabbableKey"].cloneLifetime ? parsedUserData["grabbableKey"].cloneLifetime : 300;
|
elCloneableLifetime.value = parsedUserData["grabbableKey"].cloneLifetime ? parsedUserData["grabbableKey"].cloneLifetime : 300;
|
||||||
}
|
}
|
||||||
if ("cloneLimit" in parsedUserData["grabbableKey"]) {
|
if ("cloneLimit" in parsedUserData["grabbableKey"]) {
|
||||||
elCloneableLimit.value = parsedUserData["grabbableKey"].cloneLimit ? parsedUserData["grabbableKey"].cloneLimit : 10;
|
elCloneableLimit.value = parsedUserData["grabbableKey"].cloneLimit ? parsedUserData["grabbableKey"].cloneLimit : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue