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:
Jean Niklas L'orange
2018-10-11 12:51:17 +02:00
committed by Thomas Krijnen
parent c28efa788b
commit 216089adcc
+3 -3
View File
@@ -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) {