Fix: USD instancing export errors
Fixed two errors when exporting to USD with Instancing enabled: Ensuring the mesh prototype prim exists before referencing it to avoid the "Unresolved reference prim path" error messages in the console. Adding the Root Prim path prefix to the prototype reference path. Pull Request: https://projects.blender.org/blender/blender/pulls/126210
This commit is contained in:
committed by
Michael Kowalski
parent
4b726b41b9
commit
f30689e12c
@@ -261,7 +261,17 @@ bool USDAbstractWriter::mark_as_instance(const HierarchyContext &context, const
|
||||
return false;
|
||||
}
|
||||
|
||||
pxr::SdfPath ref_path(context.original_export_path);
|
||||
BLI_assert(!context.original_export_path.empty());
|
||||
BLI_assert(context.original_export_path.front() == '/');
|
||||
|
||||
std::string ref_path_str(usd_export_context_.export_params.root_prim_path);
|
||||
ref_path_str += context.original_export_path;
|
||||
|
||||
pxr::SdfPath ref_path(ref_path_str);
|
||||
|
||||
/* To avoid USD errors, make sure the referenced path exists. */
|
||||
usd_export_context_.stage->DefinePrim(ref_path);
|
||||
|
||||
if (!prim.GetReferences().AddInternalReference(ref_path)) {
|
||||
/* See this URL for a description for why referencing may fail"
|
||||
* https://graphics.pixar.com/usd/docs/api/class_usd_references.html#Usd_Failing_References
|
||||
|
||||
Reference in New Issue
Block a user