[Bf-blender-cvs] [50843f4aeb7] sybren-usd: USD: export meters-per-unit scale in stage metadata

Sybren A. Stüvel noreply at git.blender.org
Fri Jul 5 18:11:23 CEST 2019


Commit: 50843f4aeb7b95b5bb497418ad97e0d08e4870d0
Author: Sybren A. Stüvel
Date:   Fri Jul 5 16:28:34 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB50843f4aeb7b95b5bb497418ad97e0d08e4870d0

USD: export meters-per-unit scale in stage metadata

When set to a non-metric unit system, Blender internally still stores
imperial units, so the scale is the only thing we need to write to USD.

===================================================================

M	source/blender/usd/intern/usd_capi.cc

===================================================================

diff --git a/source/blender/usd/intern/usd_capi.cc b/source/blender/usd/intern/usd_capi.cc
index 891b49b96f5..757e2283948 100644
--- a/source/blender/usd/intern/usd_capi.cc
+++ b/source/blender/usd/intern/usd_capi.cc
@@ -102,9 +102,11 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
   {
     Timer usd_write_timer_("Writing to USD");
 
-    // Create a stage with the Only Correct up-axis.
+    // Create a stage and set up the metadata.
     pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(data->filename);
     usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z));
+    usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit,
+                           pxr::VtValue(scene->unit.scale_length));
 
     // Set up the stage for animated data.
     if (data->params.export_animation) {



More information about the Bf-blender-cvs mailing list