Skip to content

Commit

Permalink
Fix PropertyType is not updated when attribute already exists in props
Browse files Browse the repository at this point in the history
map.
  • Loading branch information
syoyo committed May 10, 2024
1 parent 246e2aa commit aa89975
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ascii-parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4022,6 +4022,9 @@ bool AsciiParser::ParsePrimProps(std::map<std::string, Property> *props,
}

props->at(attr_name).attribute().set_connection(abs_path);

// Set PropType to Attrib(since previously created Property may have EmptyAttrib).
props->at(attr_name).set_property_type(Property::Type::Attrib);
} else {

Attribute attr;
Expand Down Expand Up @@ -4095,6 +4098,7 @@ bool AsciiParser::ParsePrimProps(std::map<std::string, Property> *props,
Attribute *pattr{nullptr};
bool attr_exists = props->count(attr_name) && props->at(attr_name).is_attribute();
if (attr_exists) {
DCOUT("Attr exists");
// Add timeSamples to existing Attribute
pattr = &(props->at(attr_name).attribute());

Expand All @@ -4105,6 +4109,9 @@ bool AsciiParser::ParsePrimProps(std::map<std::string, Property> *props,

pattr->get_var().set_timesamples(ts);

// Set PropType to Attrib(since previously created Property may have EmptyAttrib).
props->at(attr_name).set_property_type(Property::Type::Attrib);

} else {
// new Attribute
pattr = &attr;
Expand Down Expand Up @@ -4497,6 +4504,9 @@ bool AsciiParser::ParsePrimProps(std::map<std::string, Property> *props,
if (pattr->variability() != variability) {
PUSH_ERROR_AND_RETURN(fmt::format("Variability mismatch. Attribute `{}` already has variability `{}`, but 'default' value has variability `{}`.", attr_name, to_string(pattr->variability()), to_string(variability)));
}

// Set PropType to Attrib(since previously created Property may have EmptyAttrib).
props->at(attr_name).set_property_type(Property::Type::Attrib);
} else {
pattr->variability() = variability;
Property p(*pattr, custom_qual);
Expand Down

0 comments on commit aa89975

Please sign in to comment.