From 8e1c514a9c5c289d9c5059f58ce912b709ff0104 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 11:51:53 -0800 Subject: [PATCH 01/26] Replace scene buckets with nonspatial set --- libraries/render/src/render/Item.h | 7 +- libraries/render/src/render/Scene.cpp | 112 +++++++------------------- libraries/render/src/render/Scene.h | 41 +++------- 3 files changed, 46 insertions(+), 114 deletions(-) diff --git a/libraries/render/src/render/Item.h b/libraries/render/src/render/Item.h index 8aaaf07300..53e1f3f0df 100644 --- a/libraries/render/src/render/Item.h +++ b/libraries/render/src/render/Item.h @@ -112,6 +112,7 @@ public: bool isPickable() const { return _flags[PICKABLE]; } bool isLayered() const { return _flags[LAYERED]; } + bool isSpatial() const { return !isLayered(); } // Probably not public, flags used by the scene bool isSmall() const { return _flags[SMALLER]; } @@ -315,8 +316,10 @@ public: // Main scene / item managment interface Reset/Update/Kill void resetPayload(const PayloadPointer& payload); void resetCell(ItemCell cell, bool _small) { _cell = cell; _key.setSmaller(_small); } - void update(const UpdateFunctorPointer& updateFunctor) { _payload->update(updateFunctor); } // Communicate update to the payload - void kill() { _payload.reset(); _key._flags.reset(); _cell = INVALID_CELL; } // Kill means forget the payload and key and cell + // Communicate the update to the payload + void update(const UpdateFunctorPointer& updateFunctor) { _payload->update(updateFunctor); _key = _payload->getKey(); } + // Forget the payload, key, and cell + void kill() { _payload.reset(); _key._flags.reset(); _cell = INVALID_CELL; } // Check heuristic key const ItemKey& getKey() const { return _key; } diff --git a/libraries/render/src/render/Scene.cpp b/libraries/render/src/render/Scene.cpp index 58b1e61046..624f639d79 100644 --- a/libraries/render/src/render/Scene.cpp +++ b/libraries/render/src/render/Scene.cpp @@ -15,59 +15,11 @@ using namespace render; -void ItemBucketMap::insert(const ItemID& id, const ItemKey& key) { - // Insert the itemID in every bucket where it filters true - for (auto& bucket : (*this)) { - if (bucket.first.test(key)) { - bucket.second.insert(id); - } - } -} -void ItemBucketMap::erase(const ItemID& id, const ItemKey& key) { - // Remove the itemID in every bucket where it filters true - for (auto& bucket : (*this)) { - if (bucket.first.test(key)) { - bucket.second.erase(id); - } - } -} - -void ItemBucketMap::reset(const ItemID& id, const ItemKey& oldKey, const ItemKey& newKey) { - // Reset the itemID in every bucket, - // Remove from the buckets where oldKey filters true AND newKey filters false - // Insert into the buckets where newKey filters true - for (auto& bucket : (*this)) { - if (bucket.first.test(oldKey)) { - if (!bucket.first.test(newKey)) { - bucket.second.erase(id); - } - } else if (bucket.first.test(newKey)) { - bucket.second.insert(id); - } - } -} - -void ItemBucketMap::allocateStandardOpaqueTranparentBuckets() { - (*this)[ItemFilter::Builder::opaqueShape().withoutLayered()]; - (*this)[ItemFilter::Builder::transparentShape().withoutLayered()]; - (*this)[ItemFilter::Builder::light()]; - (*this)[ItemFilter::Builder::background()]; - (*this)[ItemFilter::Builder::opaqueShape().withLayered()]; - (*this)[ItemFilter::Builder::transparentShape().withLayered()]; -} - - void PendingChanges::resetItem(ItemID id, const PayloadPointer& payload) { _resetItems.push_back(id); _resetPayloads.push_back(payload); } -void PendingChanges::resortItem(ItemID id, ItemKey oldKey, ItemKey newKey) { - _resortItems.push_back(id); - _resortOldKeys.push_back(oldKey); - _resortNewKeys.push_back(newKey); -} - void PendingChanges::removeItem(ItemID id) { _removedItems.push_back(id); } @@ -80,9 +32,6 @@ void PendingChanges::updateItem(ItemID id, const UpdateFunctorPointer& functor) void PendingChanges::merge(PendingChanges& changes) { _resetItems.insert(_resetItems.end(), changes._resetItems.begin(), changes._resetItems.end()); _resetPayloads.insert(_resetPayloads.end(), changes._resetPayloads.begin(), changes._resetPayloads.end()); - _resortItems.insert(_resortItems.end(), changes._resortItems.begin(), changes._resortItems.end()); - _resortOldKeys.insert(_resortOldKeys.end(), changes._resortOldKeys.begin(), changes._resortOldKeys.end()); - _resortNewKeys.insert(_resortNewKeys.end(), changes._resortNewKeys.begin(), changes._resortNewKeys.end()); _removedItems.insert(_removedItems.end(), changes._removedItems.begin(), changes._removedItems.end()); _updatedItems.insert(_updatedItems.end(), changes._updatedItems.begin(), changes._updatedItems.end()); _updateFunctors.insert(_updateFunctors.end(), changes._updateFunctors.begin(), changes._updateFunctors.end()); @@ -92,7 +41,6 @@ Scene::Scene(glm::vec3 origin, float size) : _masterSpatialTree(origin, size) { _items.push_back(Item()); // add the itemID #0 to nothing - _masterBucketMap.allocateStandardOpaqueTranparentBuckets(); } ItemID Scene::allocateID() { @@ -133,7 +81,6 @@ void Scene::processPendingChangesQueue() { // capture anything coming from the pendingChanges resetItems(consolidatedPendingChanges._resetItems, consolidatedPendingChanges._resetPayloads); updateItems(consolidatedPendingChanges._updatedItems, consolidatedPendingChanges._updateFunctors); - resortItems(consolidatedPendingChanges._resortItems, consolidatedPendingChanges._resortOldKeys, consolidatedPendingChanges._resortNewKeys); removeItems(consolidatedPendingChanges._removedItems); // ready to go back to rendering activities @@ -141,7 +88,6 @@ void Scene::processPendingChangesQueue() { } void Scene::resetItems(const ItemIDs& ids, Payloads& payloads) { - auto resetPayload = payloads.begin(); for (auto resetID : ids) { // Access the true item @@ -153,28 +99,18 @@ void Scene::resetItems(const ItemIDs& ids, Payloads& payloads) { item.resetPayload(*resetPayload); auto newKey = item.getKey(); - - // Reset the item in the Bucket map - _masterBucketMap.reset(resetID, oldKey, newKey); - - // Reset the item in the spatial tree - auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), resetID, newKey); - item.resetCell(newCell, newKey.isSmall()); + // Update the item's container + assert((oldKey.isSpatial() == newKey.isSpatial()) || oldKey._flags.none()); + if (newKey.isSpatial()) { + auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), resetID, newKey); + item.resetCell(newCell, newKey.isSmall()); + } // next loop resetPayload++; } } -void Scene::resortItems(const ItemIDs& ids, ItemKeys& oldKeys, ItemKeys& newKeys) { - auto resortID = ids.begin(); - auto oldKey = oldKeys.begin(); - auto newKey = newKeys.begin(); - for (; resortID != ids.end(); resortID++, oldKey++, newKey++) { - _masterBucketMap.reset(*resortID, *oldKey, *newKey); - } -} - void Scene::removeItems(const ItemIDs& ids) { for (auto removedID :ids) { // Access the true item @@ -182,11 +118,12 @@ void Scene::removeItems(const ItemIDs& ids) { auto oldCell = item.getCell(); auto oldKey = item.getKey(); - // Remove from Bucket map - _masterBucketMap.erase(removedID, item.getKey()); - - // Remove from spatial tree - _masterSpatialTree.removeItem(oldCell, oldKey, removedID); + // Remove the item + if (oldKey.isSpatial()) { + _masterSpatialTree.removeItem(oldCell, oldKey, removedID); + } else { + _masterNonspatialSet.erase(removedID); + } // Kill it item.kill(); @@ -202,14 +139,27 @@ void Scene::updateItems(const ItemIDs& ids, UpdateFunctors& functors) { auto oldCell = item.getCell(); auto oldKey = item.getKey(); - // Update it - _items[updateID].update((*updateFunctor)); - + // Update the item + item.update((*updateFunctor)); auto newKey = item.getKey(); - // Update the citem in the spatial tree if needed - auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), updateID, newKey); - item.resetCell(newCell, newKey.isSmall()); + // Update the item's container + if (oldKey.isSpatial() == newKey.isSpatial()) { + if (newKey.isSpatial()) { + auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), updateID, newKey); + item.resetCell(newCell, newKey.isSmall()); + } + } else { + if (newKey.isSpatial()) { + _masterNonspatialSet.erase(updateID); + auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), updateID, newKey); + item.resetCell(newCell, newKey.isSmall()); + } else { + _masterSpatialTree.removeItem(oldCell, oldKey, updateID); + _masterNonspatialSet.insert(updateID); + } + } + // next loop updateFunctor++; diff --git a/libraries/render/src/render/Scene.h b/libraries/render/src/render/Scene.h index 63aa2ba831..8516c234dd 100644 --- a/libraries/render/src/render/Scene.h +++ b/libraries/render/src/render/Scene.h @@ -17,21 +17,6 @@ namespace render { -// A map of ItemIDSets allowing to create bucket lists of items which are filtered according to their key -class ItemBucketMap : public std::map { -public: - - ItemBucketMap() {} - - void insert(const ItemID& id, const ItemKey& key); - void erase(const ItemID& id, const ItemKey& key); - void reset(const ItemID& id, const ItemKey& oldKey, const ItemKey& newKey); - - // standard builders allocating the main buckets - void allocateStandardOpaqueTranparentBuckets(); - -}; - class Engine; class PendingChanges { @@ -40,7 +25,6 @@ public: ~PendingChanges() {} void resetItem(ItemID id, const PayloadPointer& payload); - void resortItem(ItemID id, ItemKey oldKey, ItemKey newKey); void removeItem(ItemID id); template void updateItem(ItemID id, std::function func) { @@ -53,9 +37,6 @@ public: ItemIDs _resetItems; Payloads _resetPayloads; - ItemIDs _resortItems; - ItemKeys _resortOldKeys; - ItemKeys _resortNewKeys; ItemIDs _removedItems; ItemIDs _updatedItems; UpdateFunctors _updateFunctors; @@ -75,27 +56,27 @@ public: Scene(glm::vec3 origin, float size); ~Scene() {} - /// This call is thread safe, can be called from anywhere to allocate a new ID + // This call is thread safe, can be called from anywhere to allocate a new ID ItemID allocateID(); - /// Enqueue change batch to the scene + // Enqueue change batch to the scene void enqueuePendingChanges(const PendingChanges& pendingChanges); // Process the penging changes equeued void processPendingChangesQueue(); - /// Access a particular item form its ID - /// WARNING, There is No check on the validity of the ID, so this could return a bad Item + // Access a particular item form its ID + // WARNING, There is No check on the validity of the ID, so this could return a bad Item const Item& getItem(const ItemID& id) const { return _items[id]; } size_t getNumItems() const { return _items.size(); } - /// Access the main bucketmap of items - const ItemBucketMap& getMasterBucket() const { return _masterBucketMap; } - - /// Access the item spatial tree + // Access the spatialized items const ItemSpatialTree& getSpatialTree() const { return _masterSpatialTree; } - + + // Access non-spatialized items (overlays, backgrounds) + const ItemIDSet& getNonspatialSet() const { return _masterNonspatialSet; } + protected: // Thread safe elements that can be accessed from anywhere std::atomic _IDAllocator{ 1 }; // first valid itemID will be One @@ -106,12 +87,10 @@ protected: // database of items is protected for editing by a mutex std::mutex _itemsMutex; Item::Vector _items; - ItemBucketMap _masterBucketMap; ItemSpatialTree _masterSpatialTree; - + ItemIDSet _masterNonspatialSet; void resetItems(const ItemIDs& ids, Payloads& payloads); - void resortItems(const ItemIDs& ids, ItemKeys& oldKeys, ItemKeys& newKeys); void removeItems(const ItemIDs& ids); void updateItems(const ItemIDs& ids, UpdateFunctors& functors); From 6c3dd027a70adfcc1ba2b9a5ef8cd8a63198a231 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 11:58:21 -0800 Subject: [PATCH 02/26] Use spatial tree for shadow fetch --- .../render-utils/src/RenderShadowTask.cpp | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index f8057c164b..c5ae5f0f6a 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -104,19 +104,17 @@ RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) : Task(std::make_sha skinProgram, state); } - // CPU: Fetch shadow-casting opaques - const auto fetchedItems = addJob("FetchShadowMap"); + // CPU jobs: + // Fetch and cull the items from the scene + auto shadowFilter = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered(); + const auto shadowSelection = addJob("FetchShadowSelection", shadowFilter); + const auto culledShadowSelection = addJob("CullShadowSelection", shadowSelection, cullFunctor, RenderDetails::SHADOW, shadowFilter); - // CPU: Cull against KeyLight frustum (nearby viewing camera) - const auto culledItems = addJob>("CullShadowMap", fetchedItems, cullFunctor); + // Sort + const auto sortedShapes = addJob("PipelineSortShadowSort", culledShadowSelection); + const auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); - // CPU: Sort by pipeline - const auto sortedShapes = addJob("PipelineSortShadowSort", culledItems); - - // CPU: Sort front to back - const auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); - - // GPU: Render to shadow map + // GPU jobs: Render to shadow map addJob("RenderShadowMap", shadowShapes, shapePlumber); } From 2cd6706a6a39a4f3d946f1095604ade16ba7004a Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 12:10:20 -0800 Subject: [PATCH 03/26] Update fetch to use nonspatialSet --- .../render-utils/src/RenderDeferredTask.cpp | 54 +++++++++---------- .../render-utils/src/RenderDeferredTask.h | 4 +- libraries/render/src/render/CullTask.cpp | 23 +++----- libraries/render/src/render/CullTask.h | 45 ++-------------- libraries/render/src/render/DrawTask.cpp | 15 ------ libraries/render/src/render/DrawTask.h | 10 ---- 6 files changed, 38 insertions(+), 113 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 31f40f5285..d2209ae321 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -54,34 +54,42 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) { // CPU jobs: // Fetch and cull the items from the scene - auto sceneFilter = ItemFilter::Builder::visibleWorldItems().withoutLayered(); - const auto sceneSelection = addJob("FetchSceneSelection", sceneFilter); - const auto culledSceneSelection = addJob("CullSceneSelection", sceneSelection, cullFunctor, RenderDetails::ITEM, sceneFilter); + auto spatialFilter = ItemFilter::Builder::visibleWorldItems().withoutLayered(); + const auto spatialSelection = addJob("FetchSceneSelection", spatialFilter); + const auto culledSpatialSelection = addJob("CullSceneSelection", spatialSelection, cullFunctor, RenderDetails::ITEM, spatialFilter); + + // Overlays are not culled + const auto nonspatialSelection = addJob("FetchOverlaySelection"); // Multi filter visible items into different buckets const int NUM_FILTERS = 3; const int OPAQUE_SHAPE_BUCKET = 0; const int TRANSPARENT_SHAPE_BUCKET = 1; const int LIGHT_BUCKET = 2; - MultiFilterItem::ItemFilterArray triageFilters = { { + const int BACKGROUND_BUCKET = 2; + MultiFilterItem::ItemFilterArray spatialFilters = { { ItemFilter::Builder::opaqueShape(), ItemFilter::Builder::transparentShape(), ItemFilter::Builder::light() } }; - const auto filteredItemsBuckets = addJob>("FilterSceneSelection", culledSceneSelection, triageFilters).get::ItemBoundsArray>(); + MultiFilterItem::ItemFilterArray nonspatialFilters = { { + ItemFilter::Builder::opaqueShape(), + ItemFilter::Builder::transparentShape(), + ItemFilter::Builder::background() + } }; + const auto filteredSpatialBuckets = addJob>("FilterSceneSelection", culledSpatialSelection, spatialFilters).get::ItemBoundsArray>(); + const auto filteredNonspatialBuckets = addJob>("FilterOverlaySelection", nonspatialSelection, nonspatialFilters).get::ItemBoundsArray>(); // Extract / Sort opaques / Transparents / Lights / Overlays - const auto opaques = addJob("DepthSortOpaque", filteredItemsBuckets[OPAQUE_SHAPE_BUCKET]); - const auto transparents = addJob("DepthSortTransparent", filteredItemsBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false)); - const auto lights = filteredItemsBuckets[LIGHT_BUCKET]; + const auto opaques = addJob("DepthSortOpaque", filteredSpatialBuckets[OPAQUE_SHAPE_BUCKET]); + const auto transparents = addJob("DepthSortTransparent", filteredSpatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false)); + const auto lights = filteredSpatialBuckets[LIGHT_BUCKET]; - // Overlays are not culled because we want to make sure they are seen - // Could be considered a bug in the current cullfunctor - const auto overlayOpaques = addJob("FetchOverlayOpaque", ItemFilter::Builder::opaqueShapeLayered()); - const auto fetchedOverlayOpaques = addJob("FetchOverlayTransparents", ItemFilter::Builder::transparentShapeLayered()); - const auto overlayTransparents = addJob("DepthSortTransparentOverlay", fetchedOverlayOpaques, DepthSortItems(false)); + const auto overlayOpaques = addJob("DepthSortOverlayOpaque", filteredNonspatialBuckets[OPAQUE_SHAPE_BUCKET]); + const auto overlayTransparents = addJob("DepthSortOverlayTransparent", filteredNonspatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false)); + const auto background = filteredNonspatialBuckets[BACKGROUND_BUCKET]; - // GPU Jobs: Start preparing the deferred and lighting buffer + // GPU jobs: Start preparing the deferred and lighting buffer addJob("PrepareDeferred"); // Render opaque objects in DeferredBuffer @@ -91,7 +99,7 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) { addJob("DrawOpaqueStencil"); // Use Stencil and start drawing background in Lighting buffer - addJob("DrawBackgroundDeferred"); + addJob("DrawBackgroundDeferred", background); // AO job addJob("AmbientOcclusion"); @@ -123,8 +131,8 @@ RenderDeferredTask::RenderDeferredTask(CullFunctor cullFunctor) { // Scene Octree Debuging job { - addJob("DrawSceneOctree", sceneSelection); - addJob("DrawItemSelection", sceneSelection); + addJob("DrawSceneOctree", spatialSelection); + addJob("DrawItemSelection", spatialSelection); } // Status icon rendering job @@ -276,20 +284,10 @@ void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const Ren args->_batch = nullptr; } -void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { +void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems) { assert(renderContext->args); assert(renderContext->args->_viewFrustum); - // render backgrounds - auto& scene = sceneContext->_scene; - auto& items = scene->getMasterBucket().at(ItemFilter::Builder::background()); - - - ItemBounds inItems; - inItems.reserve(items.size()); - for (auto id : items) { - inItems.emplace_back(id); - } RenderArgs* args = renderContext->args; doInBatch(args->_context, [&](gpu::Batch& batch) { args->_batch = &batch; diff --git a/libraries/render-utils/src/RenderDeferredTask.h b/libraries/render-utils/src/RenderDeferredTask.h index 5591edce7c..f8837f5b24 100755 --- a/libraries/render-utils/src/RenderDeferredTask.h +++ b/libraries/render-utils/src/RenderDeferredTask.h @@ -85,9 +85,9 @@ protected: class DrawBackgroundDeferred { public: - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); + void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const render::ItemBounds& inItems); - using JobModel = render::Job::Model; + using JobModel = render::Job::ModelI; }; class DrawOverlay3DConfig : public render::Job::Config { diff --git a/libraries/render/src/render/CullTask.cpp b/libraries/render/src/render/CullTask.cpp index 7824514649..7c5f5184da 100644 --- a/libraries/render/src/render/CullTask.cpp +++ b/libraries/render/src/render/CullTask.cpp @@ -129,32 +129,21 @@ void DepthSortItems::run(const SceneContextPointer& sceneContext, const RenderCo depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems); } - -void FetchItems::configure(const Config& config) { -} - -void FetchItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems) { +void FetchNonspatialItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems) { assert(renderContext->args); assert(renderContext->args->_viewFrustum); auto& scene = sceneContext->_scene; outItems.clear(); - const auto& bucket = scene->getMasterBucket(); - const auto& items = bucket.find(_filter); - if (items != bucket.end()) { - outItems.reserve(items->second.size()); - for (auto& id : items->second) { - auto& item = scene->getItem(id); - outItems.emplace_back(ItemBound(id, item.getBound())); - } + const auto& items = scene->getNonspatialSet(); + outItems.reserve(items.size()); + for (auto& id : items) { + auto& item = scene->getItem(id); + outItems.emplace_back(ItemBound(id, item.getBound())); } - - std::static_pointer_cast(renderContext->jobConfig)->numItems = (int)outItems.size(); } - - void FetchSpatialTree::configure(const Config& config) { _justFrozeFrustum = _justFrozeFrustum || (config.freezeFrustum && !_freezeFrustum); _freezeFrustum = config.freezeFrustum; diff --git a/libraries/render/src/render/CullTask.h b/libraries/render/src/render/CullTask.h index 734d683ad7..1306640891 100644 --- a/libraries/render/src/render/CullTask.h +++ b/libraries/render/src/render/CullTask.h @@ -23,50 +23,12 @@ namespace render { const ItemBounds& inItems, ItemBounds& outItems); void depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems); - class FetchItemsConfig : public Job::Config { - Q_OBJECT - Q_PROPERTY(int numItems READ getNumItems) + class FetchNonspatialItems { public: - int getNumItems() { return numItems; } - - int numItems{ 0 }; - }; - - class FetchItems { - public: - using Config = FetchItemsConfig; - using JobModel = Job::ModelO; - - FetchItems() {} - FetchItems(const ItemFilter& filter) : _filter(filter) {} - - ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() }; - - void configure(const Config& config); + using JobModel = Job::ModelO; void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems); }; - - template - class CullItems { - public: - using JobModel = Job::ModelIO, ItemBounds, ItemBounds>; - - CullItems(CullFunctor cullFunctor) : _cullFunctor{ cullFunctor } {} - - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { - const auto& args = renderContext->args; - auto& details = args->_details.edit(T); - outItems.clear(); - outItems.reserve(inItems.size()); - render::cullItems(renderContext, _cullFunctor, details, inItems, outItems); - } - - protected: - CullFunctor _cullFunctor; - }; - - class FetchSpatialTreeConfig : public Job::Config { Q_OBJECT Q_PROPERTY(int numItems READ getNumItems) @@ -209,13 +171,14 @@ namespace render { outItems[i].template edit().clear(); } - // For each item, filter it into the buckets + // For each item, filter it into one bucket for (auto itemBound : inItems) { auto& item = scene->getItem(itemBound.id); auto itemKey = item.getKey(); for (size_t i = 0; i < NUM_FILTERS; i++) { if (_filters[i].test(itemKey)) { outItems[i].template edit().emplace_back(itemBound); + break; } } } diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 5ad6ca0547..85bb01a378 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -93,18 +93,3 @@ void PipelineSortShapes::run(const SceneContextPointer& sceneContext, const Rend items.second.shrink_to_fit(); } } - -void DepthSortShapes::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapesIDsBounds& inShapes, ShapesIDsBounds& outShapes) { - outShapes.clear(); - outShapes.reserve(inShapes.size()); - - for (auto& pipeline : inShapes) { - auto& inItems = pipeline.second; - auto outItems = outShapes.find(pipeline.first); - if (outItems == outShapes.end()) { - outItems = outShapes.insert(std::make_pair(pipeline.first, ItemBounds{})).first; - } - - depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems->second); - } -} diff --git a/libraries/render/src/render/DrawTask.h b/libraries/render/src/render/DrawTask.h index a52bd3192f..29543dfb3e 100755 --- a/libraries/render/src/render/DrawTask.h +++ b/libraries/render/src/render/DrawTask.h @@ -37,16 +37,6 @@ public: void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapesIDsBounds& outShapes); }; -class DepthSortShapes { -public: - using JobModel = Job::ModelIO; - - bool _frontToBack; - DepthSortShapes(bool frontToBack = true) : _frontToBack(frontToBack) {} - - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapesIDsBounds& inShapes, ShapesIDsBounds& outShapes); -}; - } #endif // hifi_render_DrawTask_h From 5995c3717f44a26d6a2caf7999d47d0ada64b338 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 14:42:00 -0800 Subject: [PATCH 04/26] Continue updating overlay key on edit --- interface/src/ui/overlays/Overlays.cpp | 20 ++++++++------------ libraries/render/src/render/Item.cpp | 7 +++++++ libraries/render/src/render/Item.h | 8 +++----- libraries/render/src/render/Scene.h | 1 + 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 2bc1286419..5a2d05815b 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -233,23 +233,19 @@ bool Overlays::editOverlay(unsigned int id, const QScriptValue& properties) { Overlay::Pointer thisOverlay = getOverlay(id); if (thisOverlay) { + thisOverlay->setProperties(properties); + if (thisOverlay->is3D()) { - render::ItemKey oldItemKey = render::payloadGetKey(thisOverlay); - - thisOverlay->setProperties(properties); - - render::ItemKey itemKey = render::payloadGetKey(thisOverlay); - if (itemKey != oldItemKey) { - auto itemID = thisOverlay->getRenderItemID(); - if (render::Item::isValidID(itemID)) { - render::ScenePointer scene = qApp->getMain3DScene(); + auto itemID = thisOverlay->getRenderItemID(); + if (render::Item::isValidID(itemID)) { + render::ScenePointer scene = qApp->getMain3DScene(); + const render::Item& item = scene->getItem(itemID); + if (item.getKey() != render::payloadGetKey(thisOverlay)) { render::PendingChanges pendingChanges; - pendingChanges.resortItem(itemID, oldItemKey, itemKey); + pendingChanges.updateItem(itemID); scene->enqueuePendingChanges(pendingChanges); } } - } else { - thisOverlay->setProperties(properties); } return true; diff --git a/libraries/render/src/render/Item.cpp b/libraries/render/src/render/Item.cpp index e5356c2b0c..f80563bf73 100644 --- a/libraries/render/src/render/Item.cpp +++ b/libraries/render/src/render/Item.cpp @@ -63,6 +63,13 @@ void Item::PayloadInterface::addStatusGetters(const Status::Getters& getters) { } } +void Item::update(const UpdateFunctorPointer& updateFunctor) { + if (updateFunctor) { + _payload->update(updateFunctor); + } + _key = _payload->getKey(); +} + void Item::resetPayload(const PayloadPointer& payload) { if (!payload) { kill(); diff --git a/libraries/render/src/render/Item.h b/libraries/render/src/render/Item.h index 53e1f3f0df..ddc5a92c9d 100644 --- a/libraries/render/src/render/Item.h +++ b/libraries/render/src/render/Item.h @@ -313,13 +313,11 @@ public: Item() {} ~Item() {} - // Main scene / item managment interface Reset/Update/Kill + // Main scene / item managment interface reset/update/kill void resetPayload(const PayloadPointer& payload); void resetCell(ItemCell cell, bool _small) { _cell = cell; _key.setSmaller(_small); } - // Communicate the update to the payload - void update(const UpdateFunctorPointer& updateFunctor) { _payload->update(updateFunctor); _key = _payload->getKey(); } - // Forget the payload, key, and cell - void kill() { _payload.reset(); _key._flags.reset(); _cell = INVALID_CELL; } + void update(const UpdateFunctorPointer& updateFunctor); // communicate update to payload + void kill() { _payload.reset(); _key._flags.reset(); _cell = INVALID_CELL; } // forget the payload, key, cell // Check heuristic key const ItemKey& getKey() const { return _key; } diff --git a/libraries/render/src/render/Scene.h b/libraries/render/src/render/Scene.h index 8516c234dd..40c0baca60 100644 --- a/libraries/render/src/render/Scene.h +++ b/libraries/render/src/render/Scene.h @@ -32,6 +32,7 @@ public: } void updateItem(ItemID id, const UpdateFunctorPointer& functor); + void updateItem(ItemID id) { updateItem(id, nullptr); } void merge(PendingChanges& changes); From 56aac35348b9e9aa08be09eddbcb6534086cb8b3 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 15:24:37 -0800 Subject: [PATCH 05/26] Fix drawInFront bugs --- libraries/render/src/render/Item.h | 4 ++-- libraries/render/src/render/Scene.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/render/src/render/Item.h b/libraries/render/src/render/Item.h index ddc5a92c9d..c075b281f3 100644 --- a/libraries/render/src/render/Item.h +++ b/libraries/render/src/render/Item.h @@ -315,9 +315,9 @@ public: // Main scene / item managment interface reset/update/kill void resetPayload(const PayloadPointer& payload); - void resetCell(ItemCell cell, bool _small) { _cell = cell; _key.setSmaller(_small); } + void resetCell(ItemCell cell = INVALID_CELL, bool _small = false) { _cell = cell; _key.setSmaller(_small); } void update(const UpdateFunctorPointer& updateFunctor); // communicate update to payload - void kill() { _payload.reset(); _key._flags.reset(); _cell = INVALID_CELL; } // forget the payload, key, cell + void kill() { _payload.reset(); resetCell(); _key._flags.reset(); } // forget the payload, key, cell // Check heuristic key const ItemKey& getKey() const { return _key; } diff --git a/libraries/render/src/render/Scene.cpp b/libraries/render/src/render/Scene.cpp index 624f639d79..0cdd736fee 100644 --- a/libraries/render/src/render/Scene.cpp +++ b/libraries/render/src/render/Scene.cpp @@ -104,6 +104,8 @@ void Scene::resetItems(const ItemIDs& ids, Payloads& payloads) { if (newKey.isSpatial()) { auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), resetID, newKey); item.resetCell(newCell, newKey.isSmall()); + } else { + _masterNonspatialSet.insert(resetID); } // next loop @@ -152,10 +154,13 @@ void Scene::updateItems(const ItemIDs& ids, UpdateFunctors& functors) { } else { if (newKey.isSpatial()) { _masterNonspatialSet.erase(updateID); + auto newCell = _masterSpatialTree.resetItem(oldCell, oldKey, item.getBound(), updateID, newKey); item.resetCell(newCell, newKey.isSmall()); } else { _masterSpatialTree.removeItem(oldCell, oldKey, updateID); + item.resetCell(); + _masterNonspatialSet.insert(updateID); } } From 30fbd99d1130de92a67fd11d851d3ab8026dc809 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 16:04:15 -0800 Subject: [PATCH 06/26] Factor out SortTask to fix shadows --- .../render-utils/src/RenderDeferredTask.cpp | 13 +- .../render-utils/src/RenderDeferredTask.h | 5 +- .../render-utils/src/RenderShadowTask.cpp | 18 ++- libraries/render-utils/src/RenderShadowTask.h | 6 +- libraries/render/src/render/CullTask.cpp | 67 ---------- libraries/render/src/render/CullTask.h | 11 -- libraries/render/src/render/DrawTask.cpp | 20 --- libraries/render/src/render/DrawTask.h | 10 -- libraries/render/src/render/Item.h | 2 +- libraries/render/src/render/SortTask.cpp | 120 ++++++++++++++++++ libraries/render/src/render/SortTask.h | 47 +++++++ 11 files changed, 192 insertions(+), 127 deletions(-) create mode 100644 libraries/render/src/render/SortTask.cpp create mode 100644 libraries/render/src/render/SortTask.h diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index d2209ae321..27316007b7 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -10,27 +10,30 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "RenderDeferredTask.h" + #include #include #include #include #include +#include +#include +#include +#include +#include + #include "DebugDeferredBuffer.h" #include "DeferredLightingEffect.h" #include "FramebufferCache.h" #include "HitEffect.h" #include "TextureCache.h" -#include "render/DrawTask.h" -#include "render/DrawStatus.h" -#include "render/DrawSceneOctree.h" #include "AmbientOcclusionEffect.h" #include "AntialiasingEffect.h" #include "ToneMappingEffect.h" -#include "RenderDeferredTask.h" - using namespace render; extern void initStencilPipeline(gpu::PipelinePointer& pipeline); diff --git a/libraries/render-utils/src/RenderDeferredTask.h b/libraries/render-utils/src/RenderDeferredTask.h index f8837f5b24..bbcaec34f3 100755 --- a/libraries/render-utils/src/RenderDeferredTask.h +++ b/libraries/render-utils/src/RenderDeferredTask.h @@ -12,9 +12,8 @@ #ifndef hifi_RenderDeferredTask_h #define hifi_RenderDeferredTask_h -#include "gpu/Pipeline.h" - -#include "render/DrawTask.h" +#include +#include class SetupDeferred { public: diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index c5ae5f0f6a..d9e0c06a90 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -9,16 +9,20 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +#include "RenderShadowTask.h" + #include #include -#include "render/Context.h" +#include +#include +#include +#include + #include "DeferredLightingEffect.h" #include "FramebufferCache.h" -#include "RenderShadowTask.h" - #include "model_shadow_vert.h" #include "skin_model_shadow_vert.h" @@ -28,7 +32,7 @@ using namespace render; void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, - const render::ShapesIDsBounds& inShapes) { + const render::ShapeBounds& inShapes) { assert(renderContext->args); assert(renderContext->args->_viewFrustum); @@ -111,11 +115,11 @@ RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) : Task(std::make_sha const auto culledShadowSelection = addJob("CullShadowSelection", shadowSelection, cullFunctor, RenderDetails::SHADOW, shadowFilter); // Sort - const auto sortedShapes = addJob("PipelineSortShadowSort", culledShadowSelection); - const auto shadowShapes = addJob("DepthSortShadowMap", sortedShapes); + const auto sortedPipelines = addJob("PipelineSortShadowSort", culledShadowSelection); + const auto sortedShapes = addJob("DepthSortShadowMap", sortedPipelines); // GPU jobs: Render to shadow map - addJob("RenderShadowMap", shadowShapes, shapePlumber); + addJob("RenderShadowMap", sortedShapes, shapePlumber); } void RenderShadowTask::configure(const Config& configuration) { diff --git a/libraries/render-utils/src/RenderShadowTask.h b/libraries/render-utils/src/RenderShadowTask.h index 679302b69f..4a6ff1b0e9 100644 --- a/libraries/render-utils/src/RenderShadowTask.h +++ b/libraries/render-utils/src/RenderShadowTask.h @@ -15,17 +15,17 @@ #include #include -#include +#include class ViewFrustum; class RenderShadowMap { public: - using JobModel = render::Job::ModelI; + using JobModel = render::Job::ModelI; RenderShadowMap(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, - const render::ShapesIDsBounds& inShapes); + const render::ShapeBounds& inShapes); protected: render::ShapePlumberPointer _shapePlumber; diff --git a/libraries/render/src/render/CullTask.cpp b/libraries/render/src/render/CullTask.cpp index 7c5f5184da..484f049944 100644 --- a/libraries/render/src/render/CullTask.cpp +++ b/libraries/render/src/render/CullTask.cpp @@ -62,73 +62,6 @@ void render::cullItems(const RenderContextPointer& renderContext, const CullFunc details._rendered += (int)outItems.size(); } -struct ItemBoundSort { - float _centerDepth = 0.0f; - float _nearDepth = 0.0f; - float _farDepth = 0.0f; - ItemID _id = 0; - AABox _bounds; - - ItemBoundSort() {} - ItemBoundSort(float centerDepth, float nearDepth, float farDepth, ItemID id, const AABox& bounds) : _centerDepth(centerDepth), _nearDepth(nearDepth), _farDepth(farDepth), _id(id), _bounds(bounds) {} -}; - -struct FrontToBackSort { - bool operator() (const ItemBoundSort& left, const ItemBoundSort& right) { - return (left._centerDepth < right._centerDepth); - } -}; - -struct BackToFrontSort { - bool operator() (const ItemBoundSort& left, const ItemBoundSort& right) { - return (left._centerDepth > right._centerDepth); - } -}; - -void render::depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems) { - assert(renderContext->args); - assert(renderContext->args->_viewFrustum); - - auto& scene = sceneContext->_scene; - RenderArgs* args = renderContext->args; - - - // Allocate and simply copy - outItems.clear(); - outItems.reserve(inItems.size()); - - - // Make a local dataset of the center distance and closest point distance - std::vector itemBoundSorts; - itemBoundSorts.reserve(outItems.size()); - - for (auto itemDetails : inItems) { - auto item = scene->getItem(itemDetails.id); - auto bound = itemDetails.bound; // item.getBound(); - float distance = args->_viewFrustum->distanceToCamera(bound.calcCenter()); - - itemBoundSorts.emplace_back(ItemBoundSort(distance, distance, distance, itemDetails.id, bound)); - } - - // sort against Z - if (frontToBack) { - FrontToBackSort frontToBackSort; - std::sort(itemBoundSorts.begin(), itemBoundSorts.end(), frontToBackSort); - } else { - BackToFrontSort backToFrontSort; - std::sort(itemBoundSorts.begin(), itemBoundSorts.end(), backToFrontSort); - } - - // FInally once sorted result to a list of itemID - for (auto& item : itemBoundSorts) { - outItems.emplace_back(ItemBound(item._id, item._bounds)); - } -} - -void DepthSortItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { - depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems); -} - void FetchNonspatialItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems) { assert(renderContext->args); assert(renderContext->args->_viewFrustum); diff --git a/libraries/render/src/render/CullTask.h b/libraries/render/src/render/CullTask.h index 1306640891..a6a32e4561 100644 --- a/libraries/render/src/render/CullTask.h +++ b/libraries/render/src/render/CullTask.h @@ -21,7 +21,6 @@ namespace render { void cullItems(const RenderContextPointer& renderContext, const CullFunctor& cullFunctor, RenderDetails::Item& details, const ItemBounds& inItems, ItemBounds& outItems); - void depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems); class FetchNonspatialItems { public: @@ -184,16 +183,6 @@ namespace render { } } }; - - class DepthSortItems { - public: - using JobModel = Job::ModelIO; - - bool _frontToBack; - DepthSortItems(bool frontToBack = true) : _frontToBack(frontToBack) {} - - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); - }; } #endif // hifi_render_CullTask_h; \ No newline at end of file diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 85bb01a378..733f7d9e9c 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -73,23 +73,3 @@ void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContext args->_batch = nullptr; }); } - -void PipelineSortShapes::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapesIDsBounds& outShapes) { - auto& scene = sceneContext->_scene; - outShapes.clear(); - - for (const auto& item : inItems) { - auto key = scene->getItem(item.id).getShapeKey(); - auto outItems = outShapes.find(key); - if (outItems == outShapes.end()) { - outItems = outShapes.insert(std::make_pair(key, ItemBounds{})).first; - outItems->second.reserve(inItems.size()); - } - - outItems->second.push_back(item); - } - - for (auto& items : outShapes) { - items.second.shrink_to_fit(); - } -} diff --git a/libraries/render/src/render/DrawTask.h b/libraries/render/src/render/DrawTask.h index 29543dfb3e..fc2ab9682f 100755 --- a/libraries/render/src/render/DrawTask.h +++ b/libraries/render/src/render/DrawTask.h @@ -13,10 +13,6 @@ #define hifi_render_DrawTask_h #include "Engine.h" -#include "CullTask.h" -#include "ShapePipeline.h" -#include "gpu/Batch.h" - namespace render { @@ -31,12 +27,6 @@ public: protected: }; -class PipelineSortShapes { -public: - using JobModel = Job::ModelIO; - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapesIDsBounds& outShapes); -}; - } #endif // hifi_render_DrawTask_h diff --git a/libraries/render/src/render/Item.h b/libraries/render/src/render/Item.h index c075b281f3..fb5534e3ab 100644 --- a/libraries/render/src/render/Item.h +++ b/libraries/render/src/render/Item.h @@ -465,7 +465,7 @@ public: using ItemBounds = std::vector; // A map of items by ShapeKey to optimize rendering pipeline assignments -using ShapesIDsBounds = std::unordered_map; +using ShapeBounds = std::unordered_map; } diff --git a/libraries/render/src/render/SortTask.cpp b/libraries/render/src/render/SortTask.cpp new file mode 100644 index 0000000000..d2fda542b1 --- /dev/null +++ b/libraries/render/src/render/SortTask.cpp @@ -0,0 +1,120 @@ +// +// CullTask.cpp +// render/src/render +// +// Created by Sam Gateau on 2/2/16. +// Copyright 2016 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 +// + +#include "SortTask.h" +#include "ShapePipeline.h" + +#include +#include + +using namespace render; + +struct ItemBoundSort { + float _centerDepth = 0.0f; + float _nearDepth = 0.0f; + float _farDepth = 0.0f; + ItemID _id = 0; + AABox _bounds; + + ItemBoundSort() {} + ItemBoundSort(float centerDepth, float nearDepth, float farDepth, ItemID id, const AABox& bounds) : _centerDepth(centerDepth), _nearDepth(nearDepth), _farDepth(farDepth), _id(id), _bounds(bounds) {} +}; + +struct FrontToBackSort { + bool operator() (const ItemBoundSort& left, const ItemBoundSort& right) { + return (left._centerDepth < right._centerDepth); + } +}; + +struct BackToFrontSort { + bool operator() (const ItemBoundSort& left, const ItemBoundSort& right) { + return (left._centerDepth > right._centerDepth); + } +}; + +void render::depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems) { + assert(renderContext->args); + assert(renderContext->args->_viewFrustum); + + auto& scene = sceneContext->_scene; + RenderArgs* args = renderContext->args; + + + // Allocate and simply copy + outItems.clear(); + outItems.reserve(inItems.size()); + + + // Make a local dataset of the center distance and closest point distance + std::vector itemBoundSorts; + itemBoundSorts.reserve(outItems.size()); + + for (auto itemDetails : inItems) { + auto item = scene->getItem(itemDetails.id); + auto bound = itemDetails.bound; // item.getBound(); + float distance = args->_viewFrustum->distanceToCamera(bound.calcCenter()); + + itemBoundSorts.emplace_back(ItemBoundSort(distance, distance, distance, itemDetails.id, bound)); + } + + // sort against Z + if (frontToBack) { + FrontToBackSort frontToBackSort; + std::sort(itemBoundSorts.begin(), itemBoundSorts.end(), frontToBackSort); + } else { + BackToFrontSort backToFrontSort; + std::sort(itemBoundSorts.begin(), itemBoundSorts.end(), backToFrontSort); + } + + // Finally once sorted result to a list of itemID + for (auto& item : itemBoundSorts) { + outItems.emplace_back(ItemBound(item._id, item._bounds)); + } +} + +void PipelineSortShapes::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes) { + auto& scene = sceneContext->_scene; + outShapes.clear(); + + for (const auto& item : inItems) { + auto key = scene->getItem(item.id).getShapeKey(); + auto outItems = outShapes.find(key); + if (outItems == outShapes.end()) { + outItems = outShapes.insert(std::make_pair(key, ItemBounds{})).first; + outItems->second.reserve(inItems.size()); + } + + outItems->second.push_back(item); + } + + for (auto& items : outShapes) { + items.second.shrink_to_fit(); + } +} + +void DepthSortShapes::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapeBounds& inShapes, ShapeBounds& outShapes) { + outShapes.clear(); + outShapes.reserve(inShapes.size()); + + for (auto& pipeline : inShapes) { + auto& inItems = pipeline.second; + auto outItems = outShapes.find(pipeline.first); + if (outItems == outShapes.end()) { + outItems = outShapes.insert(std::make_pair(pipeline.first, ItemBounds{})).first; + } + + depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems->second); + } +} + +void DepthSortItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { + depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems); +} diff --git a/libraries/render/src/render/SortTask.h b/libraries/render/src/render/SortTask.h new file mode 100644 index 0000000000..eb341192aa --- /dev/null +++ b/libraries/render/src/render/SortTask.h @@ -0,0 +1,47 @@ +// +// SortTask.h +// render/src/render +// +// Created by Zach Pomerantz on 2/26/2016. +// Copyright 2016 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 +// + +#ifndef hifi_render_SortTask_h +#define hifi_render_SortTask_h + +#include "Engine.h" + +namespace render { + void depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems); + + class PipelineSortShapes { + public: + using JobModel = Job::ModelIO; + void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes); + }; + + class DepthSortShapes { + public: + using JobModel = Job::ModelIO; + + bool _frontToBack; + DepthSortShapes(bool frontToBack = true) : _frontToBack(frontToBack) {} + + void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapeBounds& inShapes, ShapeBounds& outShapes); + }; + + class DepthSortItems { + public: + using JobModel = Job::ModelIO; + + bool _frontToBack; + DepthSortItems(bool frontToBack = true) : _frontToBack(frontToBack) {} + + void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + }; +} + +#endif // hifi_render_SortTask_h; \ No newline at end of file From 32807012e8124ede2e94549cb6ec01933d8c3aff Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Fri, 26 Feb 2016 16:26:16 -0800 Subject: [PATCH 07/26] Rm redundant texture reset in overlay draw --- libraries/render-utils/src/RenderDeferredTask.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 27316007b7..f87ca26df1 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -181,9 +181,9 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont RenderArgs* args = renderContext->args; gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { + args->_batch = &batch; batch.setViewportTransform(args->_viewport); batch.setStateScissorRect(args->_viewport); - args->_batch = &batch; config->setNumDrawn((int)inItems.size()); emit config->numDrawnChanged(); @@ -233,7 +233,8 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon // Render the items gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { args->_batch = &batch; - args->_whiteTexture = DependencyManager::get()->getWhiteTexture(); + batch.setViewportTransform(args->_viewport); + batch.setStateScissorRect(args->_viewport); glm::mat4 projMat; Transform viewMat; @@ -242,14 +243,10 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon batch.setProjectionTransform(projMat); batch.setViewTransform(viewMat); - batch.setViewportTransform(args->_viewport); - batch.setStateScissorRect(args->_viewport); - batch.setResourceTexture(0, args->_whiteTexture); renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn); + args->_batch = nullptr; }); - args->_batch = nullptr; - args->_whiteTexture.reset(); } } From ba1e8db34ac8e9a992abc062a5fb534ea90dda92 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 13:51:13 +1300 Subject: [PATCH 08/26] Add QML UI test dialogs for creating and deleting bookmarks --- tests/ui/qml/main.qml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/ui/qml/main.qml b/tests/ui/qml/main.qml index 97f6224670..a3b6114c11 100644 --- a/tests/ui/qml/main.qml +++ b/tests/ui/qml/main.qml @@ -137,6 +137,25 @@ ApplicationWindow { }); } } + Button { + text: "Bookmark Location" + onClicked: { + desktop.inputDialog({ + title: "Bookmark Location", + label: "Name" + }); + } + } + Button { + text: "Delete Bookmark" + onClicked: { + desktop.inputDialog({ + title: "Delete Bookmark", + label: "Select the bookmark to delete", + items: ["Bookmark A", "Bookmark B", "Bookmark C"] + }); + } + } /* // There is no such desktop.queryBox() function; may need to update test to cover QueryDialog.qml? Button { From d893b2e3b1affc6fd178a2d2fde459f820656692 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 13:52:24 +1300 Subject: [PATCH 09/26] Handle no icon in modal dialogs --- interface/resources/qml/windows-uit/ModalFrame.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/windows-uit/ModalFrame.qml b/interface/resources/qml/windows-uit/ModalFrame.qml index d6c05c8f91..57298ccb1a 100644 --- a/interface/resources/qml/windows-uit/ModalFrame.qml +++ b/interface/resources/qml/windows-uit/ModalFrame.qml @@ -47,12 +47,12 @@ Frame { } Item { - width: title.width + (window.iconText !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0) + width: title.width + (icon.text !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0) x: (parent.width - width) / 2 FontAwesome { id: icon - text: window.iconText + text: window.iconText ? window.iconText : "" size: 30 color: hifi.colors.lightGrayText visible: text != "" From b7fd5467ba1c141ba3404a14ef09df9ae9e45866 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 13:53:05 +1300 Subject: [PATCH 10/26] Restyle query dialogs --- .../resources/qml/dialogs/QueryDialog.qml | 82 ++++++++++++------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index 948bbb1295..f13c738bb0 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -1,10 +1,20 @@ +// +// QueryDialog.qml +// +// Created by Bradley Austin Davis on 22 Jan 2016 +// Copyright 2015 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 +// + import QtQuick 2.5 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.4 import QtQuick.Dialogs 1.2 as OriginalDialogs -import "../controls" as VrControls -import "../styles" -import "../windows" +import "../controls-uit" +import "../styles-uit" +import "../windows-uit" ModalWindow { id: root @@ -17,7 +27,7 @@ ModalWindow { signal canceled(); property var items; - property alias label: mainTextContainer.text + property string label property var result; // FIXME not current honored property var current; @@ -28,64 +38,76 @@ ModalWindow { // For combo boxes property bool editable: true; - Rectangle { + Item { clip: true - anchors.fill: parent - radius: 4 - color: "white" + width: pane.width + height: pane.height + anchors.margins: 0 QtObject { id: d - readonly property real spacing: hifi.layout.spacing - readonly property real outerSpacing: hifi.layout.spacing * 2 readonly property int minWidth: 480 readonly property int maxWdith: 1280 readonly property int minHeight: 120 readonly property int maxHeight: 720 function resize() { - var targetWidth = mainTextContainer.width + d.spacing * 6 - var targetHeight = mainTextContainer.implicitHeight + textResult.height + d.spacing + buttons.height + var targetWidth = pane.width + var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth) root.height = (targetHeight < d.minHeight) ? d.minHeight: ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight) } } - Text { - id: mainTextContainer - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - wrapMode: Text.WordWrap - font { pointSize: 14; weight: Font.Bold } - anchors { left: parent.left; top: parent.top; margins: d.spacing } - } - Item { - anchors { top: mainTextContainer.bottom; bottom: buttons.top; left: parent.left; right: parent.right; margins: d.spacing } + anchors { + top: parent.top + bottom: buttons.top; + left: parent.left; + right: parent.right; + margins: 0 + bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } + // FIXME make a text field type that can be bound to a history for autocompletion - VrControls.TextField { + TextField { id: textResult + label: root.label focus: items ? false : true visible: items ? false : true - anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter } + anchors { + left: parent.left; + right: parent.right; + bottom: parent.bottom + } } - VrControls.ComboBox { + ComboBox { id: comboBox + label: root.label focus: true visible: items ? true : false - anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter } + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } model: items ? items : [] } - } Flow { id: buttons focus: true - spacing: d.spacing + spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); layoutDirection: Qt.RightToLeft - anchors { bottom: parent.bottom; right: parent.right; margins: d.spacing; } + anchors { + bottom: parent.bottom + right: parent.right + margins: 0 + bottomMargin: hifi.dimensions.contentSpacing.y + } Button { action: acceptAction } Button { action: cancelAction } } @@ -130,4 +152,6 @@ ModalWindow { break; } } + + Component.onCompleted: d.resize() } From 7f2938c53fb8fdc7cbcef7396814bd282024f518 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 13:56:25 +1300 Subject: [PATCH 11/26] Tidy message dialog code --- .../resources/qml/dialogs/MessageDialog.qml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml index 26ed406b02..e3c0f96968 100644 --- a/interface/resources/qml/dialogs/MessageDialog.qml +++ b/interface/resources/qml/dialogs/MessageDialog.qml @@ -1,8 +1,8 @@ // -// Desktop.qml +// MessageDialog.qml // -// Created by Bradley Austin Davis on 25 Apr 2015 -// Copyright 2015 High Fidelity, Inc. +// Created by Bradley Austin Davis on 15 Jan 2016 +// Copyright 2016 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 @@ -80,8 +80,6 @@ ModalWindow { QtObject { id: d - readonly property real spacing: hifi.dimensions.contentSpacing.x - readonly property real outerSpacing: hifi.dimensions.contentSpacing.y readonly property int minWidth: 480 readonly property int maxWdith: 1280 readonly property int minHeight: 120 @@ -132,7 +130,7 @@ ModalWindow { Flow { id: buttons focus: true - spacing: d.spacing + spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); layoutDirection: Qt.RightToLeft anchors { @@ -186,8 +184,8 @@ ModalWindow { id: flickable contentHeight: detailedText.height anchors.fill: parent - anchors.topMargin: root.spacing - anchors.bottomMargin: root.outerSpacing + anchors.topMargin: hifi.dimensions.contentSpacing.x + anchors.bottomMargin: hifi.dimensions.contentSpacing.y TextEdit { id: detailedText size: hifi.fontSizes.menuItem @@ -210,7 +208,7 @@ ModalWindow { } ] - Component.onCompleted: updateIcon(); + Component.onCompleted: updateIcon() onStateChanged: d.resize() } From b71a512a6ff0c333e37ebff175dd65ebd1036005 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 13:58:20 +1300 Subject: [PATCH 12/26] Reorder OK and Cancel buttons --- interface/resources/qml/dialogs/QueryDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index f13c738bb0..008e3f4bcd 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -108,8 +108,8 @@ ModalWindow { margins: 0 bottomMargin: hifi.dimensions.contentSpacing.y } - Button { action: acceptAction } Button { action: cancelAction } + Button { action: acceptAction } } Action { From 09390ffffd4289beeb8f034b33a6cf0e6841843a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 14:00:49 +1300 Subject: [PATCH 13/26] Remove colon from dialog label --- interface/src/Bookmarks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index 0a885493e3..c37e7cde87 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -107,7 +107,7 @@ void Bookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) { void Bookmarks::bookmarkLocation() { bool ok = false; - auto bookmarkName = OffscreenUi::getText(nullptr, "Bookmark Location", "Name:", QLineEdit::Normal, QString(), &ok); + auto bookmarkName = OffscreenUi::getText(nullptr, "Bookmark Location", "Name", QLineEdit::Normal, QString(), &ok); if (!ok) { return; } From 2f91b29c062eb00f66547bdeb74b110efe10d66e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 14:03:54 +1300 Subject: [PATCH 14/26] Set default focus --- interface/resources/qml/dialogs/QueryDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index 008e3f4bcd..9420801500 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -153,5 +153,5 @@ ModalWindow { } } - Component.onCompleted: d.resize() + Component.onCompleted: { d.resize(); textResult.forceActiveFocus(); } } From e5188108a16ebc326097cf70a4b0ec6345abf7f0 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 15:21:15 +1300 Subject: [PATCH 15/26] Fix width of delete bookmark drop-down --- interface/resources/qml/controls-uit/ComboBox.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/resources/qml/controls-uit/ComboBox.qml b/interface/resources/qml/controls-uit/ComboBox.qml index 392d5534c8..888e8ccbc1 100644 --- a/interface/resources/qml/controls-uit/ComboBox.qml +++ b/interface/resources/qml/controls-uit/ComboBox.qml @@ -160,6 +160,7 @@ FocusScope { ScrollView { id: scrollView height: 480 + width: root.width + 4 ListView { id: listView From 2aaf9ff0d050fd80083a0964750892a61ba9edf5 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 8 Mar 2016 17:13:05 +1300 Subject: [PATCH 16/26] Update message dialogs to use HiFi-Glyphs icons --- interface/resources/qml/dialogs/MessageDialog.qml | 12 ++++++------ interface/resources/qml/styles-uit/HifiConstants.qml | 5 +++++ interface/resources/qml/windows-uit/ModalFrame.qml | 8 ++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml index e3c0f96968..2d83c512e4 100644 --- a/interface/resources/qml/dialogs/MessageDialog.qml +++ b/interface/resources/qml/dialogs/MessageDialog.qml @@ -42,10 +42,10 @@ ModalWindow { property alias detailedText: detailedText.text property alias text: mainTextContainer.text property alias informativeText: informativeTextContainer.text - onIconChanged: updateIcon(); property int buttons: OriginalDialogs.StandardButton.Ok property int icon: OriginalDialogs.StandardIcon.NoIcon property string iconText: "" + onIconChanged: updateIcon(); property int defaultButton: OriginalDialogs.StandardButton.NoButton; property int clickedButton: OriginalDialogs.StandardButton.NoButton; focus: defaultButton === OriginalDialogs.StandardButton.NoButton @@ -56,19 +56,19 @@ ModalWindow { } switch (root.icon) { case OriginalDialogs.StandardIcon.Information: - iconText = "\uF05A"; + iconText = hifi.glyphs.informatonIcon; break; case OriginalDialogs.StandardIcon.Question: - iconText = "\uF059" + iconText = hifi.glyphs.questionIcon; break; case OriginalDialogs.StandardIcon.Warning: - iconText = "\uF071" + iconText = hifi.glyphs.warningIcon; break; case OriginalDialogs.StandardIcon.Critical: - iconText = "\uF057" + iconText = hifi.glyphs.criticalIcon; break; default: - iconText = "" + iconText = hifi.glyphs.noIcon; } } diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index 108cf8a221..de65cb4ecb 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -141,15 +141,20 @@ Item { readonly property string close: "w" readonly property string closeInverted: "x" readonly property string closeSmall: "C" + readonly property string criticalIcon: "=" readonly property string disclosureButtonCollapse: "M" readonly property string disclosureButtonExpand: "L" readonly property string disclosureCollapse: "Z" readonly property string disclosureExpand: "B" readonly property string forward: "D" + readonly property string informatonIcon: "[" + readonly property string noIcon: "" readonly property string pin: "y" readonly property string pinInverted: "z" + readonly property string questionIcon: "]" readonly property string reloadSmall: "a" readonly property string resizeHandle: "A" + readonly property string warningIcon: "+" } Item { diff --git a/interface/resources/qml/windows-uit/ModalFrame.qml b/interface/resources/qml/windows-uit/ModalFrame.qml index 57298ccb1a..902fdda4b5 100644 --- a/interface/resources/qml/windows-uit/ModalFrame.qml +++ b/interface/resources/qml/windows-uit/ModalFrame.qml @@ -50,13 +50,13 @@ Frame { width: title.width + (icon.text !== "" ? icon.width + hifi.dimensions.contentSpacing.x : 0) x: (parent.width - width) / 2 - FontAwesome { + HiFiGlyphs { id: icon text: window.iconText ? window.iconText : "" - size: 30 - color: hifi.colors.lightGrayText + size: 50 + color: hifi.colors.lightGray visible: text != "" - y: -hifi.dimensions.modalDialogTitleHeight - 5 + anchors.verticalCenter: title.verticalCenter anchors.left: parent.left } RalewayRegular { From 03fb6b1444fab8f0944a98e8e9091746df55a0b7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 9 Mar 2016 10:45:14 +1300 Subject: [PATCH 17/26] Add ability to have icons in query dialogs Add icon to bookmark dialogs' titles. --- .../resources/qml/dialogs/MessageDialog.qml | 9 ++++--- .../resources/qml/dialogs/QueryDialog.qml | 25 ++++++++++++++++++- .../qml/styles-uit/HifiConstants.qml | 17 ++++++++++--- .../resources/qml/windows-uit/ModalFrame.qml | 2 +- interface/src/Bookmarks.cpp | 4 +-- libraries/ui/src/OffscreenUi.cpp | 22 +++++++++------- libraries/ui/src/OffscreenUi.h | 24 ++++++++++++++---- tests/ui/qml/main.qml | 5 ++++ 8 files changed, 82 insertions(+), 26 deletions(-) diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml index 2d83c512e4..77056ec893 100644 --- a/interface/resources/qml/dialogs/MessageDialog.qml +++ b/interface/resources/qml/dialogs/MessageDialog.qml @@ -45,6 +45,7 @@ ModalWindow { property int buttons: OriginalDialogs.StandardButton.Ok property int icon: OriginalDialogs.StandardIcon.NoIcon property string iconText: "" + property int iconSize: 50 onIconChanged: updateIcon(); property int defaultButton: OriginalDialogs.StandardButton.NoButton; property int clickedButton: OriginalDialogs.StandardButton.NoButton; @@ -56,16 +57,16 @@ ModalWindow { } switch (root.icon) { case OriginalDialogs.StandardIcon.Information: - iconText = hifi.glyphs.informatonIcon; + iconText = hifi.glyphs.info; break; case OriginalDialogs.StandardIcon.Question: - iconText = hifi.glyphs.questionIcon; + iconText = hifi.glyphs.question; break; case OriginalDialogs.StandardIcon.Warning: - iconText = hifi.glyphs.warningIcon; + iconText = hifi.glyphs.alert; break; case OriginalDialogs.StandardIcon.Critical: - iconText = hifi.glyphs.criticalIcon; + iconText = hifi.glyphs.critical; break; default: iconText = hifi.glyphs.noIcon; diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index 9420801500..48adeaf074 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -26,6 +26,11 @@ ModalWindow { signal selected(var result); signal canceled(); + property int icon: hifi.icons.none + property string iconText: "" + property int iconSize: 35 + onIconChanged: updateIcon(); + property var items; property string label property var result; @@ -38,6 +43,20 @@ ModalWindow { // For combo boxes property bool editable: true; + function updateIcon() { + if (!root) { + return; + } + + switch (root.icon) { + case hifi.icons.placemark: + iconText = hifi.glyphs.placemark; + break; + default: + iconText = ""; + } + } + Item { clip: true width: pane.width @@ -153,5 +172,9 @@ ModalWindow { } } - Component.onCompleted: { d.resize(); textResult.forceActiveFocus(); } + Component.onCompleted: { + updateIcon(); + d.resize(); + textResult.forceActiveFocus(); + } } diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index de65cb4ecb..e0b6061833 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -17,6 +17,7 @@ Item { readonly property alias dimensions: dimensions readonly property alias fontSizes: fontSizes readonly property alias glyphs: glyphs + readonly property alias icons: icons readonly property alias buttons: buttons readonly property alias effects: effects @@ -134,6 +135,7 @@ Item { Item { id: glyphs + readonly property string alert: "+" readonly property string backward: "E" readonly property string caratDn: "5" readonly property string caratR: "3" @@ -141,20 +143,27 @@ Item { readonly property string close: "w" readonly property string closeInverted: "x" readonly property string closeSmall: "C" - readonly property string criticalIcon: "=" + readonly property string critical: "=" readonly property string disclosureButtonCollapse: "M" readonly property string disclosureButtonExpand: "L" readonly property string disclosureCollapse: "Z" readonly property string disclosureExpand: "B" readonly property string forward: "D" - readonly property string informatonIcon: "[" + readonly property string info: "[" readonly property string noIcon: "" readonly property string pin: "y" readonly property string pinInverted: "z" - readonly property string questionIcon: "]" + readonly property string placemark: "U" + readonly property string question: "]" readonly property string reloadSmall: "a" readonly property string resizeHandle: "A" - readonly property string warningIcon: "+" + } + + Item { + id: icons + // Values per OffscreenUi::Icon + readonly property int none: 0 + readonly property int placemark: 1 } Item { diff --git a/interface/resources/qml/windows-uit/ModalFrame.qml b/interface/resources/qml/windows-uit/ModalFrame.qml index 902fdda4b5..5c6556021e 100644 --- a/interface/resources/qml/windows-uit/ModalFrame.qml +++ b/interface/resources/qml/windows-uit/ModalFrame.qml @@ -53,7 +53,7 @@ Frame { HiFiGlyphs { id: icon text: window.iconText ? window.iconText : "" - size: 50 + size: window.iconSize ? window.iconSize : 30 color: hifi.colors.lightGray visible: text != "" anchors.verticalCenter: title.verticalCenter diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index c37e7cde87..479c21538b 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -107,7 +107,7 @@ void Bookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) { void Bookmarks::bookmarkLocation() { bool ok = false; - auto bookmarkName = OffscreenUi::getText(nullptr, "Bookmark Location", "Name", QLineEdit::Normal, QString(), &ok); + auto bookmarkName = OffscreenUi::getText(OffscreenUi::ICON_PLACEMARK, "Bookmark Location", "Name", QString(), &ok); if (!ok) { return; } @@ -156,7 +156,7 @@ void Bookmarks::deleteBookmark() { } bool ok = false; - auto bookmarkName = OffscreenUi::getItem(nullptr, "Delete Bookmark", "Select the bookmark to delete", bookmarkList, 0, false, &ok); + auto bookmarkName = OffscreenUi::getItem(OffscreenUi::ICON_PLACEMARK, "Delete Bookmark", "Select the bookmark to delete", bookmarkList, 0, false, &ok); if (!ok) { return; } diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 999f9ef2f7..8412ac7f6d 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -286,24 +286,24 @@ private slots: } }; -// FIXME many input parameters currently ignored -QString OffscreenUi::getText(void* ignored, const QString & title, const QString & label, QLineEdit::EchoMode mode, const QString & text, bool * ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints) { +QString OffscreenUi::getText(const Icon icon, const QString& title, const QString& label, const QString& text, bool* ok) { if (ok) { *ok = false; } - QVariant result = DependencyManager::get()->inputDialog(title, label, text).toString(); + QVariant result = DependencyManager::get()->inputDialog(icon, title, label, text).toString(); if (ok && result.isValid()) { *ok = true; } return result.toString(); } -// FIXME many input parameters currently ignored -QString OffscreenUi::getItem(void *ignored, const QString & title, const QString & label, const QStringList & items, int current, bool editable, bool * ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints) { +QString OffscreenUi::getItem(const Icon icon, const QString& title, const QString& label, const QStringList& items, + int current, bool editable, bool* ok) { + if (ok) { *ok = false; } auto offscreenUi = DependencyManager::get(); - auto inputDialog = offscreenUi->createInputDialog(title, label, current); + auto inputDialog = offscreenUi->createInputDialog(icon, title, label, current); if (!inputDialog) { return QString(); } @@ -321,24 +321,28 @@ QString OffscreenUi::getItem(void *ignored, const QString & title, const QString return result.toString(); } -QVariant OffscreenUi::inputDialog(const QString& title, const QString& label, const QVariant& current) { +QVariant OffscreenUi::inputDialog(const Icon icon, const QString& title, const QString& label, const QVariant& current) { if (QThread::currentThread() != thread()) { QVariant result; QMetaObject::invokeMethod(this, "inputDialog", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QVariant, result), Q_ARG(QString, title), + Q_ARG(Icon, icon), Q_ARG(QString, label), Q_ARG(QVariant, current)); return result; } - return waitForInputDialogResult(createInputDialog(title, label, current)); + return waitForInputDialogResult(createInputDialog(icon, title, label, current)); } -QQuickItem* OffscreenUi::createInputDialog(const QString& title, const QString& label, const QVariant& current) { +QQuickItem* OffscreenUi::createInputDialog(const Icon icon, const QString& title, const QString& label, + const QVariant& current) { + QVariantMap map; map.insert("title", title); + map.insert("icon", icon); map.insert("label", label); map.insert("current", current); QVariant result; diff --git a/libraries/ui/src/OffscreenUi.h b/libraries/ui/src/OffscreenUi.h index 32f7a31d17..7ccbe7b687 100644 --- a/libraries/ui/src/OffscreenUi.h +++ b/libraries/ui/src/OffscreenUi.h @@ -95,16 +95,30 @@ public: // Compatibility with QFileDialog::getSaveFileName static QString getSaveFileName(void* ignored, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); + enum Icon { + ICON_NONE = 0, + ICON_PLACEMARK + }; - // input dialog compatibility - Q_INVOKABLE QVariant inputDialog(const QString& title, const QString& label = QString(), const QVariant& current = QVariant()); - QQuickItem* createInputDialog(const QString& title, const QString& label, const QVariant& current); + Q_INVOKABLE QVariant inputDialog(const Icon icon, const QString& title, const QString& label = QString(), const QVariant& current = QVariant()); + QQuickItem* createInputDialog(const Icon icon, const QString& title, const QString& label, const QVariant& current); QVariant waitForInputDialogResult(QQuickItem* inputDialog); // Compatibility with QInputDialog::getText - static QString getText(void* ignored, const QString & title, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone); + static QString getText(void* ignored, const QString & title, const QString & label, + QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, + Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone) { + return getText(OffscreenUi::ICON_NONE, title, label, text, ok); + } // Compatibility with QInputDialog::getItem - static QString getItem(void *ignored, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0, Qt::WindowFlags flags = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone); + static QString getItem(void *ignored, const QString & title, const QString & label, const QStringList & items, + int current = 0, bool editable = true, bool * ok = 0, Qt::WindowFlags flags = 0, + Qt::InputMethodHints inputMethodHints = Qt::ImhNone) { + return getItem(OffscreenUi::ICON_NONE, title, label, items, current, editable, ok); + } + + static QString getText(const Icon icon, const QString & title, const QString & label, const QString & text = QString(), bool * ok = 0); + static QString getItem(const Icon icon, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0); signals: void showDesktop(); diff --git a/tests/ui/qml/main.qml b/tests/ui/qml/main.qml index a3b6114c11..9f4df4e68f 100644 --- a/tests/ui/qml/main.qml +++ b/tests/ui/qml/main.qml @@ -9,6 +9,7 @@ import "../../../interface/resources/qml/windows-uit" import "../../../interface/resources/qml/dialogs" import "../../../interface/resources/qml/hifi" import "../../../interface/resources/qml/hifi/dialogs" +import "../../../interface/resources/qml/styles-uit" ApplicationWindow { id: appWindow @@ -17,6 +18,8 @@ ApplicationWindow { height: 800 title: qsTr("Scratch App") + HifiConstants { id: hifi } + Desktop { id: desktop anchors.fill: parent @@ -142,6 +145,7 @@ ApplicationWindow { onClicked: { desktop.inputDialog({ title: "Bookmark Location", + icon: hifi.icons.placemark, label: "Name" }); } @@ -151,6 +155,7 @@ ApplicationWindow { onClicked: { desktop.inputDialog({ title: "Delete Bookmark", + icon: hifi.icons.placemark, label: "Select the bookmark to delete", items: ["Bookmark A", "Bookmark B", "Bookmark C"] }); From 10e4e5e3a76d34db82ddcc51cf0a53c276ed5ca7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 9 Mar 2016 11:33:55 +1300 Subject: [PATCH 18/26] Use OffscreenUI icon enum instead of QMessageBox icon enum --- .../resources/qml/dialogs/MessageDialog.qml | 17 +--------- .../resources/qml/dialogs/QueryDialog.qml | 9 +----- .../qml/styles-uit/HifiConstants.qml | 31 ++++++++++++++++++- interface/src/Bookmarks.cpp | 2 +- libraries/ui/src/OffscreenUi.cpp | 14 ++++----- libraries/ui/src/OffscreenUi.h | 17 +++++----- tests/ui/qml/main.qml | 16 +++++----- 7 files changed, 58 insertions(+), 48 deletions(-) diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml index 77056ec893..9809708c37 100644 --- a/interface/resources/qml/dialogs/MessageDialog.qml +++ b/interface/resources/qml/dialogs/MessageDialog.qml @@ -55,22 +55,7 @@ ModalWindow { if (!root) { return; } - switch (root.icon) { - case OriginalDialogs.StandardIcon.Information: - iconText = hifi.glyphs.info; - break; - case OriginalDialogs.StandardIcon.Question: - iconText = hifi.glyphs.question; - break; - case OriginalDialogs.StandardIcon.Warning: - iconText = hifi.glyphs.alert; - break; - case OriginalDialogs.StandardIcon.Critical: - iconText = hifi.glyphs.critical; - break; - default: - iconText = hifi.glyphs.noIcon; - } + iconText = hifi.glyphForIcon(root.icon); } Item { diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index 48adeaf074..5e02fa4859 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -47,14 +47,7 @@ ModalWindow { if (!root) { return; } - - switch (root.icon) { - case hifi.icons.placemark: - iconText = hifi.glyphs.placemark; - break; - default: - iconText = ""; - } + iconText = hifi.glyphForIcon(root.icon); } Item { diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index e0b6061833..b884793025 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -21,6 +21,31 @@ Item { readonly property alias buttons: buttons readonly property alias effects: effects + function glyphForIcon(icon) { + // Translates icon enum to glyph char. + var glyph; + switch (icon) { + case hifi.icons.information: + glyph = hifi.glyphs.info; + break; + case hifi.icons.question: + glyph = hifi.glyphs.question; + break; + case hifi.icons.warning: + glyph = hifi.glyphs.alert; + break; + case hifi.icons.critical: + glyph = hifi.glyphs.critical; + break; + case hifi.icons.placemark: + glyph = hifi.glyphs.placemark; + break; + default: + ch = hifi.glyphs.noIcon; + } + return glyph; + } + Item { id: colors @@ -163,7 +188,11 @@ Item { id: icons // Values per OffscreenUi::Icon readonly property int none: 0 - readonly property int placemark: 1 + readonly property int question: 1 + readonly property int information: 2 + readonly property int warning: 3 + readonly property int critical: 4 + readonly property int placemark: 5 } Item { diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index 479c21538b..913ff7e890 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -123,7 +123,7 @@ void Bookmarks::bookmarkLocation() { Menu* menubar = Menu::getInstance(); if (contains(bookmarkName)) { auto offscreenUi = DependencyManager::get(); - auto duplicateBookmarkMessage = offscreenUi->createMessageBox(QMessageBox::Warning, "Duplicate Bookmark", + auto duplicateBookmarkMessage = offscreenUi->createMessageBox(OffscreenUi::ICON_WARNING, "Duplicate Bookmark", "The bookmark name you entered already exists in your list.", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); duplicateBookmarkMessage->setProperty("informativeText", "Would you like to overwrite it?"); diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 8412ac7f6d..ce7ea169f3 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -204,7 +204,7 @@ private slots: } }; -QQuickItem* OffscreenUi::createMessageBox(QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { +QQuickItem* OffscreenUi::createMessageBox(Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { QVariantMap map; map.insert("title", title); map.insert("text", text); @@ -232,12 +232,12 @@ int OffscreenUi::waitForMessageBoxResult(QQuickItem* messageBox) { } -QMessageBox::StandardButton OffscreenUi::messageBox(QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { +QMessageBox::StandardButton OffscreenUi::messageBox(Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { if (QThread::currentThread() != thread()) { QMessageBox::StandardButton result = QMessageBox::StandardButton::NoButton; QMetaObject::invokeMethod(this, "messageBox", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QMessageBox::StandardButton, result), - Q_ARG(QMessageBox::Icon, icon), + Q_ARG(Icon, icon), Q_ARG(QString, title), Q_ARG(QString, text), Q_ARG(QMessageBox::StandardButtons, buttons), @@ -250,19 +250,19 @@ QMessageBox::StandardButton OffscreenUi::messageBox(QMessageBox::Icon icon, cons QMessageBox::StandardButton OffscreenUi::critical(const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - return DependencyManager::get()->messageBox(QMessageBox::Icon::Critical, title, text, buttons, defaultButton); + return DependencyManager::get()->messageBox(OffscreenUi::Icon::ICON_CRITICAL, title, text, buttons, defaultButton); } QMessageBox::StandardButton OffscreenUi::information(const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - return DependencyManager::get()->messageBox(QMessageBox::Icon::Information, title, text, buttons, defaultButton); + return DependencyManager::get()->messageBox(OffscreenUi::Icon::ICON_INFORMATION, title, text, buttons, defaultButton); } QMessageBox::StandardButton OffscreenUi::question(const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - return DependencyManager::get()->messageBox(QMessageBox::Icon::Question, title, text, buttons, defaultButton); + return DependencyManager::get()->messageBox(OffscreenUi::Icon::ICON_QUESTION, title, text, buttons, defaultButton); } QMessageBox::StandardButton OffscreenUi::warning(const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { - return DependencyManager::get()->messageBox(QMessageBox::Icon::Warning, title, text, buttons, defaultButton); + return DependencyManager::get()->messageBox(OffscreenUi::Icon::ICON_WARNING, title, text, buttons, defaultButton); } diff --git a/libraries/ui/src/OffscreenUi.h b/libraries/ui/src/OffscreenUi.h index 7ccbe7b687..0188ac5365 100644 --- a/libraries/ui/src/OffscreenUi.h +++ b/libraries/ui/src/OffscreenUi.h @@ -41,11 +41,19 @@ public: QQuickItem* getDesktop(); QQuickItem* getToolWindow(); + enum Icon { + ICON_NONE = 0, + ICON_QUESTION, + ICON_INFORMATION, + ICON_WARNING, + ICON_CRITICAL, + ICON_PLACEMARK + }; // Message box compatibility - Q_INVOKABLE QMessageBox::StandardButton messageBox(QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton); + Q_INVOKABLE QMessageBox::StandardButton messageBox(Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton); // Must be called from the main thread - QQuickItem* createMessageBox(QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton); + QQuickItem* createMessageBox(Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton); // Must be called from the main thread Q_INVOKABLE int waitForMessageBoxResult(QQuickItem* messageBox); @@ -95,11 +103,6 @@ public: // Compatibility with QFileDialog::getSaveFileName static QString getSaveFileName(void* ignored, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); - enum Icon { - ICON_NONE = 0, - ICON_PLACEMARK - }; - Q_INVOKABLE QVariant inputDialog(const Icon icon, const QString& title, const QString& label = QString(), const QVariant& current = QVariant()); QQuickItem* createInputDialog(const Icon icon, const QString& title, const QString& label, const QVariant& current); QVariant waitForInputDialogResult(QQuickItem* inputDialog); diff --git a/tests/ui/qml/main.qml b/tests/ui/qml/main.qml index 9f4df4e68f..273eb1df47 100644 --- a/tests/ui/qml/main.qml +++ b/tests/ui/qml/main.qml @@ -102,11 +102,11 @@ ApplicationWindow { var messageBox = desktop.messageBox({ title: "Set Avatar", text: "Would you like to use 'Albert' for your avatar?", - icon: OriginalDialogs.StandardIcon.Question, // Test question icon - //icon: OriginalDialogs.StandardIcon.Information, // Test informaton icon - //icon: OriginalDialogs.StandardIcon.Warning, // Test warning icon - //icon: OriginalDialogs.StandardIcon.Critical, // Test critical icon - //icon: OriginalDialogs.StandardIcon.NoIcon, // Test no icon + icon: hifi.icons.question, // Test question icon + //icon: hifi.icons.information, // Test informaton icon + //icon: hifi.icons.warning, // Test warning icon + //icon: hifi.icons.critical, // Test critical icon + //icon: hifi.icons.none, // Test no icon buttons: OriginalDialogs.StandardButton.Ok + OriginalDialogs.StandardButton.Cancel, defaultButton: OriginalDialogs.StandardButton.Ok }); @@ -121,7 +121,7 @@ ApplicationWindow { onClicked: { var messageBox = desktop.messageBox({ text: "Diagnostic cycle will be complete in 30 seconds", - icon: OriginalDialogs.StandardIcon.Critical, + icon: hifi.icons.critical, }); messageBox.selected.connect(function(button) { console.log("You clicked " + button) @@ -135,7 +135,7 @@ ApplicationWindow { desktop.messageBox({ informativeText: "Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds ", text: "Baloney", - icon: OriginalDialogs.StandardIcon.Warning, + icon: hifi.icons.warning, detailedText: "sakjd;laskj dksa;dl jka;lsd j;lkjas ;dlkaj s;dlakjd ;alkjda; slkjda; lkjda;lksjd ;alksjd; alksjd ;alksjd; alksjd; alksdjas;ldkjas;lkdja ;kj ;lkasjd; lkj as;dlka jsd;lka jsd;laksjd a" }); } @@ -169,7 +169,7 @@ ApplicationWindow { var queryBox = desktop.queryBox({ text: "Have you stopped beating your wife?", placeholderText: "Are you sure?", - // icon: OriginalDialogs.StandardIcon.Critical, + // icon: hifi.icons.critical, }); queryBox.selected.connect(function(result) { console.log("User responded with " + result); From edc50f102d74ebc624acb94f2d7ad0989bae25c5 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 9 Mar 2016 11:55:09 +1300 Subject: [PATCH 19/26] Fix "duplicate bookmark" dialog --- interface/resources/qml/dialogs/MessageDialog.qml | 9 ++++++--- tests/ui/qml/main.qml | 13 +++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml index 9809708c37..28a36d5a75 100644 --- a/interface/resources/qml/dialogs/MessageDialog.qml +++ b/interface/resources/qml/dialogs/MessageDialog.qml @@ -84,7 +84,7 @@ ModalWindow { RalewaySemibold { id: mainTextContainer - onHeightChanged: d.resize(); onWidthChanged: d.resize(); + onTextChanged: d.resize(); wrapMode: Text.WordWrap size: hifi.fontSizes.menuItem color: hifi.colors.baseGrayHighlight @@ -100,7 +100,7 @@ ModalWindow { RalewaySemibold { id: informativeTextContainer - onHeightChanged: d.resize(); onWidthChanged: d.resize(); + onTextChanged: d.resize(); wrapMode: Text.WordWrap size: hifi.fontSizes.menuItem color: hifi.colors.baseGrayHighlight @@ -194,7 +194,10 @@ ModalWindow { } ] - Component.onCompleted: updateIcon() + Component.onCompleted: { + updateIcon(); + d.resize(); + } onStateChanged: d.resize() } diff --git a/tests/ui/qml/main.qml b/tests/ui/qml/main.qml index 273eb1df47..d8083b7bbd 100644 --- a/tests/ui/qml/main.qml +++ b/tests/ui/qml/main.qml @@ -161,6 +161,19 @@ ApplicationWindow { }); } } + Button { + text: "Duplicate Bookmark" + onClicked: { + desktop.messageBox({ + title: "Duplicate Bookmark", + icon: hifi.icons.warning, + text: "The bookmark name you entered alread exists in yoru list.", + informativeText: "Would you like to overwrite it?", + buttons: OriginalDialogs.StandardButton.Yes + OriginalDialogs.StandardButton.No, + defaultButton: OriginalDialogs.StandardButton.Yes + }); + } + } /* // There is no such desktop.queryBox() function; may need to update test to cover QueryDialog.qml? Button { From ac1ab4b5b714f81e981a7b71c584d4a799451bbb Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 1 Mar 2016 15:50:25 -0800 Subject: [PATCH 20/26] Map the primary thumbs to menu/camera as well as the secondary thumb --- interface/resources/controllers/standard.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/resources/controllers/standard.json b/interface/resources/controllers/standard.json index 5dd6c0641d..135fe81df7 100644 --- a/interface/resources/controllers/standard.json +++ b/interface/resources/controllers/standard.json @@ -33,7 +33,9 @@ { "from": [ "Standard.A", "Standard.B", "Standard.X", "Standard.Y" ], "to": "Standard.RightPrimaryThumb" }, { "from": "Standard.Start", "to": "Standard.RightSecondaryThumb" }, + { "from": "Standard.LeftPrimaryThumb", "to": "Actions.CycleCamera" }, { "from": "Standard.LeftSecondaryThumb", "to": "Actions.CycleCamera" }, + { "from": "Standard.RightPrimaryThumb", "to": "Actions.ContextMenu" }, { "from": "Standard.RightSecondaryThumb", "to": "Actions.ContextMenu" }, { "from": "Standard.LT", "to": "Actions.LeftHandClick" }, From 1312901f0657c3545a7024c9d9d21704212d57e6 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 8 Mar 2016 12:42:24 -0800 Subject: [PATCH 21/26] Removing thumb mappings, using start/back for camera and menu --- interface/resources/controllers/hydra.json | 6 +++--- interface/resources/controllers/standard.json | 11 +++-------- .../resources/controllers/standard_navigation.json | 2 +- interface/resources/controllers/vive.json | 6 ++---- plugins/openvr/src/ViveControllerManager.cpp | 8 +++----- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/interface/resources/controllers/hydra.json b/interface/resources/controllers/hydra.json index 0193612d27..42237033af 100644 --- a/interface/resources/controllers/hydra.json +++ b/interface/resources/controllers/hydra.json @@ -13,11 +13,11 @@ { "from": "Hydra.RB", "to": "Standard.RB" }, { "from": "Hydra.RS", "to": "Standard.RS" }, - { "from": [ "Hydra.L1", "Hydra.L2", "Hydra.L3", "Hydra.L4" ], "to": "Standard.LeftPrimaryThumb" }, - { "from": [ "Hydra.L0" ], "to": "Standard.LeftSecondaryThumb" }, + { "from": "Hydra.L0", "to": "Standard.Back" }, + { "from": "Hydra.R0", "to": "Standard.Start" }, + { "from": [ "Hydra.L1", "Hydra.L2", "Hydra.L3", "Hydra.L4" ], "to": "Standard.LeftPrimaryThumb" }, { "from": [ "Hydra.R1", "Hydra.R2", "Hydra.R3", "Hydra.R4" ], "to": "Standard.RightPrimaryThumb" }, - { "from": [ "Hydra.R0" ], "to": "Standard.RightSecondaryThumb" }, { "from": "Hydra.LeftHand", "to": "Standard.LeftHand" }, { "from": "Hydra.RightHand", "to": "Standard.RightHand" } diff --git a/interface/resources/controllers/standard.json b/interface/resources/controllers/standard.json index 135fe81df7..f25e0cc3c4 100644 --- a/interface/resources/controllers/standard.json +++ b/interface/resources/controllers/standard.json @@ -27,16 +27,11 @@ { "from": "Standard.RY", "to": "Actions.Up", "filters": "invert"}, + { "from": "Standard.Back", "to": "Actions.CycleCamera" }, + { "from": "Standard.Start", "to": "Actions.ContextMenu" }, + { "from": [ "Standard.DU", "Standard.DL", "Standard.DR", "Standard.DD" ], "to": "Standard.LeftPrimaryThumb" }, - { "from": "Standard.Back", "to": "Standard.LeftSecondaryThumb" }, - { "from": [ "Standard.A", "Standard.B", "Standard.X", "Standard.Y" ], "to": "Standard.RightPrimaryThumb" }, - { "from": "Standard.Start", "to": "Standard.RightSecondaryThumb" }, - - { "from": "Standard.LeftPrimaryThumb", "to": "Actions.CycleCamera" }, - { "from": "Standard.LeftSecondaryThumb", "to": "Actions.CycleCamera" }, - { "from": "Standard.RightPrimaryThumb", "to": "Actions.ContextMenu" }, - { "from": "Standard.RightSecondaryThumb", "to": "Actions.ContextMenu" }, { "from": "Standard.LT", "to": "Actions.LeftHandClick" }, { "from": "Standard.RT", "to": "Actions.RightHandClick" }, diff --git a/interface/resources/controllers/standard_navigation.json b/interface/resources/controllers/standard_navigation.json index 208970f030..62c0883142 100644 --- a/interface/resources/controllers/standard_navigation.json +++ b/interface/resources/controllers/standard_navigation.json @@ -12,7 +12,7 @@ { "from": "Standard.LB", "to": "Actions.UiNavGroup","filters": "invert" }, { "from": "Standard.RB", "to": "Actions.UiNavGroup" }, { "from": [ "Standard.A", "Standard.X" ], "to": "Actions.UiNavSelect" }, - { "from": [ "Standard.B", "Standard.Y", "Standard.RightPrimaryThumb", "Standard.LeftPrimaryThumb" ], "to": "Actions.UiNavBack" }, + { "from": [ "Standard.B", "Standard.Y" ], "to": "Actions.UiNavBack" }, { "from": [ "Standard.RT", "Standard.LT" ], "to": "Actions.UiNavSelect", diff --git a/interface/resources/controllers/vive.json b/interface/resources/controllers/vive.json index c46bcd9402..62602ee36d 100644 --- a/interface/resources/controllers/vive.json +++ b/interface/resources/controllers/vive.json @@ -15,10 +15,8 @@ { "from": "Vive.RB", "to": "Standard.RB" }, { "from": "Vive.RS", "to": "Standard.RS" }, - { "from": "Vive.LeftPrimaryThumb", "to": "Standard.LeftPrimaryThumb" }, - { "from": "Vive.RightPrimaryThumb", "to": "Standard.RightPrimaryThumb" }, - { "from": "Vive.LeftSecondaryThumb", "to": "Standard.LeftSecondaryThumb" }, - { "from": "Vive.RightSecondaryThumb", "to": "Standard.RightSecondaryThumb" }, + { "from": "Vive.Back", "to": "Standard.Back" }, + { "from": "Vive.Start", "to": "Standard.Start" }, { "from": "Vive.LeftHand", "to": "Standard.LeftHand" }, { "from": "Vive.RightHand", "to": "Standard.RightHand" } diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index 0de8f6891d..be3f3adc92 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -311,7 +311,7 @@ void ViveControllerManager::InputDevice::handleButtonEvent(float deltaTime, uint using namespace controller; if (button == vr::k_EButton_ApplicationMenu) { - _buttonPressedMap.insert(isLeftHand ? LEFT_PRIMARY_THUMB : RIGHT_PRIMARY_THUMB); + _buttonPressedMap.insert(isLeftHand ? BACK : START); } else if (button == vr::k_EButton_Grip) { _buttonPressedMap.insert(isLeftHand ? LB : RB); } else if (button == vr::k_EButton_SteamVR_Trigger) { @@ -426,10 +426,8 @@ controller::Input::NamedVector ViveControllerManager::InputDevice::getAvailableI makePair(LEFT_HAND, "LeftHand"), makePair(RIGHT_HAND, "RightHand"), - makePair(LEFT_PRIMARY_THUMB, "LeftPrimaryThumb"), - makePair(LEFT_SECONDARY_THUMB, "LeftSecondaryThumb"), - makePair(RIGHT_PRIMARY_THUMB, "RightPrimaryThumb"), - makePair(RIGHT_SECONDARY_THUMB, "RightSecondaryThumb"), + makePair(BACK, "Back"), + makePair(START, "Start"), }; //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 0), "Left Button A")); From f651adbd24c93f4a9c2ef624c287d50518c32861 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 8 Mar 2016 15:12:54 -0800 Subject: [PATCH 22/26] Correcting vive button naming --- interface/resources/controllers/vive.json | 4 ++-- plugins/openvr/src/ViveControllerManager.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/resources/controllers/vive.json b/interface/resources/controllers/vive.json index 62602ee36d..1f71658946 100644 --- a/interface/resources/controllers/vive.json +++ b/interface/resources/controllers/vive.json @@ -15,8 +15,8 @@ { "from": "Vive.RB", "to": "Standard.RB" }, { "from": "Vive.RS", "to": "Standard.RS" }, - { "from": "Vive.Back", "to": "Standard.Back" }, - { "from": "Vive.Start", "to": "Standard.Start" }, + { "from": "Vive.LeftApplicationMenu", "to": "Standard.Back" }, + { "from": "Vive.RightApplicationMenu", "to": "Standard.Start" }, { "from": "Vive.LeftHand", "to": "Standard.LeftHand" }, { "from": "Vive.RightHand", "to": "Standard.RightHand" } diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index be3f3adc92..fa74a57466 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -426,8 +426,8 @@ controller::Input::NamedVector ViveControllerManager::InputDevice::getAvailableI makePair(LEFT_HAND, "LeftHand"), makePair(RIGHT_HAND, "RightHand"), - makePair(BACK, "Back"), - makePair(START, "Start"), + makePair(BACK, "LeftApplicationMenu"), + makePair(START, "RightApplicationMenu"), }; //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 0), "Left Button A")); From 269936f3ac6908d61a9114057f75e54f63f42a47 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 9 Mar 2016 12:20:09 +1300 Subject: [PATCH 23/26] Fix typo --- interface/resources/qml/styles-uit/HifiConstants.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index b884793025..eb4c84b5b8 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -41,7 +41,7 @@ Item { glyph = hifi.glyphs.placemark; break; default: - ch = hifi.glyphs.noIcon; + glyph = hifi.glyphs.noIcon; } return glyph; } From 155a084eaa0726cf7b182c6bda9968833d2fad32 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 9 Mar 2016 13:08:44 +1300 Subject: [PATCH 24/26] Temporarily rename file a part of changing case of filename --- .../styles-uit/{RalewaySemibold.qml => RalewaySemiBold-temp.qml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename interface/resources/qml/styles-uit/{RalewaySemibold.qml => RalewaySemiBold-temp.qml} (100%) diff --git a/interface/resources/qml/styles-uit/RalewaySemibold.qml b/interface/resources/qml/styles-uit/RalewaySemiBold-temp.qml similarity index 100% rename from interface/resources/qml/styles-uit/RalewaySemibold.qml rename to interface/resources/qml/styles-uit/RalewaySemiBold-temp.qml From 17852e86d25f1d351f429ff7a01ce0ce28ca58f2 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 8 Mar 2016 16:16:44 -0800 Subject: [PATCH 25/26] Fixing enum names --- plugins/openvr/src/ViveControllerManager.cpp | 53 ++++---------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index fa74a57466..9358f3c77b 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -303,6 +303,13 @@ void ViveControllerManager::InputDevice::handleAxisEvent(float deltaTime, uint32 } } +// An enum for buttons which do not exist in the StandardControls enum +enum ViveButtonChannel { + LEFT_APP_MENU = controller::StandardButtonChannel::NUM_STANDARD_BUTTONS, + RIGHT_APP_MENU +}; + + // These functions do translation from the Steam IDs to the standard controller IDs void ViveControllerManager::InputDevice::handleButtonEvent(float deltaTime, uint32_t button, bool pressed, bool isLeftHand) { if (!pressed) { @@ -311,7 +318,7 @@ void ViveControllerManager::InputDevice::handleButtonEvent(float deltaTime, uint using namespace controller; if (button == vr::k_EButton_ApplicationMenu) { - _buttonPressedMap.insert(isLeftHand ? BACK : START); + _buttonPressedMap.insert(isLeftHand ? LEFT_APP_MENU : RIGHT_APP_MENU); } else if (button == vr::k_EButton_Grip) { _buttonPressedMap.insert(isLeftHand ? LB : RB); } else if (button == vr::k_EButton_SteamVR_Trigger) { @@ -426,22 +433,10 @@ controller::Input::NamedVector ViveControllerManager::InputDevice::getAvailableI makePair(LEFT_HAND, "LeftHand"), makePair(RIGHT_HAND, "RightHand"), - makePair(BACK, "LeftApplicationMenu"), - makePair(START, "RightApplicationMenu"), + Input::NamedPair(Input(_deviceID, LEFT_APP_MENU, ChannelType::BUTTON), "LeftApplicationMenu"), + Input::NamedPair(Input(_deviceID, RIGHT_APP_MENU, ChannelType::BUTTON), "RightApplicationMenu"), }; - //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 0), "Left Button A")); - //availableInputs.append(Input::NamedPair(makeInput(GRIP_BUTTON, 0), "Left Grip Button")); - //availableInputs.append(Input::NamedPair(makeInput(TRACKPAD_BUTTON, 0), "Left Trackpad Button")); - //availableInputs.append(Input::NamedPair(makeInput(TRIGGER_BUTTON, 0), "Left Trigger Button")); - //availableInputs.append(Input::NamedPair(makeInput(BACK_TRIGGER, 0), "Left Back Trigger")); - //availableInputs.append(Input::NamedPair(makeInput(RIGHT_HAND), "Right Hand")); - //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 1), "Right Button A")); - //availableInputs.append(Input::NamedPair(makeInput(GRIP_BUTTON, 1), "Right Grip Button")); - //availableInputs.append(Input::NamedPair(makeInput(TRACKPAD_BUTTON, 1), "Right Trackpad Button")); - //availableInputs.append(Input::NamedPair(makeInput(TRIGGER_BUTTON, 1), "Right Trigger Button")); - //availableInputs.append(Input::NamedPair(makeInput(BACK_TRIGGER, 1), "Right Back Trigger")); - return availableInputs; } @@ -449,31 +444,3 @@ QString ViveControllerManager::InputDevice::getDefaultMappingConfig() const { static const QString MAPPING_JSON = PathUtils::resourcesPath() + "/controllers/vive.json"; return MAPPING_JSON; } - -//void ViveControllerManager::assignDefaultInputMapping(UserInputMapper& mapper) { -// const float JOYSTICK_MOVE_SPEED = 1.0f; -// -// // Left Trackpad: Movement, strafing -// mapper.addInputChannel(UserInputMapper::LONGITUDINAL_FORWARD, makeInput(AXIS_Y_POS, 0), makeInput(TRACKPAD_BUTTON, 0), JOYSTICK_MOVE_SPEED); -// mapper.addInputChannel(UserInputMapper::LONGITUDINAL_BACKWARD, makeInput(AXIS_Y_NEG, 0), makeInput(TRACKPAD_BUTTON, 0), JOYSTICK_MOVE_SPEED); -// mapper.addInputChannel(UserInputMapper::LATERAL_RIGHT, makeInput(AXIS_X_POS, 0), makeInput(TRACKPAD_BUTTON, 0), JOYSTICK_MOVE_SPEED); -// mapper.addInputChannel(UserInputMapper::LATERAL_LEFT, makeInput(AXIS_X_NEG, 0), makeInput(TRACKPAD_BUTTON, 0), JOYSTICK_MOVE_SPEED); -// -// // Right Trackpad: Vertical movement, zooming -// mapper.addInputChannel(UserInputMapper::VERTICAL_UP, makeInput(AXIS_Y_POS, 1), makeInput(TRACKPAD_BUTTON, 1), JOYSTICK_MOVE_SPEED); -// mapper.addInputChannel(UserInputMapper::VERTICAL_DOWN, makeInput(AXIS_Y_NEG, 1), makeInput(TRACKPAD_BUTTON, 1), JOYSTICK_MOVE_SPEED); -// -// // Buttons -// mapper.addInputChannel(UserInputMapper::SHIFT, makeInput(BUTTON_A, 0)); -// mapper.addInputChannel(UserInputMapper::SHIFT, makeInput(BUTTON_A, 1)); -// -// mapper.addInputChannel(UserInputMapper::ACTION1, makeInput(GRIP_BUTTON, 0)); -// mapper.addInputChannel(UserInputMapper::ACTION2, makeInput(GRIP_BUTTON, 1)); -// -// mapper.addInputChannel(UserInputMapper::LEFT_HAND_CLICK, makeInput(BACK_TRIGGER, 0)); -// mapper.addInputChannel(UserInputMapper::RIGHT_HAND_CLICK, makeInput(BACK_TRIGGER, 1)); -// -// // Hands -// mapper.addInputChannel(UserInputMapper::LEFT_HAND, makeInput(LEFT_HAND)); -// mapper.addInputChannel(UserInputMapper::RIGHT_HAND, makeInput(RIGHT_HAND)); -//} From 973fa28d3f6594f9d01218a6c52ab82a7bb7ab9a Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 9 Mar 2016 13:32:37 +1300 Subject: [PATCH 26/26] Fix case of RalewaySemiBold font name --- interface/resources/qml/controls-uit/Label.qml | 2 +- interface/resources/qml/controls-uit/TextEdit.qml | 4 ++-- interface/resources/qml/dialogs/MessageDialog.qml | 4 ++-- .../{RalewaySemiBold-temp.qml => RalewaySemiBold.qml} | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename interface/resources/qml/styles-uit/{RalewaySemiBold-temp.qml => RalewaySemiBold.qml} (76%) diff --git a/interface/resources/qml/controls-uit/Label.qml b/interface/resources/qml/controls-uit/Label.qml index f4015edd62..d9d33c1bfa 100644 --- a/interface/resources/qml/controls-uit/Label.qml +++ b/interface/resources/qml/controls-uit/Label.qml @@ -12,7 +12,7 @@ import QtQuick 2.5 import "../styles-uit" -RalewaySemibold { +RalewaySemiBold { property int colorScheme: hifi.colorSchemes.light size: hifi.fontSizes.inputLabel diff --git a/interface/resources/qml/controls-uit/TextEdit.qml b/interface/resources/qml/controls-uit/TextEdit.qml index 5edc65a6e5..5ee9ce94ba 100644 --- a/interface/resources/qml/controls-uit/TextEdit.qml +++ b/interface/resources/qml/controls-uit/TextEdit.qml @@ -17,8 +17,8 @@ TextEdit { property real size: 32 - FontLoader { id: ralewaySemibold; source: "../../fonts/Raleway-Semibold.ttf"; } - font.family: ralewaySemibold.name + FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } + font.family: ralewaySemiBold.name font.pointSize: size verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignLeft diff --git a/interface/resources/qml/dialogs/MessageDialog.qml b/interface/resources/qml/dialogs/MessageDialog.qml index 26ed406b02..e7e630c1ff 100644 --- a/interface/resources/qml/dialogs/MessageDialog.qml +++ b/interface/resources/qml/dialogs/MessageDialog.qml @@ -98,7 +98,7 @@ ModalWindow { } } - RalewaySemibold { + RalewaySemiBold { id: mainTextContainer onHeightChanged: d.resize(); onWidthChanged: d.resize(); wrapMode: Text.WordWrap @@ -114,7 +114,7 @@ ModalWindow { lineHeightMode: Text.ProportionalHeight } - RalewaySemibold { + RalewaySemiBold { id: informativeTextContainer onHeightChanged: d.resize(); onWidthChanged: d.resize(); wrapMode: Text.WordWrap diff --git a/interface/resources/qml/styles-uit/RalewaySemiBold-temp.qml b/interface/resources/qml/styles-uit/RalewaySemiBold.qml similarity index 76% rename from interface/resources/qml/styles-uit/RalewaySemiBold-temp.qml rename to interface/resources/qml/styles-uit/RalewaySemiBold.qml index 3648e6bab9..3c36a872a4 100644 --- a/interface/resources/qml/styles-uit/RalewaySemiBold-temp.qml +++ b/interface/resources/qml/styles-uit/RalewaySemiBold.qml @@ -1,5 +1,5 @@ // -// RalewaySemibold.qml +// RalewaySemiBold.qml // // Created by David Rowe on 12 Feb 2016 // Copyright 2016 High Fidelity, Inc. @@ -14,10 +14,10 @@ import QtQuick.Controls.Styles 1.4 Text { id: root - FontLoader { id: ralewaySemibold; source: "../../fonts/Raleway-Semibold.ttf"; } + FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; } property real size: 32 font.pixelSize: size verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignLeft - font.family: ralewaySemibold.name + font.family: ralewaySemiBold.name }