From 9abd0943ffcca7509828b06b4294f1076d77bc3c Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 27 Mar 2019 16:29:04 -0700 Subject: [PATCH 1/2] Add new web and other properties to Create --- .../system/assets/data/createAppTooltips.json | 21 +++++++ scripts/system/html/js/createAppTooltip.js | 4 +- scripts/system/html/js/entityProperties.js | 57 ++++++++++++++++++- 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/scripts/system/assets/data/createAppTooltips.json b/scripts/system/assets/data/createAppTooltips.json index 7201cdecad..ec23925a50 100644 --- a/scripts/system/assets/data/createAppTooltips.json +++ b/scripts/system/assets/data/createAppTooltips.json @@ -549,6 +549,27 @@ "acceleration": { "tooltip": "A acceleration that the entity should move with, in world space." }, + "renderLayer": { + "tooltip": "The layer on which this entity is rendered." + }, + "primitiveMode": { + "tooltip": "The mode in which to draw an entity, either \"Solid\" or \"Wireframe\"." + }, + "groupCulled": { + "tooltip": "If false, individual pieces of the entity may be culled by the render engine. If true, either the entire entity will be culled, or it won't at all." + }, + "webColor": { + "tooltip": "The tint of the web entity." + }, + "webAlpha": { + "tooltip": "The alpha of the web entity." + }, + "maxFPS": { + "tooltip": "The FPS at which to render the web entity. Higher values will have a performance impact." + }, + "scriptURL": { + "tooltip": "The URL of a script to inject into the web page." + }, "alignToGrid": { "tooltip": "Used to align entities to the grid, or floor of the environment.", "skipJSProperty": true diff --git a/scripts/system/html/js/createAppTooltip.js b/scripts/system/html/js/createAppTooltip.js index a5c961a7e2..3eb206d8a3 100644 --- a/scripts/system/html/js/createAppTooltip.js +++ b/scripts/system/html/js/createAppTooltip.js @@ -43,7 +43,7 @@ CreateAppTooltip.prototype = { this._tooltipData = tooltipData; }, - registerTooltipElement: function(element, tooltipID) { + registerTooltipElement: function(element, tooltipID, jsPropertyName) { element.addEventListener("mouseover", function() { if (!this._isEnabled) { return; @@ -70,7 +70,7 @@ CreateAppTooltip.prototype = { elTipDescription.innerText = tooltipData.tooltip; elTip.appendChild(elTipDescription); - let jsAttribute = tooltipID; + let jsAttribute = jsPropertyName; if (tooltipData.jsPropertyName) { jsAttribute = tooltipData.jsPropertyName; } diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index f259b0a017..0b2e575fbe 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -75,6 +75,25 @@ const GROUPS = [ propertyID: "visible", replaceID: "placeholder-property-visible", }, + { + label: "Render Layer", + type: "dropdown", + options: { + world: "World", + front: "Front", + hud: "HUD" + }, + propertyID: "renderLayer", + }, + { + label: "Primitive Mode", + type: "dropdown", + options: { + solid: "Solid", + lines: "Wireframe", + }, + propertyID: "primitiveMode", + }, ] }, { @@ -520,6 +539,11 @@ const GROUPS = [ readOnly: true, hideIfCertified: true, }, + { + label: "Group Culled", + type: "bool", + propertyID: "groupCulled", + }, ] }, { @@ -579,6 +603,35 @@ const GROUPS = [ type: "number-draggable", propertyID: "dpi", }, + { + label: "Web Color", + type: "color", + propertyID: "webColor", + propertyName: "color", // actual entity property name + }, + { + label: "Web Alpha", + type: "number-draggable", + step: 0.001, + decimals: 3, + propertyID: "webAlpha", + propertyName: "alpha", + }, + { + label: "Max FPS", + type: "number-draggable", + step: 1, + decimals: 0, + min: 0, + max: 240, + propertyID: "maxFPS", + }, + { + label: "Script URL", + type: "string", + propertyID: "scriptURL", + placeholder: "URL", + }, ] }, { @@ -3152,7 +3205,7 @@ function loaded() { } if (elLabel) { - createAppTooltip.registerTooltipElement(elLabel.childNodes[0], propertyID); + createAppTooltip.registerTooltipElement(elLabel.childNodes[0], propertyID, propertyName); } let elProperty = createElementFromHTML('
'); @@ -3177,7 +3230,7 @@ function loaded() { property.spaceMode = propertySpaceMode; let elLabel = createElementFromHTML(`
${innerPropertyData.label}
`); - createAppTooltip.registerTooltipElement(elLabel, propertyID); + createAppTooltip.registerTooltipElement(elLabel, propertyID, propertyName); elWrapper.appendChild(elLabel); From 9c4b3f017fa0417cfe23e088f1366dbff592e5ec Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 5 Apr 2019 15:08:48 -0700 Subject: [PATCH 2/2] Remove min/max on web entity maxFPS Instead, let the C++ side enforce any limits. If we enforce a hard limit later on, we can get them via `Entities.getPropertyInfo`. --- scripts/system/html/js/entityProperties.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/system/html/js/entityProperties.js b/scripts/system/html/js/entityProperties.js index 0b2e575fbe..382413586a 100644 --- a/scripts/system/html/js/entityProperties.js +++ b/scripts/system/html/js/entityProperties.js @@ -622,8 +622,6 @@ const GROUPS = [ type: "number-draggable", step: 1, decimals: 0, - min: 0, - max: 240, propertyID: "maxFPS", }, {