diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index bf29f3bec9..60bcc85575 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -913,18 +913,25 @@ void EntityTree::findEntities(RecurseOctreeOperation& elementFilter, recurseTreeWithOperation(elementFilter, nullptr); } -EntityItemPointer EntityTree::findEntityByID(const QUuid& id) { +EntityItemPointer EntityTree::findEntityByID(const QUuid& id) const { EntityItemID entityID(id); return findEntityByEntityItemID(entityID); } -EntityItemPointer EntityTree::findEntityByEntityItemID(const EntityItemID& entityID) /*const*/ { - EntityItemPointer foundEntity = NULL; - EntityTreeElementPointer containingElement = getContainingElement(entityID); - if (containingElement) { - foundEntity = containingElement->getEntityWithEntityItemID(entityID); +EntityItemPointer EntityTree::findEntityByEntityItemID(const EntityItemID& entityID) const { + EntityItemPointer foundEntity = nullptr; + { + QReadLocker locker(&_entityMapLock); + foundEntity = _entityMap.value(entityID); + } + if (foundEntity && !foundEntity->getElement()) { + // special case to maintain legacy behavior: + // if the entity is in the map but not in the tree + // then pretend the entity doesn't exist + return EntityItemPointer(nullptr); + } else { + return foundEntity; } - return foundEntity; } void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList& changedProperties) { diff --git a/libraries/entities/src/EntityTree.h b/libraries/entities/src/EntityTree.h index 8cb89d6493..90fe342f57 100644 --- a/libraries/entities/src/EntityTree.h +++ b/libraries/entities/src/EntityTree.h @@ -132,9 +132,9 @@ public: /// \param position point of query in world-frame (meters) /// \param targetRadius radius of query (meters) EntityItemPointer findClosestEntity(const glm::vec3& position, float targetRadius); - EntityItemPointer findEntityByID(const QUuid& id); - EntityItemPointer findEntityByEntityItemID(const EntityItemID& entityID); - virtual SpatiallyNestablePointer findByID(const QUuid& id) override { return findEntityByID(id); } + EntityItemPointer findEntityByID(const QUuid& id) const; + EntityItemPointer findEntityByEntityItemID(const EntityItemID& entityID) const; + virtual SpatiallyNestablePointer findByID(const QUuid& id) const override { return findEntityByID(id); } EntityItemID assignEntityID(const EntityItemID& entityItemID); /// Assigns a known ID for a creator token ID diff --git a/libraries/render-utils/src/FadeEffectJobs.cpp b/libraries/render-utils/src/FadeEffectJobs.cpp index d00632c017..da3f8dddc0 100644 --- a/libraries/render-utils/src/FadeEffectJobs.cpp +++ b/libraries/render-utils/src/FadeEffectJobs.cpp @@ -297,19 +297,20 @@ float FadeConfig::getEdgeWidth() const { return sqrtf(events[editedCategory].edgeWidth); } -void FadeConfig::setEdgeInnerColorR(float value) { - events[editedCategory].edgeInnerColor.r = value; +void FadeConfig::setEdgeInnerColor(const QColor& value) { + events[editedCategory].edgeInnerColor.r = value.redF(); + events[editedCategory].edgeInnerColor.g = value.greenF(); + events[editedCategory].edgeInnerColor.b = value.blueF(); emit dirty(); } -void FadeConfig::setEdgeInnerColorG(float value) { - events[editedCategory].edgeInnerColor.g = value; - emit dirty(); -} - -void FadeConfig::setEdgeInnerColorB(float value) { - events[editedCategory].edgeInnerColor.b = value; - emit dirty(); +QColor FadeConfig::getEdgeInnerColor() const { + QColor color; + color.setRedF(events[editedCategory].edgeInnerColor.r); + color.setGreenF(events[editedCategory].edgeInnerColor.g); + color.setBlueF(events[editedCategory].edgeInnerColor.b); + color.setAlphaF(1.0f); + return color; } void FadeConfig::setEdgeInnerIntensity(float value) { @@ -317,19 +318,20 @@ void FadeConfig::setEdgeInnerIntensity(float value) { emit dirty(); } -void FadeConfig::setEdgeOuterColorR(float value) { - events[editedCategory].edgeOuterColor.r = value; +void FadeConfig::setEdgeOuterColor(const QColor& value) { + events[editedCategory].edgeOuterColor.r = value.redF(); + events[editedCategory].edgeOuterColor.g = value.greenF(); + events[editedCategory].edgeOuterColor.b = value.blueF(); emit dirty(); } -void FadeConfig::setEdgeOuterColorG(float value) { - events[editedCategory].edgeOuterColor.g = value; - emit dirty(); -} - -void FadeConfig::setEdgeOuterColorB(float value) { - events[editedCategory].edgeOuterColor.b = value; - emit dirty(); +QColor FadeConfig::getEdgeOuterColor() const { + QColor color; + color.setRedF(events[editedCategory].edgeOuterColor.r); + color.setGreenF(events[editedCategory].edgeOuterColor.g); + color.setBlueF(events[editedCategory].edgeOuterColor.b); + color.setAlphaF(1.0f); + return color; } void FadeConfig::setEdgeOuterIntensity(float value) { @@ -352,13 +354,13 @@ QString FadeConfig::eventNames[FADE_CATEGORY_COUNT] = { }; void FadeConfig::save() const { + // Save will only work if the HIFI_USE_SOURCE_TREE_RESOURCES environment variable is set assert(editedCategory < FADE_CATEGORY_COUNT); QJsonObject lProperties; - const QString configFile = "config/" + eventNames[editedCategory] + ".json"; - QUrl path(PathUtils::resourcesPath() + configFile); - QFile file(path.toString()); + const QString configFilePath = PathUtils::resourcesPath() + "config/" + eventNames[editedCategory] + ".json"; + QFile file(configFilePath); if (!file.open(QFile::WriteOnly | QFile::Text)) { - qWarning() << "Fade event configuration file " << path << " cannot be opened"; + qWarning() << "Fade event configuration file " << configFilePath << " cannot be opened"; } else { const auto& event = events[editedCategory]; @@ -381,15 +383,13 @@ void FadeConfig::save() const { } void FadeConfig::load() { - const QString configFile = "config/" + eventNames[editedCategory] + ".json"; - - QUrl path(PathUtils::resourcesPath() + configFile); - QFile file(path.toString()); + const QString configFilePath = PathUtils::resourcesPath() + "config/" + eventNames[editedCategory] + ".json"; + QFile file(configFilePath); if (!file.exists()) { - qWarning() << "Fade event configuration file " << path << " does not exist"; + qWarning() << "Fade event configuration file " << configFilePath << " does not exist"; } else if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "Fade event configuration file " << path << " cannot be opened"; + qWarning() << "Fade event configuration file " << configFilePath << " cannot be opened"; } else { QString fileData = file.readAll(); @@ -401,14 +401,14 @@ void FadeConfig::load() { QJsonValue value; auto& event = events[editedCategory]; - qCDebug(renderlogging) << "Fade event configuration file" << path << "loaded"; + qCDebug(renderlogging) << "Fade event configuration file" << configFilePath << "loaded"; value = jsonObject["edgeInnerColor"]; if (value.isArray()) { QJsonArray data = value.toArray(); if (data.size() < 4) { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'edgeInnerColor' field. Expected array of size 4"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'edgeInnerColor' field. Expected array of size 4"; } else { event.edgeInnerColor.r = (float)data.at(0).toDouble(); @@ -418,7 +418,7 @@ void FadeConfig::load() { } } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'edgeInnerColor' field. Expected array of size 4"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'edgeInnerColor' field. Expected array of size 4"; } value = jsonObject["edgeOuterColor"]; @@ -426,7 +426,7 @@ void FadeConfig::load() { QJsonArray data = value.toArray(); if (data.size() < 4) { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'edgeOuterColor' field. Expected array of size 4"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'edgeOuterColor' field. Expected array of size 4"; } else { event.edgeOuterColor.r = (float)data.at(0).toDouble(); @@ -436,7 +436,7 @@ void FadeConfig::load() { } } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'edgeOuterColor' field. Expected array of size 4"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'edgeOuterColor' field. Expected array of size 4"; } value = jsonObject["noiseSize"]; @@ -444,7 +444,7 @@ void FadeConfig::load() { QJsonArray data = value.toArray(); if (data.size() < 3) { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'noiseSize' field. Expected array of size 3"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'noiseSize' field. Expected array of size 3"; } else { event.noiseSize.x = (float)data.at(0).toDouble(); @@ -453,7 +453,7 @@ void FadeConfig::load() { } } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'noiseSize' field. Expected array of size 3"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'noiseSize' field. Expected array of size 3"; } value = jsonObject["noiseSpeed"]; @@ -461,7 +461,7 @@ void FadeConfig::load() { QJsonArray data = value.toArray(); if (data.size() < 3) { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'noiseSpeed' field. Expected array of size 3"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'noiseSpeed' field. Expected array of size 3"; } else { event.noiseSpeed.x = (float)data.at(0).toDouble(); @@ -470,7 +470,7 @@ void FadeConfig::load() { } } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'noiseSpeed' field. Expected array of size 3"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'noiseSpeed' field. Expected array of size 3"; } value = jsonObject["baseSize"]; @@ -478,7 +478,7 @@ void FadeConfig::load() { QJsonArray data = value.toArray(); if (data.size() < 3) { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'baseSize' field. Expected array of size 3"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'baseSize' field. Expected array of size 3"; } else { event.baseSize.x = (float)data.at(0).toDouble(); @@ -487,7 +487,7 @@ void FadeConfig::load() { } } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'baseSize' field. Expected array of size 3"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'baseSize' field. Expected array of size 3"; } value = jsonObject["noiseLevel"]; @@ -495,7 +495,7 @@ void FadeConfig::load() { event.noiseLevel = (float)value.toDouble(); } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'noiseLevel' field. Expected float value"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'noiseLevel' field. Expected float value"; } value = jsonObject["baseLevel"]; @@ -503,7 +503,7 @@ void FadeConfig::load() { event.baseLevel = (float)value.toDouble(); } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'baseLevel' field. Expected float value"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'baseLevel' field. Expected float value"; } value = jsonObject["duration"]; @@ -511,7 +511,7 @@ void FadeConfig::load() { event.duration = (float)value.toDouble(); } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'duration' field. Expected float value"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'duration' field. Expected float value"; } value = jsonObject["edgeWidth"]; @@ -519,7 +519,7 @@ void FadeConfig::load() { event.edgeWidth = std::min(1.f, std::max(0.f, (float)value.toDouble())); } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'edgeWidth' field. Expected float value"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'edgeWidth' field. Expected float value"; } value = jsonObject["timing"]; @@ -527,7 +527,7 @@ void FadeConfig::load() { event.timing = std::max(0, std::min(TIMING_COUNT - 1, value.toInt())); } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'timing' field. Expected integer value"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'timing' field. Expected integer value"; } value = jsonObject["isInverted"]; @@ -535,13 +535,13 @@ void FadeConfig::load() { event.isInverted = value.toBool(); } else { - qWarning() << "Fade event configuration file " << path << " contains an invalid 'isInverted' field. Expected boolean value"; + qWarning() << "Fade event configuration file " << configFilePath << " contains an invalid 'isInverted' field. Expected boolean value"; } emit dirty(); } else { - qWarning() << "Fade event configuration file" << path << "failed to load:" << + qWarning() << "Fade event configuration file" << configFilePath << "failed to load:" << error.errorString() << "at offset" << error.offset; } } diff --git a/libraries/render-utils/src/FadeEffectJobs.h b/libraries/render-utils/src/FadeEffectJobs.h index a585d5b98a..783f026bcd 100644 --- a/libraries/render-utils/src/FadeEffectJobs.h +++ b/libraries/render-utils/src/FadeEffectJobs.h @@ -56,13 +56,9 @@ class FadeConfig : public render::Job::Config { Q_PROPERTY(float noiseSizeZ READ getNoiseSizeZ WRITE setNoiseSizeZ NOTIFY dirty) Q_PROPERTY(float noiseLevel READ getNoiseLevel WRITE setNoiseLevel NOTIFY dirty) Q_PROPERTY(float edgeWidth READ getEdgeWidth WRITE setEdgeWidth NOTIFY dirty) - Q_PROPERTY(float edgeInnerColorR READ getEdgeInnerColorR WRITE setEdgeInnerColorR NOTIFY dirty) - Q_PROPERTY(float edgeInnerColorG READ getEdgeInnerColorG WRITE setEdgeInnerColorG NOTIFY dirty) - Q_PROPERTY(float edgeInnerColorB READ getEdgeInnerColorB WRITE setEdgeInnerColorB NOTIFY dirty) + Q_PROPERTY(QColor edgeInnerColor READ getEdgeInnerColor WRITE setEdgeInnerColor NOTIFY dirty) Q_PROPERTY(float edgeInnerIntensity READ getEdgeInnerIntensity WRITE setEdgeInnerIntensity NOTIFY dirty) - Q_PROPERTY(float edgeOuterColorR READ getEdgeOuterColorR WRITE setEdgeOuterColorR NOTIFY dirty) - Q_PROPERTY(float edgeOuterColorG READ getEdgeOuterColorG WRITE setEdgeOuterColorG NOTIFY dirty) - Q_PROPERTY(float edgeOuterColorB READ getEdgeOuterColorB WRITE setEdgeOuterColorB NOTIFY dirty) + Q_PROPERTY(QColor edgeOuterColor READ getEdgeOuterColor WRITE setEdgeOuterColor NOTIFY dirty) Q_PROPERTY(float edgeOuterIntensity READ getEdgeOuterIntensity WRITE setEdgeOuterIntensity NOTIFY dirty) Q_PROPERTY(int timing READ getTiming WRITE setTiming NOTIFY dirty) Q_PROPERTY(float noiseSpeedX READ getNoiseSpeedX WRITE setNoiseSpeedX NOTIFY dirty) @@ -129,26 +125,14 @@ public: void setEdgeWidth(float value); float getEdgeWidth() const; - void setEdgeInnerColorR(float value); - float getEdgeInnerColorR() const { return events[editedCategory].edgeInnerColor.r; } - - void setEdgeInnerColorG(float value); - float getEdgeInnerColorG() const { return events[editedCategory].edgeInnerColor.g; } - - void setEdgeInnerColorB(float value); - float getEdgeInnerColorB() const { return events[editedCategory].edgeInnerColor.b; } + void setEdgeInnerColor(const QColor& value); + QColor getEdgeInnerColor() const; void setEdgeInnerIntensity(float value); float getEdgeInnerIntensity() const { return events[editedCategory].edgeInnerColor.a; } - void setEdgeOuterColorR(float value); - float getEdgeOuterColorR() const { return events[editedCategory].edgeOuterColor.r; } - - void setEdgeOuterColorG(float value); - float getEdgeOuterColorG() const { return events[editedCategory].edgeOuterColor.g; } - - void setEdgeOuterColorB(float value); - float getEdgeOuterColorB() const { return events[editedCategory].edgeOuterColor.b; } + void setEdgeOuterColor(const QColor& value); + QColor getEdgeOuterColor() const; void setEdgeOuterIntensity(float value); float getEdgeOuterIntensity() const { return events[editedCategory].edgeOuterColor.a; } diff --git a/libraries/shared/src/SpatialParentFinder.h b/libraries/shared/src/SpatialParentFinder.h index aae7d9f040..c19babbc7f 100644 --- a/libraries/shared/src/SpatialParentFinder.h +++ b/libraries/shared/src/SpatialParentFinder.h @@ -21,7 +21,7 @@ using SpatiallyNestableWeakPointer = std::weak_ptr; using SpatiallyNestablePointer = std::shared_ptr; class SpatialParentTree { public: - virtual SpatiallyNestablePointer findByID(const QUuid& id) { return nullptr; } + virtual SpatiallyNestablePointer findByID(const QUuid& id) const { return nullptr; } }; class SpatialParentFinder : public Dependency { diff --git a/scripts/developer/utilities/render/debugFade.js b/scripts/developer/utilities/render/debugFade.js deleted file mode 100644 index b01c4b5e1f..0000000000 --- a/scripts/developer/utilities/render/debugFade.js +++ /dev/null @@ -1,21 +0,0 @@ -// -// debugFade.js -// developer/utilities/render -// -// Olivier Prat, created on 30/04/2017. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// Set up the qml ui -var qml = Script.resolvePath('fade.qml'); -var window = new OverlayWindow({ - title: 'Fade', - source: qml, - width: 910, - height: 610, -}); -window.setPosition(50, 50); -window.closed.connect(function() { Script.stop(); }); diff --git a/scripts/developer/utilities/render/debugTransition.js b/scripts/developer/utilities/render/debugTransition.js new file mode 100644 index 0000000000..161ff3f5d4 --- /dev/null +++ b/scripts/developer/utilities/render/debugTransition.js @@ -0,0 +1,84 @@ +"use strict"; + +// +// debugTransition.js +// developer/utilities/render +// +// Olivier Prat, created on 30/04/2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +(function() { + var TABLET_BUTTON_NAME = "Transition"; + var QMLAPP_URL = Script.resolvePath("./transition.qml"); + var ICON_URL = Script.resolvePath("../../../system/assets/images/transition-i.svg"); + var ACTIVE_ICON_URL = Script.resolvePath("../../../system/assets/images/transition-a.svg"); + + + var onScreen = false; + + function onClicked() { + if (onScreen) { + tablet.gotoHomeScreen(); + } else { + tablet.loadQMLSource(QMLAPP_URL); + } + } + + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + var button = tablet.addButton({ + text: TABLET_BUTTON_NAME, + icon: ICON_URL, + activeIcon: ACTIVE_ICON_URL + }); + + var hasEventBridge = false; + + function wireEventBridge(on) { + if (!tablet) { + print("Warning in wireEventBridge(): 'tablet' undefined!"); + return; + } + if (on) { + if (!hasEventBridge) { + tablet.fromQml.connect(fromQml); + hasEventBridge = true; + } + } else { + if (hasEventBridge) { + tablet.fromQml.disconnect(fromQml); + hasEventBridge = false; + } + } + } + + function onScreenChanged(type, url) { + if (url === QMLAPP_URL) { + onScreen = true; + } else { + onScreen = false; + } + + button.editProperties({isActive: onScreen}); + wireEventBridge(onScreen); + } + + function fromQml(message) { + } + + button.clicked.connect(onClicked); + tablet.screenChanged.connect(onScreenChanged); + + Script.scriptEnding.connect(function () { + if (onScreen) { + tablet.gotoHomeScreen(); + } + button.clicked.disconnect(onClicked); + tablet.screenChanged.disconnect(onScreenChanged); + tablet.removeButton(button); + }); + +}()); \ No newline at end of file diff --git a/scripts/developer/utilities/render/fade.qml b/scripts/developer/utilities/render/fade.qml deleted file mode 100644 index 1dffd0fbbb..0000000000 --- a/scripts/developer/utilities/render/fade.qml +++ /dev/null @@ -1,397 +0,0 @@ -// -// fade.qml -// developer/utilities/render -// -// Olivier Prat, created on 30/04/2017. -// Copyright 2017 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html -// -import QtQuick 2.5 -import QtQuick.Controls 1.4 -import "configSlider" -import "../lib/plotperf" - -Column { - id: root - property var config: Render.getConfig("RenderMainView.Fade"); - property var configEdit: Render.getConfig("RenderMainView.FadeEdit"); - spacing: 8 - - Row { - spacing: 8 - - CheckBox { - text: "Edit Fade" - checked: root.configEdit["editFade"] - onCheckedChanged: { - root.configEdit["editFade"] = checked; - Render.getConfig("RenderMainView.DrawFadedOpaqueBounds").enabled = checked; - } - } - ComboBox { - id: categoryBox - width: 400 - model: ["Elements enter/leave domain", "Bubble isect. - Owner POV", "Bubble isect. - Trespasser POV", "Another user leaves/arrives", "Changing an avatar"] - Timer { - id: postpone - interval: 100; running: false; repeat: false - onTriggered: { paramWidgetLoader.sourceComponent = paramWidgets } - } - onCurrentIndexChanged: { - root.config["editedCategory"] = currentIndex; - // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component - // by setting the loader source to Null and then recreate it 100ms later - paramWidgetLoader.sourceComponent = undefined; - postpone.interval = 100 - postpone.start() - } - } - } - Row { - spacing: 8 - - CheckBox { - text: "Manual" - checked: root.config["manualFade"] - onCheckedChanged: { - root.config["manualFade"] = checked; - } - } - ConfigSlider { - label: "Threshold" - integral: false - config: root.config - property: "manualThreshold" - max: 1.0 - min: 0.0 - width: 400 - } - } - - Action { - id: saveAction - text: "Save" - onTriggered: { - root.config.save() - } - } - Action { - id: loadAction - text: "Load" - onTriggered: { - root.config.load() - // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component - // by setting the loader source to Null and then recreate it 500ms later - paramWidgetLoader.sourceComponent = undefined; - postpone.interval = 500 - postpone.start() - } - } - - Component { - id: paramWidgets - - Column { - spacing: 8 - - CheckBox { - text: "Invert" - checked: root.config["isInverted"] - onCheckedChanged: { root.config["isInverted"] = checked } - } - Row { - spacing: 8 - - GroupBox { - title: "Base Gradient" - width: 450 - Column { - spacing: 8 - - ConfigSlider { - label: "Size X" - integral: false - config: root.config - property: "baseSizeX" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Size Y" - integral: false - config: root.config - property: "baseSizeY" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Size Z" - integral: false - config: root.config - property: "baseSizeZ" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Level" - integral: false - config: root.config - property: "baseLevel" - max: 1.0 - min: 0.0 - width: 400 - } - } - } - GroupBox { - title: "Noise Gradient" - width: 450 - Column { - spacing: 8 - - ConfigSlider { - label: "Size X" - integral: false - config: root.config - property: "noiseSizeX" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Size Y" - integral: false - config: root.config - property: "noiseSizeY" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Size Z" - integral: false - config: root.config - property: "noiseSizeZ" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Level" - integral: false - config: root.config - property: "noiseLevel" - max: 1.0 - min: 0.0 - width: 400 - } - } - } - } - Row { - spacing: 8 - - GroupBox { - title: "Edge" - width: 450 - Column { - spacing: 8 - - ConfigSlider { - label: "Width" - integral: false - config: root.config - property: "edgeWidth" - max: 1.0 - min: 0.0 - width: 400 - } - GroupBox { - title: "Inner color" - Column { - spacing: 8 - ConfigSlider { - label: "Color R" - integral: false - config: root.config - property: "edgeInnerColorR" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Color G" - integral: false - config: root.config - property: "edgeInnerColorG" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Color B" - integral: false - config: root.config - property: "edgeInnerColorB" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Color intensity" - integral: false - config: root.config - property: "edgeInnerIntensity" - max: 5.0 - min: 0.0 - width: 400 - } - } - } - GroupBox { - title: "Outer color" - Column { - spacing: 8 - ConfigSlider { - label: "Color R" - integral: false - config: root.config - property: "edgeOuterColorR" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Color G" - integral: false - config: root.config - property: "edgeOuterColorG" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Color B" - integral: false - config: root.config - property: "edgeOuterColorB" - max: 1.0 - min: 0.0 - width: 400 - } - ConfigSlider { - label: "Color intensity" - integral: false - config: root.config - property: "edgeOuterIntensity" - max: 5.0 - min: 0.0 - width: 400 - } - } - } - } - } - - Column { - GroupBox { - title: "Timing" - width: 450 - Column { - spacing: 8 - - ConfigSlider { - label: "Duration" - integral: false - config: root.config - property: "duration" - max: 10.0 - min: 0.1 - width: 400 - } - ComboBox { - width: 400 - model: ["Linear", "Ease In", "Ease Out", "Ease In / Out"] - currentIndex: root.config["timing"] - onCurrentIndexChanged: { - root.config["timing"] = currentIndex; - } - } - GroupBox { - title: "Noise Animation" - Column { - spacing: 8 - ConfigSlider { - label: "Speed X" - integral: false - config: root.config - property: "noiseSpeedX" - max: 1.0 - min: -1.0 - width: 400 - } - ConfigSlider { - label: "Speed Y" - integral: false - config: root.config - property: "noiseSpeedY" - max: 1.0 - min: -1.0 - width: 400 - } - ConfigSlider { - label: "Speed Z" - integral: false - config: root.config - property: "noiseSpeedZ" - max: 1.0 - min: -1.0 - width: 400 - } - } - } - - PlotPerf { - title: "Threshold" - height: parent.evalEvenHeight() - object: config - valueUnit: "%" - valueScale: 0.01 - valueNumDigits: "1" - plots: [ - { - prop: "threshold", - label: "Threshold", - color: "#FFBB77" - } - ] - } - - } - } - - Row { - spacing: 8 - Button { - action: saveAction - } - Button { - action: loadAction - } - } - - } - } - } - } - - Loader { - id: paramWidgetLoader - sourceComponent: paramWidgets - } -} diff --git a/scripts/developer/utilities/render/transition.qml b/scripts/developer/utilities/render/transition.qml new file mode 100644 index 0000000000..e83a85f8ed --- /dev/null +++ b/scripts/developer/utilities/render/transition.qml @@ -0,0 +1,383 @@ +// +// transition.qml +// developer/utilities/render +// +// Olivier Prat, created on 30/04/2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 + +import "qrc:///qml/styles-uit" +import "qrc:///qml/controls-uit" as HifiControls +import "configSlider" +import "../lib/plotperf" + +Rectangle { + HifiConstants { id: hifi;} + id: root + anchors.margins: hifi.dimensions.contentMargin.x + + color: hifi.colors.baseGray; + + property var config: Render.getConfig("RenderMainView.Fade"); + property var configEdit: Render.getConfig("RenderMainView.FadeEdit"); + + ColumnLayout { + spacing: 3 + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: hifi.dimensions.contentMargin.x + HifiControls.Label { + text: "Transition" + } + + RowLayout { + spacing: 20 + Layout.fillWidth: true + id: root_col + + HifiControls.CheckBox { + anchors.verticalCenter: parent.verticalCenter + boxSize: 20 + text: "Edit" + checked: root.configEdit["editFade"] + onCheckedChanged: { + root.configEdit["editFade"] = checked; + Render.getConfig("RenderMainView.DrawFadedOpaqueBounds").enabled = checked; + } + } + HifiControls.ComboBox { + anchors.verticalCenter: parent.verticalCenter + Layout.fillWidth: true + id: categoryBox + model: ["Elements enter/leave domain", "Bubble isect. - Owner POV", "Bubble isect. - Trespasser POV", "Another user leaves/arrives", "Changing an avatar"] + Timer { + id: postpone + interval: 100; running: false; repeat: false + onTriggered: { + paramWidgetLoader.sourceComponent = paramWidgets + } + } + onCurrentIndexChanged: { + root.config["editedCategory"] = currentIndex; + // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component + // by setting the loader source to Null and then recreate it 100ms later + paramWidgetLoader.sourceComponent = undefined; + postpone.interval = 100 + postpone.start() + } + } + } + + RowLayout { + spacing: 20 + height: 36 + HifiControls.CheckBox { + boxSize: 20 + anchors.verticalCenter: parent.verticalCenter + text: "Manual" + checked: root.config["manualFade"] + onCheckedChanged: { + root.config["manualFade"] = checked; + } + } + ConfigSlider { + anchors.left: undefined + anchors.verticalCenter: parent.verticalCenter + height: 36 + width: 320 + label: "Threshold" + integral: false + config: root.config + property: "manualThreshold" + max: 1.0 + min: 0.0 + } + } + + Action { + id: saveAction + text: "Save" + onTriggered: { + root.config.save() + } + } + Action { + id: loadAction + text: "Load" + onTriggered: { + root.config.load() + // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component + // by setting the loader source to Null and then recreate it 500ms later + paramWidgetLoader.sourceComponent = undefined; + postpone.interval = 500 + postpone.start() + } + } + + Separator {} + + Component { + id: paramWidgets + + ColumnLayout { + spacing: 3 + width: root_col.width + + HifiControls.CheckBox { + text: "Invert" + boxSize: 20 + checked: root.config["isInverted"] + onCheckedChanged: { root.config["isInverted"] = checked } + } + RowLayout { + Layout.fillWidth: true + + GroupBox { + title: "Base Gradient" + Layout.fillWidth: true + + Column { + spacing: 3 + anchors.left: parent.left + anchors.right: parent.right + + Repeater { + model: [ + "Size X:baseSizeX", + "Size Y:baseSizeY", + "Size Z:baseSizeZ", + "Level:baseLevel" ] + + ConfigSlider { + height: 36 + label: modelData.split(":")[0] + integral: false + config: root.config + property: modelData.split(":")[1] + max: 1.0 + min: 0.0 + } + } + } + } + GroupBox { + title: "Noise Gradient" + Layout.fillWidth: true + + Column { + spacing: 3 + anchors.left: parent.left + anchors.right: parent.right + + Repeater { + model: [ + "Size X:noiseSizeX", + "Size Y:noiseSizeY", + "Size Z:noiseSizeZ", + "Level:noiseLevel" ] + + ConfigSlider { + height: 36 + label: modelData.split(":")[0] + integral: false + config: root.config + property: modelData.split(":")[1] + max: 1.0 + min: 0.0 + } + } + } + } + } + + + ConfigSlider { + height: 36 + label: "Edge Width" + integral: false + config: root.config + property: "edgeWidth" + max: 1.0 + min: 0.0 + } + RowLayout { + Layout.fillWidth: true + + GroupBox { + title: "Edge Inner color" + Layout.fillWidth: true + + Column { + anchors.left: parent.left + anchors.right: parent.right + + Color { + height: 30 + anchors.left: parent.left + anchors.right: parent.right + _color: root.config.edgeInnerColor + onNewColor: { + root.config.edgeInnerColor = _color + } + } + ConfigSlider { + height: 36 + label: "Intensity" + integral: false + config: root.config + property: "edgeInnerIntensity" + max: 1.0 + min: 0.0 + } + } + } + GroupBox { + title: "Edge Outer color" + Layout.fillWidth: true + + Column { + anchors.left: parent.left + anchors.right: parent.right + + Color { + height: 30 + anchors.left: parent.left + anchors.right: parent.right + _color: root.config.edgeOuterColor + onNewColor: { + root.config.edgeOuterColor = _color + } + } + ConfigSlider { + height: 36 + label: "Intensity" + integral: false + config: root.config + property: "edgeOuterIntensity" + max: 1.0 + min: 0.0 + } + } + } + } + GroupBox { + title: "Timing" + Layout.fillWidth: true + + ColumnLayout { + anchors.left: parent.left + anchors.right: parent.right + + RowLayout { + Layout.fillWidth: true + + ConfigSlider { + anchors.left: undefined + anchors.right: undefined + Layout.fillWidth: true + height: 36 + label: "Duration" + integral: false + config: root.config + property: "duration" + max: 10.0 + min: 0.1 + } + HifiControls.ComboBox { + Layout.fillWidth: true + model: ["Linear", "Ease In", "Ease Out", "Ease In / Out"] + currentIndex: root.config["timing"] + onCurrentIndexChanged: { + root.config["timing"] = currentIndex; + } + } + } + RowLayout { + Layout.fillWidth: true + + function evalEvenHeight() { + // Why do we have to do that manually ? cannot seem to find a qml / anchor / layout mode that does that ? + return (height - spacing * (children.length - 1)) / children.length + } + + GroupBox { + title: "Noise Animation" + Layout.fillWidth: true + id: animBox + + Column { + anchors.left: parent.left + anchors.right: parent.right + + Repeater { + model: [ + "Speed X:noiseSpeedX", + "Speed Y:noiseSpeedY", + "Speed Z:noiseSpeedZ" ] + + ConfigSlider { + height: 36 + label: modelData.split(":")[0] + integral: false + config: root.config + property: modelData.split(":")[1] + max: 1.0 + min: -1.0 + } + } + } + } + + PlotPerf { + title: "Threshold" + width: 200 + anchors.top: animBox.top + anchors.bottom : animBox.bottom + object: root.config + valueUnit: "%" + valueScale: 0.01 + valueNumDigits: "1" + plots: [ + { + prop: "threshold", + label: "Threshold", + color: "#FFBB77" + } + ] + } + } + } + } + + } + } + + + + Loader { + id: paramWidgetLoader + sourceComponent: paramWidgets + } + + Row { + anchors.left: parent.left + anchors.right: parent.right + + Button { + action: saveAction + } + Button { + action: loadAction + } + } + + + + } +} \ No newline at end of file