Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/io/usd/intern/usd_writer_mesh.cc')
-rw-r--r--source/blender/io/usd/intern/usd_writer_mesh.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc
index 841501bcf42..bd2c549e729 100644
--- a/source/blender/io/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/io/usd/intern/usd_writer_mesh.cc
@@ -42,7 +42,9 @@
#include "DNA_object_fluidsim_types.h"
#include "DNA_particle_types.h"
-namespace USD {
+namespace blender {
+namespace io {
+namespace usd {
USDGenericMeshWriter::USDGenericMeshWriter(const USDExporterContext &ctx) : USDAbstractWriter(ctx)
{
@@ -335,14 +337,15 @@ void USDGenericMeshWriter::assign_materials(const HierarchyContext &context,
* which is why we always bind the first material to the entire mesh. See
* https://github.com/PixarAnimationStudios/USD/issues/542 for more info. */
bool mesh_material_bound = false;
- for (short mat_num = 0; mat_num < context.object->totcol; mat_num++) {
+ pxr::UsdShadeMaterialBindingAPI material_binding_api(usd_mesh.GetPrim());
+ for (int mat_num = 0; mat_num < context.object->totcol; mat_num++) {
Material *material = BKE_object_material_get(context.object, mat_num + 1);
if (material == nullptr) {
continue;
}
pxr::UsdShadeMaterial usd_material = ensure_usd_material(material);
- usd_material.Bind(usd_mesh.GetPrim());
+ material_binding_api.Bind(usd_material);
/* USD seems to support neither per-material nor per-face-group double-sidedness, so we just
* use the flag from the first non-empty material slot. */
@@ -378,9 +381,9 @@ void USDGenericMeshWriter::assign_materials(const HierarchyContext &context,
pxr::UsdShadeMaterial usd_material = ensure_usd_material(material);
pxr::TfToken material_name = usd_material.GetPath().GetNameToken();
- pxr::UsdShadeMaterialBindingAPI api = pxr::UsdShadeMaterialBindingAPI(usd_mesh);
- pxr::UsdGeomSubset usd_face_subset = api.CreateMaterialBindSubset(material_name, face_indices);
- usd_material.Bind(usd_face_subset.GetPrim());
+ pxr::UsdGeomSubset usd_face_subset = material_binding_api.CreateMaterialBindSubset(
+ material_name, face_indices);
+ pxr::UsdShadeMaterialBindingAPI(usd_face_subset.GetPrim()).Bind(usd_material);
}
}
@@ -483,4 +486,6 @@ Mesh *USDMeshWriter::get_export_mesh(Object *object_eval, bool & /*r_needsfree*/
return BKE_object_get_evaluated_mesh(object_eval);
}
-} // namespace USD
+} // namespace usd
+} // namespace io
+} // namespace blender