mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Add option to disable loading index maps #5848
As currently it might still might take too long
This commit is contained in:
@@ -72,7 +72,8 @@ class MaterialCreator:
|
||||
self.mesh = mesh
|
||||
self.obj = obj
|
||||
self.parsed_meshes.add(self.mesh.name)
|
||||
self.load_texture_maps(shape_has_openings)
|
||||
if not self.ifc_import_settings.load_indexed_maps:
|
||||
self.load_texture_maps(shape_has_openings)
|
||||
self.assign_material_slots_to_faces()
|
||||
tool.Geometry.record_object_materials(obj)
|
||||
del self.mesh["ios_materials"]
|
||||
@@ -1069,7 +1070,12 @@ class IfcImporter:
|
||||
verts = geometry.verts
|
||||
mesh["has_cartesian_point_offset"] = False
|
||||
|
||||
return tool.Loader.convert_geometry_to_mesh(geometry, mesh, verts=verts)
|
||||
return tool.Loader.convert_geometry_to_mesh(
|
||||
geometry,
|
||||
mesh,
|
||||
verts=verts,
|
||||
load_indexed_maps=self.ifc_import_settings.load_indexed_maps,
|
||||
)
|
||||
except:
|
||||
self.ifc_import_settings.logger.error("Could not create mesh for %s", element)
|
||||
import traceback
|
||||
@@ -1155,6 +1161,7 @@ class IfcImportSettings:
|
||||
self.context_settings: list[ifcopenshell.geom.main.settings] = []
|
||||
self.gross_context_settings: list[ifcopenshell.geom.main.settings] = []
|
||||
self.elements: set[ifcopenshell.entity_instance] = set()
|
||||
self.load_indexed_maps = False
|
||||
|
||||
@staticmethod
|
||||
def factory(context=None, input_file=None, logger=None):
|
||||
@@ -1196,4 +1203,5 @@ class IfcImportSettings:
|
||||
settings.element_limit_mode = props.element_limit_mode
|
||||
settings.element_offset = props.element_offset
|
||||
settings.element_limit = props.element_limit
|
||||
settings.load_indexed_maps = props.load_indexed_maps
|
||||
return settings
|
||||
|
||||
@@ -217,6 +217,11 @@ class BIMProjectProperties(PropertyGroup):
|
||||
)
|
||||
element_offset: IntProperty(name="Element Offset", default=0)
|
||||
element_limit: IntProperty(name="Element Offset", default=30000)
|
||||
load_indexed_maps: BoolProperty(
|
||||
name="Load Indexed Maps",
|
||||
description="Load indexed maps (UV and color maps)",
|
||||
default=True,
|
||||
)
|
||||
should_disable_undo_on_save: BoolProperty(
|
||||
name="Disable Undo When Saving (Faster saves, no undo for you!)", default=False
|
||||
)
|
||||
|
||||
@@ -173,6 +173,7 @@ class BIM_PT_project(Panel):
|
||||
row.prop(pprops, "should_load_geometry")
|
||||
row = self.layout.row()
|
||||
row.prop(pprops, "should_merge_materials_by_colour")
|
||||
self.layout.prop(pprops, "load_indexed_maps")
|
||||
row = self.layout.row()
|
||||
row.prop(pprops, "geometry_library")
|
||||
row = self.layout.row()
|
||||
|
||||
@@ -37,7 +37,7 @@ import numpy as np
|
||||
import numpy.typing as npt
|
||||
from mathutils import Vector, Matrix
|
||||
from pathlib import Path
|
||||
from typing import Union, Any
|
||||
from typing import Union, Any, Optional
|
||||
|
||||
|
||||
# Progressively we'll refactor loading elements into Blender objects into this
|
||||
@@ -921,7 +921,12 @@ class Loader(bonsai.core.tool.Loader):
|
||||
|
||||
@classmethod
|
||||
def convert_geometry_to_mesh(
|
||||
cls, geometry: ifcopenshell.geom.ShapeType, mesh: bpy.types.Mesh, verts=None
|
||||
cls,
|
||||
geometry: ifcopenshell.geom.ShapeType,
|
||||
mesh: bpy.types.Mesh,
|
||||
verts: Optional[list[float]] = None,
|
||||
*,
|
||||
load_indexed_maps=True,
|
||||
) -> bpy.types.Mesh:
|
||||
if verts is None:
|
||||
verts = geometry.verts
|
||||
@@ -968,7 +973,7 @@ class Loader(bonsai.core.tool.Loader):
|
||||
mesh.update()
|
||||
|
||||
rep_str: str = geometry.id
|
||||
if "openings" not in rep_str:
|
||||
if load_indexed_maps and "openings" not in rep_str:
|
||||
rep_id = rep_str.split("-", 1)[0]
|
||||
rep = tool.Ifc.get().by_id(int(rep_id))
|
||||
# For now, not necessary to load maps in Item mode
|
||||
|
||||
Reference in New Issue
Block a user