Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed caching in Stage::find_prim_by_prim_id, enforce boolean as return values #192

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/asset-resolution.hh
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class AssetResolutionResolver {
}

bool has_asset_resolution_handler(const std::string &ext_name) {
return _asset_resolution_handlers.count(ext_name);
return _asset_resolution_handlers.count(ext_name) > 0;
}


Expand Down
12 changes: 6 additions & 6 deletions src/prim-types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ordered_dict {
}

bool count(const std::string &key) const {
return _m.count(key);
return _m.count(key) > 0;
}

void insert(const std::string &key, const T &value) {
Expand Down Expand Up @@ -2635,11 +2635,11 @@ class Attribute {
return false;
}

return _paths.size();
return _paths.size() > 0;
}

bool has_connections() const {
return _paths.size();
return _paths.size() > 0;
}


Expand Down Expand Up @@ -3177,7 +3177,7 @@ class MaterialBinding {
} else if (mat_purpose.str() == "preview") {
return has_materialBindingPreview();
} else {
return _materialBindingMap.count(mat_purpose.str());
return _materialBindingMap.count(mat_purpose.str()) > 0;
}
}

Expand Down Expand Up @@ -3257,7 +3257,7 @@ class MaterialBinding {
return false;
}

return _materialBindingCollectionMap.count(tok);
return _materialBindingCollectionMap.count(tok) > 0;
}

void set_materialBindingCollection(const value::token &tok, const value::token &mat_purpose, const Relationship &rel) {
Expand Down Expand Up @@ -4244,7 +4244,7 @@ class Layer {

// Check if `primname` exists in root Prims?
bool has_primspec(const std::string &primname) const {
return _prim_specs.count(primname);
return _prim_specs.count(primname) > 0;
}

///
Expand Down
2 changes: 1 addition & 1 deletion src/primvar.hh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct PrimVar {
}

bool has_timesamples() const {
return _ts.size();
return _ts.size() > 0;
}

bool is_scalar() const {
Expand Down
3 changes: 2 additions & 1 deletion src/stage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ bool Stage::find_prim_by_prim_id(const uint64_t prim_id, const Prim *&prim,
auto ret = _prim_id_cache.find(prim_id);
if (ret != _prim_id_cache.end()) {
DCOUT("Found cache.");
return ret->second;
prim = ret->second;
return true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/usdGeom.hh
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class GeomPrimvar {
}

bool has_default_indices() const { return !_indices.empty(); }
bool has_timesampled_indices() const { return _ts_indices.size(); }
bool has_timesampled_indices() const { return _ts_indices.size() > 0; }

bool has_indices() const {
return has_default_indices() || has_timesampled_indices();
Expand Down
Loading