Level Sequence SpotLight USD Exporter Bug

I’ve noticed a bug when using the Level Sequence USD Exporter. The attributes for spotlights are not exported. This is due to the fact of the ShapingAPI never being added to the defined prim during the exporter process.

For Level Sequence export, the SpotLight callback stack is:

ULevelSequenceExporterUsd::ExportBinary (LevelSequenceExporterUSD.cpp:1749)

└── LevelSequenceExporterImpl::ExportMovieSceneSequence (1492, called at 1990)

└── GenerateBakersForMovieScene (812\)

    └── GetPrimForComponent lambda (1088\-1109\)

        └── UsdUtils::GetSchemaNameForComponent (USDConversionUtils.cpp:595\)

            └── returns "SphereLight" via UPointLightComponent branch (641\-644\)

                // This happens because USpotLightComponent derives from UPointLightComponent

                └── CreateComponentPropertyBaker (USDPrimConversion.cpp:4491, called at 1199\)

                    └── Spot branch (4948\+)

                        └── pxr::UsdLuxShapingAPI ShapingAPI{Prim}

                            └── fails if (!SphereLight \|\| !ShapingAPI) return false; (4955\-4959\)

                                // ShapingAPI was never applied, so this check fails

                                └── AddBaker ignores it because BakerType \=\= None (LevelSequenceExporterUSD.cpp:1121\-1124\)

                                    └── BakeMovieSceneSequence (1366\)

                                        └── Spot light baker never executes (1461\)

                                            // As a result, Spot intensity is not authored, while Point lights do work

Reading at the code the LevelExporter and the Level Sequencer exporter use different approaches for the prim creation, while in the USDLightConverter.cpp, used by the LevelExporter, it does apply the ShapingAPI for spotlight component, for the Level Sequence exporter, on the USDPrimConversion.cpp, it only checks if the ShapingAPI is valid, but it’s never applied.

A change on USDCore\Source\USDUtilities\Private\USDPrimConversion.cpp > 4956 seems to fix the issue:

pxr::UsdLuxShapingAPI ShapingAPI{Prim}; -> pxr::UsdLuxShapingAPI ShapingAPI = pxr::UsdLuxShapingAPI::Apply(Prim);

Steps to Reproduce

  • Create a Empty level with a SpotLight
  • Bind the intensity of the spot light to the a level sequence and animate it
  • Export the level sequence data with Sequencer > Actions > Export

Hey there,

First, apologies for the very long delay in response time. Thanks for raising this, I’ve logged an issue that you can follow here: https://issues.unrealengine.com/issue/UE-371490

I tested your suggestion, and it did not change anything for me. Do you have further USD adjustments you’ve made? If you do have suggestions that do work, feel free to submit a PR and reference the issue above.

https://dev.epicgames.com/documentation/en-us/unreal-engine/contributing-to-the-unreal-engine

Dustin

Hey, just a heads up. We’ve addressed this issue in this change:

https://github.com/EpicGames/UnrealEngine/commit/89c679c5739a8ad6c6d74ba62a22e299c8bb9d54

Dustin