mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 03:14:23 +00:00
Add GenerateUVMap operator and integrate into ExploreTool (#7695)
Co-authored-by: Dion Moult <dionmoult@gmail.com>
This commit is contained in:
@@ -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"}
|
||||
Reference in New Issue
Block a user