From 1fb1e7468927ef04506db1ccf1d540c895e41e3f Mon Sep 17 00:00:00 2001 From: Yusarina Date: Mon, 14 Oct 2024 05:31:13 +0100 Subject: [PATCH] Add remove doubles warning Gives user a warning about how long advanced remove doubles takes. --- functions/remove_doubles_safely.py | 16 +++++++++++++--- ui/optimization.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/functions/remove_doubles_safely.py b/functions/remove_doubles_safely.py index 9582740..ea635f7 100644 --- a/functions/remove_doubles_safely.py +++ b/functions/remove_doubles_safely.py @@ -18,7 +18,6 @@ class AvatarToolKit_OT_RemoveDoublesSafelyAdvanced(Operator): bl_description = t("Optimization.remove_doubles_safely_advanced.desc") bl_options = {'REGISTER', 'UNDO'} - merge_distance: bpy.props.FloatProperty(default=0.0001) @classmethod @@ -26,9 +25,20 @@ class AvatarToolKit_OT_RemoveDoublesSafelyAdvanced(Operator): armature = get_selected_armature(context) return armature is not None and is_valid_armature(armature) + def draw(self, context): + layout = self.layout + layout.label(text="This process may take a long time.") + layout.label(text="Blender may seem unresponsive during this operation.") + layout.label(text="Please be patient and wait for it to complete.") + + def invoke(self, context, event): + return context.window_manager.invoke_props_dialog(self) + def execute(self, context: Context): - bpy.ops.avatar_toolkit.remove_doubles_safely('INVOKE_DEFAULT',advanced=True,merge_distance=self.merge_distance) - return {'FINISHED'} + bpy.ops.avatar_toolkit.remove_doubles_safely('INVOKE_DEFAULT', advanced=True, merge_distance=self.merge_distance) + return {'RUNNING_MODAL'} + + @register_wrap class AvatarToolKit_OT_RemoveDoublesSafely(Operator): bl_idname = "avatar_toolkit.remove_doubles_safely" diff --git a/ui/optimization.py b/ui/optimization.py index 3e19c9f..f275007 100644 --- a/ui/optimization.py +++ b/ui/optimization.py @@ -30,7 +30,7 @@ class AvatarToolkit_PT_OptimizationPanel(bpy.types.Panel): row = layout.row(align=True) row.scale_y = 1.2 row.operator(AvatarToolKit_OT_RemoveDoublesSafely.bl_idname, text=t("Optimization.remove_doubles_safely.label"), icon='SNAP_VERTEX') - row.operator(AvatarToolKit_OT_RemoveDoublesSafelyAdvanced.bl_idname, text=t("Optimization.remove_doubles_safely_advanced.label"), icon = "ACTION") + row.operator(AvatarToolKit_OT_RemoveDoublesSafelyAdvanced.bl_idname, text=t("Optimization.remove_doubles_safely_advanced.label"), icon="ACTION") layout.separator(factor=0.5) layout.label(text=t("Optimization.joinmeshes.label"), icon='SETTINGS')