@ -160,29 +160,18 @@ void USDGenericMeshWriter::write_mesh(HierarchyContext &context, Mesh *mesh)
get_geometry_data ( mesh , usd_mesh_data ) ;
if ( usd_export_context_ . export_params . use_instancing & & context . is_instance ( ) ) {
// This object data is instanced, just reference the original instead of writing a copy.
if ( context . export_path = = context . original_export_path ) {
printf ( " USD ref error: export path is reference path: %s \n " , context . export_path . c_str ( ) ) ;
BLI_assert ( ! " USD reference error " ) ;
return ;
}
pxr : : SdfPath ref_path ( context . original_export_path ) ;
if ( ! usd_mesh . GetPrim ( ) . GetReferences ( ) . AddInternalReference ( ref_path ) ) {
/* See this URL for a description fo why referencing may fail"
* https : //graphics.pixar.com/usd/docs/api/class_usd_references.html#Usd_Failing_References
*/
printf ( " USD Export warning: unable to add reference from %s to %s, not instancing object \n " ,
context . export_path . c_str ( ) ,
context . original_export_path . c_str ( ) ) ;
if ( ! mark_as_instance ( context , usd_mesh . GetPrim ( ) ) ) {
return ;
}
/* The material path will be of the form </_materials/{material name}>, which is outside the
sub - tree pointed to by ref_path . As a result , the referenced data is not allowed to point out
of its own sub - tree . It does work when we override the material with exactly the same path ,
though . */
* sub - tree pointed to by ref_path . As a result , the referenced data is not allowed to point
* out of its own sub - tree . It does work when we override the material with exactly the same
* path , though . */
if ( usd_export_context_ . export_params . export_materials ) {
assign_materials ( context , usd_mesh , usd_mesh_data . face_groups ) ;
}
return ;
}