Add GenerateUVMap operator and integrate into ExploreTool (#7695)

Co-authored-by: Dion Moult <dionmoult@gmail.com>
This commit is contained in:
falken10vdl
2026-03-15 21:30:49 +01:00
committed by GitHub
parent 8c9e89ace8
commit 1999d93f9a
2 changed files with 21 additions and 0 deletions
@@ -76,6 +76,7 @@ classes = (
operator.UnlinkIfc,
operator.UnloadLink,
workspace.ExploreHotkey,
workspace.GenerateUVMap,
prop.LibraryBreadcrumb,
prop.LibraryElement,
prop.FilterCategory,
@@ -87,6 +87,9 @@ class ExploreTool(bpy.types.WorkSpaceTool):
op.hotkey = "S_S"
op.description = "Scale Image Annotation. Allows to scale an IfcReferenceImage. Select image, select tool. Check lower left corner instructions to select two points and provide real distance between them"
op = row.operator("bim.generate_uv_map", text="Generate UV Map", icon="UV")
op.description = "Generate UV map for selected mesh."
class ExploreHotkey(bpy.types.Operator):
bl_idname = "bim.explore_hotkey"
@@ -153,3 +156,20 @@ class ExploreHotkey(bpy.types.Operator):
def hotkey_A_H(self) -> None:
bpy.ops.bim.hide_queried_linked_element(unhide_all=True)
class GenerateUVMap(bpy.types.Operator):
bl_idname = "bim.generate_uv_map"
bl_label = "Generate UV Map"
bl_options = {"REGISTER", "UNDO", "INTERNAL"}
description: bpy.props.StringProperty()
def execute(self, context):
obj = context.active_object
if not obj or not hasattr(obj, "data") or not hasattr(obj.data, "polygons"):
self.report({"ERROR"}, "No valid mesh selected.")
return {"CANCELLED"}
tool.Loader.load_generated_uv_map(obj.data)
self.report({"INFO"}, "Generated UV map for selected mesh.")
return {"FINISHED"}