mesh_outline_projection #1
1 changed files with 34 additions and 0 deletions
|
|
@ -499,6 +499,16 @@ class MESH_OT_outline_project(bpy.types.Operator):
|
|||
bl_label = "Project Outline"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
dissolve_angle: bpy.props.FloatProperty(
|
||||
name="Dissolve Angle",
|
||||
description="Angle threshold for Limit Dissolve (degrees)",
|
||||
default=0.04,
|
||||
min=0.0,
|
||||
max=180.0,
|
||||
step=1,
|
||||
precision=3
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.active_object is not None and
|
||||
|
|
@ -528,6 +538,29 @@ class MESH_OT_outline_project(bpy.types.Operator):
|
|||
original_mode = context.mode
|
||||
print(f"Original mode: {original_mode}")
|
||||
|
||||
# MESH CLEANUP: Remove previous knife cuts
|
||||
print(f"\nCleaning up target mesh...")
|
||||
print(f"Dissolve angle: {self.dissolve_angle} degrees")
|
||||
|
||||
# Switch to edit mode for cleanup operations
|
||||
bpy.context.view_layer.objects.active = target_obj
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
# Select all faces
|
||||
bpy.ops.mesh.select_all(action='SELECT')
|
||||
|
||||
# Run Limit Dissolve to remove unnecessary edges
|
||||
bpy.ops.mesh.dissolve_limited(angle_limit=self.dissolve_angle * 3.14159 / 180.0)
|
||||
print(f"✓ Ran Limit Dissolve")
|
||||
|
||||
# Convert quads to tris
|
||||
bpy.ops.mesh.quads_convert_to_tris()
|
||||
print(f"✓ Converted quads to tris")
|
||||
|
||||
# Return to object mode
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
print(f"Mesh cleanup complete")
|
||||
|
||||
# RESET TARGET MATERIALS ONCE (not per source object)
|
||||
print(f"\nResetting target materials...")
|
||||
print(f"Target currently has {len(target_obj.material_slots)} material slot(s)")
|
||||
|
|
@ -597,6 +630,7 @@ class VIEW3D_PT_outline_project(bpy.types.Panel):
|
|||
layout.label(text="Project Outline:")
|
||||
layout.label(text="1. Select source objects", icon='RESTRICT_SELECT_OFF')
|
||||
layout.label(text="2. Active = target mesh", icon='OBJECT_DATA')
|
||||
layout.label(text="3. Press Numpad 7 (top view)", icon='CAMERA_DATA')
|
||||
|
||||
row = layout.row()
|
||||
row.scale_y = 1.5
|
||||
|
|
|
|||
Loading…
Reference in a new issue