Hello
I tried to use USD Stage Actor to import an USD file at runtime.
I used “Set Root Layer” node and it worked on PIE and Stand Alone but it did not work with packaged project.
But when I used that actor with “Spawn Actor from Class” it spawns and again, it does not work.
When you try to load usd in runtime with log enabled, there will be a error log :
*LogUsd: Error: The USD SDK is disabled because the executable is not forcing the ansi C allocator (you need to set ‘FORCE_ANSI_ALLOCATOR=1’ as a global definition on your project .Target.cs file). Read the comments at the end of UnrealUSDWrapper.Build.cs for more details.
Then, you should download your unreal engine from github.com and compile it by your own if you installed 4.27 from epic launcher, otherwise, you will meet another package error.
I gave up in this step because I decieded to switch to DatasmithRuntime to import scene in runtime for vray materials support.
I helps a lot ! Thank you very much. I tried and got same errors. I wont try to compile engine because there are additional mechanics which I need to write. But I will try in the future.
I tried to use Datasmith Runtime but for CAD aspect, part names and hierarchy come broken. So I use GLTF Runtime.
Hey, Is it possible to import USD file in Packaged project If Yes can you tell me the steps to do that ???
Purpose :- I want to load all the assets in my game in runtime like i have a .CSV file that have all the data about location and rotation about the actor and the actor is in .USD format so I just want to read that .csv file and pick USD file From that location…
Has this been resolved in 5.0/5.1 using a launcher build to package? Would really like to be able to package using a launcher build but running into similar issues.
I haven’t tried it yet and won’t try it near future. But you can try it. Just try to import something to a template and package it. If there will be an error after target.cs edit, we can say you need source code.
Yes I was able to import USD at run time in standalone mode…
But I wanted to import multiple USD file for multiple locations. But it only loads last USD file like if I have 3 root location than it only imports the last one…
Because you (probably) try to import multiple USD with single container.
Use two actor classes.
1- BP_USD (example name) which holds USD root.
2- Another BP which has your loop to trigger import sequence.
For this:
First, put your loop actot to the scene and spawn your USD container actors from its loop actor’s inside. You have to have equal numbered container actors for each USD file.
Second, set container actors’ world space locations with your list. Do it before importing. Because after you import, moving an actor which contains static meshes will be hard. (I consider you have at least hundreds of components)
Finaly, set each container’s USD root with your path.
// Just be sure about your USDs’ main center. When you put all of them in a group in 3Ds Max or Blender, that group has to be at 0,0,0. This is your main / assembly center. If not, second step just offsets your meshes.
// Don’t use “for each loop” or “delay”. Because they don’t know when your import finish or not. You have to create a custom loop and use .json as list. Json object count will be your loop bound.
And,
create a delegate on your actor which contains loop.
create an int32 variable as “Index_USD”
After you import something, your USD container should trigger that delegate to start new import and increment Index_USD by one. So, each of them will be imported with correct order.