Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ std::size_t SofaGLFWBaseGUI::runLoop(std::size_t targetNbIterations)

m_guiEngine->beforeDraw(glfwWindow);
sofaGlfwWindow->draw(m_groot, m_vparams);

drawSelection(m_vparams);

m_guiEngine->afterDraw();

m_guiEngine->startFrame(this);
Expand Down
17 changes: 12 additions & 5 deletions SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ void ImGuiGUIEngine::startFrame(sofaglfw::SofaGLFWBaseGUI* baseGUI)
static constexpr auto windowNameMouse = ICON_FA_COMPUTER_MOUSE " Mouse Manager";
static constexpr auto windowNameSettings = ICON_FA_SLIDERS " Settings";


if (!*firstRunState.getStatePtr())
{
resetView(dockspace_id, windowNameSceneGraph, windowNameLog, windowNameViewport);
Expand Down Expand Up @@ -670,9 +669,9 @@ void ImGuiGUIEngine::startFrame(sofaglfw::SofaGLFWBaseGUI* baseGUI)
/***************************************
* Viewport window
**************************************/
showViewPort(groot, windowNameViewport, ini, m_fbo, m_viewportWindowSize,
isMouseOnViewport, winManagerViewPort, baseGUI,
isViewportDisplayedForTheFirstTime, lastViewPortPos);
windows::showViewPort(groot, windowNameViewport, ini, m_fbo, m_viewportWindowSize,
isMouseOnViewport, winManagerViewPort, baseGUI,
isViewportDisplayedForTheFirstTime, lastViewPortPos);


/***************************************
Expand All @@ -695,7 +694,15 @@ void ImGuiGUIEngine::startFrame(sofaglfw::SofaGLFWBaseGUI* baseGUI)
**************************************/
static std::set<core::objectmodel::BaseObject*> openedComponents;
static std::set<core::objectmodel::BaseObject*> focusedComponents;
windows::showSceneGraph(groot, windowNameSceneGraph, openedComponents, focusedComponents, winManagerSceneGraph);
static std::set<core::objectmodel::Base*> currentSelection;
windows::showSceneGraph(groot, windowNameSceneGraph, openedComponents,
focusedComponents, currentSelection,
winManagerSceneGraph);

std::set<core::objectmodel::Base::SPtr> currentSelectionV;
for(auto component : currentSelection)
currentSelectionV.insert(component);
baseGUI->setCurrentSelection(currentSelectionV);

/***************************************
* Display flags window
Expand Down
17 changes: 12 additions & 5 deletions SofaImGui/src/SofaImGui/windows/SceneGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace windows
const char* const& windowNameSceneGraph,
std::set<sofa::core::objectmodel::BaseObject*>& openedComponents,
std::set<sofa::core::objectmodel::BaseObject*>& focusedComponents,
std::set<sofa::core::objectmodel::Base*>& currentSelection,
WindowState& winManagerSceneGraph)
{
std::set<sofa::core::objectmodel::BaseObject*> componentToOpen;
Expand Down Expand Up @@ -75,7 +76,7 @@ namespace windows

std::function<void(sofa::simulation::Node*)> showNode;
showNode = [&showNode, &treeDepth, expand, collapse, &openedComponents,
&componentToOpen](sofa::simulation::Node* node)
&componentToOpen, &currentSelection](sofa::simulation::Node* node)
{
if (node == nullptr) return;
if (treeDepth == 0)
Expand Down Expand Up @@ -168,22 +169,29 @@ namespace windows
else
{
clickedObject = object;
if(!currentSelection.contains(clickedObject)){
currentSelection.clear();
currentSelection.insert(clickedObject);
}
else{
currentSelection.erase(clickedObject);
}
}
}

ImGui::SameLine();

if (isObjectHighlighted)
bool doHighLight = isObjectHighlighted || currentSelection.contains(object);
if (doHighLight)
{
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1,1,0,1));
}
ImGui::Text(object->getName().c_str());

ImGui::TableNextColumn();
ImGui::TextDisabled(objectClassName.c_str());
ImGui::PopID();

if (isObjectHighlighted)
if (doHighLight)
{
ImGui::PopStyleColor();
}
Expand Down Expand Up @@ -353,7 +361,6 @@ namespace windows

openedComponents.insert(componentToOpen.begin(), componentToOpen.end());
openedComponents.insert(focusedComponents.begin(), focusedComponents.end());
focusedComponents.clear();

sofa::type::vector<sofa::core::objectmodel::BaseObject*> toRemove;
static std::map<sofa::core::objectmodel::BaseObject*, int> resizeWindow;
Expand Down
1 change: 1 addition & 0 deletions SofaImGui/src/SofaImGui/windows/SceneGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace windows
const char* const& windowNameSceneGraph,
std::set<sofa::core::objectmodel::BaseObject*>& openedComponents,
std::set<sofa::core::objectmodel::BaseObject*>& focusedComponents,
std::set<sofa::core::objectmodel::Base*>& currentSelection,
WindowState& winManagerSceneGraph);


Expand Down
Loading