mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
Fix whitespace: add newline and remove trailing spaces
- aousd/setup_env.sh: Add missing newline at end of file - src/value-types.hh: Remove trailing whitespace 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -50,4 +50,4 @@ echo " - usdzip: Create USDZ archives"
|
||||
echo ""
|
||||
echo "Python USD module:"
|
||||
echo " python -c 'from pxr import Usd; print(Usd)'"
|
||||
echo "================================================"
|
||||
echo "================================================"
|
||||
|
||||
@@ -285,7 +285,7 @@ enum TypeId {
|
||||
|
||||
// -- begin value type
|
||||
TYPE_ID_VALUE_BEGIN,
|
||||
|
||||
|
||||
TYPE_ID_TOKEN,
|
||||
TYPE_ID_STRING,
|
||||
TYPE_ID_STRING_DATA, // String for primvar and metadata. Includes multi-line
|
||||
@@ -395,11 +395,11 @@ enum TypeId {
|
||||
TYPE_ID_DICT, // Generic dict type. TODO: remove?
|
||||
TYPE_ID_CUSTOMDATA, // similar to `dictionary`, but limited types are allowed
|
||||
// to use. for metadatum(e.g. `customData` in Prim Meta)
|
||||
|
||||
|
||||
TYPE_ID_VALUE_END,
|
||||
|
||||
// -- end value type
|
||||
|
||||
|
||||
TYPE_ID_LAYER_OFFSET,
|
||||
TYPE_ID_PAYLOAD,
|
||||
|
||||
@@ -519,7 +519,7 @@ enum TypeId {
|
||||
|
||||
TYPE_ID_MODEL_END,
|
||||
|
||||
|
||||
|
||||
// Types for API
|
||||
TYPE_ID_API_BEGIN = 1 << 14,
|
||||
TYPE_ID_COLLECTION,
|
||||
@@ -793,7 +793,7 @@ struct matrix4f {
|
||||
m[2][0] = 0.0f;
|
||||
m[2][1] = 0.0f;
|
||||
m[2][2] = sz;
|
||||
m[2][3] = 0.0f;
|
||||
m[2][3] = 0.0f;
|
||||
|
||||
m[3][0] = 0.0f;
|
||||
m[3][1] = 0.0f;
|
||||
@@ -929,7 +929,7 @@ struct matrix4d {
|
||||
m[2][0] = 0.0;
|
||||
m[2][1] = 0.0;
|
||||
m[2][2] = sz;
|
||||
m[2][3] = 0.0;
|
||||
m[2][3] = 0.0;
|
||||
|
||||
m[3][0] = 0.0;
|
||||
m[3][1] = 0.0;
|
||||
@@ -982,7 +982,7 @@ struct frame4d {
|
||||
//
|
||||
// p * S * R * T = p'
|
||||
// p' = Mult(Mult(S, R), T)
|
||||
//
|
||||
//
|
||||
// you can express world matrix as
|
||||
//
|
||||
// node.world = parent.world * node.local
|
||||
@@ -990,7 +990,7 @@ struct frame4d {
|
||||
template <typename MTy, typename STy, size_t N>
|
||||
MTy Mult(const MTy &m, const MTy &n) {
|
||||
MTy ret;
|
||||
//memset(ret.m, 0, sizeof(MTy));
|
||||
//memset(ret.m, 0, sizeof(MTy));
|
||||
|
||||
for (size_t j = 0; j < N; j++) {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
@@ -1984,7 +1984,7 @@ class Value {
|
||||
//
|
||||
// Returns a view over array data if the value contains an array type that's compatible
|
||||
// with the requested element type T. For non-array types, returns an empty view.
|
||||
//
|
||||
//
|
||||
// The view provides zero-copy access to the underlying data with type safety validation.
|
||||
//
|
||||
// Template parameter T: the desired element type for the view
|
||||
@@ -2041,7 +2041,7 @@ class Value {
|
||||
return TypedArrayView<T>();
|
||||
}
|
||||
} else {
|
||||
// Non-strict cast - allow compatible types (same underlying type)
|
||||
// Non-strict cast - allow compatible types (same underlying type)
|
||||
if (underlying_type_id != target_type_id) {
|
||||
return TypedArrayView<T>();
|
||||
}
|
||||
@@ -2077,7 +2077,7 @@ class Value {
|
||||
// Helper to check vector size bounds
|
||||
template <typename T>
|
||||
static bool check_vector_size(const std::vector<T>& vec) {
|
||||
constexpr size_t MAX_REASONABLE_SIZE = 100000000;
|
||||
constexpr size_t MAX_REASONABLE_SIZE = 100000000; // 100M
|
||||
if (vec.size() > MAX_REASONABLE_SIZE) {
|
||||
TUSDZ_LOG_E("ERROR: Vector size " << vec.size() << " exceeds reasonable limit (" << MAX_REASONABLE_SIZE << "). Data is likely corrupted!");
|
||||
return false;
|
||||
@@ -2101,16 +2101,16 @@ class Value {
|
||||
return nonstd::nullopt;
|
||||
}
|
||||
|
||||
TUSDZ_LOG_I("get_value: about to move/copy value of type " << TypeTraits<T>::type_name());
|
||||
//TUSDZ_LOG_I("get_value: about to move/copy value of type " << TypeTraits<T>::type_name());
|
||||
log_vector_size(*pv);
|
||||
return std::move(*pv);
|
||||
} else if (!strict_cast) {
|
||||
|
||||
if (TypeTraits<T>::is_array() && (v_.type_id() & value::TYPE_ID_1D_ARRAY_BIT)) { // both are array type
|
||||
if ((TypeTraits<T>::underlying_type_id() & (~value::TYPE_ID_1D_ARRAY_BIT)) == (v_.underlying_type_id() & (~value::TYPE_ID_1D_ARRAY_BIT))) {
|
||||
TUSDZ_LOG_I("get_value: strict_cast=false, both are array types, about to cast for type " << TypeTraits<T>::type_name());
|
||||
//TUSDZ_LOG_I("get_value: strict_cast=false, both are array types, about to cast for type " << TypeTraits<T>::type_name());
|
||||
const T* pv = linb::cast<const T>(&v_);
|
||||
TUSDZ_LOG_I("get_value: cast successful, pv=" << (pv ? "valid" : "null"));
|
||||
//TUSDZ_LOG_I("get_value: cast successful, pv=" << (pv ? "valid" : "null"));
|
||||
if (pv) {
|
||||
log_vector_size(*pv);
|
||||
if (!check_vector_size(*pv)) {
|
||||
@@ -2196,17 +2196,17 @@ class Value {
|
||||
template <class T>
|
||||
TypedArrayView<const T> create_array_view_helper(bool strict_cast) const {
|
||||
// Try common array types that could contain T elements
|
||||
|
||||
|
||||
// Direct type match - try std::vector<T>
|
||||
if (auto* vec = as<std::vector<T>>(strict_cast)) {
|
||||
return TypedArrayView<const T>(*vec);
|
||||
}
|
||||
|
||||
|
||||
// Try related types based on underlying type compatibility
|
||||
if (!strict_cast) {
|
||||
// Handle role type conversions (e.g., float3 <-> vector3f <-> normal3f)
|
||||
uint32_t target_underlying_id = TypeTraits<T>::underlying_type_id();
|
||||
|
||||
|
||||
switch (target_underlying_id) {
|
||||
case TYPE_ID_FLOAT: {
|
||||
if (auto* vec = as<std::vector<float>>(false)) {
|
||||
@@ -2275,7 +2275,7 @@ class Value {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No compatible type found
|
||||
return TypedArrayView<const T>();
|
||||
}
|
||||
@@ -2283,17 +2283,17 @@ class Value {
|
||||
template <class T>
|
||||
TypedArrayView<T> create_array_view_helper_mutable(bool strict_cast) {
|
||||
// Try common array types that could contain T elements
|
||||
|
||||
|
||||
// Direct type match - try std::vector<T>
|
||||
if (auto* vec = as<std::vector<T>>(strict_cast)) {
|
||||
return TypedArrayView<T>(*vec);
|
||||
}
|
||||
|
||||
|
||||
// Try related types based on underlying type compatibility
|
||||
if (!strict_cast) {
|
||||
// Handle role type conversions (e.g., float3 <-> vector3f <-> normal3f)
|
||||
uint32_t target_underlying_id = TypeTraits<T>::underlying_type_id();
|
||||
|
||||
|
||||
switch (target_underlying_id) {
|
||||
case TYPE_ID_FLOAT: {
|
||||
if (auto* vec = as<std::vector<float>>(false)) {
|
||||
@@ -2362,7 +2362,7 @@ class Value {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No compatible type found
|
||||
return TypedArrayView<T>();
|
||||
}
|
||||
@@ -2706,7 +2706,7 @@ struct LerpTraits<std::vector<ty>> { \
|
||||
static constexpr bool supported() { \
|
||||
return true; \
|
||||
} \
|
||||
};
|
||||
};
|
||||
|
||||
DEFINE_LERP_TRAIT(value::half)
|
||||
DEFINE_LERP_TRAIT(value::half2)
|
||||
|
||||
Reference in New Issue
Block a user