From a6d3619449817c46e6bedce345d8c00e0611baa7 Mon Sep 17 00:00:00 2001 From: Jean Niklas L'orange Date: Thu, 11 Oct 2018 12:51:17 +0200 Subject: [PATCH] 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. --- src/ifcgeom/IfcGeomRenderStyles.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ifcgeom/IfcGeomRenderStyles.cpp b/src/ifcgeom/IfcGeomRenderStyles.cpp index 04875679f5..cf0fac335b 100644 --- a/src/ifcgeom/IfcGeomRenderStyles.cpp +++ b/src/ifcgeom/IfcGeomRenderStyles.cpp @@ -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("transparency"); } - default_materials_initialized = true; } const IfcGeom::SurfaceStyle* IfcGeom::get_default_style(const std::string& s) {