Merge pull request #14544 from huffman/fix/particle-property-layout

Improve Create properties for particles + materials
This commit is contained in:
John Conklin II 2018-12-06 16:45:44 -08:00 committed by GitHub
commit 88efaaa4c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 35 deletions

View file

@ -267,7 +267,7 @@
"jsPropertyName": "parentMaterialName" "jsPropertyName": "parentMaterialName"
}, },
"selectSubmesh": { "selectSubmesh": {
"tooltip": "If enabled, \"Select Submesh\" property will show up, otherwise \"Material Name to Replace\" will be shown.", "tooltip": "If enabled, \"Submesh to Replace\" property will show up, otherwise \"Material to Replace\" will be shown.",
"skipJSProperty": true "skipJSProperty": true
}, },
"priority": { "priority": {

View file

@ -598,6 +598,7 @@ div.section[collapsed="true"], div.section[collapsed="true"] > .section-header {
.triple-label { .triple-label {
text-transform: uppercase; text-transform: uppercase;
text-align: center;
padding: 6px 0; padding: 6px 0;
} }
@ -605,6 +606,10 @@ div.section[collapsed="true"], div.section[collapsed="true"] > .section-header {
margin-right: 10px; margin-right: 10px;
} }
.triple-item.rgb.fstuple {
display: block !important;
}
.section-header[collapsed="true"] { .section-header[collapsed="true"] {
margin-bottom: -21px; margin-bottom: -21px;
} }
@ -911,14 +916,17 @@ div.refresh input[type="button"] {
clear: both; clear: both;
} }
.draggable-number-container {
flex: 0 1 124px;
}
.draggable-number { .draggable-number {
position: relative; position: relative;
}
.draggable-number div {
height: 28px; height: 28px;
width: 124px; flex: 0 1 124px;
} }
.draggable-number.text {
.draggable-number .text {
position: absolute;
display: inline-block; display: inline-block;
color: #afafaf; color: #afafaf;
background-color: #252525; background-color: #252525;
@ -930,11 +938,12 @@ div.refresh input[type="button"] {
width: 100%; width: 100%;
line-height: 2; line-height: 2;
box-sizing: border-box; box-sizing: border-box;
z-index: 1;
} }
.draggable-number.text:hover { .draggable-number .text:hover {
cursor: ew-resize; cursor: ew-resize;
} }
.draggable-number span { .draggable-number .left-arrow, .draggable-number .right-arrow {
position: absolute; position: absolute;
display: inline-block; display: inline-block;
font-family: HiFi-Glyphs; font-family: HiFi-Glyphs;
@ -944,12 +953,12 @@ div.refresh input[type="button"] {
.draggable-number span:hover { .draggable-number span:hover {
cursor: default; cursor: default;
} }
.draggable-number.left-arrow { .draggable-number .left-arrow {
top: 3px; top: 3px;
left: 0px; left: 0px;
transform: rotate(180deg); transform: rotate(180deg);
} }
.draggable-number.right-arrow { .draggable-number .right-arrow {
top: 3px; top: 3px;
right: 0px; right: 0px;
} }
@ -1514,6 +1523,7 @@ input.rename-entity {
width: 258px; width: 258px;
min-height: 20px; min-height: 20px;
padding: 5px; padding: 5px;
z-index: 100;
} }
.create-app-tooltip .create-app-tooltip-description { .create-app-tooltip .create-app-tooltip-description {
@ -1629,10 +1639,6 @@ input.number-slider {
flex-flow: column; flex-flow: column;
} }
.flex-column + .flex-column {
padding-left: 50px;
}
.flex-center { .flex-center {
align-items: center; align-items: center;
} }

View file

@ -170,8 +170,8 @@ DraggableNumber.prototype = {
this.elDiv = document.createElement('div'); this.elDiv = document.createElement('div');
this.elDiv.className = "draggable-number"; this.elDiv.className = "draggable-number";
this.elText = document.createElement('label'); this.elText = document.createElement('span');
this.elText.className = "draggable-number text"; this.elText.className = "text";
this.elText.innerText = " "; this.elText.innerText = " ";
this.elText.style.visibility = "visible"; this.elText.style.visibility = "visible";
this.elText.addEventListener("mousedown", this.onMouseDown); this.elText.addEventListener("mousedown", this.onMouseDown);
@ -179,15 +179,15 @@ DraggableNumber.prototype = {
this.elLeftArrow = document.createElement('span'); this.elLeftArrow = document.createElement('span');
this.elRightArrow = document.createElement('span'); this.elRightArrow = document.createElement('span');
this.elLeftArrow.className = 'draggable-number left-arrow'; this.elLeftArrow.className = 'left-arrow';
this.elLeftArrow.innerHTML = 'D'; this.elLeftArrow.innerHTML = 'D';
this.elLeftArrow.addEventListener("click", this.onStepDown); this.elLeftArrow.addEventListener("click", this.onStepDown);
this.elRightArrow.className = 'draggable-number right-arrow'; this.elRightArrow.className = 'right-arrow';
this.elRightArrow.innerHTML = 'D'; this.elRightArrow.innerHTML = 'D';
this.elRightArrow.addEventListener("click", this.onStepUp); this.elRightArrow.addEventListener("click", this.onStepUp);
this.elInput = document.createElement('input'); this.elInput = document.createElement('input');
this.elInput.className = "draggable-number input"; this.elInput.className = "input";
this.elInput.setAttribute("type", "number"); this.elInput.setAttribute("type", "number");
if (this.min !== undefined) { if (this.min !== undefined) {
this.elInput.setAttribute("min", this.min); this.elInput.setAttribute("min", this.min);
@ -205,8 +205,8 @@ DraggableNumber.prototype = {
this.elInput.addEventListener("focus", this.showInput.bind(this)); this.elInput.addEventListener("focus", this.showInput.bind(this));
this.elDiv.appendChild(this.elLeftArrow); this.elDiv.appendChild(this.elLeftArrow);
this.elDiv.appendChild(this.elText);
this.elDiv.appendChild(this.elInput); this.elDiv.appendChild(this.elInput);
this.elDiv.appendChild(this.elRightArrow); this.elDiv.appendChild(this.elRightArrow);
this.elDiv.appendChild(this.elText);
} }
}; };

View file

@ -556,22 +556,24 @@ const GROUPS = [
{ id: "save", label: "Save Material Data", className: "black", onClick: saveMaterialData } ], { id: "save", label: "Save Material Data", className: "black", onClick: saveMaterialData } ],
propertyID: "materialData", propertyID: "materialData",
}, },
{
label: "Select Submesh",
type: "bool",
propertyID: "selectSubmesh",
},
{ {
label: "Submesh to Replace", label: "Submesh to Replace",
type: "number", type: "number",
min: 0, min: 0,
step: 1, step: 1,
propertyID: "submeshToReplace", propertyID: "submeshToReplace",
indentedLabel: true,
}, },
{ {
label: "Material Name to Replace", label: "Material to Replace",
type: "string", type: "string",
propertyID: "materialNameToReplace", propertyID: "materialNameToReplace",
}, indentedLabel: true,
{
label: "Select Submesh",
type: "bool",
propertyID: "selectSubmesh",
}, },
{ {
label: "Priority", label: "Priority",
@ -590,7 +592,7 @@ const GROUPS = [
{ {
label: "Material Position", label: "Material Position",
type: "vec2", type: "vec2",
vec2Type: "xy", vec2Type: "xyz",
min: 0, min: 0,
max: 1, max: 1,
step: 0.1, step: 0.1,
@ -601,11 +603,11 @@ const GROUPS = [
{ {
label: "Material Scale", label: "Material Scale",
type: "vec2", type: "vec2",
vec2Type: "wh", vec2Type: "xyz",
min: 0, min: 0,
step: 0.1, step: 0.1,
decimals: 4, decimals: 4,
subLabels: [ "width", "height" ], subLabels: [ "x", "y" ],
propertyID: "materialMappingScale", propertyID: "materialMappingScale",
}, },
{ {
@ -1875,7 +1877,7 @@ function createNumberProperty(property, elProperty) {
let elementID = property.elementID; let elementID = property.elementID;
let propertyData = property.data; let propertyData = property.data;
elProperty.className = "draggable-number"; elProperty.className += " draggable-number-container";
let dragStartFunction = createDragStartFunction(property); let dragStartFunction = createDragStartFunction(property);
let dragEndFunction = createDragEndFunction(property); let dragEndFunction = createDragEndFunction(property);
@ -1954,7 +1956,7 @@ function createColorProperty(property, elProperty) {
let elementID = property.elementID; let elementID = property.elementID;
let propertyData = property.data; let propertyData = property.data;
elProperty.className = "rgb fstuple"; elProperty.className += " rgb fstuple";
let elColorPicker = document.createElement('div'); let elColorPicker = document.createElement('div');
elColorPicker.className = "color-picker"; elColorPicker.className = "color-picker";
@ -1995,6 +1997,7 @@ function createColorProperty(property, elProperty) {
color: '000000', color: '000000',
submit: false, // We don't want to have a submission button submit: false, // We don't want to have a submission button
onShow: function(colpick) { onShow: function(colpick) {
console.log("Showing");
$(colorPickerID).attr('active', 'true'); $(colorPickerID).attr('active', 'true');
// The original color preview within the picker needs to be updated on show because // The original color preview within the picker needs to be updated on show because
// prior to the picker being shown we don't have access to the selections' starting color. // prior to the picker being shown we don't have access to the selections' starting color.
@ -2896,21 +2899,21 @@ function loaded() {
for (let i = 0; i < propertyData.properties.length; ++i) { for (let i = 0; i < propertyData.properties.length; ++i) {
let innerPropertyData = propertyData.properties[i]; let innerPropertyData = propertyData.properties[i];
let elWrapper = createElementFromHTML('<div class="flex-column flex-center triple-item"><div></div></div>'); let elWrapper = createElementFromHTML('<div class="triple-item"></div>');
elProperty.appendChild(elWrapper);
let propertyID = innerPropertyData.propertyID; let propertyID = innerPropertyData.propertyID;
let propertyName = innerPropertyData.propertyName !== undefined ? innerPropertyData.propertyName : propertyID; let propertyName = innerPropertyData.propertyName !== undefined ? innerPropertyData.propertyName : propertyID;
let propertyElementID = "property-" + propertyID; let propertyElementID = "property-" + propertyID;
propertyElementID = propertyElementID.replace('.', '-'); propertyElementID = propertyElementID.replace('.', '-');
elWrapper.appendChild(createElementFromHTML(`<div class="triple-label">${innerPropertyData.label}</div>`)); let property = createProperty(innerPropertyData, propertyElementID, propertyName, propertyID, elWrapper);
elProperty.appendChild(elWrapper);
let property = createProperty(innerPropertyData, propertyElementID, propertyName, propertyID, elWrapper.childNodes[0]);
property.isParticleProperty = group.id.includes("particles"); property.isParticleProperty = group.id.includes("particles");
property.elContainer = elContainer; property.elContainer = elContainer;
property.spaceMode = propertySpaceMode; property.spaceMode = propertySpaceMode;
elWrapper.appendChild(createElementFromHTML(`<div class="triple-label">${innerPropertyData.label}</div>`));
if (property.type !== 'placeholder') { if (property.type !== 'placeholder') {
properties[propertyID] = property; properties[propertyID] = property;
} }