mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix bug where default material was not initialised
We kind-of sort-of do double work here, but I think it is better to always assume that InitDefaultMaterials when setting the defaults, to avoid too many code paths.
This commit is contained in:
committed by
Thomas Krijnen
parent
c28efa788b
commit
216089adcc
@@ -177,9 +177,10 @@ void InitDefaultMaterials() {
|
||||
}
|
||||
|
||||
void IfcGeom::set_default_style(const std::string& json_file) {
|
||||
if (default_materials_initialized) {
|
||||
default_materials.clear();
|
||||
if (!default_materials_initialized) {
|
||||
InitDefaultMaterials();
|
||||
}
|
||||
default_materials.clear();
|
||||
|
||||
pt::ptree root;
|
||||
pt::read_json(json_file, root);
|
||||
@@ -216,7 +217,6 @@ void IfcGeom::set_default_style(const std::string& json_file) {
|
||||
default_materials[name].Transparency() = material.get_optional<double>("transparency");
|
||||
}
|
||||
|
||||
default_materials_initialized = true;
|
||||
}
|
||||
|
||||
const IfcGeom::SurfaceStyle* IfcGeom::get_default_style(const std::string& s) {
|
||||
|
||||
Reference in New Issue
Block a user