Timeline Prototype

This commit is contained in:
2026-06-13 11:48:56 +08:00
parent 43c70be574
commit c4bf9673a8
24 changed files with 501 additions and 58 deletions
+17 -1
View File
@@ -69,11 +69,19 @@ bool Application::Initialize(const std::string& windowTitle, int width, int heig
m_propertyPanel->SetPropertyManager(m_propertyManager.get());
m_propertyPanel->SetCommandHistory(&m_commandHistory);
m_timelinePanel = std::make_unique<TimelinePanel>();
m_timelinePanel->OnTimeChanged = [this](pxr::UsdTimeCode displayTime,
pxr::UsdTimeCode editTime) {
m_viewportPanel->SetTimeCodes(displayTime, editTime);
m_propertyPanel->SetTimeCodes(displayTime, editTime);
};
// Initialize IconManager — must happen after OpenGL context is ready (ImGui init above).
m_iconManager = std::make_unique<IconManager>();
m_iconManager->Initialize(ResourcePath("resources/icons"), 24);
m_sceneHierarchyPanel->SetIconManager(m_iconManager.get());
m_viewportPanel->SetIconManager(m_iconManager.get());
m_timelinePanel->SetIconManager(m_iconManager.get());
m_sceneHierarchyPanel->SetOnPrimSelected(
[this](const std::string& path) {
@@ -155,19 +163,23 @@ void Application::RefreshManagers() {
m_viewportPanel->SetStage(stage);
m_viewportPanel->FrameScene();
m_propertyPanel->SetStage(stage);
m_timelinePanel->SetStage(stage);
} else {
m_layerManager->SetStage(nullptr);
m_propertyManager->SetStage(nullptr);
m_sceneHierarchyPanel->SetStage(nullptr);
m_viewportPanel->SetStage(nullptr);
m_propertyPanel->SetStage(nullptr);
m_timelinePanel->SetStage(nullptr);
}
}
void Application::Update() {
ImGuiIO& io = ImGui::GetIO();
m_timelinePanel->Update(io.DeltaTime);
// Process undo/redo hotkeys (Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z).
// Only fire when no ImGui text-input widget has keyboard focus.
ImGuiIO& io = ImGui::GetIO();
if (!io.WantTextInput) {
if (io.KeyCtrl && !io.KeyShift && ImGui::IsKeyPressed(ImGuiKey_Z, false)) {
m_commandHistory.Undo();
@@ -211,6 +223,10 @@ void Application::RenderUI() {
m_propertyPanel->Render();
ImGui::End();
ImGui::Begin("Timeline", nullptr, ImGuiWindowFlags_NoCollapse);
m_timelinePanel->Render();
ImGui::End();
m_imguiContext->Render();
}