mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Operator to select link handle
Example - https://imgchest.com/p/md7oxbze97p
This commit is contained in:
@@ -53,6 +53,7 @@ classes = (
|
|||||||
operator.RewindLibrary,
|
operator.RewindLibrary,
|
||||||
operator.SaveLibraryFile,
|
operator.SaveLibraryFile,
|
||||||
operator.SelectLibraryFile,
|
operator.SelectLibraryFile,
|
||||||
|
operator.SelectLinkHandle,
|
||||||
operator.ToggleFilterCategories,
|
operator.ToggleFilterCategories,
|
||||||
operator.ToggleLinkSelectability,
|
operator.ToggleLinkSelectability,
|
||||||
operator.ToggleLinkVisibility,
|
operator.ToggleLinkVisibility,
|
||||||
|
|||||||
@@ -1245,6 +1245,24 @@ class ToggleLinkVisibility(bpy.types.Operator):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class SelectLinkHandle(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_link_handle"
|
||||||
|
bl_label = "Select Link Handle"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
bl_description = "Select link empty object handle"
|
||||||
|
index: bpy.props.IntProperty(name="Link Index")
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
props = context.scene.BIMProjectProperties
|
||||||
|
link = props.links[self.index]
|
||||||
|
handle = link.empty_handle
|
||||||
|
if not handle:
|
||||||
|
self.report({"ERROR"}, "Link has no empty handle (probably it was deleted).")
|
||||||
|
return {"CANCELLED"}
|
||||||
|
tool.Blender.select_and_activate_single_object(context, handle)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class ExportIFCBase:
|
class ExportIFCBase:
|
||||||
bl_idname = "bim.save_project"
|
bl_idname = "bim.save_project"
|
||||||
bl_label = "Save IFC"
|
bl_label = "Save IFC"
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ class BIM_UL_filter_categories(UIList):
|
|||||||
|
|
||||||
|
|
||||||
class BIM_UL_links(UIList):
|
class BIM_UL_links(UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||||
if item:
|
if item:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
if item.is_loaded:
|
if item.is_loaded:
|
||||||
@@ -498,6 +498,8 @@ class BIM_UL_links(UIList):
|
|||||||
)
|
)
|
||||||
op.link = item.name
|
op.link = item.name
|
||||||
op.mode = "VISIBLE"
|
op.mode = "VISIBLE"
|
||||||
|
op = row.operator("bim.select_link_handle", text="", icon="OBJECT_DATA")
|
||||||
|
op.index = index
|
||||||
op = row.operator("bim.unload_link", text="", icon="UNLINKED")
|
op = row.operator("bim.unload_link", text="", icon="UNLINKED")
|
||||||
op.filepath = item.name
|
op.filepath = item.name
|
||||||
op = row.operator("bim.reload_link", text="", icon="FILE_REFRESH")
|
op = row.operator("bim.reload_link", text="", icon="FILE_REFRESH")
|
||||||
|
|||||||
Reference in New Issue
Block a user