mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
Make combo box go by index, add default values
This commit is contained in:
parent
6bd7034c1a
commit
06985f9278
2 changed files with 39 additions and 20 deletions
|
@ -34,6 +34,21 @@ ModalWindow {
|
||||||
property var textInput;
|
property var textInput;
|
||||||
property var comboBox;
|
property var comboBox;
|
||||||
property var checkBox;
|
property var checkBox;
|
||||||
|
onTextInputChanged: {
|
||||||
|
if (textInput) {
|
||||||
|
textField.text = textInput.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onComboBoxChanged: {
|
||||||
|
if (comboBox) {
|
||||||
|
comboBoxField.currentIndex = comboBox.index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onCheckBoxChanged: {
|
||||||
|
if (checkBox) {
|
||||||
|
checkBoxField.checked = checkBox.checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property var warning: "";
|
property var warning: "";
|
||||||
property var result;
|
property var result;
|
||||||
|
@ -52,15 +67,15 @@ ModalWindow {
|
||||||
|
|
||||||
function updateCheckbox() {
|
function updateCheckbox() {
|
||||||
if (checkBox.disableForItems) {
|
if (checkBox.disableForItems) {
|
||||||
var currentTextInDisableList = false;
|
var currentItemInDisableList = false;
|
||||||
for (var i in checkBox.disableForItems) {
|
for (var i in checkBox.disableForItems) {
|
||||||
if (comboBoxField.currentText === checkBox.disableForItems[i]) {
|
if (comboBoxField.currentIndex === checkBox.disableForItems[i]) {
|
||||||
currentTextInDisableList = true;
|
currentItemInDisableList = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTextInDisableList) {
|
if (currentItemInDisableList) {
|
||||||
checkBoxField.enabled = false;
|
checkBoxField.enabled = false;
|
||||||
if (checkBox.checkStateOnDisable !== null && checkBox.checkStateOnDisable !== undefined) {
|
if (checkBox.checkStateOnDisable !== null && checkBox.checkStateOnDisable !== undefined) {
|
||||||
root.implicitCheckState = checkBoxField.checked;
|
root.implicitCheckState = checkBoxField.checked;
|
||||||
|
@ -245,8 +260,8 @@ ModalWindow {
|
||||||
result.textInput = textField.text;
|
result.textInput = textField.text;
|
||||||
}
|
}
|
||||||
if (comboBox) {
|
if (comboBox) {
|
||||||
result.comboBox = comboBoxField.currentText;
|
result.comboBox = comboBoxField.currentIndex;
|
||||||
result.comboBoxIndex = comboBoxField.currentIndex;
|
result.comboBoxText = comboBoxField.currentText;
|
||||||
}
|
}
|
||||||
if (checkBox) {
|
if (checkBox) {
|
||||||
result.checkBox = checkBoxField.enabled ? checkBoxField.checked : null;
|
result.checkBox = checkBoxField.enabled ? checkBoxField.checked : null;
|
||||||
|
|
|
@ -246,10 +246,18 @@ var toolBar = (function () {
|
||||||
toolBar.writeProperty("shown", false);
|
toolBar.writeProperty("shown", false);
|
||||||
|
|
||||||
addButton("newModelButton", "model-01.svg", function () {
|
addButton("newModelButton", "model-01.svg", function () {
|
||||||
var SHAPE_TYPE_NONE_TEXT = "No Collision";
|
var SHAPE_TYPE_NONE = 0;
|
||||||
var SHAPE_TYPE_SIMPLE_HULL_TEXT = "Basic - Whole model";
|
var SHAPE_TYPE_SIMPLE_HULL = 1;
|
||||||
var SHAPE_TYPE_SIMPLE_COMPOUND_TEXT = "Good - Sub-meshes";
|
var SHAPE_TYPE_SIMPLE_COMPOUND = 2;
|
||||||
var SHAPE_TYPE_STATIC_MESH_TEXT = "Exact - All polygons";
|
var SHAPE_TYPE_STATIC_MESH = 3;
|
||||||
|
|
||||||
|
var SHAPE_TYPES = [];
|
||||||
|
SHAPE_TYPES[SHAPE_TYPE_NONE] = "No Collision";
|
||||||
|
SHAPE_TYPES[SHAPE_TYPE_SIMPLE_HULL] = "Basic - Whole model";
|
||||||
|
SHAPE_TYPES[SHAPE_TYPE_SIMPLE_COMPOUND] = "Good - Sub-meshes";
|
||||||
|
SHAPE_TYPES[SHAPE_TYPE_STATIC_MESH] = "Exact - All polygons";
|
||||||
|
|
||||||
|
var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_STATIC_MESH;
|
||||||
var DYNAMIC_DEFAULT = false;
|
var DYNAMIC_DEFAULT = false;
|
||||||
var result = Window.customPrompt({
|
var result = Window.customPrompt({
|
||||||
textInput: {
|
textInput: {
|
||||||
|
@ -257,18 +265,14 @@ var toolBar = (function () {
|
||||||
},
|
},
|
||||||
comboBox: {
|
comboBox: {
|
||||||
label: "Automatic Collisions",
|
label: "Automatic Collisions",
|
||||||
items: [
|
index: SHAPE_TYPE_DEFAULT,
|
||||||
SHAPE_TYPE_NONE_TEXT,
|
items: SHAPE_TYPES
|
||||||
SHAPE_TYPE_SIMPLE_HULL_TEXT,
|
|
||||||
SHAPE_TYPE_SIMPLE_COMPOUND_TEXT,
|
|
||||||
SHAPE_TYPE_STATIC_MESH_TEXT
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
checkBox: {
|
checkBox: {
|
||||||
label: "Dynamic",
|
label: "Dynamic",
|
||||||
checked: DYNAMIC_DEFAULT,
|
checked: DYNAMIC_DEFAULT,
|
||||||
disableForItems: [
|
disableForItems: [
|
||||||
SHAPE_TYPE_STATIC_MESH_TEXT
|
SHAPE_TYPE_STATIC_MESH
|
||||||
],
|
],
|
||||||
checkStateOnDisable: false,
|
checkStateOnDisable: false,
|
||||||
warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic"
|
warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic"
|
||||||
|
@ -279,13 +283,13 @@ var toolBar = (function () {
|
||||||
var url = result.textInput;
|
var url = result.textInput;
|
||||||
var shapeType;
|
var shapeType;
|
||||||
switch (result.comboBox) {
|
switch (result.comboBox) {
|
||||||
case SHAPE_TYPE_SIMPLE_HULL_TEXT:
|
case SHAPE_TYPE_SIMPLE_HULL:
|
||||||
shapeType = "simple-hull";
|
shapeType = "simple-hull";
|
||||||
break;
|
break;
|
||||||
case SHAPE_TYPE_SIMPLE_COMPOUND_TEXT:
|
case SHAPE_TYPE_SIMPLE_COMPOUND:
|
||||||
shapeType = "simple-compound";
|
shapeType = "simple-compound";
|
||||||
break;
|
break;
|
||||||
case SHAPE_TYPE_STATIC_MESH_TEXT:
|
case SHAPE_TYPE_STATIC_MESH:
|
||||||
shapeType = "static-mesh";
|
shapeType = "static-mesh";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue