mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +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",
|
description="Start file browsing directory",
|
||||||
default="",
|
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):
|
def invoke(self, context, event):
|
||||||
mat = context.active_object.active_material
|
external_style = None
|
||||||
external_style = tool.Style.get_style_elements(mat).get("IfcExternallyDefinedSurfaceStyle", 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
|
# automatically select previously selected external style in file browser
|
||||||
if external_style and self.filepath == "":
|
if external_style and self.filepath == "":
|
||||||
style_path = Path(tool.Ifc.resolve_uri(external_style.Location))
|
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")
|
row.operator("bim.disable_editing_style", text="", icon="CANCEL")
|
||||||
|
|
||||||
def draw_externally_defined_surface_style(self):
|
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)
|
blenderbim.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout)
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.operator("bim.edit_surface_style", text="Save External Style", icon="CHECKMARK")
|
row.operator("bim.edit_surface_style", text="Save External Style", icon="CHECKMARK")
|
||||||
|
|||||||
Reference in New Issue
Block a user