Add remove doubles warning

Gives user a warning about how long advanced remove doubles takes.
This commit is contained in:
Yusarina
2024-10-14 05:31:13 +01:00
parent 0e03515767
commit 1fb1e74689
2 changed files with 14 additions and 4 deletions
+13 -3
View File
@@ -18,7 +18,6 @@ class AvatarToolKit_OT_RemoveDoublesSafelyAdvanced(Operator):
bl_description = t("Optimization.remove_doubles_safely_advanced.desc") bl_description = t("Optimization.remove_doubles_safely_advanced.desc")
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
merge_distance: bpy.props.FloatProperty(default=0.0001) merge_distance: bpy.props.FloatProperty(default=0.0001)
@classmethod @classmethod
@@ -26,9 +25,20 @@ class AvatarToolKit_OT_RemoveDoublesSafelyAdvanced(Operator):
armature = get_selected_armature(context) armature = get_selected_armature(context)
return armature is not None and is_valid_armature(armature) 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): def execute(self, context: Context):
bpy.ops.avatar_toolkit.remove_doubles_safely('INVOKE_DEFAULT',advanced=True,merge_distance=self.merge_distance) bpy.ops.avatar_toolkit.remove_doubles_safely('INVOKE_DEFAULT', advanced=True, merge_distance=self.merge_distance)
return {'FINISHED'} return {'RUNNING_MODAL'}
@register_wrap @register_wrap
class AvatarToolKit_OT_RemoveDoublesSafely(Operator): class AvatarToolKit_OT_RemoveDoublesSafely(Operator):
bl_idname = "avatar_toolkit.remove_doubles_safely" bl_idname = "avatar_toolkit.remove_doubles_safely"
+1 -1
View File
@@ -30,7 +30,7 @@ class AvatarToolkit_PT_OptimizationPanel(bpy.types.Panel):
row = layout.row(align=True) row = layout.row(align=True)
row.scale_y = 1.2 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_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.separator(factor=0.5)
layout.label(text=t("Optimization.joinmeshes.label"), icon='SETTINGS') layout.label(text=t("Optimization.joinmeshes.label"), icon='SETTINGS')