Merge remote-tracking branch 'upstream/master' into scriptvec3

This commit is contained in:
SamGondelman 2018-07-31 10:07:23 -07:00
commit 7c8d080050
15 changed files with 72 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 125 KiB

View file

@ -22,6 +22,7 @@ Original.Button {
property int fontSize: hifi.fontSizes.buttonLabel
property alias implicitTextWidth: buttonText.implicitWidth
property string buttonGlyph: "";
property int fontCapitalization: Font.AllUppercase
width: hifi.dimensions.buttonWidth
height: hifi.dimensions.controlLineHeight
@ -107,7 +108,7 @@ Original.Button {
RalewayBold {
id: buttonText;
anchors.centerIn: parent;
font.capitalization: Font.AllUppercase
font.capitalization: control.fontCapitalization
color: enabled ? hifi.buttons.textColor[control.color]
: hifi.buttons.disabledTextColor[control.colorScheme]
size: control.fontSize

View file

@ -682,6 +682,14 @@ Rectangle {
PropertyChanges { target: container; y: -5 }
PropertyChanges { target: favoriteAvatarImage; dropShadowRadius: 10 }
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 {
id: getMoreAvatarsImage
width: 92
height: 92
radius: 5
@ -756,7 +765,9 @@ Rectangle {
}
MouseArea {
id: getMoreAvatarsMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
popup.showBuyAvatars(function() {

View file

@ -14,6 +14,7 @@ Rectangle {
property string titleText: ''
property string bodyText: ''
property alias inputText: input;
property alias dialogButtons: buttons
property string imageSource: null
onImageSourceChanged: {
@ -36,6 +37,7 @@ Rectangle {
function close() {
visible = false;
dialogButtons.yesButton.fontCapitalization = Font.AllUppercase;
onButton1Clicked = null;
onButton2Clicked = null;
button1text = '';

View file

@ -37,11 +37,12 @@ MessageBox {
function showGetWearables(callback, linkCallback) {
popup.button2text = 'AvatarIsland'
popup.dialogButtons.yesButton.fontCapitalization = Font.MixedCase;
popup.button1text = 'CANCEL'
popup.titleText = 'Get Wearables'
popup.bodyText = 'Buy wearables from <a href="app://marketplace">Marketplace</a>' + '<br/>' +
'Wear wearables from <a href="app://purchases">My Purchases</a>' + '<br/>' +
'You can visit the domain “AvatarIsland” to get wearables'
popup.bodyText = 'Buy wearables from <b><a href="app://marketplace">Marketplace.</a></b>' + '<br/>' +
'Wear wearables from <b><a href="app://purchases">My Purchases.</a></b>' + '<br/>' + '<br/>' +
'Visit “AvatarIsland” to get wearables'
popup.imageSource = getWearablesUrl;
popup.onButton2Clicked = function() {
@ -96,12 +97,13 @@ MessageBox {
function showBuyAvatars(callback, linkCallback) {
popup.button2text = 'BodyMart'
popup.dialogButtons.yesButton.fontCapitalization = Font.MixedCase;
popup.button1text = 'CANCEL'
popup.titleText = 'Get Avatars'
popup.bodyText = 'Buy avatars from <a href="app://marketplace">Marketplace</a>' + '<br/>' +
'Wear avatars from <a href="app://purchases">My Purchases</a>' + '<br/>' +
'You can visit the domain “BodyMart” to get avatars'
popup.bodyText = 'Buy avatars from <b><a href="app://marketplace">Marketplace.</a></b>' + '<br/>' +
'Wear avatars from <b><a href="app://purchases">My Purchases.</a></b>' + '<br/>' + '<br/>' +
'Visit “BodyMart” to get free avatars.'
popup.imageSource = getAvatarsUrl;
popup.onButton2Clicked = function() {

View file

@ -1137,7 +1137,6 @@ void MyAvatar::saveData() {
settings.setValue("userHeight", getUserHeight());
settings.setValue("flyingDesktop", getFlyingDesktopPref());
settings.setValue("flyingHMD", getFlyingHMDPref());
settings.setValue("enabledFlying", getFlyingEnabled());
settings.endGroup();
}

View file

@ -207,7 +207,7 @@ std::shared_ptr<StartEndRenderState> ParabolaPointer::buildRenderState(const QVa
QVariantMap pathMap = propMap["path"].toMap();
if (pathMap["color"].isValid()) {
bool valid;
color = toGlm(xColorFromVariant(pathMap["color"], valid));
color = toGlm(vec3FromVariant(pathMap["color"], valid));
}
if (pathMap["alpha"].isValid()) {

View file

@ -53,7 +53,8 @@ WebEntityRenderer::ContentType WebEntityRenderer::getContentType(const QString&
}
const QUrl url(urlString);
if (url.scheme() == URL_SCHEME_HTTP || url.scheme() == URL_SCHEME_HTTPS ||
auto scheme = url.scheme();
if (scheme == URL_SCHEME_ABOUT || scheme == URL_SCHEME_HTTP || scheme == URL_SCHEME_HTTPS ||
urlString.toLower().endsWith(".htm") || urlString.toLower().endsWith(".html")) {
return ContentType::HtmlContent;
}

View file

@ -226,8 +226,10 @@ ScriptVec3UChar ShapeEntityItem::getColor() const {
}
void ShapeEntityItem::setAlpha(float alpha) {
_alpha = alpha;
_material->setOpacity(alpha);
withWriteLock([&] {
_alpha = alpha;
_material->setOpacity(alpha);
});
}
void ShapeEntityItem::setUnscaledDimensions(const glm::vec3& value) {

View file

@ -30,6 +30,7 @@ namespace NetworkingConstants {
QUrl METAVERSE_SERVER_URL();
}
const QString URL_SCHEME_ABOUT = "about";
const QString URL_SCHEME_HIFI = "hifi";
const QString URL_SCHEME_QRC = "qrc";
const QString URL_SCHEME_FILE = "file";

View file

@ -939,9 +939,7 @@ bool Octree::toJSONDocument(QJsonDocument* doc, const OctreeElementPointer& elem
return false;
}
qDebug() << "boop3" << entityDescription;
*doc = QJsonDocument::fromVariant(entityDescription);
qDebug() << "boop4" << *doc;
return true;
}

View file

@ -57,7 +57,7 @@ public:
ScriptVec2Float() {}
ScriptVec2Float(float xy) : x(xy), y(xy) {}
ScriptVec2Float(float x, float y) : x(x), y(y) {}
ScriptVec2Float(const ScriptVec2Float& other) : x(other.x), y(other.y) {}
ScriptVec2Float(const ScriptVec2Float& other) : QObject(), x(other.x), y(other.y) {}
ScriptVec2Float(const glm::vec2& other) : x(other.x), y(other.y) {}
void operator=(const ScriptVec2Float& other) { x = other.x; y = other.y; }
inline bool operator==(const ScriptVec2Float& other) const { return (x == other.x && y == other.y); }
@ -107,7 +107,7 @@ public:
ScriptVec3Float() {}
ScriptVec3Float(float xyz) : x(xyz), y(xyz), z(xyz) {}
ScriptVec3Float(float x, float y, float z) : x(x), y(y), z(z) {}
ScriptVec3Float(const ScriptVec3Float& other) : x(other.x), y(other.y), z(other.z) {}
ScriptVec3Float(const ScriptVec3Float& other) : QObject(), x(other.x), y(other.y), z(other.z) {}
ScriptVec3Float(const glm::vec3& other) : x(other.x), y(other.y), z(other.z) {}
void operator=(const ScriptVec3Float& other) { x = other.x; y = other.y; z = other.z; }
inline bool operator==(const ScriptVec3Float& other) const { return (x == other.x && y == other.y && z == other.z); }
@ -150,7 +150,7 @@ public:
ScriptVec3UChar() {}
ScriptVec3UChar(unsigned int xyz) : x(xyz), y(xyz), z(xyz) {}
ScriptVec3UChar(unsigned int x, unsigned int y, unsigned int z) : x(x), y(y), z(z) {}
ScriptVec3UChar(const ScriptVec3UChar& other) : x(other.x), y(other.y), z(other.z) {}
ScriptVec3UChar(const ScriptVec3UChar& other) : QObject(), x(other.x), y(other.y), z(other.z) {}
ScriptVec3UChar(const glm::vec3& other) : x(other.x), y(other.y), z(other.z) {}
void operator=(const ScriptVec3UChar& other) { x = other.x; y = other.y; z = other.z; }
inline bool operator==(const ScriptVec3UChar& other) const { return (x == other.x && y == other.y && z == other.z); }

View file

@ -12,17 +12,32 @@
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,
TEAR_AWAY_COUNT, distanceBetweenPointAndEntityBoundingBox, print, Uuid, highlightTargetEntity, unhighlightTargetEntity,
distanceBetweenEntityLocalPositionAndBoundingBox
distanceBetweenEntityLocalPositionAndBoundingBox, GRAB_POINT_SPHERE_OFFSET
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Script.include("/~/system/libraries/cloneEntityUtils.js");
Script.include("/~/system/libraries/controllers.js");
(function() {
// XXX this.ignoreIK = (grabbableData.ignoreIK !== undefined) ? grabbableData.ignoreIK : true;
// 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) {
this.hand = hand;
this.targetEntityID = null;
@ -174,7 +189,9 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
this.lastUnequipCheckTime = now;
if (props.parentID === MyAvatar.SELF_ID) {
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) {
this.autoUnequipCounter++;
} else {

View file

@ -58,7 +58,7 @@
entityIsFarGrabbedByOther:true,
highlightTargetEntity:true,
clearHighlightedEntities:true,
unhighlightTargetEntity:true
unhighlightTargetEntity:true,
distanceBetweenEntityLocalPositionAndBoundingBox: true
*/
@ -95,7 +95,7 @@ COLORS_GRAB_DISTANCE_HOLD = { red: 238, green: 75, blue: 214 };
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_CHECK_TIME = 0.15; // seconds, duration between checks
DISPATCHER_HOVERING_LIST = "dispactherHoveringList";
@ -416,13 +416,18 @@ findHandChildEntities = function(hand) {
});
};
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps) {
var localPoint = entityProps.localPosition;
var entityXform = new Xform(entityProps.rotation, entityProps.position);
var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions);
var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions);
var localMin = Vec3.subtract(entityXform.trans, minOffset);
var localMax = Vec3.sum(entityXform.trans, maxOffset);
distanceBetweenEntityLocalPositionAndBoundingBox = function(entityProps, jointGrabOffset) {
var DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
var rotInv = Quat.inverse(entityProps.localRotation);
var localPosition = Vec3.sum(entityProps.localPosition, jointGrabOffset);
var localPoint = Vec3.multiplyQbyV(rotInv, Vec3.multiply(localPosition, -1.0));
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};
v.x = Math.max(v.x, localMin.x);

View file

@ -215,6 +215,11 @@ HifiEntityUI.prototype = {
red.value = parseInt(property.x);
green.value = parseInt(property.y);
blue.value = parseInt(property.z);
// trigger update to color picker
red.oninput({
target: red
});
} else if (field.className.indexOf("xyz") !== -1) {
var x = document.getElementById(value + "-x");
var y = document.getElementById(value + "-y");