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
View File
@@ -3,6 +3,7 @@
#include <imgui.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usd/usd/timeCode.h>
#include <pxr/usd/sdf/path.h>
#include <pxr/base/gf/vec3d.h>
#include <pxr/base/gf/vec3f.h>
@@ -12,6 +13,8 @@
#include <pxr/base/gf/ray.h>
#include <pxr/usd/usdGeom/xformCommonAPI.h>
#include "../core/commands/TransformCommand.h"
namespace UsdLayerManager {
class CommandHistory;
@@ -33,6 +36,13 @@ public:
void SetSelectedPrim(const pxr::SdfPath& path);
void SetCommandHistory(CommandHistory* h) { m_commandHistory = h; }
/// displayTime — frame used to read/evaluate transforms (timeline frame).
/// editTime — frame writes are authored at (Default unless Auto-Key).
void SetTimeCodes(pxr::UsdTimeCode displayTime, pxr::UsdTimeCode editTime) {
m_displayTime = displayTime;
m_editTime = editTime;
}
void Render(ImDrawList* dl, const pxr::GfMatrix4d& viewProj,
const pxr::GfVec3d& pivot, const pxr::GfVec3d& cameraEye,
const ImVec2& imagePos, int viewW, int viewH);
@@ -83,6 +93,8 @@ private:
pxr::UsdStageRefPtr m_stage;
pxr::SdfPath m_primPath;
CommandHistory* m_commandHistory = nullptr;
pxr::UsdTimeCode m_displayTime = pxr::UsdTimeCode::Default();
pxr::UsdTimeCode m_editTime = pxr::UsdTimeCode::Default();
bool m_isDragging = false;
int m_dragAxis = -1;
@@ -127,6 +139,11 @@ private:
pxr::GfVec3d m_dragStartTranslate = {0,0,0};
pxr::GfVec3f m_dragStartRotate = {0,0,0};
pxr::GfVec3f m_dragStartScale = {1,1,1};
// Sample presence at m_editTime, captured at drag start (before the
// first live write) so the end-of-drag TransformCommand can undo
// keyframe creation correctly.
TransformCommand::SamplePresence m_dragPreEditSamples;
};
} // namespace UsdLayerManager