I would like to be able to add extra metadata onto USD prims in order that I can read this data on import, add an actor component to the spawned actor and set the component properties to these read values. This appears to be what the USD Stage Editor does when you apply a schema. For example, I add the LiveLinkApi schema and it adds a LiveLinkControllerComponent to the spawned actor.
If possible, I would like to develop the code needed to generate my own USD schema with custom properties. On import I would then use this to add an acor component to the actor on stage and set it’s properties from the USD file. As a simple example, I would like to:
- Create a USD schema that stores a string variable for name and an integer for age.
- Create a corresponding actor component that has name and an age variables, and a function to print the name and age to log on begin play.
- Create functionlity that would process the USD when loading it onto the stage, finding the prims with the new schema, adding the actor component to the stage actors and setting the appropriate values.
I’ve been wading my way through the USD plugin code in UE 5.4 but i’m really struggling to know where to begin on this. Please can somebody give me a high level overview of the main functions I would need to dig into in the USD plugin and a rough idea of how I could put this together? I’m experienced with Unreal Engine and developing in C++ but much of this plugin looks alien.
I have some specific questions:
Do I create the schema in Unreal in C++ or does this have to be generated outside of Unreal in python or similar? How do I “register” this with Unreal to use it in the engine?
How do I either extend the existing stage loading to add functionality to read my extra properties and spawn actor components? Or bind to an event post stage loading and add my functionality there? Which is the favoured approach?
Many thanks.