From f356de5fdfc519447a932a623aa1d7b2317af7fe Mon Sep 17 00:00:00 2001 From: Alexia Mandeville Date: Fri, 16 Mar 2018 11:51:03 -0700 Subject: [PATCH 01/28] Updating repo script to match marketplace script --- scripts/tutorials/entity_scripts/sit.js | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/scripts/tutorials/entity_scripts/sit.js b/scripts/tutorials/entity_scripts/sit.js index 70456ea493..9de65d7037 100644 --- a/scripts/tutorials/entity_scripts/sit.js +++ b/scripts/tutorials/entity_scripts/sit.js @@ -12,9 +12,9 @@ Script.include("/~/system/libraries/utils.js"); if (!String.prototype.startsWith) { String.prototype.startsWith = function(searchString, position){ - position = position || 0; - return this.substr(position, searchString.length) === searchString; - }; + position = position || 0; + return this.substr(position, searchString.length) === searchString; + }; } var SETTING_KEY = "com.highfidelity.avatar.isSitting"; @@ -122,20 +122,10 @@ this.rolesToOverride = function() { return MyAvatar.getAnimationRoles().filter(function(role) { - return !(role.startsWith("right") || role.startsWith("left")); + return !(role.startsWith("right") || role.startsWith("left")); }); } - // Handler for user changing the avatar model while sitting. There's currently an issue with changing avatar models while override role animations are applied, - // so to avoid that problem, re-apply the role overrides once the model has finished changing. - this.modelURLChangeFinished = function () { - print("Sitter's model has FINISHED changing. Reapply anim role overrides."); - var roles = this.rolesToOverride(); - for (i in roles) { - MyAvatar.overrideRoleAnimation(roles[i], ANIMATION_URL, ANIMATION_FPS, true, ANIMATION_FIRST_FRAME, ANIMATION_LAST_FRAME); - } - } - this.sitDown = function() { if (this.checkSeatForAvatar()) { print("Someone is already sitting in that chair."); @@ -174,14 +164,12 @@ return { headType: 0 }; }, ["headType"]); Script.update.connect(this, this.update); - MyAvatar.onLoadComplete.connect(this, this.modelURLChangeFinished); } this.standUp = function() { print("Standing up (" + this.entityID + ")"); MyAvatar.removeAnimationStateHandler(this.animStateHandlerID); Script.update.disconnect(this, this.update); - MyAvatar.onLoadComplete.disconnect(this, this.modelURLChangeFinished); if (MyAvatar.sessionUUID === this.getSeatUser()) { this.setSeatUser(null); @@ -343,7 +331,7 @@ } this.cleanupOverlay(); } - + this.clickDownOnEntity = function (id, event) { if (isInEditMode()) { return; @@ -352,4 +340,4 @@ this.sitDown(); } } -}); +}); \ No newline at end of file From 35551f045c120bb2664be13dc85c0c4da1bf0bee Mon Sep 17 00:00:00 2001 From: Alexia Mandeville Date: Wed, 21 Mar 2018 15:35:10 -0700 Subject: [PATCH 02/28] Updating with jshint edits --- scripts/tutorials/entity_scripts/sit.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/tutorials/entity_scripts/sit.js b/scripts/tutorials/entity_scripts/sit.js index 9de65d7037..9c994ed2ea 100644 --- a/scripts/tutorials/entity_scripts/sit.js +++ b/scripts/tutorials/entity_scripts/sit.js @@ -145,11 +145,11 @@ MyAvatar.characterControllerEnabled = false; MyAvatar.hmdLeanRecenterEnabled = false; var roles = this.rolesToOverride(); - for (i in roles) { + for (var i = 0; i < roles.length; i++) { MyAvatar.overrideRoleAnimation(roles[i], ANIMATION_URL, ANIMATION_FPS, true, ANIMATION_FIRST_FRAME, ANIMATION_LAST_FRAME); } - for (var i in OVERRIDEN_DRIVE_KEYS) { + for (i = 0; i < OVERRIDEN_DRIVE_KEYS.length; i++) { MyAvatar.disableDriveKey(OVERRIDEN_DRIVE_KEYS[i]); } @@ -178,12 +178,12 @@ if (Settings.getValue(SETTING_KEY) === this.entityID) { Settings.setValue(SETTING_KEY, ""); - for (var i in OVERRIDEN_DRIVE_KEYS) { + for (var i = 0; i < OVERRIDEN_DRIVE_KEYS.length; i++) { MyAvatar.enableDriveKey(OVERRIDEN_DRIVE_KEYS[i]); } var roles = this.rolesToOverride(); - for (i in roles) { + for (i = 0; i < roles.length; i++) { MyAvatar.restoreRoleAnimation(roles[i]); } MyAvatar.characterControllerEnabled = true; @@ -260,7 +260,7 @@ // Check if a drive key is pressed var hasActiveDriveKey = false; for (var i in OVERRIDEN_DRIVE_KEYS) { - if (MyAvatar.getRawDriveKey(OVERRIDEN_DRIVE_KEYS[i]) != 0.0) { + if (MyAvatar.getRawDriveKey(OVERRIDEN_DRIVE_KEYS[i]) !== 0.0) { hasActiveDriveKey = true; break; } From 9dd91ea31e89c49a57b23371f3db8bc2533a1108 Mon Sep 17 00:00:00 2001 From: Liv Erickson Date: Fri, 23 Mar 2018 11:39:44 -0700 Subject: [PATCH 03/28] style fixes and fix for grid color changes not applying --- scripts/system/libraries/gridTool.js | 110 ++++++++++++++------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/scripts/system/libraries/gridTool.js b/scripts/system/libraries/gridTool.js index 19d4417a12..3968c9376c 100644 --- a/scripts/system/libraries/gridTool.js +++ b/scripts/system/libraries/gridTool.js @@ -1,16 +1,8 @@ var GRID_CONTROLS_HTML_URL = Script.resolvePath('../html/gridControls.html'); -Grid = function(opts) { +Grid = function (opts) { var that = {}; - - var colors = [ - { red: 0, green: 0, blue: 0 }, - { red: 255, green: 255, blue: 255 }, - { red: 255, green: 0, blue: 0 }, - { red: 0, green: 255, blue: 0 }, - { red: 0, green: 0, blue: 255 }, - ]; - var colorIndex = 0; + var gridColor = { red: 0, green: 0, blue: 0 }; var gridAlpha = 0.6; var origin = { x: 0, y: +MyAvatar.getJointPosition('LeftToeBase').y.toFixed(1) + 0.1, z: 0 }; var scale = 500; @@ -28,58 +20,70 @@ Grid = function(opts) { position: origin, visible: false, drawInFront: false, - color: colors[0], + color: gridColor, alpha: gridAlpha, minorGridEvery: minorGridEvery, - majorGridEvery: majorGridEvery, + majorGridEvery: majorGridEvery }); that.visible = false; that.enabled = false; - that.getOrigin = function() { + that.getOrigin = function () { return origin; - } + }; - that.getMinorIncrement = function() { return minorGridEvery; }; - that.setMinorIncrement = function(value) { + that.getMinorIncrement = function () { + return minorGridEvery; + }; + + that.setMinorIncrement = function (value) { minorGridEvery = value; updateGrid(); - } - that.getMajorIncrement = function() { return majorGridEvery; }; - that.setMajorIncrement = function(value) { + }; + + that.getMajorIncrement = function () { + return majorGridEvery; + }; + + that.setMajorIncrement = function (value) { majorGridEvery = value; updateGrid(); }; - that.getColorIndex = function() { return colorIndex; }; - that.setColorIndex = function(value) { - colorIndex = value; + that.getColor = function () { + return gridColor; + }; + + that.setColor = function (value) { + gridColor = value; updateGrid(); }; - that.getSnapToGrid = function() { return snapToGrid; }; - that.setSnapToGrid = function(value) { + that.getSnapToGrid = function () { + return snapToGrid; + }; + that.setSnapToGrid = function (value) { snapToGrid = value; that.emitUpdate(); }; - that.setEnabled = function(enabled) { + that.setEnabled = function (enabled) { that.enabled = enabled; updateGrid(); - } + }; - that.getVisible = function() { return that.visible; }; - that.setVisible = function(visible, noUpdate) { + that.getVisible = function () { return that.visible; }; + that.setVisible = function (visible, noUpdate) { that.visible = visible; updateGrid(); if (!noUpdate) { that.emitUpdate(); } - } + }; - that.snapToSurface = function(position, dimensions, registration) { + that.snapToSurface = function (position, dimensions, registration) { if (!snapToGrid) { return position; } @@ -97,9 +101,9 @@ Grid = function(opts) { y: origin.y + (registration.y * dimensions.y), z: position.z }; - } + }; - that.snapToGrid = function(position, majorOnly, dimensions, registration) { + that.snapToGrid = function (position, majorOnly, dimensions, registration) { if (!snapToGrid) { return position; } @@ -123,7 +127,7 @@ Grid = function(opts) { return Vec3.sum(Vec3.sum(position, Vec3.multiplyVbyV(registration, dimensions)), origin); } - that.snapToSpacing = function(delta, majorOnly) { + that.snapToSpacing = function (delta, majorOnly) { if (!snapToGrid) { return delta; } @@ -133,14 +137,14 @@ Grid = function(opts) { var snappedDelta = { x: Math.round(delta.x / spacing) * spacing, y: Math.round(delta.y / spacing) * spacing, - z: Math.round(delta.z / spacing) * spacing, + z: Math.round(delta.z / spacing) * spacing }; return snappedDelta; - } + }; - that.setPosition = function(newPosition, noUpdate) { + that.setPosition = function (newPosition, noUpdate) { origin = { x: 0, y: newPosition.y, z: 0 }; updateGrid(); @@ -149,7 +153,7 @@ Grid = function(opts) { } }; - that.emitUpdate = function() { + that.emitUpdate = function () { if (that.onUpdate) { that.onUpdate({ origin: origin, @@ -157,12 +161,12 @@ Grid = function(opts) { majorGridEvery: majorGridEvery, gridSize: halfSize, visible: that.visible, - snapToGrid: snapToGrid, + snapToGrid: snapToGrid }); } }; - that.update = function(data) { + that.update = function (data) { if (data.snapToGrid !== undefined) { snapToGrid = data.snapToGrid; } @@ -183,8 +187,8 @@ Grid = function(opts) { majorGridEvery = data.majorGridEvery; } - if (data.colorIndex !== undefined) { - colorIndex = data.colorIndex; + if (data.gridColor) { + gridColor = data.gridColor; } if (data.gridSize) { @@ -196,7 +200,7 @@ Grid = function(opts) { } updateGrid(true); - } + }; function updateGrid(noUpdate) { Overlays.editOverlay(gridOverlay, { @@ -204,8 +208,8 @@ Grid = function(opts) { visible: that.visible && that.enabled, minorGridEvery: minorGridEvery, majorGridEvery: majorGridEvery, - color: colors[colorIndex], - alpha: gridAlpha, + color: gridColor, + alpha: gridAlpha }); if (!noUpdate) { @@ -217,7 +221,7 @@ Grid = function(opts) { Overlays.deleteOverlay(gridOverlay); } - that.addListener = function(callback) { + that.addListener = function (callback) { that.onUpdate = callback; } @@ -229,7 +233,7 @@ Grid = function(opts) { return that; }; -GridTool = function(opts) { +GridTool = function (opts) { var that = {}; var horizontalGrid = opts.horizontalGrid; @@ -238,19 +242,19 @@ GridTool = function(opts) { var webView = null; webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - webView.setVisible = function(value) {}; + webView.setVisible = function (value) { }; - horizontalGrid.addListener(function(data) { + horizontalGrid.addListener(function (data) { webView.emitScriptEvent(JSON.stringify(data)); if (selectionDisplay) { selectionDisplay.updateHandles(); } }); - webView.webEventReceived.connect(function(data) { + webView.webEventReceived.connect(function (data) { try { data = JSON.parse(data); - } catch(e) { + } catch (e) { print("gridTool.js: Error parsing JSON: " + e.name + " data " + data) return; } @@ -260,7 +264,7 @@ GridTool = function(opts) { } else if (data.type == "update") { horizontalGrid.update(data); for (var i = 0; i < listeners.length; i++) { - listeners[i] && listeners[i](data); + [i] && listeners[i](data); } } else if (data.type == "action") { var action = data.action; @@ -278,11 +282,11 @@ GridTool = function(opts) { } }); - that.addListener = function(callback) { + that.addListener = function (callback) { listeners.push(callback); } - that.setVisible = function(visible) { + that.setVisible = function (visible) { webView.setVisible(visible); } From c66badc53c7b8e49a56dbc934cd07eeb528ea840 Mon Sep 17 00:00:00 2001 From: Liv Erickson Date: Fri, 23 Mar 2018 11:42:39 -0700 Subject: [PATCH 04/28] replace accidentally deleted line --- scripts/system/libraries/gridTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/libraries/gridTool.js b/scripts/system/libraries/gridTool.js index 3968c9376c..a991d66b40 100644 --- a/scripts/system/libraries/gridTool.js +++ b/scripts/system/libraries/gridTool.js @@ -264,7 +264,7 @@ GridTool = function (opts) { } else if (data.type == "update") { horizontalGrid.update(data); for (var i = 0; i < listeners.length; i++) { - [i] && listeners[i](data); + listeners[i] && listeners[i](data); } } else if (data.type == "action") { var action = data.action; From c3df741c6218c5f7758174585e21fcbeebb037e2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 28 Mar 2018 17:14:06 +1300 Subject: [PATCH 05/28] Settings API JSDoc --- .../scripting/SettingsScriptingInterface.h | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/interface/src/scripting/SettingsScriptingInterface.h b/interface/src/scripting/SettingsScriptingInterface.h index 2fe55eaea0..9e0271601b 100644 --- a/interface/src/scripting/SettingsScriptingInterface.h +++ b/interface/src/scripting/SettingsScriptingInterface.h @@ -15,6 +15,11 @@ #include #include +/**jsdoc + * The Settings API provides a facility to store and retrieve values that persist between Interface runs. + * @namespace Settings + */ + class SettingsScriptingInterface : public QObject { Q_OBJECT SettingsScriptingInterface() { }; @@ -22,8 +27,37 @@ public: static SettingsScriptingInterface* getInstance(); public slots: + + /**jsdoc + * Retrieve the value from a named setting. + * @function Settings.getValue + * @param {string} key - The name of the setting. + * @param {string|number|boolean|object} [defaultValue=""] - The value to return if the setting doesn't exist. + * @returns {string|number|boolean|object} The value stored in the named setting if it exists, otherwise the + * defaultValue. + * @example Retrieve non-existent setting values. + * var value1 = Settings.getValue("Script Example/Nonexistent Key"); + * print("Value: " + (typeof value1) + " " + JSON.stringify(value1)); // string "" + * + * var value2 = Settings.getValue("Script Example/Nonexistent Key", true); + * print("Value: " + (typeof value2) + " " + JSON.stringify(value2)); // boolean true + */ QVariant getValue(const QString& setting); QVariant getValue(const QString& setting, const QVariant& defaultValue); + + /**jsdoc + * Store a value in a named setting. If the setting already exists its value is overwritten, otherwise a new setting is + * created. If the value is set to null or undefined, the setting is deleted. + * @function Settings.setValue + * @param {string} key - The name of the setting. Be sure to use a unique name if creating a new setting. + * @param {string|number|boolean|object|undefined} value - The value to store in the setting. If null or + * undefined is specified, the setting is deleted. + * @example Store and retrieve an object value. + * Settings.setValue("Script Example/My Key", { x: 0, y: 10, z: 0 }); + * + * var value = Settings.getValue("Script Example/My Key"); + * print("Value: " + (typeof value) + " " + JSON.stringify(value)); // object {"x":0,"y":10,"z":0} + */ void setValue(const QString& setting, const QVariant& value); }; From ec0874be1a2b8b9dcc3774b49bbd0ed371034ca0 Mon Sep 17 00:00:00 2001 From: Liv Erickson Date: Thu, 22 Mar 2018 17:16:02 -0700 Subject: [PATCH 06/28] fix for edit preferences not persisting --- scripts/system/edit.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index cfaf517487..12f5f05417 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -227,6 +227,9 @@ function adjustPositionPerBoundingBox(position, direction, registration, dimensi var TOOLS_PATH = Script.resolvePath("assets/images/tools/"); var GRABBABLE_ENTITIES_MENU_CATEGORY = "Edit"; var GRABBABLE_ENTITIES_MENU_ITEM = "Create Entities As Grabbable (except Zones, Particles, and Lights)"; +var ALLOW_SELECTION_LARGE = "Allow Selecting of Large Models"; +var ALLOW_SELECTION_SMALL = "Allow Selecting of Small Models"; +var ALLOW_SELECTION_LIGHTS = "Allow Selecting of Lights"; var toolBar = (function () { var EDIT_SETTING = "io.highfidelity.isEditing"; // for communication with other scripts @@ -1146,31 +1149,32 @@ function setupModelMenus() { menuItemName: GRABBABLE_ENTITIES_MENU_ITEM, afterItem: "Unparent Entity", isCheckable: true, - isChecked: true, + isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + GRABBABLE_ENTITIES_MENU_ITEM), grouping: "Advanced" }); Menu.addMenuItem({ menuName: "Edit", - menuItemName: "Allow Selecting of Large Models", + menuItemName: ALLOW_SELECTION_LARGE, afterItem: GRABBABLE_ENTITIES_MENU_ITEM, isCheckable: true, - isChecked: true, + isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + ALLOW_SELECTION_LARGE), grouping: "Advanced" }); Menu.addMenuItem({ menuName: "Edit", - menuItemName: "Allow Selecting of Small Models", - afterItem: "Allow Selecting of Large Models", + menuItemName: ALLOW_SELECTION_SMALL, + afterItem: ALLOW_SELECTION_LARGE, isCheckable: true, - isChecked: true, + isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + ALLOW_SELECTION_SMALL), grouping: "Advanced" }); Menu.addMenuItem({ menuName: "Edit", - menuItemName: "Allow Selecting of Lights", - afterItem: "Allow Selecting of Small Models", + menuItemName: ALLOW_SELECTION_LIGHTS, + afterItem: ALLOW_SELECTION_SMALL, isCheckable: true, + isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + ALLOW_SELECTION_LIGHTS), grouping: "Advanced" }); Menu.addMenuItem({ From 810930ff2356ee0858abd1e0378fc918c4c2b53d Mon Sep 17 00:00:00 2001 From: Liv Erickson Date: Fri, 23 Mar 2018 10:10:55 -0700 Subject: [PATCH 07/28] handle correct first time settings --- scripts/system/edit.js | 45 ++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 12f5f05417..316ec13631 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -116,11 +116,19 @@ var MENU_EASE_ON_FOCUS = "Ease Orientation on Focus"; var MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE = "Show Lights and Particle Systems in Create Mode"; var MENU_SHOW_ZONES_IN_EDIT_MODE = "Show Zones in Create Mode"; +var MENU_CREATE_ENTITIES_GRABBABLE = "Create Entities As Grabbable (except Zones, Particles, and Lights)"; +var MENU_ALLOW_SELECTION_LARGE = "Allow Selecting of Large Models"; +var MENU_ALLOW_SELECTION_SMALL = "Allow Selecting of Small Models"; +var MENU_ALLOW_SELECTION_LIGHTS = "Allow Selecting of Lights"; + var SETTING_AUTO_FOCUS_ON_SELECT = "autoFocusOnSelect"; var SETTING_EASE_ON_FOCUS = "cameraEaseOnFocus"; var SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE = "showLightsAndParticlesInEditMode"; var SETTING_SHOW_ZONES_IN_EDIT_MODE = "showZonesInEditMode"; +var SETTING_EDIT_PREFIX = "Edit/"; + + var CREATE_ENABLED_ICON = "icons/tablet-icons/edit-i.svg"; var CREATE_DISABLED_ICON = "icons/tablet-icons/edit-disabled.svg"; @@ -226,10 +234,7 @@ function adjustPositionPerBoundingBox(position, direction, registration, dimensi var TOOLS_PATH = Script.resolvePath("assets/images/tools/"); var GRABBABLE_ENTITIES_MENU_CATEGORY = "Edit"; -var GRABBABLE_ENTITIES_MENU_ITEM = "Create Entities As Grabbable (except Zones, Particles, and Lights)"; -var ALLOW_SELECTION_LARGE = "Allow Selecting of Large Models"; -var ALLOW_SELECTION_SMALL = "Allow Selecting of Small Models"; -var ALLOW_SELECTION_LIGHTS = "Allow Selecting of Lights"; + var toolBar = (function () { var EDIT_SETTING = "io.highfidelity.isEditing"; // for communication with other scripts @@ -283,7 +288,7 @@ var toolBar = (function () { position = grid.snapToSurface(grid.snapToGrid(position, false, dimensions), dimensions); properties.position = position; - if (Menu.isOptionChecked(GRABBABLE_ENTITIES_MENU_ITEM) && + if (Menu.isOptionChecked(MENU_CREATE_ENTITIES_GRABBABLE) && !(properties.type === "Zone" || properties.type === "Light" || properties.type === "ParticleEffect")) { properties.userData = JSON.stringify({ grabbableKey: { grabbable: true } }); } else { @@ -341,7 +346,7 @@ var toolBar = (function () { if (systemToolbar) { systemToolbar.removeButton(EDIT_TOGGLE_BUTTON); } - Menu.removeMenuItem(GRABBABLE_ENTITIES_MENU_CATEGORY, GRABBABLE_ENTITIES_MENU_ITEM); + Menu.removeMenuItem(GRABBABLE_ENTITIES_MENU_CATEGORY, MENU_CREATE_ENTITIES_GRABBABLE); } var buttonHandlers = {}; // only used to tablet mode @@ -1146,35 +1151,35 @@ function setupModelMenus() { Menu.addMenuItem({ menuName: GRABBABLE_ENTITIES_MENU_CATEGORY, - menuItemName: GRABBABLE_ENTITIES_MENU_ITEM, + menuItemName: MENU_CREATE_ENTITIES_GRABBABLE, afterItem: "Unparent Entity", isCheckable: true, - isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + GRABBABLE_ENTITIES_MENU_ITEM), + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_CREATE_ENTITIES_GRABBABLE) !== false, grouping: "Advanced" }); Menu.addMenuItem({ menuName: "Edit", - menuItemName: ALLOW_SELECTION_LARGE, - afterItem: GRABBABLE_ENTITIES_MENU_ITEM, + menuItemName: MENU_ALLOW_SELECTION_LARGE, + afterItem: MENU_CREATE_ENTITIES_GRABBABLE, isCheckable: true, - isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + ALLOW_SELECTION_LARGE), + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE) !== false, grouping: "Advanced" }); Menu.addMenuItem({ menuName: "Edit", - menuItemName: ALLOW_SELECTION_SMALL, - afterItem: ALLOW_SELECTION_LARGE, + menuItemName: MENU_ALLOW_SELECTION_SMALL, + afterItem: MENU_ALLOW_SELECTION_LARGE, isCheckable: true, - isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + ALLOW_SELECTION_SMALL), + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL) !== false, grouping: "Advanced" }); Menu.addMenuItem({ menuName: "Edit", - menuItemName: ALLOW_SELECTION_LIGHTS, - afterItem: ALLOW_SELECTION_SMALL, + menuItemName: MENU_ALLOW_SELECTION_LIGHTS, + afterItem: MENU_ALLOW_SELECTION_SMALL, isCheckable: true, - isChecked: Settings.getValue(GRABBABLE_ENTITIES_MENU_CATEGORY + "/" + ALLOW_SELECTION_LIGHTS), + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LIGHTS), grouping: "Advanced" }); Menu.addMenuItem({ @@ -1279,6 +1284,12 @@ Script.scriptEnding.connect(function () { Settings.setValue(SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE)); Settings.setValue(SETTING_SHOW_ZONES_IN_EDIT_MODE, Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE)); + Settings.setValue(SETTING_EDIT_PREFIX + MENU_CREATE_ENTITIES_GRABBABLE, Menu.isOptionChecked(MENU_CREATE_ENTITIES_GRABBABLE)); + Settings.setValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE, Menu.isOptionChecked(MENU_ALLOW_SELECTION_LARGE)); + Settings.setValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL, Menu.isOptionChecked(MENU_ALLOW_SELECTION_SMALL)); + Settings.setValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LIGHTS, Menu.isOptionChecked(GRABBABLE_ENTITIES_MENU_ITEM)); + + progressDialog.cleanup(); cleanupModelMenus(); tooltip.cleanup(); From 799963a00905e7115feb84a9e4ee962d4dbf2033 Mon Sep 17 00:00:00 2001 From: Livi Erickson Date: Fri, 30 Mar 2018 13:30:13 -0700 Subject: [PATCH 08/28] fix syntax based on CR feedback --- scripts/system/edit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 316ec13631..993e6017c5 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -1154,7 +1154,7 @@ function setupModelMenus() { menuItemName: MENU_CREATE_ENTITIES_GRABBABLE, afterItem: "Unparent Entity", isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_CREATE_ENTITIES_GRABBABLE) !== false, + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_CREATE_ENTITIES_GRABBABLE, true), grouping: "Advanced" }); @@ -1163,7 +1163,7 @@ function setupModelMenus() { menuItemName: MENU_ALLOW_SELECTION_LARGE, afterItem: MENU_CREATE_ENTITIES_GRABBABLE, isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE) !== false, + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE, true), grouping: "Advanced" }); Menu.addMenuItem({ @@ -1171,7 +1171,7 @@ function setupModelMenus() { menuItemName: MENU_ALLOW_SELECTION_SMALL, afterItem: MENU_ALLOW_SELECTION_LARGE, isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL) !== false, + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL, true), grouping: "Advanced" }); Menu.addMenuItem({ @@ -1179,7 +1179,7 @@ function setupModelMenus() { menuItemName: MENU_ALLOW_SELECTION_LIGHTS, afterItem: MENU_ALLOW_SELECTION_SMALL, isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LIGHTS), + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LIGHTS, false), grouping: "Advanced" }); Menu.addMenuItem({ From 7f3e9547cc8e4a3d6130a93f6764ee1ef20e6888 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 2 Apr 2018 11:55:10 -0700 Subject: [PATCH 09/28] Handle the case when metaverse returns error for certificateInfo --- interface/src/commerce/Ledger.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index 0a9e867323..b8a7903b42 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -334,7 +334,13 @@ void Ledger::certificateInfoSuccess(QNetworkReply& reply) { qInfo(commerce) << "certificateInfo" << "response" << QJsonDocument(replyObject).toJson(QJsonDocument::Compact); emit certificateInfoResult(replyObject); } -void Ledger::certificateInfoFailure(QNetworkReply& reply) { failResponse("certificateInfo", reply); } +void Ledger::certificateInfoFailure(QNetworkReply& reply) { + QByteArray response = reply.readAll(); + QJsonObject replyObject = QJsonDocument::fromJson(response).object(); + + failResponse("certificateInfo", reply); + emit certificateInfoResult(replyObject); +} void Ledger::certificateInfo(const QString& certificateId) { QString endpoint = "proof_of_purchase_status/transfer"; QJsonObject request; From 5441767442fa3d8c2d6629d21325b2e0c05abf62 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 2 Apr 2018 12:14:48 -0700 Subject: [PATCH 10/28] Better cert display --- .../InspectionCertificate.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml index a622349d00..6218a46853 100644 --- a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml +++ b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml @@ -52,6 +52,23 @@ Rectangle { onCertificateInfoResult: { if (result.status !== 'success') { console.log("Failed to get certificate info", result.message); + // We should still tell the user that static cert verification failed + if (root.certificateStatus !== 3) { // CERTIFICATE_STATUS_STATIC_VERIFICATION_FAILED + root.useGoldCert = false; + root.certTitleTextColor = hifi.colors.redHighlight; + root.certTextColor = hifi.colors.redHighlight; + root.infoTextColor = hifi.colors.redHighlight; + titleBarText.text = "Certificate Unavailable"; + popText.text = ""; + showInMarketplaceButton.visible = false; + root.certInfoReplaceMode = 0; + root.itemName = ""; + root.itemEdition = ""; + root.itemOwner = ""; + root.dateOfPurchase = ""; + root.itemCost = ""; + errorText.text = "Information about this certificate is currently unavailable. Please try again later."; + } } else { root.marketplaceUrl = result.data.marketplace_item_url; root.isMyCert = result.isMyCert ? result.isMyCert : false; From ab8ee20960b487a5156102bee7d6f4e4e497dda4 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 3 Apr 2018 10:00:19 +1200 Subject: [PATCH 11/28] Add Controller.Actions.Sprint as synonym of Controller.Actions.SPRINT --- libraries/controllers/src/controllers/Actions.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/controllers/src/controllers/Actions.cpp b/libraries/controllers/src/controllers/Actions.cpp index 359ff6b33a..06a487d6ea 100644 --- a/libraries/controllers/src/controllers/Actions.cpp +++ b/libraries/controllers/src/controllers/Actions.cpp @@ -128,6 +128,7 @@ namespace controller { makeButtonPair(Action::TOGGLE_MUTE, "ToggleMute"), makeButtonPair(Action::CYCLE_CAMERA, "CycleCamera"), makeButtonPair(Action::TOGGLE_OVERLAY, "ToggleOverlay"), + makeButtonPair(Action::SPRINT, "Sprint"), makeAxisPair(Action::RETICLE_CLICK, "ReticleClick"), makeAxisPair(Action::RETICLE_X, "ReticleX"), From 71d6dbf9bfb0219d44ba527d0db17eaa7cc9133a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 2 Apr 2018 15:52:28 -0700 Subject: [PATCH 12/28] allow ESS to edit local version of properties even if the entity isn't in the ESS's local octree --- libraries/entities/src/EntityItemProperties.h | 6 ++++++ .../entities/src/EntityScriptingInterface.cpp | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 9e5d6ddc79..713eedbd5d 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -502,6 +502,12 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) { DEBUG_PROPERTY_IF_CHANGED(debug, properties, CertificateID, certificateID, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, StaticCertificateVersion, staticCertificateVersion, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalPosition, localPosition, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalRotation, localRotation, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalVelocity, localVelocity, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalAngularVelocity, localAngularVelocity, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, LocalDimensions, localDimensions, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, HazeMode, hazeMode, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, KeyLightMode, keyLightMode, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientLightMode, ambientLightMode, ""); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 7e15e78624..70a4218607 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -523,6 +523,27 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& } } }); + } else { + // Sometimes ESS don't have the entity they are trying to edit in their local tree. In this case, + // convertPropertiesFromScriptSemantics doesn't get called and local* edits will get dropped. + // This is because, on the script side, "position" is in world frame, but in the network + // protocol and in the internal data-structures, "position" is "relative to parent". + // Compensate here. The local* versions will get ignored during the edit-packet encoding. + if (properties.localPositionChanged()) { + properties.setPosition(properties.getLocalPosition()); + } + if (properties.localRotationChanged()) { + properties.setRotation(properties.getLocalRotation()); + } + if (properties.localVelocityChanged()) { + properties.setVelocity(properties.getLocalVelocity()); + } + if (properties.localAngularVelocityChanged()) { + properties.setAngularVelocity(properties.getLocalAngularVelocity()); + } + if (properties.localDimensionsChanged()) { + properties.setDimensions(properties.getLocalDimensions()); + } } }); if (!entityFound) { From 63603ff97c7b528d8e529867f67ccd65c963fff9 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 3 Apr 2018 14:21:15 +1200 Subject: [PATCH 13/28] Fix window height reported by Window.geometryChanged() signal --- interface/src/scripting/WindowScriptingInterface.cpp | 11 ++++++++++- interface/src/scripting/WindowScriptingInterface.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index 58ec744f4e..7ca4e495b1 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -51,7 +51,7 @@ WindowScriptingInterface::WindowScriptingInterface() { } }); - connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::geometryChanged); + connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::onWindowGeometryChanged); } WindowScriptingInterface::~WindowScriptingInterface() { @@ -397,6 +397,15 @@ int WindowScriptingInterface::getY() { return qApp->getWindow()->y(); } +void WindowScriptingInterface::onWindowGeometryChanged(const QRect& windowGeometry) { + auto geometry = windowGeometry; + auto menu = qApp->getPrimaryMenu(); + if (menu) { + geometry.setHeight(geometry.height() - menu->geometry().height()); + } + emit geometryChanged(geometry); +} + void WindowScriptingInterface::copyToClipboard(const QString& text) { if (QThread::currentThread() != qApp->thread()) { QMetaObject::invokeMethod(this, "copyToClipboard", Q_ARG(QString, text)); diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index e3b092d011..b41051cc6b 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -522,6 +522,7 @@ public slots: void closeMessageBox(int id); private slots: + void onWindowGeometryChanged(const QRect& geometry); void onMessageBoxSelected(int button); void disconnectedFromDomain(); From ab55f2097670119bfb624a7463df072ee19f2747 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 3 Apr 2018 16:54:07 +1200 Subject: [PATCH 14/28] Fix text sizing per text3d overlay lineHeight property Makes text size correct for multiple lines of text. --- interface/src/ui/overlays/Text3DOverlay.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/overlays/Text3DOverlay.cpp b/interface/src/ui/overlays/Text3DOverlay.cpp index 9bb1da59d2..9c920efb93 100644 --- a/interface/src/ui/overlays/Text3DOverlay.cpp +++ b/interface/src/ui/overlays/Text3DOverlay.cpp @@ -20,7 +20,8 @@ #include const int FIXED_FONT_POINT_SIZE = 40; -const int FIXED_FONT_SCALING_RATIO = FIXED_FONT_POINT_SIZE * 80.0f; // this is a ratio determined through experimentation +const int FIXED_FONT_SCALING_RATIO = FIXED_FONT_POINT_SIZE * 92.0f; // Determined through experimentation to fit font to line + // height. const float LINE_SCALE_RATIO = 1.2f; QString const Text3DOverlay::TYPE = "text3d"; From ff88956d133f222ff6afe2cf76a701f202a6e514 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 3 Apr 2018 13:22:47 -0700 Subject: [PATCH 15/28] fix help.js noisy log reference to undefined string#startsWith --- scripts/system/help.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/help.js b/scripts/system/help.js index e29fc59e59..aaeb82721c 100644 --- a/scripts/system/help.js +++ b/scripts/system/help.js @@ -40,7 +40,7 @@ } function onScreenChanged(type, url) { - onHelpScreen = type === "Web" && url.startsWith(HELP_URL); + onHelpScreen = type === "Web" && (url.indexOf(HELP_URL) === 0); button.editProperties({ isActive: onHelpScreen }); } From 38f26a26476c9fe18ee735e9410df947926d5fbe Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 3 Apr 2018 13:34:05 -0700 Subject: [PATCH 16/28] Introduce safeLoading. --- .../qml/controls/FlickableWebViewCore.qml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/controls/FlickableWebViewCore.qml b/interface/resources/qml/controls/FlickableWebViewCore.qml index efc8519c1e..8e7db44b7d 100644 --- a/interface/resources/qml/controls/FlickableWebViewCore.qml +++ b/interface/resources/qml/controls/FlickableWebViewCore.qml @@ -122,9 +122,21 @@ Item { newViewRequestedCallback(request) } + // Prior to 5.10, the WebEngineView loading property is true during initial page loading and then stays false + // as in-page javascript adds more html content. However, in 5.10 there is a bug such that adding html turns + // loading true, and never turns it false again. safeLoading provides a workaround, but it should be removed + // when QT fixes this. + property bool safeLoading: false + property bool loadingLatched: false + property var loadingRequest: null onLoadingChanged: { - flick.onLoadingChanged(loadRequest) - loadingChangedCallback(loadRequest) + webViewCore.loadingRequest = loadRequest; + webViewCore.safeLoading = webViewCore.loading && !loadingLatched; + webViewCore.loadingLatched |= webViewCore.loading; + } + onSafeLoadingChanged: { + flick.onLoadingChanged(webViewCore.loadingRequest) + loadingChangedCallback(webViewCore.loadingRequest) } } @@ -133,7 +145,7 @@ Item { x: flick.width/2 - width/2 y: flick.height/2 - height/2 source: "../../icons/loader-snake-64-w.gif" - visible: webViewCore.loading && /^(http.*|)$/i.test(webViewCore.url.toString()) + visible: webViewCore.safeLoading && /^(http.*|)$/i.test(webViewCore.url.toString()) playing: visible z: 10000 } From a3c8b2792d2df9faf23a87e17c5450f2c8f734e4 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 4 Apr 2018 09:42:05 +1200 Subject: [PATCH 17/28] Fix Window.geometryChanged() values for moving and resizing window --- interface/src/scripting/WindowScriptingInterface.cpp | 2 +- libraries/ui/src/MainWindow.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index 7ca4e495b1..f65142f875 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -401,7 +401,7 @@ void WindowScriptingInterface::onWindowGeometryChanged(const QRect& windowGeomet auto geometry = windowGeometry; auto menu = qApp->getPrimaryMenu(); if (menu) { - geometry.setHeight(geometry.height() - menu->geometry().height()); + geometry.setY(geometry.y() + menu->geometry().height()); } emit geometryChanged(geometry); } diff --git a/libraries/ui/src/MainWindow.cpp b/libraries/ui/src/MainWindow.cpp index 091fd850af..f9fc71e417 100644 --- a/libraries/ui/src/MainWindow.cpp +++ b/libraries/ui/src/MainWindow.cpp @@ -79,12 +79,12 @@ void MainWindow::closeEvent(QCloseEvent* event) { } void MainWindow::moveEvent(QMoveEvent* event) { - emit windowGeometryChanged(QRect(event->pos(), size())); + emit windowGeometryChanged(QRect(QPoint(geometry().x(), geometry().y()), size())); // Geometry excluding the window frame. QMainWindow::moveEvent(event); } void MainWindow::resizeEvent(QResizeEvent* event) { - emit windowGeometryChanged(QRect(QPoint(x(), y()), event->size())); + emit windowGeometryChanged(QRect(QPoint(geometry().x(), geometry().y()), size())); // Geometry excluding the window frame. QMainWindow::resizeEvent(event); } From 6868ca971f35ba18838369b9c4a6f4a21a821d46 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 4 Apr 2018 09:43:39 +1200 Subject: [PATCH 18/28] Make Window.x and Window.y report top left of drawable area of window --- interface/src/scripting/WindowScriptingInterface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index f65142f875..9c46f9e98a 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -390,11 +390,13 @@ glm::vec2 WindowScriptingInterface::getDeviceSize() const { } int WindowScriptingInterface::getX() { - return qApp->getWindow()->x(); + return qApp->getWindow()->geometry().x(); } int WindowScriptingInterface::getY() { - return qApp->getWindow()->y(); + auto menu = qApp->getPrimaryMenu(); + int menuHeight = menu ? menu->geometry().height() : 0; + return qApp->getWindow()->geometry().y() + menuHeight; } void WindowScriptingInterface::onWindowGeometryChanged(const QRect& windowGeometry) { From 095c1b837c43ba9bb387cff37b34d8fde8081f14 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 4 Apr 2018 09:48:33 +1200 Subject: [PATCH 19/28] Update JSDoc --- interface/src/scripting/WindowScriptingInterface.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index b41051cc6b..dd74358064 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -33,8 +33,10 @@ * @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other * chrome), in pixels. Read-only. * @property {object} location - Provides facilities for working with your current metaverse location. See {@link location}. - * @property {number} x - The x coordinate of the top left corner of the Interface window on the display. Read-only. - * @property {number} y - The y coordinate of the top left corner of the Interface window on the display. Read-only. + * @property {number} x - The x display coordinate of the top left corner of the drawable area of the Interface window. + * Read-only. + * @property {number} y - The y display coordinate of the top left corner of the drawable area of the Interface window. + * Read-only. */ class WindowScriptingInterface : public QObject, public Dependency { From 1629756d53ebf4a1d98a59258fdcb31c75faa24e Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 3 Apr 2018 18:08:43 -0700 Subject: [PATCH 20/28] Adding more budget options for memory texture --- interface/src/Menu.cpp | 9 +++++++++ interface/src/Menu.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 6c071defff..df7546cd33 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -447,6 +447,9 @@ Menu::Menu() { textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture512MB, 0, false)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture1024MB, 0, false)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture2048MB, 0, false)); + textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture4096MB, 0, false)); + textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture6144MB, 0, false)); + textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture8192MB, 0, false)); connect(textureGroup, &QActionGroup::triggered, [textureGroup] { auto checked = textureGroup->checkedAction(); auto text = checked->text(); @@ -463,6 +466,12 @@ Menu::Menu() { newMaxTextureMemory = MB_TO_BYTES(1024); } else if (MenuOption::RenderMaxTexture2048MB == text) { newMaxTextureMemory = MB_TO_BYTES(2048); + } else if (MenuOption::RenderMaxTexture4096MB == text) { + newMaxTextureMemory = MB_TO_BYTES(4096); + } else if (MenuOption::RenderMaxTexture6144MB == text) { + newMaxTextureMemory = MB_TO_BYTES(6144); + } else if (MenuOption::RenderMaxTexture8192MB == text) { + newMaxTextureMemory = MB_TO_BYTES(8192); } gpu::Texture::setAllowedGPUMemoryUsage(newMaxTextureMemory); }); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index cf9eed1a27..4d418a16d2 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -155,6 +155,10 @@ namespace MenuOption { const QString RenderMaxTexture512MB = "512 MB"; const QString RenderMaxTexture1024MB = "1024 MB"; const QString RenderMaxTexture2048MB = "2048 MB"; + const QString RenderMaxTexture3072MB = "3072 MB"; + const QString RenderMaxTexture4096MB = "4096 MB"; + const QString RenderMaxTexture6144MB = "6144 MB"; + const QString RenderMaxTexture8192MB = "8192 MB"; const QString RenderResolution = "Scale Resolution"; const QString RenderResolutionOne = "1"; const QString RenderResolutionTwoThird = "2/3"; From 66f78ea2c756825a01155378356b80e7c62b5790 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 5 Apr 2018 10:39:27 -0700 Subject: [PATCH 21/28] update bake tool --- tools/bake-tools/bake.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/bake-tools/bake.py b/tools/bake-tools/bake.py index 0c8d5e1048..cad638c911 100644 --- a/tools/bake-tools/bake.py +++ b/tools/bake-tools/bake.py @@ -1,6 +1,16 @@ import os, json, sys, shutil, subprocess, shlex, time EXE = os.environ['HIFI_OVEN'] +def getRelativePath(path1, path2, stop): + parts1 = path1.split('/'); + parts2 = path2.split('/'); + if len(parts1) <= len(parts2): + for part in parts1: + if part != stop and part != '': + index = parts2.index(part) + parts2.pop(index) + return os.path.join(*parts2) + def listFiles(directory, extension): items = os.listdir(directory) fileList = [] @@ -44,18 +54,20 @@ def bakeFile(filePath, outputDirectory): groupKTXFiles(outputDirectory, bakedFile) def bakeFilesInDirectory(directory, outputDirectory): + rootDirectory = os.path.basename(os.path.normpath(directory)) for root, subFolders, filenames in os.walk(directory): for filename in filenames: + appendPath = getRelativePath(directory, root, rootDirectory); if filename.endswith('.fbx'): filePath = os.sep.join([root, filename]) absFilePath = os.path.abspath(filePath) - outputFolder = os.path.join(outputDirectory, os.path.relpath(root)) + outputFolder = os.path.join(outputDirectory, appendPath) print "Baking file: " + filename bakeFile(absFilePath, outputFolder) else: filePath = os.sep.join([root, filename]) absFilePath = os.path.abspath(filePath) - outputFolder = os.path.join(outputDirectory, os.path.relpath(root)) + outputFolder = os.path.join(outputDirectory, appendPath) newFilePath = os.sep.join([outputFolder, filename]) createDirectory(outputFolder) print "moving file: " + filename + " to: " + outputFolder From 0c48ccefa4f1536b49c58ab2dc052ac0dd33ea70 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 6 Apr 2018 11:41:17 -0700 Subject: [PATCH 22/28] Clean up failResponse to make it better --- .../InspectionCertificate.qml | 2 +- interface/src/commerce/Ledger.cpp | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml index 6218a46853..009aa8f852 100644 --- a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml +++ b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml @@ -51,7 +51,7 @@ Rectangle { onCertificateInfoResult: { if (result.status !== 'success') { - console.log("Failed to get certificate info", result.message); + console.log("Failed to get certificate info", result.data.message); // We should still tell the user that static cert verification failed if (root.certificateStatus !== 3) { // CERTIFICATE_STATUS_STATIC_VERIFICATION_FAILED root.useGoldCert = false; diff --git a/interface/src/commerce/Ledger.cpp b/interface/src/commerce/Ledger.cpp index e84fb84017..573d4db33c 100644 --- a/interface/src/commerce/Ledger.cpp +++ b/interface/src/commerce/Ledger.cpp @@ -35,12 +35,19 @@ QJsonObject Ledger::apiResponse(const QString& label, QNetworkReply& reply) { QJsonObject Ledger::failResponse(const QString& label, QNetworkReply& reply) { QString response = reply.readAll(); qWarning(commerce) << "FAILED" << label << response; - QJsonObject result - { - { "status", "fail" }, - { "message", response } - }; - return result; + + // tempResult will be NULL if the response isn't valid JSON. + QJsonDocument tempResult = QJsonDocument::fromJson(response.toLocal8Bit()); + if (tempResult.isNull()) { + QJsonObject result + { + { "status", "fail" }, + { "message", response } + }; + return result; + } else { + return tempResult.object(); + } } #define ApiHandler(NAME) void Ledger::NAME##Success(QNetworkReply& reply) { emit NAME##Result(apiResponse(#NAME, reply)); } #define FailHandler(NAME) void Ledger::NAME##Failure(QNetworkReply& reply) { emit NAME##Result(failResponse(#NAME, reply)); } @@ -338,11 +345,7 @@ void Ledger::certificateInfoSuccess(QNetworkReply& reply) { emit certificateInfoResult(replyObject); } void Ledger::certificateInfoFailure(QNetworkReply& reply) { - QByteArray response = reply.readAll(); - QJsonObject replyObject = QJsonDocument::fromJson(response).object(); - - failResponse("certificateInfo", reply); - emit certificateInfoResult(replyObject); + emit certificateInfoResult(failResponse("certificateInfo", reply)); } void Ledger::certificateInfo(const QString& certificateId) { QString endpoint = "proof_of_purchase_status/transfer"; From 8f65813924e20e25a4090db82674c0092bed36eb Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 9 Apr 2018 17:10:49 -0700 Subject: [PATCH 23/28] fix asserts on domain switch --- libraries/entities/src/EntityItem.cpp | 2 +- libraries/physics/src/PhysicalEntitySimulation.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index aab8777862..fe88f21a23 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -62,7 +62,7 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) : EntityItem::~EntityItem() { // these pointers MUST be correct at delete, else we probably have a dangling backpointer // to this EntityItem in the corresponding data structure. - assert(!_simulated); + assert(!_simulated || (!_element && !_physicsInfo)); assert(!_element); assert(!_physicsInfo); } diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index d799577fc2..06e7069f72 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -158,7 +158,6 @@ void PhysicalEntitySimulation::clearEntitiesInternal() { EntityMotionState* motionState = static_cast(&(*stateItr)); assert(motionState); EntityItemPointer entity = motionState->getEntity(); - entity->setPhysicsInfo(nullptr); // TODO: someday when we invert the entities/physics lib dependencies we can let EntityItem delete its own PhysicsInfo // until then we must do it here delete motionState; From 6c155776535d9175573eec1d34cb396ef8a16c27 Mon Sep 17 00:00:00 2001 From: Liv Erickson Date: Tue, 10 Apr 2018 09:18:54 -0700 Subject: [PATCH 24/28] style fixes for eslint --- scripts/system/libraries/gridTool.js | 60 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/scripts/system/libraries/gridTool.js b/scripts/system/libraries/gridTool.js index a991d66b40..fe2938326a 100644 --- a/scripts/system/libraries/gridTool.js +++ b/scripts/system/libraries/gridTool.js @@ -1,6 +1,6 @@ var GRID_CONTROLS_HTML_URL = Script.resolvePath('../html/gridControls.html'); -Grid = function (opts) { +Grid = function(opts) { var that = {}; var gridColor = { red: 0, green: 0, blue: 0 }; var gridAlpha = 0.6; @@ -29,52 +29,54 @@ Grid = function (opts) { that.visible = false; that.enabled = false; - that.getOrigin = function () { + that.getOrigin = function() { return origin; }; - that.getMinorIncrement = function () { + that.getMinorIncrement = function() { return minorGridEvery; }; - that.setMinorIncrement = function (value) { + that.setMinorIncrement = function(value) { minorGridEvery = value; updateGrid(); }; - that.getMajorIncrement = function () { + that.getMajorIncrement = function() { return majorGridEvery; }; - that.setMajorIncrement = function (value) { + that.setMajorIncrement = function(value) { majorGridEvery = value; updateGrid(); }; - that.getColor = function () { + that.getColor = function() { return gridColor; }; - that.setColor = function (value) { + that.setColor = function(value) { gridColor = value; updateGrid(); }; - that.getSnapToGrid = function () { + that.getSnapToGrid = function() { return snapToGrid; }; - that.setSnapToGrid = function (value) { + that.setSnapToGrid = function(value) { snapToGrid = value; that.emitUpdate(); }; - that.setEnabled = function (enabled) { + that.setEnabled = function(enabled) { that.enabled = enabled; updateGrid(); }; - that.getVisible = function () { return that.visible; }; - that.setVisible = function (visible, noUpdate) { + that.getVisible = function() { + return that.visible; + }; + that.setVisible = function(visible, noUpdate) { that.visible = visible; updateGrid(); @@ -83,7 +85,7 @@ Grid = function (opts) { } }; - that.snapToSurface = function (position, dimensions, registration) { + that.snapToSurface = function(position, dimensions, registration) { if (!snapToGrid) { return position; } @@ -103,7 +105,7 @@ Grid = function (opts) { }; }; - that.snapToGrid = function (position, majorOnly, dimensions, registration) { + that.snapToGrid = function(position, majorOnly, dimensions, registration) { if (!snapToGrid) { return position; } @@ -125,9 +127,9 @@ Grid = function (opts) { position.z = Math.round(position.z / spacing) * spacing; return Vec3.sum(Vec3.sum(position, Vec3.multiplyVbyV(registration, dimensions)), origin); - } + }; - that.snapToSpacing = function (delta, majorOnly) { + that.snapToSpacing = function(delta, majorOnly) { if (!snapToGrid) { return delta; } @@ -144,7 +146,7 @@ Grid = function (opts) { }; - that.setPosition = function (newPosition, noUpdate) { + that.setPosition = function(newPosition, noUpdate) { origin = { x: 0, y: newPosition.y, z: 0 }; updateGrid(); @@ -153,7 +155,7 @@ Grid = function (opts) { } }; - that.emitUpdate = function () { + that.emitUpdate = function() { if (that.onUpdate) { that.onUpdate({ origin: origin, @@ -166,7 +168,7 @@ Grid = function (opts) { } }; - that.update = function (data) { + that.update = function(data) { if (data.snapToGrid !== undefined) { snapToGrid = data.snapToGrid; } @@ -223,7 +225,7 @@ Grid = function (opts) { that.addListener = function (callback) { that.onUpdate = callback; - } + }; Script.scriptEnding.connect(cleanup); updateGrid(); @@ -233,7 +235,7 @@ Grid = function (opts) { return that; }; -GridTool = function (opts) { +GridTool = function(opts) { var that = {}; var horizontalGrid = opts.horizontalGrid; @@ -244,18 +246,18 @@ GridTool = function (opts) { webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); webView.setVisible = function (value) { }; - horizontalGrid.addListener(function (data) { + horizontalGrid.addListener(function(data) { webView.emitScriptEvent(JSON.stringify(data)); if (selectionDisplay) { selectionDisplay.updateHandles(); } }); - webView.webEventReceived.connect(function (data) { + webView.webEventReceived.connect(function(data) { try { data = JSON.parse(data); } catch (e) { - print("gridTool.js: Error parsing JSON: " + e.name + " data " + data) + print("gridTool.js: Error parsing JSON: " + e.name + " data " + data); return; } @@ -282,13 +284,13 @@ GridTool = function (opts) { } }); - that.addListener = function (callback) { + that.addListener = function(callback) { listeners.push(callback); - } + }; - that.setVisible = function (visible) { + that.setVisible = function(visible) { webView.setVisible(visible); - } + }; return that; }; From 20ee1690547911038580ba48b166ea02f872a36b Mon Sep 17 00:00:00 2001 From: Liv Erickson Date: Tue, 10 Apr 2018 09:23:14 -0700 Subject: [PATCH 25/28] two more spaces --- scripts/system/libraries/gridTool.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/libraries/gridTool.js b/scripts/system/libraries/gridTool.js index fe2938326a..3be6ac0b00 100644 --- a/scripts/system/libraries/gridTool.js +++ b/scripts/system/libraries/gridTool.js @@ -223,7 +223,7 @@ Grid = function(opts) { Overlays.deleteOverlay(gridOverlay); } - that.addListener = function (callback) { + that.addListener = function(callback) { that.onUpdate = callback; }; @@ -244,7 +244,7 @@ GridTool = function(opts) { var webView = null; webView = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - webView.setVisible = function (value) { }; + webView.setVisible = function(value) { }; horizontalGrid.addListener(function(data) { webView.emitScriptEvent(JSON.stringify(data)); From c7be6e09346618542f52ba503a992eaf85e1ffea Mon Sep 17 00:00:00 2001 From: Liv Date: Tue, 10 Apr 2018 12:15:57 -0700 Subject: [PATCH 26/28] Update edit.js remove the unneeded manual removal of the create setting - it's handled with the rest of the menu items now, and this was causing it to default to false every start.. tested locally but might have gotten in a weird state, so fixing in GH editor. --- scripts/system/edit.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 993e6017c5..ea22359805 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -346,7 +346,6 @@ var toolBar = (function () { if (systemToolbar) { systemToolbar.removeButton(EDIT_TOGGLE_BUTTON); } - Menu.removeMenuItem(GRABBABLE_ENTITIES_MENU_CATEGORY, MENU_CREATE_ENTITIES_GRABBABLE); } var buttonHandlers = {}; // only used to tablet mode From 0d237f84b04b374a21b9dce6b499553010bd50b4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 10 Apr 2018 14:56:47 -0700 Subject: [PATCH 27/28] remove the installer information file during uninstall --- cmake/templates/NSIS.template.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index bdedf4cbba..28ac320e42 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -1234,6 +1234,9 @@ Section "Uninstall" @CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ + ;Remove the installer information file + Delete "$INSTDIR\installer.ini" + ;Remove files we installed. ;Keep the list of directories here in sync with the File commands above. @CPACK_NSIS_DELETE_FILES@ From 7ec65e8c0ca8f850fd576db77b9e97c6251d9583 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 10 Apr 2018 15:02:23 -0700 Subject: [PATCH 28/28] fix unreadable baked textures in serverless tutorial --- cmake/externals/serverless-content/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/externals/serverless-content/CMakeLists.txt b/cmake/externals/serverless-content/CMakeLists.txt index 4d0773f5f5..adfde4439a 100644 --- a/cmake/externals/serverless-content/CMakeLists.txt +++ b/cmake/externals/serverless-content/CMakeLists.txt @@ -4,8 +4,8 @@ set(EXTERNAL_NAME serverless-content) ExternalProject_Add( ${EXTERNAL_NAME} - URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC66-v2.zip - URL_MD5 d76bdb3e2bf7ae5d20115bd97b0c44a8 + URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC66-v3.zip + URL_MD5 ea608c2e4c90539ab3c1d66acf0e005a CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""