mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 00:44:38 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into editHandleTriggerValues
This commit is contained in:
commit
7bf7663f09
6 changed files with 66 additions and 25 deletions
|
@ -682,6 +682,14 @@ Rectangle {
|
||||||
PropertyChanges { target: container; y: -5 }
|
PropertyChanges { target: container; y: -5 }
|
||||||
PropertyChanges { target: favoriteAvatarImage; dropShadowRadius: 10 }
|
PropertyChanges { target: favoriteAvatarImage; dropShadowRadius: 10 }
|
||||||
PropertyChanges { target: favoriteAvatarImage; dropShadowVerticalOffset: 6 }
|
PropertyChanges { target: favoriteAvatarImage; dropShadowVerticalOffset: 6 }
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "getMoreAvatarsHovered"
|
||||||
|
when: getMoreAvatarsMouseArea.containsMouse;
|
||||||
|
PropertyChanges { target: getMoreAvatarsMouseArea; anchors.bottomMargin: -5 }
|
||||||
|
PropertyChanges { target: container; y: -5 }
|
||||||
|
PropertyChanges { target: getMoreAvatarsImage; dropShadowRadius: 10 }
|
||||||
|
PropertyChanges { target: getMoreAvatarsImage; dropShadowVerticalOffset: 6 }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -741,6 +749,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadowRectangle {
|
ShadowRectangle {
|
||||||
|
id: getMoreAvatarsImage
|
||||||
width: 92
|
width: 92
|
||||||
height: 92
|
height: 92
|
||||||
radius: 5
|
radius: 5
|
||||||
|
@ -756,7 +765,9 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: getMoreAvatarsMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.showBuyAvatars(function() {
|
popup.showBuyAvatars(function() {
|
||||||
|
|
|
@ -1137,7 +1137,6 @@ void MyAvatar::saveData() {
|
||||||
settings.setValue("userHeight", getUserHeight());
|
settings.setValue("userHeight", getUserHeight());
|
||||||
settings.setValue("flyingDesktop", getFlyingDesktopPref());
|
settings.setValue("flyingDesktop", getFlyingDesktopPref());
|
||||||
settings.setValue("flyingHMD", getFlyingHMDPref());
|
settings.setValue("flyingHMD", getFlyingHMDPref());
|
||||||
settings.setValue("enabledFlying", getFlyingEnabled());
|
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,17 +12,32 @@
|
||||||
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
findGroupParent, Vec3, cloneEntity, entityIsCloneable, propsAreCloneDynamic, HAPTIC_PULSE_STRENGTH,
|
||||||
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
HAPTIC_PULSE_DURATION, BUMPER_ON_VALUE, findHandChildEntities, TEAR_AWAY_DISTANCE, MSECS_PER_SEC, TEAR_AWAY_CHECK_TIME,
|
||||||
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity,
|
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity,
|
||||||
distanceBetweenEntityLocalPositionAndBoundingBox
|
distanceBetweenEntityLocalPositionAndBoundingBox, GRAB_POINT_SPHERE_OFFSET
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
Script.include("/~/system/libraries/cloneEntityUtils.js");
|
Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
|
Script.include("/~/system/libraries/controllers.js");
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
// XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true;
|
// XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true;
|
||||||
// XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC;
|
// XXX this.kinematicGrab = (grabbableData.kinematic !== undefined) ? grabbableData.kinematic : NEAR_GRABBING_KINEMATIC;
|
||||||
|
|
||||||
|
function getGrabOffset(handController) {
|
||||||
|
var offset = GRAB_POINT_SPHERE_OFFSET;
|
||||||
|
if (handController === Controller.Standard.LeftHand) {
|
||||||
|
offset = {
|
||||||
|
x: -GRAB_POINT_SPHERE_OFFSET.x,
|
||||||
|
y: GRAB_POINT_SPHERE_OFFSET.y,
|
||||||
|
z: GRAB_POINT_SPHERE_OFFSET.z
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
offset.y = -GRAB_POINT_SPHERE_OFFSET.y;
|
||||||
|
return Vec3.multiply(MyAvatar.sensorToWorldScale, offset);
|
||||||
|
}
|
||||||
|
|
||||||
function NearParentingGrabEntity(hand) {
|
function NearParentingGrabEntity(hand) {
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
this.targetEntityID = null;
|
this.targetEntityID = null;
|
||||||
|
@ -174,7 +189,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
|
||||||
this.lastUnequipCheckTime = now;
|
this.lastUnequipCheckTime = now;
|
||||||
if (props.parentID === MyAvatar.SELF_ID) {
|
if (props.parentID === MyAvatar.SELF_ID) {
|
||||||
var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale;
|
var tearAwayDistance = TEAR_AWAY_DISTANCE * MyAvatar.sensorToWorldScale;
|
||||||
var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props);
|
var controllerIndex = (this.hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand);
|
||||||
|
var controllerGrabOffset = getGrabOffset(controllerIndex);
|
||||||
|
var distance = distanceBetweenEntityLocalPositionAndBoundingBox(props, controllerGrabOffset);
|
||||||
if (distance > tearAwayDistance) {
|
if (distance > tearAwayDistance) {
|
||||||
this.autoUnequipCounter++;
|
this.autoUnequipCounter++;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -126,8 +126,8 @@
|
||||||
<label for="property-grabbable">Grabbable</label>
|
<label for="property-grabbable">Grabbable</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="property checkbox">
|
<div class="property checkbox">
|
||||||
<input type="checkbox" id="property-wants-trigger">
|
<input type="checkbox" id="property-triggerable">
|
||||||
<label for="property-wants-trigger">Triggerable</label>
|
<label for="property-triggerable">Triggerable</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="property checkbox">
|
<div class="property checkbox">
|
||||||
<input type="checkbox" id="property-cloneable">
|
<input type="checkbox" id="property-cloneable">
|
||||||
|
|
|
@ -308,9 +308,10 @@ function setUserDataFromEditor(noUpdate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
|
function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults, removeKeys) {
|
||||||
var properties = {};
|
var properties = {};
|
||||||
var parsedData = {};
|
var parsedData = {};
|
||||||
|
var keysToBeRemoved = removeKeys ? removeKeys : [];
|
||||||
try {
|
try {
|
||||||
if ($('#userdata-editor').css('height') !== "0px") {
|
if ($('#userdata-editor').css('height') !== "0px") {
|
||||||
// if there is an expanded, we want to use its json.
|
// if there is an expanded, we want to use its json.
|
||||||
|
@ -342,6 +343,12 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
|
||||||
parsedData[groupName][key] = defaults[key];
|
parsedData[groupName][key] = defaults[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
keysToBeRemoved.forEach(function(key) {
|
||||||
|
if (parsedData[groupName].hasOwnProperty(key)) {
|
||||||
|
delete parsedData[groupName][key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (Object.keys(parsedData[groupName]).length === 0) {
|
if (Object.keys(parsedData[groupName]).length === 0) {
|
||||||
delete parsedData[groupName];
|
delete parsedData[groupName];
|
||||||
}
|
}
|
||||||
|
@ -355,11 +362,11 @@ function multiDataUpdater(groupName, updateKeyPair, userDataElement, defaults) {
|
||||||
|
|
||||||
updateProperties(properties);
|
updateProperties(properties);
|
||||||
}
|
}
|
||||||
function userDataChanger(groupName, keyName, values, userDataElement, defaultValue) {
|
function userDataChanger(groupName, keyName, values, userDataElement, defaultValue, removeKeys) {
|
||||||
var val = {}, def = {};
|
var val = {}, def = {};
|
||||||
val[keyName] = values;
|
val[keyName] = values;
|
||||||
def[keyName] = defaultValue;
|
def[keyName] = defaultValue;
|
||||||
multiDataUpdater(groupName, val, userDataElement, def);
|
multiDataUpdater(groupName, val, userDataElement, def, removeKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMaterialDataFromEditor(noUpdate) {
|
function setMaterialDataFromEditor(noUpdate) {
|
||||||
|
@ -711,7 +718,7 @@ function loaded() {
|
||||||
var elCloneableLifetime = document.getElementById("property-cloneable-lifetime");
|
var elCloneableLifetime = document.getElementById("property-cloneable-lifetime");
|
||||||
var elCloneableLimit = document.getElementById("property-cloneable-limit");
|
var elCloneableLimit = document.getElementById("property-cloneable-limit");
|
||||||
|
|
||||||
var elWantsTrigger = document.getElementById("property-wants-trigger");
|
var elTriggerable = document.getElementById("property-triggerable");
|
||||||
var elIgnoreIK = document.getElementById("property-ignore-ik");
|
var elIgnoreIK = document.getElementById("property-ignore-ik");
|
||||||
|
|
||||||
var elLifetime = document.getElementById("property-lifetime");
|
var elLifetime = document.getElementById("property-lifetime");
|
||||||
|
@ -1234,7 +1241,7 @@ function loaded() {
|
||||||
|
|
||||||
elGrabbable.checked = properties.dynamic;
|
elGrabbable.checked = properties.dynamic;
|
||||||
|
|
||||||
elWantsTrigger.checked = false;
|
elTriggerable.checked = false;
|
||||||
elIgnoreIK.checked = true;
|
elIgnoreIK.checked = true;
|
||||||
|
|
||||||
elCloneable.checked = properties.cloneable;
|
elCloneable.checked = properties.cloneable;
|
||||||
|
@ -1257,10 +1264,12 @@ function loaded() {
|
||||||
} else {
|
} else {
|
||||||
elGrabbable.checked = true;
|
elGrabbable.checked = true;
|
||||||
}
|
}
|
||||||
if ("wantsTrigger" in grabbableData) {
|
if ("triggerable" in grabbableData) {
|
||||||
elWantsTrigger.checked = grabbableData.wantsTrigger;
|
elTriggerable.checked = grabbableData.triggerable;
|
||||||
|
} else if ("wantsTrigger" in grabbableData) {
|
||||||
|
elTriggerable.checked = grabbableData.wantsTrigger;
|
||||||
} else {
|
} else {
|
||||||
elWantsTrigger.checked = false;
|
elTriggerable.checked = false;
|
||||||
}
|
}
|
||||||
if ("ignoreIK" in grabbableData) {
|
if ("ignoreIK" in grabbableData) {
|
||||||
elIgnoreIK.checked = grabbableData.ignoreIK;
|
elIgnoreIK.checked = grabbableData.ignoreIK;
|
||||||
|
@ -1273,7 +1282,7 @@ function loaded() {
|
||||||
}
|
}
|
||||||
if (!grabbablesSet) {
|
if (!grabbablesSet) {
|
||||||
elGrabbable.checked = true;
|
elGrabbable.checked = true;
|
||||||
elWantsTrigger.checked = false;
|
elTriggerable.checked = false;
|
||||||
elIgnoreIK.checked = true;
|
elIgnoreIK.checked = true;
|
||||||
elCloneable.checked = false;
|
elCloneable.checked = false;
|
||||||
}
|
}
|
||||||
|
@ -1647,8 +1656,8 @@ function loaded() {
|
||||||
elCloneableLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('cloneLifetime'));
|
elCloneableLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('cloneLifetime'));
|
||||||
elCloneableLimit.addEventListener('change', createEmitNumberPropertyUpdateFunction('cloneLimit'));
|
elCloneableLimit.addEventListener('change', createEmitNumberPropertyUpdateFunction('cloneLimit'));
|
||||||
|
|
||||||
elWantsTrigger.addEventListener('change', function() {
|
elTriggerable.addEventListener('change', function() {
|
||||||
userDataChanger("grabbableKey", "wantsTrigger", elWantsTrigger, elUserData, false);
|
userDataChanger("grabbableKey", "triggerable", elTriggerable, elUserData, false, ['wantsTrigger']);
|
||||||
});
|
});
|
||||||
elIgnoreIK.addEventListener('change', function() {
|
elIgnoreIK.addEventListener('change', function() {
|
||||||
userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, true);
|
userDataChanger("grabbableKey", "ignoreIK", elIgnoreIK, elUserData, true);
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
entityIsFarGrabbedByOther:true,
|
entityIsFarGrabbedByOther:true,
|
||||||
highlightTargetEntity:true,
|
highlightTargetEntity:true,
|
||||||
clearHighlightedEntities:true,
|
clearHighlightedEntities:true,
|
||||||
unhighlightTargetEntity:true
|
unhighlightTargetEntity:true,
|
||||||
distanceBetweenEntityLocalPositionAndBoundingBox: true
|
distanceBetweenEntityLocalPositionAndBoundingBox: true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 };
|
||||||
|
|
||||||
NEAR_GRAB_RADIUS = 1.0;
|
NEAR_GRAB_RADIUS = 1.0;
|
||||||
|
|
||||||
TEAR_AWAY_DISTANCE = 0.1; // ungrab an entity if its bounding-box moves this far from the hand
|
TEAR_AWAY_DISTANCE = 0.15; // ungrab an entity if its bounding-box moves this far from the hand
|
||||||
TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away
|
TEAR_AWAY_COUNT = 2; // multiply by TEAR_AWAY_CHECK_TIME to know how long the item must be away
|
||||||
TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks
|
TEAR_AWAY_CHECK_TIME = 0.15; // seconds, duration between checks
|
||||||
DISPATCHER_HOVERING_LIST = "dispactherHoveringList";
|
DISPATCHER_HOVERING_LIST = "dispactherHoveringList";
|
||||||
|
@ -416,13 +416,18 @@ findHandChildEntities = function(hand) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps) {
|
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGrabOffset) {
|
||||||
var localPoint = entityProps.localPosition;
|
var DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
|
||||||
var entityXform = new Xform(entityProps.rotation, entityProps.position);
|
var rotInv = Quat.inverse(entityProps.localRotation);
|
||||||
var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions);
|
var localPosition = Vec3.sum(entityProps.localPosition, jointGrabOffset);
|
||||||
var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions);
|
var localPoint = Vec3.multiplyQbyV(rotInv, Vec3.multiply(localPosition, -1.0));
|
||||||
var localMin = Vec3.subtract(entityXform.trans, minOffset);
|
|
||||||
var localMax = Vec3.sum(entityXform.trans, maxOffset);
|
var halfDims = Vec3.multiply(entityProps.dimensions, 0.5);
|
||||||
|
var regRatio = Vec3.subtract(DEFAULT_REGISTRATION_POINT, entityProps.registrationPoint);
|
||||||
|
var entityCenter = Vec3.multiplyVbyV(regRatio, entityProps.dimensions);
|
||||||
|
var localMin = Vec3.subtract(entityCenter, halfDims);
|
||||||
|
var localMax = Vec3.sum(entityCenter, halfDims);
|
||||||
|
|
||||||
|
|
||||||
var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z};
|
var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z};
|
||||||
v.x = Math.max(v.x, localMin.x);
|
v.x = Math.max(v.x, localMin.x);
|
||||||
|
|
Loading…
Reference in a new issue