diff --git a/examples/libraries/entityPropertyDialogBox.js b/examples/libraries/entityPropertyDialogBox.js index da60e0c370..2bc9de9e79 100644 --- a/examples/libraries/entityPropertyDialogBox.js +++ b/examples/libraries/entityPropertyDialogBox.js @@ -41,15 +41,15 @@ EntityPropertyDialogBox = (function () { array.push({ label: "Entity Type:" + properties.type, type: "header" }); index++; - array.push({ label: "Locked:", value: properties.locked }); + array.push({ label: "Locked:", type: "checkbox", value: properties.locked }); index++; - + if (properties.type == "Model") { array.push({ label: "Model URL:", value: properties.modelURL }); index++; array.push({ label: "Animation URL:", value: properties.animationURL }); index++; - array.push({ label: "Animation is playing:", value: properties.animationIsPlaying }); + array.push({ label: "Animation is playing:", type: "checkbox", value: properties.animationIsPlaying }); previousAnimationIsPlaying = properties.animationIsPlaying; index++; array.push({ label: "Animation FPS:", value: properties.animationFPS }); @@ -140,20 +140,20 @@ EntityPropertyDialogBox = (function () { index++; array.push({ label: "Mass:", value: properties.mass.toFixed(decimals) }); index++; - array.push({ label: "Ignore for Collisions:", value: properties.ignoreForCollisions }); + array.push({ label: "Ignore for Collisions:", type: "checkbox", value: properties.ignoreForCollisions }); index++; - array.push({ label: "Collisions Will Move:", value: properties.collisionsWillMove }); + array.push({ label: "Collisions Will Move:", type: "checkbox", value: properties.collisionsWillMove }); index++; array.push({ label: "Lifetime:", value: properties.lifetime.toFixed(decimals) }); index++; - array.push({ label: "Visible:", value: properties.visible }); + array.push({ label: "Visible:", type: "checkbox", value: properties.visible }); index++; array.push({ label: "Script:", value: properties.script }); index++; - + if (properties.type == "Box" || properties.type == "Sphere") { array.push({ label: "Color:", type: "header" }); index++; @@ -225,7 +225,7 @@ EntityPropertyDialogBox = (function () { var rescaledX = peekX * peekRescale / 100.0; var rescaledY = peekY * peekRescale / 100.0; var rescaledZ = peekZ * peekRescale / 100.0; - + Window.reloadNonBlockingForm([ { value: rescaledX.toFixed(decimals), oldIndex: dimensionX }, { value: rescaledY.toFixed(decimals), oldIndex: dimensionY }, @@ -354,4 +354,3 @@ EntityPropertyDialogBox = (function () { return that; }()); - diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index cc3c0fceda..556f139fb4 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -357,7 +357,7 @@ var toolBar = (function () { var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); if (position.x > 0 && position.y > 0 && position.z > 0) { - Entities.addEntity({ + Entities.addEntity({ type: "Light", position: position, dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION }, @@ -710,7 +710,7 @@ function handeMenuEvent(menuItem) { var selectedModel = form[0].value; if (form[1].value == "Properties") { editModelID = selectedModel; - showPropertiesForm(editModelID); + entityPropertyDialogBox.openDialog(editModelID); } else if (form[1].value == "Delete") { Entities.deleteEntity(selectedModel); } else if (form[1].value == "Teleport") { diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f890baff3d..31be016380 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1555,6 +1555,8 @@ void Application::checkBandwidthMeterClick() { // ... to be called upon button release if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) && + Menu::getInstance()->isOptionChecked(MenuOption::Stats) && + Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) && glm::compMax(glm::abs(glm::ivec2(_mouseX - _mouseDragStartedX, _mouseY - _mouseDragStartedY))) <= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH && _bandwidthMeter.isWithinArea(_mouseX, _mouseY, _glWidget->width(), _glWidget->height())) { diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index 8a79cad6e1..591ae87560 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -252,6 +252,7 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue int e = -1; int d = -1; int c = -1; + int h = -1; for (int i = 0; i < _form.property("length").toInt32(); ++i) { QScriptValue item = _form.property(i); QScriptValue value = item.property("value"); @@ -275,6 +276,11 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue array.engine()->undefinedValue() ); _form.setProperty(i, item); + } else if (item.property("type").toString() == "checkbox") { + h++; + value = _checks.at(h)->checkState() == Qt::Checked; + item.setProperty("value", value); + _form.setProperty(i, item); } else { e += 1; bool ok = true; @@ -309,6 +315,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a int e = -1; int d = -1; int c = -1; + int h = -1; for (int i = 0; i < _form.property("length").toInt32(); ++i) { QScriptValue item = _form.property(i); QScriptValue value = item.property("value"); @@ -332,6 +339,11 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a array.engine()->undefinedValue() ); _form.setProperty(i, item); + } else if (item.property("type").toString() == "checkbox") { + h++; + value = _checks.at(h)->checkState() == Qt::Checked; + item.setProperty("value", value); + _form.setProperty(i, item); } else { e += 1; bool ok = true; @@ -362,6 +374,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a _edits.clear(); _directories.clear(); _combos.clear(); + _checks.clear(); array = _form; return (_formResult == QDialog::Accepted); @@ -387,6 +400,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal int e = -1; int d = -1; int c = -1; + int h = -1; for (int i = 0; i < form.property("length").toInt32(); ++i) { QScriptValue item = form.property(i); QScriptValue value = item.property("value"); @@ -410,6 +424,11 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal form.engine()->undefinedValue() ); form.setProperty(i, item); + } else if (item.property("type").toString() == "checkbox") { + h++; + value = _checks.at(h)->checkState() == Qt::Checked; + item.setProperty("value", value); + form.setProperty(i, item); } else { e += 1; bool ok = true; @@ -436,6 +455,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal delete editDialog; _combos.clear(); + _checks.clear(); _edits.clear(); _directories.clear(); return (result == QDialog::Accepted); @@ -522,6 +542,12 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue } _combos.push_back(combo); formLayout->addRow(new QLabel(item.property("label").toString()), combo); + } else if (item.property("type").toString() == "checkbox") { + QCheckBox* check = new QCheckBox(); + check->setTristate(false); + check->setCheckState(item.property("value").toString() == "true" ? Qt::Checked : Qt::Unchecked); + _checks.push_back(check); + formLayout->addRow(new QLabel(item.property("label").toString()), check); } else { QLineEdit* edit = new QLineEdit(item.property("value").toString()); edit->setMinimumWidth(200); diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 0b320f23a1..05411530df 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -90,6 +90,7 @@ private: bool _nonBlockingFormActive; int _formResult; QVector _combos; + QVector _checks; QVector _edits; QVector _directories; };