mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
bulk adjusting to coding guidelines
This commit is contained in:
parent
9f92ff5de9
commit
cfb820762d
9 changed files with 123 additions and 106 deletions
|
@ -57,7 +57,7 @@ Rectangle {
|
||||||
try {
|
try {
|
||||||
var marketResponse = JSON.parse(xmlhttp.responseText.trim())
|
var marketResponse = JSON.parse(xmlhttp.responseText.trim())
|
||||||
|
|
||||||
if(marketResponse.status === 'success') {
|
if (marketResponse.status === 'success') {
|
||||||
avatar.modelName = marketResponse.data.title;
|
avatar.modelName = marketResponse.data.title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,14 +72,14 @@ Rectangle {
|
||||||
|
|
||||||
function getAvatarModelName() {
|
function getAvatarModelName() {
|
||||||
|
|
||||||
if(currentAvatar === null) {
|
if (currentAvatar === null) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if(currentAvatar.modelName !== undefined) {
|
if (currentAvatar.modelName !== undefined) {
|
||||||
return currentAvatar.modelName;
|
return currentAvatar.modelName;
|
||||||
} else {
|
} else {
|
||||||
var marketId = allAvatars.extractMarketId(currentAvatar.avatarUrl);
|
var marketId = allAvatars.extractMarketId(currentAvatar.avatarUrl);
|
||||||
if(marketId !== '') {
|
if (marketId !== '') {
|
||||||
fetchAvatarModelName(marketId, currentAvatar);
|
fetchAvatarModelName(marketId, currentAvatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,51 +103,51 @@ Rectangle {
|
||||||
property url externalAvatarThumbnailUrl: '../../images/avatarapp/guy-in-circle.svg'
|
property url externalAvatarThumbnailUrl: '../../images/avatarapp/guy-in-circle.svg'
|
||||||
|
|
||||||
function fromScript(message) {
|
function fromScript(message) {
|
||||||
if(message.method === 'initialize') {
|
if (message.method === 'initialize') {
|
||||||
jointNames = message.data.jointNames;
|
jointNames = message.data.jointNames;
|
||||||
emitSendToScript({'method' : getAvatarsMethod});
|
emitSendToScript({'method' : getAvatarsMethod});
|
||||||
} else if(message.method === 'wearableUpdated') {
|
} else if (message.method === 'wearableUpdated') {
|
||||||
adjustWearables.refreshWearable(message.entityID, message.wearableIndex, message.properties, message.updateUI);
|
adjustWearables.refreshWearable(message.entityID, message.wearableIndex, message.properties, message.updateUI);
|
||||||
} else if(message.method === 'wearablesUpdated') {
|
} else if (message.method === 'wearablesUpdated') {
|
||||||
var wearablesModel = currentAvatar.wearables;
|
var wearablesModel = currentAvatar.wearables;
|
||||||
wearablesModel.clear();
|
wearablesModel.clear();
|
||||||
message.wearables.forEach(function(wearable) {
|
message.wearables.forEach(function(wearable) {
|
||||||
wearablesModel.append(wearable);
|
wearablesModel.append(wearable);
|
||||||
});
|
});
|
||||||
adjustWearables.refresh(currentAvatar);
|
adjustWearables.refresh(currentAvatar);
|
||||||
} else if(message.method === 'scaleChanged') {
|
} else if (message.method === 'scaleChanged') {
|
||||||
currentAvatar.avatarScale = message.value;
|
currentAvatar.avatarScale = message.value;
|
||||||
updateCurrentAvatarInBookmarks(currentAvatar);
|
updateCurrentAvatarInBookmarks(currentAvatar);
|
||||||
} else if(message.method === 'externalAvatarApplied') {
|
} else if (message.method === 'externalAvatarApplied') {
|
||||||
currentAvatar.avatarUrl = message.avatarURL;
|
currentAvatar.avatarUrl = message.avatarURL;
|
||||||
currentAvatar.thumbnailUrl = allAvatars.makeThumbnailUrl(message.avatarURL);
|
currentAvatar.thumbnailUrl = allAvatars.makeThumbnailUrl(message.avatarURL);
|
||||||
currentAvatar.entry.avatarUrl = currentAvatar.avatarUrl;
|
currentAvatar.entry.avatarUrl = currentAvatar.avatarUrl;
|
||||||
currentAvatar.modelName = undefined;
|
currentAvatar.modelName = undefined;
|
||||||
updateCurrentAvatarInBookmarks(currentAvatar);
|
updateCurrentAvatarInBookmarks(currentAvatar);
|
||||||
} else if(message.method === 'settingChanged') {
|
} else if (message.method === 'settingChanged') {
|
||||||
currentAvatarSettings[message.name] = message.value;
|
currentAvatarSettings[message.name] = message.value;
|
||||||
} else if(message.method === 'changeSettings') {
|
} else if (message.method === 'changeSettings') {
|
||||||
currentAvatarSettings = message.settings;
|
currentAvatarSettings = message.settings;
|
||||||
} else if(message.method === 'bookmarkLoaded') {
|
} else if (message.method === 'bookmarkLoaded') {
|
||||||
setCurrentAvatar(message.data.currentAvatar, message.data.name);
|
setCurrentAvatar(message.data.currentAvatar, message.data.name);
|
||||||
var avatarIndex = allAvatars.findAvatarIndex(currentAvatar.name);
|
var avatarIndex = allAvatars.findAvatarIndex(currentAvatar.name);
|
||||||
allAvatars.move(avatarIndex, 0, 1);
|
allAvatars.move(avatarIndex, 0, 1);
|
||||||
view.setPage(0);
|
view.setPage(0);
|
||||||
} else if(message.method === 'bookmarkAdded') {
|
} else if (message.method === 'bookmarkAdded') {
|
||||||
var avatar = allAvatars.findAvatar(message.bookmarkName);
|
var avatar = allAvatars.findAvatar(message.bookmarkName);
|
||||||
if(avatar !== undefined) {
|
if (avatar !== undefined) {
|
||||||
var avatarObject = allAvatars.makeAvatarObject(message.bookmark, message.bookmarkName);
|
var avatarObject = allAvatars.makeAvatarObject(message.bookmark, message.bookmarkName);
|
||||||
for(var prop in avatarObject) {
|
for(var prop in avatarObject) {
|
||||||
avatar[prop] = avatarObject[prop];
|
avatar[prop] = avatarObject[prop];
|
||||||
}
|
}
|
||||||
if(currentAvatar.name === message.bookmarkName) {
|
if (currentAvatar.name === message.bookmarkName) {
|
||||||
currentAvatar = currentAvatarModel.makeAvatarEntry(avatarObject);
|
currentAvatar = currentAvatarModel.makeAvatarEntry(avatarObject);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
allAvatars.addAvatarEntry(message.bookmark, message.bookmarkName);
|
allAvatars.addAvatarEntry(message.bookmark, message.bookmarkName);
|
||||||
}
|
}
|
||||||
updateCurrentAvatarInBookmarks(currentAvatar);
|
updateCurrentAvatarInBookmarks(currentAvatar);
|
||||||
} else if(message.method === 'bookmarkDeleted') {
|
} else if (message.method === 'bookmarkDeleted') {
|
||||||
pageOfAvatars.isUpdating = true;
|
pageOfAvatars.isUpdating = true;
|
||||||
|
|
||||||
var index = pageOfAvatars.findAvatarIndex(message.name);
|
var index = pageOfAvatars.findAvatarIndex(message.name);
|
||||||
|
@ -159,15 +159,16 @@ Rectangle {
|
||||||
var itemsOnPage = pageOfAvatars.count;
|
var itemsOnPage = pageOfAvatars.count;
|
||||||
var newItemIndex = view.currentPage * view.itemsPerPage + itemsOnPage;
|
var newItemIndex = view.currentPage * view.itemsPerPage + itemsOnPage;
|
||||||
|
|
||||||
if(newItemIndex <= (allAvatars.count - 1)) {
|
if (newItemIndex <= (allAvatars.count - 1)) {
|
||||||
pageOfAvatars.append(allAvatars.get(newItemIndex));
|
pageOfAvatars.append(allAvatars.get(newItemIndex));
|
||||||
} else {
|
} else {
|
||||||
if(!pageOfAvatars.hasGetAvatars())
|
if (!pageOfAvatars.hasGetAvatars()) {
|
||||||
pageOfAvatars.appendGetAvatars();
|
pageOfAvatars.appendGetAvatars();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageOfAvatars.isUpdating = false;
|
pageOfAvatars.isUpdating = false;
|
||||||
} else if(message.method === getAvatarsMethod) {
|
} else if (message.method === getAvatarsMethod) {
|
||||||
var getAvatarsData = message.data;
|
var getAvatarsData = message.data;
|
||||||
allAvatars.populate(getAvatarsData.bookmarks);
|
allAvatars.populate(getAvatarsData.bookmarks);
|
||||||
setCurrentAvatar(getAvatarsData.currentAvatar, '');
|
setCurrentAvatar(getAvatarsData.currentAvatar, '');
|
||||||
|
@ -175,16 +176,16 @@ Rectangle {
|
||||||
currentAvatarSettings = getAvatarsData.currentAvatarSettings;
|
currentAvatarSettings = getAvatarsData.currentAvatarSettings;
|
||||||
|
|
||||||
updateCurrentAvatarInBookmarks(currentAvatar);
|
updateCurrentAvatarInBookmarks(currentAvatar);
|
||||||
} else if(message.method === 'updateAvatarInBookmarks') {
|
} else if (message.method === 'updateAvatarInBookmarks') {
|
||||||
updateCurrentAvatarInBookmarks(currentAvatar);
|
updateCurrentAvatarInBookmarks(currentAvatar);
|
||||||
} else if(message.method === 'selectAvatarEntity') {
|
} else if (message.method === 'selectAvatarEntity') {
|
||||||
adjustWearables.selectWearableByID(message.entityID);
|
adjustWearables.selectWearableByID(message.entityID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCurrentAvatarInBookmarks(avatar) {
|
function updateCurrentAvatarInBookmarks(avatar) {
|
||||||
var bookmarkAvatarIndex = allAvatars.findAvatarIndexByValue(avatar);
|
var bookmarkAvatarIndex = allAvatars.findAvatarIndexByValue(avatar);
|
||||||
if(bookmarkAvatarIndex === -1) {
|
if (bookmarkAvatarIndex === -1) {
|
||||||
avatar.name = '';
|
avatar.name = '';
|
||||||
view.setPage(0);
|
view.setPage(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -597,8 +598,9 @@ Rectangle {
|
||||||
pageOfAvatars.append(avatarItem);
|
pageOfAvatars.append(avatarItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pageOfAvatars.count !== itemsPerPage)
|
if (pageOfAvatars.count !== itemsPerPage) {
|
||||||
pageOfAvatars.appendGetAvatars();
|
pageOfAvatars.appendGetAvatars();
|
||||||
|
}
|
||||||
|
|
||||||
currentPage = pageIndex;
|
currentPage = pageIndex;
|
||||||
pageOfAvatars.isUpdating = false;
|
pageOfAvatars.isUpdating = false;
|
||||||
|
@ -619,7 +621,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeGetAvatars() {
|
function removeGetAvatars() {
|
||||||
if(hasGetAvatars()) {
|
if (hasGetAvatars()) {
|
||||||
remove(count - 1)
|
remove(count - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -687,13 +689,13 @@ Rectangle {
|
||||||
hoverEnabled: enabled
|
hoverEnabled: enabled
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(isInManageState) {
|
if (isInManageState) {
|
||||||
var currentItem = delegateRoot.GridView.view.model.get(index);
|
var currentItem = delegateRoot.GridView.view.model.get(index);
|
||||||
popup.showDeleteFavorite(currentItem.name, function() {
|
popup.showDeleteFavorite(currentItem.name, function() {
|
||||||
view.deleteAvatar(currentItem);
|
view.deleteAvatar(currentItem);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(delegateRoot.GridView.view.currentIndex !== index) {
|
if (delegateRoot.GridView.view.currentIndex !== index) {
|
||||||
var currentItem = delegateRoot.GridView.view.model.get(index);
|
var currentItem = delegateRoot.GridView.view.model.get(index);
|
||||||
popup.showLoadFavorite(currentItem.name, function() {
|
popup.showLoadFavorite(currentItem.name, function() {
|
||||||
view.selectAvatar(currentItem);
|
view.selectAvatar(currentItem);
|
||||||
|
|
|
@ -43,10 +43,10 @@ Rectangle {
|
||||||
wearablesCombobox.model.clear();
|
wearablesCombobox.model.clear();
|
||||||
wearablesCombobox.currentIndex = -1;
|
wearablesCombobox.currentIndex = -1;
|
||||||
|
|
||||||
for(var i = 0; i < avatar.wearables.count; ++i) {
|
for (var i = 0; i < avatar.wearables.count; ++i) {
|
||||||
var wearable = avatar.wearables.get(i).properties;
|
var wearable = avatar.wearables.get(i).properties;
|
||||||
for(var j = (wearable.modelURL.length - 1); j >= 0; --j) {
|
for (var j = (wearable.modelURL.length - 1); j >= 0; --j) {
|
||||||
if(wearable.modelURL[j] === '/') {
|
if (wearable.modelURL[j] === '/') {
|
||||||
wearable.text = wearable.modelURL.substring(j + 1);
|
wearable.text = wearable.modelURL.substring(j + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -54,34 +54,34 @@ Rectangle {
|
||||||
wearablesCombobox.model.append(wearable);
|
wearablesCombobox.model.append(wearable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wearablesCombobox.model.count !== 0) {
|
if (wearablesCombobox.model.count !== 0) {
|
||||||
wearablesCombobox.currentIndex = 0;
|
wearablesCombobox.currentIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshWearable(wearableID, wearableIndex, properties, updateUI) {
|
function refreshWearable(wearableID, wearableIndex, properties, updateUI) {
|
||||||
if(wearableIndex === -1) {
|
if (wearableIndex === -1) {
|
||||||
wearableIndex = wearablesCombobox.model.findIndexById(wearableID);
|
wearableIndex = wearablesCombobox.model.findIndexById(wearableID);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wearable = wearablesCombobox.model.get(wearableIndex);
|
var wearable = wearablesCombobox.model.get(wearableIndex);
|
||||||
|
|
||||||
if(!wearable) {
|
if (!wearable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var wearableModelItemProperties = wearablesModel.get(wearableIndex).properties;
|
var wearableModelItemProperties = wearablesModel.get(wearableIndex).properties;
|
||||||
|
|
||||||
for(var prop in properties) {
|
for (var prop in properties) {
|
||||||
wearable[prop] = properties[prop];
|
wearable[prop] = properties[prop];
|
||||||
wearableModelItemProperties[prop] = wearable[prop];
|
wearableModelItemProperties[prop] = wearable[prop];
|
||||||
|
|
||||||
if(updateUI) {
|
if (updateUI) {
|
||||||
if(prop === 'localPosition') {
|
if (prop === 'localPosition') {
|
||||||
positionVector.set(wearable[prop]);
|
positionVector.set(wearable[prop]);
|
||||||
} else if(prop === 'localRotationAngles') {
|
} else if (prop === 'localRotationAngles') {
|
||||||
rotationVector.set(wearable[prop]);
|
rotationVector.set(wearable[prop]);
|
||||||
} else if(prop === 'dimensions') {
|
} else if (prop === 'dimensions') {
|
||||||
scalespinner.set(wearable[prop].x / wearable.naturalDimensions.x);
|
scalespinner.set(wearable[prop].x / wearable.naturalDimensions.x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,9 +95,9 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectWearableByID(entityID) {
|
function selectWearableByID(entityID) {
|
||||||
for(var i = 0; i < wearablesCombobox.model.count; ++i) {
|
for (var i = 0; i < wearablesCombobox.model.count; ++i) {
|
||||||
var wearable = wearablesCombobox.model.get(i);
|
var wearable = wearablesCombobox.model.get(i);
|
||||||
if(wearable.id === entityID) {
|
if (wearable.id === entityID) {
|
||||||
wearablesCombobox.currentIndex = i;
|
wearablesCombobox.currentIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -220,9 +220,9 @@ Rectangle {
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
function findIndexById(id) {
|
function findIndexById(id) {
|
||||||
|
|
||||||
for(var i = 0; i < count; ++i) {
|
for (var i = 0; i < count; ++i) {
|
||||||
var wearable = get(i);
|
var wearable = get(i);
|
||||||
if(wearable.id === id) {
|
if (wearable.id === id) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ Rectangle {
|
||||||
jointsCombobox.set(joint);
|
jointsCombobox.set(joint);
|
||||||
isSoft.set(soft);
|
isSoft.set(soft);
|
||||||
|
|
||||||
if(currentWearable) {
|
if (currentWearable) {
|
||||||
wearableSelected(currentWearable.id);
|
wearableSelected(currentWearable.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
if(notify) notifyJointChanged();
|
if (notify) notifyJointChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,9 +352,9 @@ Rectangle {
|
||||||
|
|
||||||
property bool notify: false;
|
property bool notify: false;
|
||||||
|
|
||||||
onXvalueChanged: if(notify) notifyPositionChanged();
|
onXvalueChanged: if (notify) notifyPositionChanged();
|
||||||
onYvalueChanged: if(notify) notifyPositionChanged();
|
onYvalueChanged: if (notify) notifyPositionChanged();
|
||||||
onZvalueChanged: if(notify) notifyPositionChanged();
|
onZvalueChanged: if (notify) notifyPositionChanged();
|
||||||
|
|
||||||
decimals: 2
|
decimals: 2
|
||||||
realFrom: -10
|
realFrom: -10
|
||||||
|
@ -412,9 +412,9 @@ Rectangle {
|
||||||
|
|
||||||
property bool notify: false;
|
property bool notify: false;
|
||||||
|
|
||||||
onXvalueChanged: if(notify) notifyRotationChanged();
|
onXvalueChanged: if (notify) notifyRotationChanged();
|
||||||
onYvalueChanged: if(notify) notifyRotationChanged();
|
onYvalueChanged: if (notify) notifyRotationChanged();
|
||||||
onZvalueChanged: if(notify) notifyRotationChanged();
|
onZvalueChanged: if (notify) notifyRotationChanged();
|
||||||
|
|
||||||
decimals: 0
|
decimals: 0
|
||||||
realFrom: -180
|
realFrom: -180
|
||||||
|
@ -453,7 +453,7 @@ Rectangle {
|
||||||
|
|
||||||
property bool notify: false;
|
property bool notify: false;
|
||||||
|
|
||||||
onCheckedChanged: if(notify) notifyIsSoftChanged();
|
onCheckedChanged: if (notify) notifyIsSoftChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
@ -482,7 +482,7 @@ Rectangle {
|
||||||
colorScheme: hifi.colorSchemes.light
|
colorScheme: hifi.colorSchemes.light
|
||||||
|
|
||||||
property bool notify: false;
|
property bool notify: false;
|
||||||
onRealValueChanged: if(notify) notifyScaleChanged();
|
onRealValueChanged: if (notify) notifyScaleChanged();
|
||||||
|
|
||||||
function set(value) {
|
function set(value) {
|
||||||
notify = false;
|
notify = false;
|
||||||
|
|
|
@ -24,8 +24,9 @@ ListModel {
|
||||||
|
|
||||||
function makeThumbnailUrl(avatarUrl) {
|
function makeThumbnailUrl(avatarUrl) {
|
||||||
var marketId = extractMarketId(avatarUrl);
|
var marketId = extractMarketId(avatarUrl);
|
||||||
if(marketId === '')
|
if (marketId === '') {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
var avatarThumbnailUrl = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/%marketId%/large/hifi-mp-%marketId%.jpg"
|
var avatarThumbnailUrl = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/%marketId%/large/hifi-mp-%marketId%.jpg"
|
||||||
.split('%marketId%').join(marketId);
|
.split('%marketId%').join(marketId);
|
||||||
|
@ -57,7 +58,7 @@ ListModel {
|
||||||
|
|
||||||
function populate(bookmarks) {
|
function populate(bookmarks) {
|
||||||
clear();
|
clear();
|
||||||
for(var avatarName in bookmarks) {
|
for (var avatarName in bookmarks) {
|
||||||
var avatar = bookmarks[avatarName];
|
var avatar = bookmarks[avatarName];
|
||||||
var avatarEntry = makeAvatarObject(avatar, avatarName);
|
var avatarEntry = makeAvatarObject(avatar, avatarName);
|
||||||
|
|
||||||
|
@ -66,19 +67,19 @@ ListModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function arraysAreEqual(a1, a2, comparer) {
|
function arraysAreEqual(a1, a2, comparer) {
|
||||||
if(Array.isArray(a1) && Array.isArray(a2)) {
|
if (Array.isArray(a1) && Array.isArray(a2)) {
|
||||||
if(a1.length !== a2.length) {
|
if (a1.length !== a2.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i = 0; i < a1.length; ++i) {
|
for (var i = 0; i < a1.length; ++i) {
|
||||||
if(!comparer(a1[i], a2[i])) {
|
if (!comparer(a1[i], a2[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(Array.isArray(a1)) {
|
} else if (Array.isArray(a1)) {
|
||||||
return a1.length === 0;
|
return a1.length === 0;
|
||||||
} else if(Array.isArray(a2)) {
|
} else if (Array.isArray(a2)) {
|
||||||
return a2.length === 0;
|
return a2.length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,26 +87,26 @@ ListModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function modelsAreEqual(m1, m2, comparer) {
|
function modelsAreEqual(m1, m2, comparer) {
|
||||||
if(m1.count !== m2.count) {
|
if (m1.count !== m2.count) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i = 0; i < m1.count; ++i) {
|
for (var i = 0; i < m1.count; ++i) {
|
||||||
var e1 = m1.get(i);
|
var e1 = m1.get(i);
|
||||||
|
|
||||||
var allDifferent = true;
|
var allDifferent = true;
|
||||||
|
|
||||||
// it turns out order of wearables can randomly change so make position-independent comparison here
|
// it turns out order of wearables can randomly change so make position-independent comparison here
|
||||||
for(var j = 0; j < m2.count; ++j) {
|
for (var j = 0; j < m2.count; ++j) {
|
||||||
var e2 = m2.get(j);
|
var e2 = m2.get(j);
|
||||||
|
|
||||||
if(comparer(e1, e2)) {
|
if (comparer(e1, e2)) {
|
||||||
allDifferent = false;
|
allDifferent = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allDifferent) {
|
if (allDifferent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,18 +115,20 @@ ListModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function compareNumericObjects(o1, o2) {
|
function compareNumericObjects(o1, o2) {
|
||||||
if(o1 === undefined && o2 !== undefined)
|
if (o1 === undefined && o2 !== undefined) {
|
||||||
return false;
|
return false;
|
||||||
if(o1 !== undefined && o2 === undefined)
|
}
|
||||||
|
if (o1 !== undefined && o2 === undefined) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for(var prop in o1) {
|
for (var prop in o1) {
|
||||||
if(o1.hasOwnProperty(prop) && o2.hasOwnProperty(prop)) {
|
if (o1.hasOwnProperty(prop) && o2.hasOwnProperty(prop)) {
|
||||||
var v1 = o1[prop];
|
var v1 = o1[prop];
|
||||||
var v2 = o2[prop];
|
var v2 = o2[prop];
|
||||||
|
|
||||||
|
|
||||||
if(v1 !== v2 && Math.round(v1 * 500) != Math.round(v2 * 500)) {
|
if (v1 !== v2 && Math.round(v1 * 500) != Math.round(v2 * 500)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +138,7 @@ ListModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function compareObjects(o1, o2, props, arrayProp) {
|
function compareObjects(o1, o2, props, arrayProp) {
|
||||||
for(var i = 0; i < props.length; ++i) {
|
for (var i = 0; i < props.length; ++i) {
|
||||||
var prop = props[i];
|
var prop = props[i];
|
||||||
var propertyName = prop.propertyName;
|
var propertyName = prop.propertyName;
|
||||||
var comparer = prop.comparer;
|
var comparer = prop.comparer;
|
||||||
|
@ -143,12 +146,12 @@ ListModel {
|
||||||
var o1Value = arrayProp ? o1[arrayProp][propertyName] : o1[propertyName];
|
var o1Value = arrayProp ? o1[arrayProp][propertyName] : o1[propertyName];
|
||||||
var o2Value = arrayProp ? o2[arrayProp][propertyName] : o2[propertyName];
|
var o2Value = arrayProp ? o2[arrayProp][propertyName] : o2[propertyName];
|
||||||
|
|
||||||
if(comparer) {
|
if (comparer) {
|
||||||
if(comparer(o1Value, o2Value) === false) {
|
if (comparer(o1Value, o2Value) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(JSON.stringify(o1Value) !== JSON.stringify(o2Value)) {
|
if (JSON.stringify(o1Value) !== JSON.stringify(o2Value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,21 +177,23 @@ ListModel {
|
||||||
var index = -1;
|
var index = -1;
|
||||||
|
|
||||||
// 2DO: find better way of determining selected avatar in bookmarks
|
// 2DO: find better way of determining selected avatar in bookmarks
|
||||||
for(var i = 0; i < allAvatars.count; ++i) {
|
for (var i = 0; i < allAvatars.count; ++i) {
|
||||||
var thesame = true;
|
var thesame = true;
|
||||||
var bookmarkedAvatar = allAvatars.get(i);
|
var bookmarkedAvatar = allAvatars.get(i);
|
||||||
|
|
||||||
if(bookmarkedAvatar.avatarUrl !== avatar.avatarUrl)
|
if (bookmarkedAvatar.avatarUrl !== avatar.avatarUrl) {
|
||||||
continue;
|
|
||||||
|
|
||||||
if(bookmarkedAvatar.avatarScale !== avatar.avatarScale)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!modelsAreEqual(bookmarkedAvatar.wearables, avatar.wearables, compareWearables)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(thesame) {
|
if (bookmarkedAvatar.avatarScale !== avatar.avatarScale) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modelsAreEqual(bookmarkedAvatar.wearables, avatar.wearables, compareWearables)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thesame) {
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -198,8 +203,8 @@ ListModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findAvatarIndex(avatarName) {
|
function findAvatarIndex(avatarName) {
|
||||||
for(var i = 0; i < count; ++i) {
|
for (var i = 0; i < count; ++i) {
|
||||||
if(get(i).name === avatarName) {
|
if (get(i).name === avatarName) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,8 +213,9 @@ ListModel {
|
||||||
|
|
||||||
function findAvatar(avatarName) {
|
function findAvatar(avatarName) {
|
||||||
var avatarIndex = findAvatarIndex(avatarName);
|
var avatarIndex = findAvatarIndex(avatarName);
|
||||||
if(avatarIndex === -1)
|
if (avatarIndex === -1) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
return get(avatarIndex);
|
return get(avatarIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,9 +125,9 @@ Rectangle {
|
||||||
size: 15
|
size: 15
|
||||||
color: 'red'
|
color: 'red'
|
||||||
visible: {
|
visible: {
|
||||||
for(var i = 0; i < avatars.count; ++i) {
|
for (var i = 0; i < avatars.count; ++i) {
|
||||||
var avatarName = avatars.get(i).name;
|
var avatarName = avatars.get(i).name;
|
||||||
if(avatarName === favoriteName.text) {
|
if (avatarName === favoriteName.text) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onYesClicked: function() {
|
onYesClicked: function() {
|
||||||
if(onSaveClicked) {
|
if (onSaveClicked) {
|
||||||
onSaveClicked();
|
onSaveClicked();
|
||||||
} else {
|
} else {
|
||||||
root.close();
|
root.close();
|
||||||
|
@ -173,7 +173,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onNoClicked: function() {
|
onNoClicked: function() {
|
||||||
if(onCancelClicked) {
|
if (onCancelClicked) {
|
||||||
onCancelClicked();
|
onCancelClicked();
|
||||||
} else {
|
} else {
|
||||||
root.close();
|
root.close();
|
||||||
|
|
|
@ -33,7 +33,7 @@ Row {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.debug('whitebutton.clicked', onNoClicked);
|
console.debug('whitebutton.clicked', onNoClicked);
|
||||||
|
|
||||||
if(onNoClicked) {
|
if (onNoClicked) {
|
||||||
onNoClicked();
|
onNoClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ Rectangle {
|
||||||
wrapMode: Text.WordWrap;
|
wrapMode: Text.WordWrap;
|
||||||
|
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
if(onLinkClicked)
|
if (onLinkClicked)
|
||||||
onLinkClicked(link);
|
onLinkClicked(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ Rectangle {
|
||||||
noText: root.button1text
|
noText: root.button1text
|
||||||
|
|
||||||
onYesClicked: function() {
|
onYesClicked: function() {
|
||||||
if(onButton2Clicked) {
|
if (onButton2Clicked) {
|
||||||
onButton2Clicked();
|
onButton2Clicked();
|
||||||
} else {
|
} else {
|
||||||
root.close();
|
root.close();
|
||||||
|
@ -174,7 +174,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onNoClicked: function() {
|
onNoClicked: function() {
|
||||||
if(onButton1Clicked) {
|
if (onButton1Clicked) {
|
||||||
onButton1Clicked();
|
onButton1Clicked();
|
||||||
} else {
|
} else {
|
||||||
root.close();
|
root.close();
|
||||||
|
|
|
@ -18,15 +18,17 @@ MessageBox {
|
||||||
popup.button2text = 'CONFIRM';
|
popup.button2text = 'CONFIRM';
|
||||||
|
|
||||||
popup.onButton2Clicked = function() {
|
popup.onButton2Clicked = function() {
|
||||||
if(callback)
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
}
|
||||||
|
|
||||||
popup.close();
|
popup.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.onLinkClicked = function(link) {
|
popup.onLinkClicked = function(link) {
|
||||||
if(linkCallback)
|
if (linkCallback) {
|
||||||
linkCallback(link);
|
linkCallback(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.open();
|
popup.open();
|
||||||
|
@ -43,8 +45,9 @@ MessageBox {
|
||||||
popup.inputText.placeholderText = 'Enter Wearable URL';
|
popup.inputText.placeholderText = 'Enter Wearable URL';
|
||||||
|
|
||||||
popup.onButton2Clicked = function() {
|
popup.onButton2Clicked = function() {
|
||||||
if(callback)
|
if (callback) {
|
||||||
callback(popup.inputText.text);
|
callback(popup.inputText.text);
|
||||||
|
}
|
||||||
|
|
||||||
popup.close();
|
popup.close();
|
||||||
}
|
}
|
||||||
|
@ -68,15 +71,17 @@ MessageBox {
|
||||||
popup.onButton2Clicked = function() {
|
popup.onButton2Clicked = function() {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
if(callback)
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.onLinkClicked = function(link) {
|
popup.onLinkClicked = function(link) {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
if(linkCallback)
|
if (linkCallback) {
|
||||||
linkCallback(link);
|
linkCallback(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.open();
|
popup.open();
|
||||||
|
@ -92,8 +97,9 @@ MessageBox {
|
||||||
popup.onButton2Clicked = function() {
|
popup.onButton2Clicked = function() {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
if(callback)
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
popup.open();
|
popup.open();
|
||||||
}
|
}
|
||||||
|
@ -107,8 +113,9 @@ MessageBox {
|
||||||
popup.onButton2Clicked = function() {
|
popup.onButton2Clicked = function() {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
if(callback)
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
popup.open();
|
popup.open();
|
||||||
}
|
}
|
||||||
|
@ -129,15 +136,17 @@ MessageBox {
|
||||||
popup.onButton2Clicked = function() {
|
popup.onButton2Clicked = function() {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
if(callback)
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.onLinkClicked = function(link) {
|
popup.onLinkClicked = function(link) {
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
if(linkCallback)
|
if (linkCallback) {
|
||||||
linkCallback(link);
|
linkCallback(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup.open();
|
popup.open();
|
||||||
|
|
|
@ -33,13 +33,13 @@ Rectangle {
|
||||||
scaleSlider.value = Math.round(avatarScale * 10);
|
scaleSlider.value = Math.round(avatarScale * 10);
|
||||||
scaleSlider.notify = true;;
|
scaleSlider.notify = true;;
|
||||||
|
|
||||||
if(settings.dominantHand === 'left') {
|
if (settings.dominantHand === 'left') {
|
||||||
leftHandRadioButton.checked = true;
|
leftHandRadioButton.checked = true;
|
||||||
} else {
|
} else {
|
||||||
rightHandRadioButton.checked = true;
|
rightHandRadioButton.checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(settings.collisionsEnabled) {
|
if (settings.collisionsEnabled) {
|
||||||
collisionsEnabledRadiobutton.checked = true;
|
collisionsEnabledRadiobutton.checked = true;
|
||||||
} else {
|
} else {
|
||||||
collisionsDisabledRadioButton.checked = true;
|
collisionsDisabledRadioButton.checked = true;
|
||||||
|
@ -113,7 +113,7 @@ Rectangle {
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
console.debug('value changed: ', value);
|
console.debug('value changed: ', value);
|
||||||
if(notify) {
|
if (notify) {
|
||||||
console.debug('notifying.. ');
|
console.debug('notifying.. ');
|
||||||
root.scaleChanged(value / 10);
|
root.scaleChanged(value / 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ Item {
|
||||||
highp vec4 maskColor = texture2D(mask, vec2(qt_TexCoord0.x, qt_TexCoord0.y));
|
highp vec4 maskColor = texture2D(mask, vec2(qt_TexCoord0.x, qt_TexCoord0.y));
|
||||||
highp vec4 sourceColor = texture2D(source, vec2(qt_TexCoord0.x, qt_TexCoord0.y));
|
highp vec4 sourceColor = texture2D(source, vec2(qt_TexCoord0.x, qt_TexCoord0.y));
|
||||||
|
|
||||||
if(maskColor.a > 0.0)
|
if (maskColor.a > 0.0)
|
||||||
gl_FragColor = sourceColor;
|
gl_FragColor = sourceColor;
|
||||||
else
|
else
|
||||||
gl_FragColor = maskColor;
|
gl_FragColor = maskColor;
|
||||||
|
|
Loading…
Reference in a new issue