Merge pull request #14540 from huffman/feat/hide-certified-urls

Add hiding of certified properties in Create
This commit is contained in:
Ryan Huffman 2018-12-07 13:42:23 -08:00 committed by GitHub
commit a42a771df5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 13 deletions

View file

@ -23,6 +23,7 @@ const SCROLLBAR_WIDTH = 20;
const RESIZER_WIDTH = 10; const RESIZER_WIDTH = 10;
const DELTA_X_MOVE_COLUMNS_THRESHOLD = 2; const DELTA_X_MOVE_COLUMNS_THRESHOLD = 2;
const DELTA_X_COLUMN_SWAP_POSITION = 5; const DELTA_X_COLUMN_SWAP_POSITION = 5;
const CERTIFIED_PLACEHOLDER = "** Certified **";
const COLUMNS = { const COLUMNS = {
type: { type: {
@ -635,10 +636,11 @@ function loaded() {
id: entity.id, id: entity.id,
name: entity.name, name: entity.name,
type: type, type: type,
url: filename, url: entity.certificateID === "" ? filename : "<i>" + CERTIFIED_PLACEHOLDER + "</i>",
fullUrl: entity.url, fullUrl: entity.certificateID === "" ? filename : CERTIFIED_PLACEHOLDER,
locked: entity.locked, locked: entity.locked,
visible: entity.visible, visible: entity.visible,
certificateID: entity.certificateID,
verticesCount: displayIfNonZero(entity.verticesCount), verticesCount: displayIfNonZero(entity.verticesCount),
texturesCount: displayIfNonZero(entity.texturesCount), texturesCount: displayIfNonZero(entity.texturesCount),
texturesSize: decimalMegabytes(entity.texturesSize), texturesSize: decimalMegabytes(entity.texturesSize),
@ -876,7 +878,7 @@ function loaded() {
if (column.data.glyph) { if (column.data.glyph) {
elCell.innerHTML = itemData[column.data.propertyID] ? column.data.columnHeader : null; elCell.innerHTML = itemData[column.data.propertyID] ? column.data.columnHeader : null;
} else { } else {
elCell.innerText = itemData[column.data.propertyID]; elCell.innerHTML = itemData[column.data.propertyID];
} }
elCell.style = "min-width:" + column.widthPx + "px;" + "max-width:" + column.widthPx + "px;"; elCell.style = "min-width:" + column.widthPx + "px;" + "max-width:" + column.widthPx + "px;";
elCell.className = createColumnClassName(column.columnID); elCell.className = createColumnClassName(column.columnID);

View file

@ -390,7 +390,9 @@ const GROUPS = [
{ {
label: "Model", label: "Model",
type: "string", type: "string",
placeholder: "URL",
propertyID: "modelURL", propertyID: "modelURL",
hideIfCertified: true,
}, },
{ {
label: "Collision Shape", label: "Collision Shape",
@ -404,11 +406,13 @@ const GROUPS = [
label: "Compound Shape", label: "Compound Shape",
type: "string", type: "string",
propertyID: "compoundShapeURL", propertyID: "compoundShapeURL",
hideIfCertified: true,
}, },
{ {
label: "Animation", label: "Animation",
type: "string", type: "string",
propertyID: "animation.url", propertyID: "animation.url",
hideIfCertified: true,
}, },
{ {
label: "Play Automatically", label: "Play Automatically",
@ -460,6 +464,7 @@ const GROUPS = [
type: "textarea", type: "textarea",
propertyID: "originalTextures", propertyID: "originalTextures",
readOnly: true, readOnly: true,
hideIfCertified: true,
}, },
] ]
}, },
@ -1187,6 +1192,7 @@ const GROUPS = [
buttons: [ { id: "reload", label: "F", className: "glyph", onClick: reloadScripts } ], buttons: [ { id: "reload", label: "F", className: "glyph", onClick: reloadScripts } ],
propertyID: "script", propertyID: "script",
placeholder: "URL", placeholder: "URL",
hideIfCertified: true,
}, },
{ {
label: "Server Script", label: "Server Script",
@ -1273,6 +1279,7 @@ const GROUPS = [
placeholder: "URL", placeholder: "URL",
propertyID: "collisionSoundURL", propertyID: "collisionSoundURL",
showPropertyRule: { "collisionless": "false" }, showPropertyRule: { "collisionless": "false" },
hideIfCertified: true,
}, },
{ {
label: "Dynamic", label: "Dynamic",
@ -3090,6 +3097,15 @@ function loaded() {
showGroupsForType(selectedEntityProperties.type); showGroupsForType(selectedEntityProperties.type);
if (selectedEntityProperties.locked) {
disableProperties();
getPropertyInputElement("locked").removeAttribute('disabled');
} else {
enableProperties();
disableSaveUserDataButton();
disableSaveMaterialDataButton()
}
for (let propertyID in properties) { for (let propertyID in properties) {
let property = properties[propertyID]; let property = properties[propertyID];
let propertyData = property.data; let propertyData = property.data;
@ -3101,6 +3117,14 @@ function loaded() {
continue; continue;
} }
if (propertyData.hideIfCertified) {
let shouldHide = selectedEntityProperties.certificateID !== "";
if (shouldHide) {
propertyValue = "** Certified **";
}
property.elInput.disabled = shouldHide;
}
let isPropertyNotNumber = false; let isPropertyNotNumber = false;
switch (propertyData.type) { switch (propertyData.type) {
case 'number': case 'number':
@ -3278,15 +3302,6 @@ function loaded() {
hideMaterialDataSaved(); hideMaterialDataSaved();
} }
if (selectedEntityProperties.locked) {
disableProperties();
getPropertyInputElement("locked").removeAttribute('disabled');
} else {
enableProperties();
disableSaveUserDataButton();
disableSaveMaterialDataButton()
}
let activeElement = document.activeElement; let activeElement = document.activeElement;
if (doSelectElement && typeof activeElement.select !== "undefined") { if (doSelectElement && typeof activeElement.select !== "undefined") {
activeElement.select(); activeElement.select();

View file

@ -164,7 +164,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
var cameraPosition = Camera.position; var cameraPosition = Camera.position;
PROFILE("getMultipleProperties", function () { PROFILE("getMultipleProperties", function () {
var multipleProperties = Entities.getMultipleEntityProperties(ids, ['name', 'type', 'locked', var multipleProperties = Entities.getMultipleEntityProperties(ids, ['name', 'type', 'locked',
'visible', 'renderInfo', 'modelURL', 'materialURL', 'script']); 'visible', 'renderInfo', 'modelURL', 'materialURL', 'script', 'certificateID']);
for (var i = 0; i < multipleProperties.length; i++) { for (var i = 0; i < multipleProperties.length; i++) {
var properties = multipleProperties[i]; var properties = multipleProperties[i];
@ -182,6 +182,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
url: url, url: url,
locked: properties.locked, locked: properties.locked,
visible: properties.visible, visible: properties.visible,
certificateID: properties.certificateID,
verticesCount: (properties.renderInfo !== undefined ? verticesCount: (properties.renderInfo !== undefined ?
valueIfDefined(properties.renderInfo.verticesCount) : ""), valueIfDefined(properties.renderInfo.verticesCount) : ""),
texturesCount: (properties.renderInfo !== undefined ? texturesCount: (properties.renderInfo !== undefined ?