src/Screens/ModelEditorScreen.cpp
// draw contextual actions (buttons, sliders) for a selected physical frame
draw contextual actions (buttons, sliders) for a selected physical frame
draw contextual actions ( buttons sliders ) for a selected physical frame
void drawPhysicalFrameContextualActions(AttachGeometryPopup& attachGeomPopup, UndoableUiModel& uim) {
        OpenSim::PhysicalFrame const* selection = uim.getSelectedAs<OpenSim::PhysicalFrame>();
        ImGui::Columns(2);
        ImGui::TextUnformatted("geometry");
        ImGui::SameLine();
        DrawHelpMarker("Geometry that is attached to this physical frame. Multiple pieces of geometry can be attached to the frame");
        ImGui::NextColumn();
        static constexpr char const* modalName = "select geometry to add";
        if (ImGui::Button("add geometry")) {
            ImGui::OpenPopup(modalName);
        }
        if (ImGui::IsItemHovered()) {
            ImGui::BeginTooltip();
            ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
            ImGui::TextUnformatted("Add geometry to this component. Geometry can be removed by selecting it in the hierarchy editor and pressing DELETE");
            ImGui::PopTextWrapPos();
            ImGui::EndTooltip();
        }
        if (auto attached = attachGeomPopup.draw(modalName); attached) {
            uim.updSelectedAs<OpenSim::PhysicalFrame>()->attachGeometry(attached.release());
        }
        ImGui::NextColumn();
        ImGui::TextUnformatted("offset frame");
        ImGui::NextColumn();
        if (ImGui::Button("add offset frame")) {
            auto pof = std::make_unique<OpenSim::PhysicalOffsetFrame>();
            pof->setName(selection->getName() + "_offsetframe");
            pof->setParentFrame(*selection);
            auto pofptr = pof.get();
            uim.updSelectedAs<OpenSim::PhysicalFrame>()->addComponent(pof.release());
            uim.setSelected(pofptr);
        }
        if (ImGui::IsItemHovered()) {
            ImGui::BeginTooltip();
            ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
            ImGui::TextUnformatted("Add an OpenSim::OffsetFrame as a child of this Component. Other components in the model can then connect to this OffsetFrame, rather than the base Component, so that it can connect at some offset that is relative to the parent Component");
            ImGui::PopTextWrapPos();
            ImGui::EndTooltip();
        }
        ImGui::NextColumn();
        ImGui::Columns();
    }
void drawPhysicalFrameContextualActions ( AttachGeometryPopup & attachGeomPopup , UndoableUiModel & uim ) { OpenSim :: PhysicalFrame const * selection = uim . getSelectedAs < OpenSim :: PhysicalFrame > ( ) ; ImGui :: Columns ( 2 ) ; ImGui :: TextUnformatted ( " " ) ; ImGui :: SameLine ( ) ; DrawHelpMarker ( " " ) ; ImGui :: NextColumn ( ) ; static constexpr char const * modalName = " " ; if ( ImGui :: Button ( " " ) ) { ImGui :: OpenPopup ( modalName ) ; } if ( ImGui :: IsItemHovered ( ) ) { ImGui :: BeginTooltip ( ) ; ImGui :: PushTextWrapPos ( ImGui :: GetFontSize ( ) * 35.0f ) ; ImGui :: TextUnformatted ( " " ) ; ImGui :: PopTextWrapPos ( ) ; ImGui :: EndTooltip ( ) ; } if ( auto attached = attachGeomPopup . draw ( modalName ) ; attached ) { uim . updSelectedAs < OpenSim :: PhysicalFrame > ( ) -> attachGeometry ( attached . release ( ) ) ; } ImGui :: NextColumn ( ) ; ImGui :: TextUnformatted ( " " ) ; ImGui :: NextColumn ( ) ; if ( ImGui :: Button ( " " ) ) { auto pof = std :: make_unique < OpenSim :: PhysicalOffsetFrame > ( ) ; pof -> setName ( selection -> getName ( ) + " " ) ; pof -> setParentFrame ( * selection ) ; auto pofptr = pof . get ( ) ; uim . updSelectedAs < OpenSim :: PhysicalFrame > ( ) -> addComponent ( pof . release ( ) ) ; uim . setSelected ( pofptr ) ; } if ( ImGui :: IsItemHovered ( ) ) { ImGui :: BeginTooltip ( ) ; ImGui :: PushTextWrapPos ( ImGui :: GetFontSize ( ) * 35.0f ) ; ImGui :: TextUnformatted ( " " ) ; ImGui :: PopTextWrapPos ( ) ; ImGui :: EndTooltip ( ) ; } ImGui :: NextColumn ( ) ; ImGui :: Columns ( ) ; }
draw contextual actions (buttons, sliders) for a selected physical frame
draw contextual actions ( buttons sliders ) for a selected physical frame