Skip to content

Commit bc9f46c

Browse files
committed
Fix workaround code was not removed.
Fix copying metadata.
1 parent aa89975 commit bc9f46c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/prim-reconstruct.cc

+8-9
Original file line numberDiff line numberDiff line change
@@ -1510,13 +1510,9 @@ nonstd::expected<T, std::string> EnumHandler(
15101510

15111511
} // namespace
15121512

1513-
// Work around until https://github.com/syoyo/tinyusdz/issues/154
1514-
// clear table to allow the latter attribute can overwrite previous definition.
15151513
#define PARSE_TYPED_ATTRIBUTE(__table, __prop, __name, __klass, __target) { \
15161514
ParseResult ret = ParseTypedAttribute(__table, __prop.first, __prop.second, __name, __target); \
15171515
if (ret.code == ParseResult::ResultCode::Success || ret.code == ParseResult::ResultCode::AlreadyProcessed) { \
1518-
/* FIXME: workaround. clear table */ \
1519-
__table.erase(__name); \
15201516
continue; /* got it */\
15211517
} else if (ret.code == ParseResult::ResultCode::Unmatched) { \
15221518
/* go next */ \
@@ -1864,17 +1860,18 @@ bool ParseTimeSampledEnumProperty(
18641860
if (__table.count(__name)) { continue; } \
18651861
if ((__prop.second.value_type_name() == value::TypeTraits<value::token>::type_name()) && __prop.second.is_attribute() && __prop.second.is_empty()) { \
18661862
PUSH_WARN("No value assigned to `" << __name << "` token attribute. Set default token value."); \
1867-
/* TODO: attr meta __target.meta = attr.meta; */ \
1863+
__target.metas() = __prop.second.get_attribute().metas(); \
18681864
__table.insert(__name); \
1865+
continue; \
18691866
} else { \
18701867
const Attribute &attr = __prop.second.get_attribute(); \
18711868
std::function<nonstd::expected<__enum_ty, std::string>(const std::string &)> fun = __enum_handler; \
18721869
if (!ParseUniformEnumProperty(__name, __strict_check, fun, attr, &__target, warn, err)) { \
18731870
return false; \
18741871
} \
1875-
/* copy metas */ \
18761872
__target.metas() = attr.metas(); \
1877-
__table.insert(__name); \
1873+
__table.insert(__name); \
1874+
continue; \
18781875
} \
18791876
} \
18801877
}
@@ -1885,17 +1882,19 @@ bool ParseTimeSampledEnumProperty(
18851882
if (__table.count(__name)) { continue; } \
18861883
if ((__prop.second.value_type_name() == value::TypeTraits<value::token>::type_name()) && __prop.second.is_attribute() && __prop.second.is_empty()) { \
18871884
PUSH_WARN("No value assigned to `" << __name << "` token attribute. Set default token value."); \
1888-
/* TODO: attr meta __target.meta = attr.meta; */ \
1885+
const Attribute &attr = __prop.second.get_attribute(); \
1886+
__target.metas() = attr.metas(); \
18891887
__table.insert(__name); \
1888+
continue; \
18901889
} else { \
18911890
const Attribute &attr = __prop.second.get_attribute(); \
18921891
std::function<nonstd::expected<__enum_ty, std::string>(const std::string &)> fun = __enum_handler; \
18931892
if (!ParseTimeSampledEnumProperty(__name, __strict_check, fun, attr, &__target, warn, err)) { \
18941893
return false; \
18951894
} \
1896-
/* copy metas */ \
18971895
__target.metas() = attr.metas(); \
18981896
__table.insert(__name); \
1897+
continue; \
18991898
} \
19001899
} \
19011900
}

0 commit comments

Comments
 (0)