| 1708 | } |
| 1709 | |
| 1710 | void RibbonMenu::drawItemDialog_( DialogItemPtr& itemPtr ) |
| 1711 | { |
| 1712 | if ( !itemPtr.item ) |
| 1713 | return; |
| 1714 | |
| 1715 | auto statePlugin = std::dynamic_pointer_cast< StateBasePlugin >( itemPtr.item ); |
| 1716 | if ( !statePlugin || !statePlugin->isEnabled() ) |
| 1717 | return; |
| 1718 | statePlugin->preDrawUpdate(); |
| 1719 | |
| 1720 | // check before drawDialog to avoid calling something like: |
| 1721 | // ImGui::Image( textId ) // with removed texture in deferred render calls |
| 1722 | if ( !statePlugin->dialogIsOpen() ) |
| 1723 | { |
| 1724 | itemPressed_( itemPtr.item ); |
| 1725 | if ( !itemPtr.item ) |
| 1726 | return; // do not proceed if we closed dialog in this call |
| 1727 | } |
| 1728 | |
| 1729 | statePlugin->drawDialog( ImGui::GetCurrentContext() ); |
| 1730 | |
| 1731 | if ( !itemPtr.item ) // if it was closed in drawDialog |
| 1732 | return; |
| 1733 | |
| 1734 | if ( !itemPtr.dialogPositionFixed ) |
| 1735 | { |
| 1736 | itemPtr.dialogPositionFixed = true; |
| 1737 | auto* window = ImGui::FindWindowByName( itemPtr.item->name().c_str() ); // this function is hidden in imgui_internal.h |
| 1738 | // viewer->framebufferSize.x here because ImGui use screen space |
| 1739 | if ( window ) |
| 1740 | { |
| 1741 | ImVec2 pos = ImVec2( viewer->framebufferSize.x - window->Size.x, float( topPanelOpenedHeight_ - 1.0f ) * UI::scale() ); |
| 1742 | ImGui::SetWindowPos( window, pos, ImGuiCond_Always ); |
| 1743 | } |
| 1744 | } |
| 1745 | |
| 1746 | if ( !statePlugin->dialogIsOpen() ) // still need to check here we ordered to close dialog in `drawDialog` |
| 1747 | itemPressed_( itemPtr.item ); |
| 1748 | else if ( prevFrameSelectedObjectsCache_ != SceneCache::getAllObjects<const Object, ObjectSelectivityType::Selected>() ) |
| 1749 | statePlugin->updateSelection( SceneCache::getAllObjects<const Object, ObjectSelectivityType::Selected>() ); |
| 1750 | } |
| 1751 | |
| 1752 | void RibbonMenu::drawRibbonSceneList_() |
| 1753 | { |
nothing calls this directly
no test coverage detected