diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 9341b2316c..524831a13e 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -522,6 +522,12 @@ Menu::Menu() { addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ComputeBlendshapes, 0, true, DependencyManager::get().data(), SLOT(setComputeBlendshapes(bool))); + { + auto drawStatusConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DrawStatus"); + addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::HighlightTransitions, 0, false, + drawStatusConfig, SLOT(setShowFade(bool))); + } + // Developer > Assets >>> // Menu item is not currently needed but code should be kept in case it proves useful again at some stage. //#define WANT_ASSET_MIGRATION diff --git a/interface/src/Menu.h b/interface/src/Menu.h index eeede178c7..7c462e4e74 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -228,6 +228,7 @@ namespace MenuOption { const QString NotificationSoundsTablet = "play_notification_sounds_tablet"; const QString ForceCoarsePicking = "Force Coarse Picking"; const QString ComputeBlendshapes = "Compute Blendshapes"; + const QString HighlightTransitions = "Highlight Transitions"; } #endif // hifi_Menu_h diff --git a/libraries/render/src/render/DrawStatus.cpp b/libraries/render/src/render/DrawStatus.cpp index 76ed5aa663..8ea79c74b1 100644 --- a/libraries/render/src/render/DrawStatus.cpp +++ b/libraries/render/src/render/DrawStatus.cpp @@ -26,7 +26,7 @@ using namespace render; void DrawStatusConfig::dirtyHelper() { - _isEnabled = showNetwork || showDisplay; + _isEnabled = showNetwork || showDisplay || showFade; emit dirty(); } @@ -79,6 +79,7 @@ const gpu::TexturePointer DrawStatus::getStatusIconMap() const { void DrawStatus::configure(const Config& config) { _showDisplay = config.showDisplay; _showNetwork = config.showNetwork; + _showFade = config.showFade; } void DrawStatus::run(const RenderContextPointer& renderContext, const Input& input) { @@ -96,40 +97,70 @@ void DrawStatus::run(const RenderContextPointer& renderContext, const Input& inp int nbItems = 0; render::ItemBounds itemBounds; std::vector> itemStatus; - { - for (size_t i = 0; i < inItems.size(); ++i) { - const auto& item = inItems[i]; - if (!item.bound.isInvalid()) { - if (!item.bound.isNull()) { - itemBounds.emplace_back(render::ItemBound(item.id, item.bound)); - } else { - itemBounds.emplace_back(item.id, AABox(item.bound.getCorner(), 0.1f)); - } - auto& itemScene = scene->getItem(item.id); + for (size_t i = 0; i < inItems.size(); ++i) { + const auto& item = inItems[i]; + if (!item.bound.isInvalid()) { + if (!item.bound.isNull()) { + itemBounds.emplace_back(render::ItemBound(item.id, item.bound)); + } else { + itemBounds.emplace_back(item.id, AABox(item.bound.getCorner(), 0.1f)); + } - auto itemStatusPointer = itemScene.getStatus(); - if (itemStatusPointer) { - itemStatus.push_back(std::pair()); - // Query the current status values, this is where the statusGetter lambda get called - auto&& currentStatusValues = itemStatusPointer->getCurrentValues(); - int valueNum = 0; - for (int vec4Num = 0; vec4Num < NUM_STATUS_VEC4_PER_ITEM; vec4Num++) { - auto& value = (vec4Num ? itemStatus[nbItems].first : itemStatus[nbItems].second); - value = glm::ivec4(Item::Status::Value::INVALID.getPackedData()); - for (int component = 0; component < VEC4_LENGTH; component++) { - valueNum = vec4Num * VEC4_LENGTH + component; - if (valueNum < (int)currentStatusValues.size()) { - value[component] = currentStatusValues[valueNum].getPackedData(); + auto& itemScene = scene->getItem(item.id); + + if (_showNetwork || _showFade) { + const static auto invalid = glm::ivec4(Item::Status::Value::INVALID.getPackedData()); + itemStatus.emplace_back(invalid, invalid); + int vec4Num = 0; + int vec4Component = 0; + + if (_showNetwork) { + auto itemStatusPointer = itemScene.getStatus(); + if (itemStatusPointer) { + // Query the current status values, this is where the statusGetter lambda get called + auto&& currentStatusValues = itemStatusPointer->getCurrentValues(); + for (const auto& statusValue : currentStatusValues) { + if (vec4Num == NUM_STATUS_VEC4_PER_ITEM) { + // Ran out of space + break; + } + + auto& value = (vec4Num == 0 ? itemStatus[nbItems].first : itemStatus[nbItems].second); + value[vec4Component] = statusValue.getPackedData(); + + ++vec4Component; + if (vec4Component == VEC4_LENGTH) { + vec4Component = 0; + ++vec4Num; } } } - } else { - auto invalid = glm::ivec4(Item::Status::Value::INVALID.getPackedData()); - itemStatus.emplace_back(invalid, invalid); } - nbItems++; + + if (_showFade && vec4Num != NUM_STATUS_VEC4_PER_ITEM) { + auto& value = (vec4Num == 0 ? itemStatus[nbItems].first : itemStatus[nbItems].second); + + Item::Status::Value status; + status.setColor(Item::Status::Value::CYAN); + status.setIcon(3); // RenderItemStatusIcon::SIMULATION_OWNER (RenderableModelEntityItem.cpp) + if (itemScene.getTransitionId() != INVALID_INDEX) { + // We have a transition. Show this icon. + status.setScale(1.0f); + } else { + status.setScale(0.0f); + } + value[vec4Component] = status.getPackedData(); + + ++vec4Component; + if (vec4Component == VEC4_LENGTH) { + vec4Component = 0; + ++vec4Num; + } + } } + + nbItems++; } } @@ -169,7 +200,7 @@ void DrawStatus::run(const RenderContextPointer& renderContext, const Input& inp batch.setPipeline(getDrawItemStatusPipeline()); - if (_showNetwork) { + if (_showNetwork || _showFade) { if (!_instanceBuffer) { _instanceBuffer = std::make_shared(); } diff --git a/libraries/render/src/render/DrawStatus.h b/libraries/render/src/render/DrawStatus.h index 2959ca59c5..6e0783f000 100644 --- a/libraries/render/src/render/DrawStatus.h +++ b/libraries/render/src/render/DrawStatus.h @@ -27,10 +27,12 @@ namespace render { bool showDisplay{ false }; bool showNetwork{ false }; + bool showFade{ false }; public slots: void setShowDisplay(bool enabled) { showDisplay = enabled; dirtyHelper(); } void setShowNetwork(bool enabled) { showNetwork = enabled; dirtyHelper(); } + void setShowFade(bool enabled) { showFade = enabled; dirtyHelper(); } signals: void dirty(); @@ -57,6 +59,7 @@ namespace render { protected: bool _showDisplay; // initialized by Config bool _showNetwork; // initialized by Config + bool _showFade; // initialized by Config gpu::Stream::FormatPointer _drawItemFormat; gpu::PipelinePointer _drawItemBoundsPipeline;