Evaluate xformOps at startTimeCode for static viewers

Set env.timecode to startTimeCode (if authored) when converting Stage to
RenderScene. This ensures xformOps with TimeSamples are evaluated at the
initial pose for static viewers like materialx.js that don't support
animation playback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Syoyo Fujita
2025-12-15 11:42:04 +09:00
parent 6f3fcdf835
commit 22f292c3dc

View File

@@ -936,7 +936,11 @@ class TinyUSDZLoaderNative {
// RenderScene: Scene graph object which is suited for GL/Vulkan renderer
tinyusdz::tydra::RenderSceneConverter converter;
// env.timecode = timecode; // TODO
// Set timecode to startTimeCode if authored, so xformOps with TimeSamples
// are evaluated at the start time (initial pose) for static viewers
if (stage.metas().startTimeCode.authored()) {
env.timecode = stage.metas().startTimeCode.get_value();
}
loaded_ = converter.ConvertToRenderScene(env, &render_scene_);
if (!loaded_) {
std::cerr << "Failed to convert USD Stage to RenderScene: \n"
@@ -1047,7 +1051,11 @@ class TinyUSDZLoaderNative {
// RenderScene: Scene graph object which is suited for GL/Vulkan renderer
tinyusdz::tydra::RenderSceneConverter converter;
// env.timecode = timecode; // TODO
// Set timecode to startTimeCode if authored, so xformOps with TimeSamples
// are evaluated at the start time (initial pose) for static viewers
if (stage.metas().startTimeCode.authored()) {
env.timecode = stage.metas().startTimeCode.get_value();
}
loaded_ = converter.ConvertToRenderScene(env, &render_scene_);
if (!loaded_) {
std::cerr << "Failed to convert USD Stage to RenderScene: \n"