Skip to content

Commit

Permalink
Fix workaround code was not removed.
Browse files Browse the repository at this point in the history
Fix copying metadata.
  • Loading branch information
syoyo committed May 10, 2024
1 parent aa89975 commit bc9f46c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/prim-reconstruct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1510,13 +1510,9 @@ nonstd::expected<T, std::string> EnumHandler(

} // namespace

// Work around until https://github.com/syoyo/tinyusdz/issues/154
// clear table to allow the latter attribute can overwrite previous definition.
#define PARSE_TYPED_ATTRIBUTE(__table, __prop, __name, __klass, __target) { \
ParseResult ret = ParseTypedAttribute(__table, __prop.first, __prop.second, __name, __target); \
if (ret.code == ParseResult::ResultCode::Success || ret.code == ParseResult::ResultCode::AlreadyProcessed) { \
/* FIXME: workaround. clear table */ \
__table.erase(__name); \
continue; /* got it */\
} else if (ret.code == ParseResult::ResultCode::Unmatched) { \
/* go next */ \
Expand Down Expand Up @@ -1864,17 +1860,18 @@ bool ParseTimeSampledEnumProperty(
if (__table.count(__name)) { continue; } \
if ((__prop.second.value_type_name() == value::TypeTraits<value::token>::type_name()) && __prop.second.is_attribute() && __prop.second.is_empty()) { \
PUSH_WARN("No value assigned to `" << __name << "` token attribute. Set default token value."); \
/* TODO: attr meta __target.meta = attr.meta; */ \
__target.metas() = __prop.second.get_attribute().metas(); \
__table.insert(__name); \
continue; \
} else { \
const Attribute &attr = __prop.second.get_attribute(); \
std::function<nonstd::expected<__enum_ty, std::string>(const std::string &)> fun = __enum_handler; \
if (!ParseUniformEnumProperty(__name, __strict_check, fun, attr, &__target, warn, err)) { \
return false; \
} \
/* copy metas */ \
__target.metas() = attr.metas(); \
__table.insert(__name); \
__table.insert(__name); \
continue; \
} \
} \
}
Expand All @@ -1885,17 +1882,19 @@ bool ParseTimeSampledEnumProperty(
if (__table.count(__name)) { continue; } \
if ((__prop.second.value_type_name() == value::TypeTraits<value::token>::type_name()) && __prop.second.is_attribute() && __prop.second.is_empty()) { \
PUSH_WARN("No value assigned to `" << __name << "` token attribute. Set default token value."); \
/* TODO: attr meta __target.meta = attr.meta; */ \
const Attribute &attr = __prop.second.get_attribute(); \
__target.metas() = attr.metas(); \
__table.insert(__name); \
continue; \
} else { \
const Attribute &attr = __prop.second.get_attribute(); \
std::function<nonstd::expected<__enum_ty, std::string>(const std::string &)> fun = __enum_handler; \
if (!ParseTimeSampledEnumProperty(__name, __strict_check, fun, attr, &__target, warn, err)) { \
return false; \
} \
/* copy metas */ \
__target.metas() = attr.metas(); \
__table.insert(__name); \
continue; \
} \
} \
}
Expand Down

0 comments on commit bc9f46c

Please sign in to comment.