mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Save texture style without textures to remove texture style
Mentioned in 618ba51, it probably will be more natural this way - if there are no textures, we hide UV attribute to indicate that it won't be saved and on save we either do nothing, if texture style wasn't saved before, or remove it.
This commit is contained in:
@@ -764,6 +764,7 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
||||
material.BIMStyleProperties.active_style_type = material.BIMStyleProperties.active_style_type
|
||||
|
||||
def edit_existing_style(self):
|
||||
ifc_file = tool.Ifc.get()
|
||||
material = tool.Ifc.get_object(self.style)
|
||||
assert self.surface_style
|
||||
|
||||
@@ -791,8 +792,9 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
||||
material = tool.Ifc.get_object(self.style)
|
||||
textures = self.get_texture_attributes()
|
||||
if not textures:
|
||||
self.report({"ERROR"}, "Cannot save texture style without any textures.")
|
||||
return {"CANCELLED"}
|
||||
assert self.texture_style
|
||||
ifcopenshell.api.style.remove_surface_style(ifc_file, self.texture_style)
|
||||
return
|
||||
textures = tool.Ifc.run("style.add_surface_textures", textures=textures, uv_maps=[])
|
||||
texture_style = tool.Ifc.run(
|
||||
"style.add_surface_style",
|
||||
@@ -835,8 +837,7 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
|
||||
material = tool.Ifc.get_object(self.style)
|
||||
textures = self.get_texture_attributes()
|
||||
if not textures:
|
||||
self.report({"ERROR"}, "Cannot create texture style without any textures.")
|
||||
return {"CANCELLED"}
|
||||
return
|
||||
textures = tool.Ifc.run("style.add_surface_textures", textures=textures, uv_maps=[])
|
||||
texture_style = tool.Ifc.run(
|
||||
"style.add_surface_style",
|
||||
|
||||
@@ -220,7 +220,8 @@ class BIM_PT_styles(Panel):
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=f"Style has {len(textures)} textures", icon="SHADING_TEXTURE")
|
||||
row.operator("bim.add_surface_texture", text="", icon="ADD")
|
||||
self.layout.prop(self.props, "uv_mode")
|
||||
if textures:
|
||||
self.layout.prop(self.props, "uv_mode")
|
||||
|
||||
for i, texture in enumerate(textures):
|
||||
split = self.layout.split(factor=0.30, align=True)
|
||||
|
||||
Reference in New Issue
Block a user