mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix issue BrowseExternalStyle not selecting current external style in file manager
This commit is contained in:
@@ -240,10 +240,17 @@ class BrowseExternalStyle(bpy.types.Operator):
|
||||
description="Start file browsing directory",
|
||||
default="",
|
||||
)
|
||||
active_surface_style_id: bpy.props.IntProperty(
|
||||
description="Currently selected IfcSurfaceStyle ID to automatically select it in the file browser",
|
||||
options={"HIDDEN", "SKIP_SAVE"},
|
||||
)
|
||||
|
||||
def invoke(self, context, event):
|
||||
mat = context.active_object.active_material
|
||||
external_style = tool.Style.get_style_elements(mat).get("IfcExternallyDefinedSurfaceStyle", None)
|
||||
external_style = None
|
||||
if self.active_surface_style_id:
|
||||
style = tool.Ifc.get().by_id(self.active_surface_style_id)
|
||||
external_style = tool.Style.get_style_elements(style).get("IfcExternallyDefinedSurfaceStyle", None)
|
||||
|
||||
# automatically select previously selected external style in file browser
|
||||
if external_style and self.filepath == "":
|
||||
style_path = Path(tool.Ifc.resolve_uri(external_style.Location))
|
||||
|
||||
@@ -233,7 +233,10 @@ class BIM_PT_styles(Panel):
|
||||
row.operator("bim.disable_editing_style", text="", icon="CANCEL")
|
||||
|
||||
def draw_externally_defined_surface_style(self):
|
||||
self.layout.row().operator("bim.browse_external_style", icon="APPEND_BLEND", text="Append From Blend File")
|
||||
row = self.layout.row()
|
||||
op = row.operator("bim.browse_external_style", icon="APPEND_BLEND", text="Append From Blend File")
|
||||
style = self.props.styles[self.props.active_style_index]
|
||||
op.active_surface_style_id = style.ifc_definition_id
|
||||
blenderbim.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout)
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.edit_surface_style", text="Save External Style", icon="CHECKMARK")
|
||||
|
||||
Reference in New Issue
Block a user