Fix T103354: Author extents on UsdGeomMesh #104676

Merged
Sybren A. Stüvel merged 6 commits from wave/blender_wave_Apple:contribs/T103354_author_extents into main 2023-02-14 12:12:05 +01:00
2 changed files with 9 additions and 12 deletions
Showing only changes of commit e3d170cd95 - Show all commits

View File

@ -162,7 +162,7 @@ void USDAbstractWriter::author_extent(const pxr::UsdTimeCode timecode, pxr::UsdG
pxr::GfBBox3d bounds = bboxCache.ComputeLocalBound(prim.GetPrim());
if (pxr::GfBBox3d() == bounds) {
/* This will occur, for example, if a mesh does not have any vertices. */
WM_reportf(RPT_ERROR,
WM_reportf(RPT_WARNING,
wave marked this conversation as resolved

Since this situation doesn't seem to abort the export itself, I think RPT_WARNING would be more suitable here.

Since this situation doesn't seem to abort the export itself, I think `RPT_WARNING` would be more suitable here.
"USD Export: no bounds could be computed for %s",
prim.GetPrim().GetName().GetText());
return;

View File

@ -14,12 +14,6 @@ import bpy
args = None
class Result(str, enum.Enum):
finished = "FINISHED"
cancelled = "CANCELLED"
class AbstractUSDTest(unittest.TestCase):
@classmethod
wave marked this conversation as resolved

I don't think this class is necessary. Comparison with {'FINISHED'} etc. is common enough in Blender unit tests that trying to abstract away from it will make it harder for people who know the Blender API to figure out what's going on.

I don't think this `class` is necessary. Comparison with `{'FINISHED'}` etc. is common enough in Blender unit tests that trying to abstract away from it will make it harder for people who know the Blender API to figure out what's going on.
def setUpClass(cls):
@ -50,7 +44,7 @@ class USDExportTest(AbstractUSDTest):
export_materials=True,
evaluation_mode="RENDER",
)
self.assertEqual({Result.finished}, res, f"Unable to export to {export_path}")
self.assertEqual({'FINISHED'}, res, f"Unable to export to {export_path}")
checker = UsdUtils.ComplianceChecker(
arkit=False,
@ -61,8 +55,11 @@ class USDExportTest(AbstractUSDTest):
)
checker.CheckCompliance(str(export_path))
collection = {}
failed_checks = {}
# The ComplianceChecker does not know how to resolve <UDIM> tags, so
# it will flag "textures/test_grid_<UDIM>.png" as a missing reference.
# That reference is in fact OK, so we skip the rule for this test.
to_skip = ("MissingReferenceChecker",)
for rule in checker._rules:
wave marked this conversation as resolved

collection is not the most descriptive name. failed_checks would be better.

`collection` is not the most descriptive name. `failed_checks` would be better.
name = rule.__class__.__name__
@ -73,9 +70,9 @@ class USDExportTest(AbstractUSDTest):
if not issues:
continue
collection[name] = issues
failed_checks[name] = issues
self.assertFalse(collection, pprint.pformat(collection))
self.assertFalse(failed_checks, pprint.pformat(failed_checks))
def compareVec3d(self, first, second):
places = 5
@ -92,7 +89,7 @@ class USDExportTest(AbstractUSDTest):
export_materials=True,
evaluation_mode="RENDER",
)
self.assertEqual({Result.finished}, res, f"Unable to export to {export_path}")
self.assertEqual({'FINISHED'}, res, f"Unable to export to {export_path}")
# if prims are missing, the exporter must have skipped some objects
stats = UsdUtils.ComputeUsdStageStats(str(export_path))