Cleanup: Remove unneeded USD cmake check/guard
In March 2022 this was added as a provision to check/guard the build if external folks were compiling without USD "Imaging" support [1] In Feb 2023 code was added which ended up depending on "Imaging" unconditionally (and probably more at this point) [2] Since we haven't heard this being a problem so far, and because the USD build option is enabled by default, let's just remove it. The test which was added is also removed because the main import/export code serves as the compile test, and the python test code serves as a much more sufficient check of actual functionality. [1] https://archive.blender.org/developer/D14456 [2] Commit `72a85d976a5781a21166356b24668b8c48d51690` Pull Request: https://projects.blender.org/blender/blender/pulls/129733
This commit is contained in:
committed by
Jesse Yurkovich
parent
88f945d068
commit
c9d50a316b
@@ -28,25 +28,6 @@ endif()
|
||||
# USD headers use deprecated TBB headers, silence warning.
|
||||
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
|
||||
|
||||
# Check if USD has the imaging headers available, if they are
|
||||
# add a USD_HAS_IMAGING define so code can dynamically detect this.
|
||||
# Cleanup of this variable is done at the end of the file since
|
||||
# test code further down uses it to add imaging tests.
|
||||
find_file(
|
||||
USD_IMAGING_HEADERS
|
||||
NAMES
|
||||
capsuleAdapter.h
|
||||
PATHS
|
||||
${USD_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES
|
||||
pxr/usdImaging/usdImaging/
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(USD_IMAGING_HEADERS)
|
||||
add_definitions(-DUSD_HAS_IMAGING)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# Some USD library headers trigger the "unreferenced formal parameter"
|
||||
# warning alert.
|
||||
@@ -269,9 +250,6 @@ if(WITH_GTESTS)
|
||||
tests/usd_usdz_export_test.cc
|
||||
intern/usd_writer_material.hh
|
||||
)
|
||||
if(USD_IMAGING_HEADERS)
|
||||
list(APPEND TEST_SRC tests/usd_imaging_test.cc)
|
||||
endif()
|
||||
|
||||
include_directories(intern)
|
||||
|
||||
@@ -282,7 +260,3 @@ if(WITH_GTESTS)
|
||||
)
|
||||
blender_add_test_suite_lib(io_usd "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}")
|
||||
endif()
|
||||
|
||||
# In CMAKE version 3.21 and up, we can instead use the `NO_CACHE` option for
|
||||
# `find_file` so we don't need to clear it from the cache here.
|
||||
unset(USD_IMAGING_HEADERS CACHE)
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2022 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#include "testing/testing.h"
|
||||
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
#include <pxr/usd/usdGeom/capsule.h>
|
||||
#include <pxr/usdImaging/usdImaging/capsuleAdapter.h>
|
||||
|
||||
namespace blender::io::usd {
|
||||
|
||||
class USDImagingTest : public testing::Test {};
|
||||
|
||||
TEST_F(USDImagingTest, CapsuleAdapterTest)
|
||||
{
|
||||
/* A simple test to exercise the UsdImagingGprimAdapter API to
|
||||
* ensure the code compiles, links and returns reasonable results.
|
||||
* We create a capsule shape on an in-memory stage and attempt
|
||||
* to access the shape's points and topology. */
|
||||
|
||||
pxr::UsdStageRefPtr stage = pxr::UsdStage::CreateInMemory();
|
||||
|
||||
if (!stage) {
|
||||
FAIL() << "Couldn't create in-memory stage.";
|
||||
return;
|
||||
}
|
||||
|
||||
pxr::UsdGeomCapsule capsule = pxr::UsdGeomCapsule::Define(stage, pxr::SdfPath("/Capsule"));
|
||||
|
||||
if (!capsule) {
|
||||
FAIL() << "Couldn't create UsdGeomCapsule.";
|
||||
return;
|
||||
}
|
||||
|
||||
pxr::UsdImagingCapsuleAdapter capsule_adapter;
|
||||
pxr::VtValue points_value = capsule_adapter.GetPoints(capsule.GetPrim(),
|
||||
pxr::UsdTimeCode::Default());
|
||||
if (!points_value.IsHolding<pxr::VtArray<pxr::GfVec3f>>()) {
|
||||
FAIL() << "Mesh points value holding unexpected type.";
|
||||
return;
|
||||
}
|
||||
|
||||
pxr::VtArray<pxr::GfVec3f> points = points_value.Get<pxr::VtArray<pxr::GfVec3f>>();
|
||||
EXPECT_FALSE(points.empty());
|
||||
|
||||
pxr::VtValue topology_value = capsule_adapter.GetTopology(
|
||||
capsule.GetPrim(), pxr::SdfPath(), pxr::UsdTimeCode::Default());
|
||||
|
||||
if (!topology_value.IsHolding<pxr::HdMeshTopology>()) {
|
||||
FAIL() << "Mesh topology value holding unexpected type.";
|
||||
return;
|
||||
}
|
||||
|
||||
pxr::HdMeshTopology topology = topology_value.Get<pxr::HdMeshTopology>();
|
||||
|
||||
pxr::VtArray<int> vertex_counts = topology.GetFaceVertexCounts();
|
||||
EXPECT_FALSE(vertex_counts.empty());
|
||||
|
||||
pxr::VtArray<int> vertex_indices = topology.GetFaceVertexIndices();
|
||||
EXPECT_FALSE(vertex_indices.empty());
|
||||
}
|
||||
|
||||
} // namespace blender::io::usd
|
||||
Reference in New Issue
Block a user