Merge branch 'master' of github.com:highfidelity/hifi into warn-for-head-position-nan

This commit is contained in:
Seth Alves 2018-01-26 10:36:26 -08:00
commit 3be42fe79a
11 changed files with 62 additions and 57 deletions

View file

@ -22,7 +22,7 @@ ListModel {
function swap(a, b) { function swap(a, b) {
if (a < b) { if (a < b) {
move(a, b, 1); move(a, b, 1);
move (b - 1, a, 1); move(b - 1, a, 1);
} else if (a > b) { } else if (a > b) {
move(b, a, 1); move(b, a, 1);
move(a - 1, b, 1); move(a - 1, b, 1);
@ -34,16 +34,17 @@ ListModel {
var piv = get(pivot)[sortColumnName]; var piv = get(pivot)[sortColumnName];
swap(pivot, end - 1); swap(pivot, end - 1);
var store = begin; var store = begin;
var i;
for (var i = begin; i < end - 1; ++i) { for (i = begin; i < end - 1; ++i) {
var currentElement = get(i)[sortColumnName]; var currentElement = get(i)[sortColumnName];
if (isSortingDescending) { if (isSortingDescending) {
if (currentElement < piv) { if (currentElement > piv) {
swap(store, i); swap(store, i);
++store; ++store;
} }
} else { } else {
if (currentElement > piv) { if (currentElement < piv) {
swap(store, i); swap(store, i);
++store; ++store;
} }
@ -56,16 +57,17 @@ ListModel {
var piv = get(pivot)[sortColumnName].toLowerCase(); var piv = get(pivot)[sortColumnName].toLowerCase();
swap(pivot, end - 1); swap(pivot, end - 1);
var store = begin; var store = begin;
var i;
for (var i = begin; i < end - 1; ++i) { for (i = begin; i < end - 1; ++i) {
var currentElement = get(i)[sortColumnName].toLowerCase(); var currentElement = get(i)[sortColumnName].toLowerCase();
if (isSortingDescending) { if (isSortingDescending) {
if (currentElement < piv) { if (currentElement > piv) {
swap(store, i); swap(store, i);
++store; ++store;
} }
} else { } else {
if (currentElement > piv) { if (currentElement < piv) {
swap(store, i); swap(store, i);
++store; ++store;
} }

View file

@ -317,6 +317,7 @@ Rectangle {
HifiControlsUit.TextField { HifiControlsUit.TextField {
id: filterBar; id: filterBar;
property string previousText: "";
colorScheme: hifi.colorSchemes.faintGray; colorScheme: hifi.colorSchemes.faintGray;
hasClearButton: true; hasClearButton: true;
hasRoundedBorder: true; hasRoundedBorder: true;
@ -329,6 +330,8 @@ Rectangle {
onTextChanged: { onTextChanged: {
buildFilteredPurchasesModel(); buildFilteredPurchasesModel();
purchasesContentsList.positionViewAtIndex(0, ListView.Beginning)
filterBar.previousText = filterBar.text;
} }
onAccepted: { onAccepted: {
@ -647,7 +650,8 @@ Rectangle {
function sortByDate() { function sortByDate() {
filteredPurchasesModel.sortColumnName = "purchase_date"; filteredPurchasesModel.sortColumnName = "purchase_date";
filteredPurchasesModel.isSortingDescending = false; filteredPurchasesModel.isSortingDescending = true;
filteredPurchasesModel.valuesAreNumerical = true;
filteredPurchasesModel.quickSort(); filteredPurchasesModel.quickSort();
} }
@ -677,7 +681,7 @@ Rectangle {
} }
} }
if (sameItemCount !== tempPurchasesModel.count || filterBar.text !== "") { if (sameItemCount !== tempPurchasesModel.count || filterBar.text !== filterBar.previousText) {
filteredPurchasesModel.clear(); filteredPurchasesModel.clear();
for (var i = 0; i < tempPurchasesModel.count; i++) { for (var i = 0; i < tempPurchasesModel.count; i++) {
filteredPurchasesModel.append(tempPurchasesModel.get(i)); filteredPurchasesModel.append(tempPurchasesModel.get(i));

View file

@ -41,14 +41,14 @@ QSpinBox, QDoubleSpinBox {
QDoubleSpinBox::up-arrow, QDoubleSpinBox::up-arrow,
QSpinBox::up-arrow { QSpinBox::up-arrow {
background-image: url(styles/up.svg); background-image: url(:/styles/up.svg);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
} }
QDoubleSpinBox::down-arrow, QDoubleSpinBox::down-arrow,
QSpinBox::down-arrow { QSpinBox::down-arrow {
background-image: url(styles/down.svg); background-image: url(:/styles/down.svg);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
} }
@ -88,7 +88,7 @@ QSlider {
QSlider::groove:horizontal { QSlider::groove:horizontal {
border: none; border: none;
background-image: url(styles/slider-bg.svg); background-image: url(:/styles/slider-bg.svg);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
} }
@ -96,7 +96,7 @@ QSlider::groove:horizontal {
QSlider::handle:horizontal { QSlider::handle:horizontal {
width: 18px; width: 18px;
height: 18px; height: 18px;
background-image: url(styles/slider-handle.svg); background-image: url(:/styles/slider-handle.svg);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
} }
@ -107,7 +107,7 @@ QPushButton#closeButton {
border-width: 1px; border-width: 1px;
border-radius: 0; border-radius: 0;
background-color: #fff; background-color: #fff;
background-image: url(styles/close.svg); background-image: url(:/styles/close.svg);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
} }

View file

@ -63,17 +63,17 @@ QPushButton#cancelButton {
} }
#backButton { #backButton {
background-image: url(icons/backButton.svg); background-image: url(:/icons/backButton.svg);
border-radius: 0px; border-radius: 0px;
} }
#forwardButton { #forwardButton {
background-image: url(icons/forwardButton.svg); background-image: url(:/icons/forwardButton.svg);
border-radius: 0px; border-radius: 0px;
} }
#toParentButton { #toParentButton {
background-image: url(icons/toParentButton.svg); background-image: url(:/icons/toParentButton.svg);
border-radius: 0px; border-radius: 0px;
} }

View file

@ -22,7 +22,7 @@ QLineEdit {
} }
QPushButton#searchButton { QPushButton#searchButton {
background: url(styles/search.svg); background: url(:/styles/search.svg);
background-repeat: none; background-repeat: none;
background-position: left center; background-position: left center;
background-origin: content; background-origin: content;
@ -55,7 +55,7 @@ QPushButton#searchPrevButton {
QPushButton#revealLogButton { QPushButton#revealLogButton {
font-family: Helvetica, Arial, sans-serif; font-family: Helvetica, Arial, sans-serif;
background: url(styles/txt-file.svg); background: url(:/styles/txt-file.svg);
background-repeat: none; background-repeat: none;
background-position: left center; background-position: left center;
background-origin: content; background-origin: content;
@ -86,11 +86,11 @@ QCheckBox {
} }
QCheckBox::indicator:unchecked { QCheckBox::indicator:unchecked {
image: url(styles/unchecked.svg); image: url(:/styles/unchecked.svg);
} }
QCheckBox::indicator:checked { QCheckBox::indicator:checked {
image: url(styles/checked.svg); image: url(:/styles/checked.svg);
} }
QComboBox { QComboBox {
@ -110,6 +110,6 @@ QComboBox::drop-down {
} }
QComboBox::down-arrow { QComboBox::down-arrow {
image: url(styles/filter.png); image: url(:/styles/filter.png);
border-width: 0px; border-width: 0px;
} }

View file

@ -2724,7 +2724,7 @@ void Application::showHelp() {
queryString.addQueryItem("defaultTab", defaultTab); queryString.addQueryItem("defaultTab", defaultTab);
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET)); TabletProxy* tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
tablet->gotoWebScreen(PathUtils::resourcesPath() + INFO_HELP_PATH + "?" + queryString.toString()); tablet->gotoWebScreen(PathUtils::resourcesUrl() + INFO_HELP_PATH + "?" + queryString.toString());
DependencyManager::get<HMDScriptingInterface>()->openTablet(); DependencyManager::get<HMDScriptingInterface>()->openTablet();
//InfoView::show(INFO_HELP_PATH, false, queryString.toString()); //InfoView::show(INFO_HELP_PATH, false, queryString.toString());
} }

View file

@ -39,7 +39,6 @@ BaseLogDialog::BaseLogDialog(QWidget* parent) : QDialog(parent, Qt::Window) {
QFile styleSheet(PathUtils::resourcesPath() + "styles/log_dialog.qss"); QFile styleSheet(PathUtils::resourcesPath() + "styles/log_dialog.qss");
if (styleSheet.open(QIODevice::ReadOnly)) { if (styleSheet.open(QIODevice::ReadOnly)) {
QDir::setCurrent(PathUtils::resourcesPath());
setStyleSheet(styleSheet.readAll()); setStyleSheet(styleSheet.readAll());
} }

View file

@ -168,7 +168,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
_contextOverlay->setColorPulse(CONTEXT_OVERLAY_UNHOVERED_COLORPULSE); _contextOverlay->setColorPulse(CONTEXT_OVERLAY_UNHOVERED_COLORPULSE);
_contextOverlay->setIgnoreRayIntersection(false); _contextOverlay->setIgnoreRayIntersection(false);
_contextOverlay->setDrawInFront(true); _contextOverlay->setDrawInFront(true);
_contextOverlay->setURL(PathUtils::resourcesPath() + "images/inspect-icon.png"); _contextOverlay->setURL(PathUtils::resourcesUrl() + "images/inspect-icon.png");
_contextOverlay->setIsFacingAvatar(true); _contextOverlay->setIsFacingAvatar(true);
_contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay); _contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay);
} }

View file

@ -1329,7 +1329,9 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
_currentTextures = newTextures; _currentTextures = newTextures;
} }
} }
if (entity->_needsJointSimulation) {
entity->copyAnimationJointDataToModel();
}
entity->updateModelBounds(); entity->updateModelBounds();
entity->stopModelOverrideIfNoParent(); entity->stopModelOverrideIfNoParent();

View file

@ -45,8 +45,8 @@ void Engine::load() {
auto config = getConfiguration(); auto config = getConfiguration();
const QString configFile= "config/render.json"; const QString configFile= "config/render.json";
QUrl path(PathUtils::resourcesPath() + configFile); QString path(PathUtils::resourcesPath() + configFile);
QFile file(path.toString()); QFile file(path);
if (!file.exists()) { if (!file.exists()) {
qWarning() << "Engine configuration file" << path << "does not exist"; qWarning() << "Engine configuration file" << path << "does not exist";
} else if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { } else if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {

View file

@ -15,7 +15,7 @@ var TEST_MODEL_URL = 'https://s3.amazonaws.com/hifi-public/ozan/avatars/albert/a
var MIRROR_JOINT_DATA = true; var MIRROR_JOINT_DATA = true;
var MIRRORED_ENTITY_SCRIPT_URL = Script.resolvePath('mirroredEntity.js'); var MIRRORED_ENTITY_SCRIPT_URL = Script.resolvePath('mirroredEntity.js');
var FREEZE_TOGGLER_SCRIPT_URL = Script.resolvePath('freezeToggler.js?' + Math.random(0, 1000)) var FREEZE_TOGGLER_SCRIPT_URL = Script.resolvePath('freezeToggler.js?' + Math.random(0, 1000));
var THROTTLE = false; var THROTTLE = false;
var THROTTLE_RATE = 100; var THROTTLE_RATE = 100;
var doppelgangers = []; var doppelgangers = [];
@ -24,8 +24,7 @@ function Doppelganger(avatar) {
this.initialProperties = { this.initialProperties = {
name: 'Hifi-Doppelganger', name: 'Hifi-Doppelganger',
type: 'Model', type: 'Model',
modelURL: TEST_MODEL_URL, modelURL: MyAvatar.skeletonModelURL,
// dimensions: getAvatarDimensions(avatar),
position: putDoppelgangerAcrossFromAvatar(this, avatar), position: putDoppelgangerAcrossFromAvatar(this, avatar),
rotation: rotateDoppelgangerTowardAvatar(this, avatar), rotation: rotateDoppelgangerTowardAvatar(this, avatar),
collisionsWillMove: false, collisionsWillMove: false,
@ -48,7 +47,7 @@ function getJointData(avatar) {
var jointNames = MyAvatar.jointNames; var jointNames = MyAvatar.jointNames;
jointNames.forEach(function(joint, index) { jointNames.forEach(function(joint, index) {
var translation = MyAvatar.getJointTranslation(index); var translation = MyAvatar.getJointTranslation(index);
var rotation = MyAvatar.getJointRotation(index) var rotation = MyAvatar.getJointRotation(index);
allJointData.push({ allJointData.push({
joint: joint, joint: joint,
index: index, index: index,
@ -66,8 +65,8 @@ function setJointData(doppelganger, relativeXforms) {
for (i = 0; i < l; i++) { for (i = 0; i < l; i++) {
jointRotations.push(relativeXforms[i].rot); jointRotations.push(relativeXforms[i].rot);
} }
Entities.setAbsoluteJointRotationsInObjectFrame(doppelganger.id, jointRotations);
Entities.setLocalJointRotations(doppelganger.id, jointRotations);
return true; return true;
} }
@ -127,7 +126,7 @@ var JOINT_MIRROR_NAME_MAP = {
LeftHandPinky2: "RightHandPinky2", LeftHandPinky2: "RightHandPinky2",
LeftHandPinky3: "RightHandPinky3", LeftHandPinky3: "RightHandPinky3",
LeftHandPinky4: "RightHandPinky4", LeftHandPinky4: "RightHandPinky4",
LeftHandPinky: "RightHandPinky", LeftHandPinky: "RightHandPinky"
}; };
// maps joint names to parent joint names. // maps joint names to parent joint names.
@ -192,7 +191,7 @@ var JOINT_PARENT_NAME_MAP = {
LeftHandPinky1: "LeftHand", LeftHandPinky1: "LeftHand",
LeftHandPinky2: "LeftHandPinky1", LeftHandPinky2: "LeftHandPinky1",
LeftHandPinky3: "LeftHandPinky2", LeftHandPinky3: "LeftHandPinky2",
LeftHandPinky: "LeftHandPinky3", LeftHandPinky: "LeftHandPinky3"
}; };
// maps joint indices to parent joint indices. // maps joint indices to parent joint indices.
@ -206,7 +205,7 @@ function Xform(rot, pos) {
}; };
Xform.ident = function () { Xform.ident = function () {
return new Xform({x: 0, y: 0, z: 0, w: 1}, {x: 0, y: 0, z: 0}); return new Xform({x: 0, y: 0, z: 0, w: 1}, {x: 0, y: 0, z: 0});
} };
Xform.mul = function (lhs, rhs) { Xform.mul = function (lhs, rhs) {
var rot = Quat.multiply(lhs.rot, rhs.rot); var rot = Quat.multiply(lhs.rot, rhs.rot);
var pos = Vec3.sum(lhs.pos, Vec3.multiplyQbyV(lhs.rot, rhs.pos)); var pos = Vec3.sum(lhs.pos, Vec3.multiplyQbyV(lhs.rot, rhs.pos));
@ -354,12 +353,12 @@ function getAvatarFootOffset() {
if (jointName === "RightToe_End") { if (jointName === "RightToe_End") {
toeTop = d.translation.y toeTop = d.translation.y
} }
}) });
var myPosition = MyAvatar.position; var myPosition = MyAvatar.position;
var offset = upperLeg + lowerLeg + foot + toe + toeTop; var offset = upperLeg + lowerLeg + foot + toe + toeTop;
offset = offset / 100; offset = offset / 100;
return offset return offset;
} }
@ -395,7 +394,7 @@ function connectDoppelgangerUpdates() {
} }
function disconnectDoppelgangerUpdates() { function disconnectDoppelgangerUpdates() {
print('SHOULD DISCONNECT') print('SHOULD DISCONNECT');
if (isConnected === true) { if (isConnected === true) {
Script.update.disconnect(updateDoppelganger); Script.update.disconnect(updateDoppelganger);
} }
@ -465,13 +464,13 @@ function handleFreezeMessages(channel, message, sender) {
} catch (e) { } catch (e) {
print('error parsing wearable message'); print('error parsing wearable message');
} }
print('MESSAGE ACTION::' + parsedMessage.action) print('MESSAGE ACTION::' + parsedMessage.action);
if (parsedMessage.action === 'freeze') { if (parsedMessage.action === 'freeze') {
print('ACTUAL FREEZE') print('ACTUAL FREEZE');
disconnectDoppelgangerUpdates(); disconnectDoppelgangerUpdates();
} }
if (parsedMessage.action === 'unfreeze') { if (parsedMessage.action === 'unfreeze') {
print('ACTUAL UNFREEZE') print('ACTUAL UNFREEZE');
connectDoppelgangerUpdates(); connectDoppelgangerUpdates();
} }
@ -496,7 +495,7 @@ function handleWearableMessages(channel, message, sender) {
} catch (e) { } catch (e) {
print('error parsing wearable message'); print('error parsing wearable message');
} }
print('parsed message!!!') print('parsed message!!!');
if (channel === 'Hifi-Doppelganger-Wearable') { if (channel === 'Hifi-Doppelganger-Wearable') {
mirrorEntitiesForDoppelganger(doppelgangers[0], parsedMessage); mirrorEntitiesForDoppelganger(doppelgangers[0], parsedMessage);
@ -511,13 +510,13 @@ function mirrorEntitiesForDoppelganger(doppelganger, parsedMessage) {
var doppelgangerProps = Entities.getEntityProperties(doppelganger.id); var doppelgangerProps = Entities.getEntityProperties(doppelganger.id);
var action = parsedMessage.action; var action = parsedMessage.action;
print('IN MIRROR ENTITIES CALL' + action) print('IN MIRROR ENTITIES CALL' + action);
var baseEntity = parsedMessage.baseEntity; var baseEntity = parsedMessage.baseEntity;
var wearableProps = Entities.getEntityProperties(baseEntity); var wearableProps = Entities.getEntityProperties(baseEntity);
print('WEARABLE PROPS::') print('WEARABLE PROPS::');
delete wearableProps.id; delete wearableProps.id;
delete wearableProps.created; delete wearableProps.created;
delete wearableProps.age; delete wearableProps.age;
@ -545,15 +544,15 @@ function mirrorEntitiesForDoppelganger(doppelganger, parsedMessage) {
baseEntity: baseEntity, baseEntity: baseEntity,
doppelganger: doppelganger.id doppelganger: doppelganger.id
} }
}) });
var mirrorEntity = Entities.addEntity(wearableProps); var mirrorEntity = Entities.addEntity(wearableProps);
var mirrorEntityProps = Entities.getEntityProperties(mirrorEntity) var mirrorEntityProps = Entities.getEntityProperties(mirrorEntity);
print('MIRROR PROPS::' + JSON.stringify(mirrorEntityProps)) print('MIRROR PROPS::' + JSON.stringify(mirrorEntityProps));
var wearablePair = { var wearablePair = {
baseEntity: baseEntity, baseEntity: baseEntity,
mirrorEntity: mirrorEntity mirrorEntity: mirrorEntity
} };
wearablePairs.push(wearablePair); wearablePairs.push(wearablePair);
} }
@ -563,11 +562,11 @@ function mirrorEntitiesForDoppelganger(doppelganger, parsedMessage) {
var mirrorEntity = getMirrorEntityForBaseEntity(baseEntity); var mirrorEntity = getMirrorEntityForBaseEntity(baseEntity);
// print('MIRROR ENTITY, newPosition' + mirrorEntity + ":::" + JSON.stringify(newPosition)) // print('MIRROR ENTITY, newPosition' + mirrorEntity + ":::" + JSON.stringify(newPosition))
Entities.editEntity(mirrorEntity, wearableProps) Entities.editEntity(mirrorEntity, wearableProps);
} }
if (action === 'remove') { if (action === 'remove') {
Entities.deleteEntity(getMirrorEntityForBaseEntity(baseEntity)) Entities.deleteEntity(getMirrorEntityForBaseEntity(baseEntity));
wearablePairs = wearablePairs.filter(function(obj) { wearablePairs = wearablePairs.filter(function(obj) {
return obj.baseEntity !== baseEntity; return obj.baseEntity !== baseEntity;
}); });
@ -575,7 +574,7 @@ function mirrorEntitiesForDoppelganger(doppelganger, parsedMessage) {
if (action === 'updateBase') { if (action === 'updateBase') {
//this gets called when the mirrored entity gets grabbed. now we move the //this gets called when the mirrored entity gets grabbed. now we move the
var mirrorEntityProperties = Entities.getEntityProperties(message.mirrorEntity) var mirrorEntityProperties = Entities.getEntityProperties(message.mirrorEntity);
var doppelgangerToMirrorEntity = Vec3.subtract(doppelgangerProps.position, mirrorEntityProperties.position); var doppelgangerToMirrorEntity = Vec3.subtract(doppelgangerProps.position, mirrorEntityProperties.position);
var newPosition = Vec3.sum(MyAvatar.position, doppelgangerToMirrorEntity); var newPosition = Vec3.sum(MyAvatar.position, doppelgangerToMirrorEntity);
@ -596,7 +595,7 @@ function getMirrorEntityForBaseEntity(baseEntity) {
if (result.length === 0) { if (result.length === 0) {
return false; return false;
} else { } else {
return result[0].mirrorEntity return result[0].mirrorEntity;
} }
} }
@ -607,13 +606,12 @@ function getBaseEntityForMirrorEntity(mirrorEntity) {
if (result.length === 0) { if (result.length === 0) {
return false; return false;
} else { } else {
return result[0].baseEntity return result[0].baseEntity;
} }
} }
makeDoppelgangerForMyAvatar(); makeDoppelgangerForMyAvatar();
subscribeToWearableMessages(); subscribeToWearableMessages();
subscribeToWearableMessagesForAvatar();
subscribeToFreezeMessages(); subscribeToFreezeMessages();
function cleanup() { function cleanup() {
@ -622,8 +620,8 @@ function cleanup() {
} }
doppelgangers.forEach(function(doppelganger) { doppelgangers.forEach(function(doppelganger) {
print('DOPPELGANGER' + doppelganger.id) print('DOPPELGANGER' + doppelganger.id);
Entities.deleteEntity(doppelganger.id); Entities.deleteEntity(doppelganger.id);
}); });
} }
Script.scriptEnding.connect(cleanup); Script.scriptEnding.connect(cleanup);