src/Screens/ModelEditorScreen.cpp
// draw model editor screen
//
// can throw if the model is in an invalid state
draw model editor screen
can throw if the model is in an invalid state
draw model editor screen can throw if the model is in an invalid state
void modelEditorDrawUnguarded(ModelEditorScreen::Impl& impl) {
        if (impl.resetPerFrame.shouldRequestRedraw) {
            App::cur().requestRedraw();
        }
        impl.resetPerFrame = {};
        {
            drawMainMenu(impl);
        }
         (the main menu may have requested a screen transition)
        if (impl.resetPerFrame.subpanelRequestedEarlyExit) {
            return;
        }
         draw 3D viewers (if any)
        {
            draw3DViewers(impl);
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
         draw editor actions panel
         contains top-level actions (e.g. "add body")
        if (impl.st->showing.actions) {
            if (ImGui::Begin("Actions", nullptr, ImGuiWindowFlags_MenuBar)) {
                impl.ui.modelActions.draw(impl.st->editedModel.updUiModel());
            }
            ImGui::End();
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
         draw hierarchy viewer
        if (impl.st->showing.hierarchy) {
            if (ImGui::Begin("Hierarchy", &impl.st->showing.hierarchy)) {
                auto resp = impl.ui.componentHierarchy.draw(
                    &impl.st->editedModel.getModel().getRoot(),
                    impl.st->getSelected(),
                    impl.st->getHovered());
                if (resp.type == ComponentHierarchy::SelectionChanged) {
                    impl.st->setSelected(resp.ptr);
                } else if (resp.type == ComponentHierarchy::HoverChanged) {
                    impl.st->setHovered(resp.ptr);
                }
            }
            ImGui::End();
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
         draw property editor
        if (impl.st->showing.propertyEditor) {
            if (ImGui::Begin("Edit Props", &impl.st->showing.propertyEditor)) {
                drawSelectionEditor(impl, impl.st->editedModel);
            }
            ImGui::End();
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
         draw application log
        if (impl.st->showing.log) {
            if (ImGui::Begin("Log", &impl.st->showing.log, ImGuiWindowFlags_MenuBar)) {
                impl.ui.logViewer.draw();
            }
            ImGui::End();
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
        if (impl.st->showing.coordinateEditor) {
            if (ImGui::Begin("Coordinate Editor")) {
                impl.ui.coordEditor.draw(impl.st->editedModel.updUiModel());
            }
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
         draw sim params editor popup (if applicable)
        {
            if (impl.resetPerFrame.editSimParamsRequested) {
                ImGui::OpenPopup("simulation parameters");
            }
            FdParamsEditorPopup{}.draw("simulation parameters", impl.st->simParams);
        }
        if (impl.resetPerFrame.subpanelRequestedEarlyExit) {
            return;
        }
         apply any updates made during this frame (can throw)
        impl.st->editedModel.updateIfDirty();
    }
void modelEditorDrawUnguarded ( ModelEditorScreen :: Impl & impl ) { if ( impl . resetPerFrame . shouldRequestRedraw ) { App :: cur ( ) . requestRedraw ( ) ; } impl . resetPerFrame = { } ; { drawMainMenu ( impl ) ; } if ( impl . resetPerFrame . subpanelRequestedEarlyExit ) { return ; } { draw3DViewers ( impl ) ; } impl . st -> editedModel . updateIfDirty ( ) ; if ( impl . st -> showing . actions ) { if ( ImGui :: Begin ( " " , nullptr , ImGuiWindowFlags_MenuBar ) ) { impl . ui . modelActions . draw ( impl . st -> editedModel . updUiModel ( ) ) ; } ImGui :: End ( ) ; } impl . st -> editedModel . updateIfDirty ( ) ; if ( impl . st -> showing . hierarchy ) { if ( ImGui :: Begin ( " " , & impl . st -> showing . hierarchy ) ) { auto resp = impl . ui . componentHierarchy . draw ( & impl . st -> editedModel . getModel ( ) . getRoot ( ) , impl . st -> getSelected ( ) , impl . st -> getHovered ( ) ) ; if ( resp . type == ComponentHierarchy :: SelectionChanged ) { impl . st -> setSelected ( resp . ptr ) ; } else if ( resp . type == ComponentHierarchy :: HoverChanged ) { impl . st -> setHovered ( resp . ptr ) ; } } ImGui :: End ( ) ; } impl . st -> editedModel . updateIfDirty ( ) ; if ( impl . st -> showing . propertyEditor ) { if ( ImGui :: Begin ( " " , & impl . st -> showing . propertyEditor ) ) { drawSelectionEditor ( impl , impl . st -> editedModel ) ; } ImGui :: End ( ) ; } impl . st -> editedModel . updateIfDirty ( ) ; if ( impl . st -> showing . log ) { if ( ImGui :: Begin ( " " , & impl . st -> showing . log , ImGuiWindowFlags_MenuBar ) ) { impl . ui . logViewer . draw ( ) ; } ImGui :: End ( ) ; } impl . st -> editedModel . updateIfDirty ( ) ; if ( impl . st -> showing . coordinateEditor ) { if ( ImGui :: Begin ( " " ) ) { impl . ui . coordEditor . draw ( impl . st -> editedModel . updUiModel ( ) ) ; } } impl . st -> editedModel . updateIfDirty ( ) ; { if ( impl . resetPerFrame . editSimParamsRequested ) { ImGui :: OpenPopup ( " " ) ; } FdParamsEditorPopup { } . draw ( " " , impl . st -> simParams ) ; } if ( impl . resetPerFrame . subpanelRequestedEarlyExit ) { return ; } impl . st -> editedModel . updateIfDirty ( ) ; }
draw model editor screen
can throw if the model is in an invalid state
draw model editor screen can throw if the model is in an invalid state
// draw main menu // check for early exit request // // (the main menu may have requested a screen transition) // draw 3D viewers (if any) // apply any updates made during this frame (can throw) // draw editor actions panel // // contains top-level actions (e.g. "add body") // apply any updates made during this frame (can throw) // draw hierarchy viewer // apply any updates made during this frame (can throw) // draw property editor // apply any updates made during this frame (can throw) // draw application log // apply any updates made during this frame (can throw) // apply any updates made during this frame (can throw) // draw sim params editor popup (if applicable) // apply any updates made during this frame (can throw)