Fix #3596. Fix bug where objects marked as edited were not unmarked after saving when toggling mode. Also fix bug where updating representation didn't check whether or not the meshlike representation has openings applied (which would bake the openings, instead of leaving them dynamic).

This commit is contained in:
Dion Moult
2023-08-18 00:03:46 +10:00
parent 90e6400115
commit 9b857cdefa
5 changed files with 21 additions and 5 deletions
@@ -16,14 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import ifccsv
import ifcopenshell
import os
import logging
import bpy
import json
import webbrowser
import ifccsv
import logging
import tempfile
import webbrowser
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.handler import purge_module_data
@@ -239,6 +239,10 @@ class UpdateRepresentation(bpy.types.Operator, Operator):
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
material = ifcopenshell.util.element.get_material(product, should_skip_usage=True)
if getattr(product, "HasOpenings", False) and obj.data.BIMMeshProperties.has_openings_applied:
# Meshlike things with openings can only be updated without openings applied.
return
if not product.is_a("IfcGridAxis"):
tool.Geometry.clear_cache(product)
@@ -1442,9 +1446,11 @@ class OverrideModeSetObject(bpy.types.Operator):
self.reload_representation(obj)
else:
self.reload_representation(obj)
tool.Ifc.finish_edit(obj)
for obj in self.unchanged_objs_with_openings:
self.reload_representation(obj)
tool.Ifc.finish_edit(obj)
return {"FINISHED"}
def reload_representation(self, obj):
+1
View File
@@ -435,6 +435,7 @@ class BIMMeshProperties(PropertyGroup):
ifc_definition_id: IntProperty(name="IFC Definition ID")
ifc_boolean_id: IntProperty(name="IFC Boolean ID")
obj: bpy.props.PointerProperty(type=bpy.types.Object)
has_openings_applied: BoolProperty(name="Has Openings Applied", default=True)
is_native: BoolProperty(name="Is Native", default=False)
is_swept_solid: BoolProperty(name="Is Swept Solid")
is_parametric: BoolProperty(name="Is Parametric", default=False)
@@ -460,6 +460,7 @@ class Geometry(blenderbim.core.tool.Geometry):
mesh = ifc_importer.create_mesh(element, shape)
ifc_importer.material_creator.load_existing_materials()
ifc_importer.material_creator.create(element, obj, mesh)
mesh.BIMMeshProperties.has_openings_applied = apply_openings
return mesh
+7
View File
@@ -146,6 +146,13 @@ class Ifc(blenderbim.core.tool.Ifc):
def edit(cls, obj):
IfcStore.edited_objs.add(obj)
@classmethod
def finish_edit(cls, obj):
try:
IfcStore.edited_objs.remove(obj)
except:
pass
@classmethod
def resolve_uri(cls, uri):
if os.path.isabs(uri):