AttributeError: 'UnwrapAssistOperator' object has no attribute 'sharpness'

Not sure where my code is different:

class UnwrapAssistOperator(bpy.types.Operator):

    bl_idname = "uv.unwrap_assist"

    bl_label = "Unwrap Assist"

    bl_description = "Marks Sharps and Unwraps based off user sharp settings."

    bl_options = {'REGISTER', 'UNDO'}

    sharpness: bpy.props.FloatProperty(

        name='Sharpness',

        default=math.radians(30),

        min=math.radians(1),

        max=math.radians(180),

        subtype='ANGLE',

        units='ROTATION'

    )

    @classmethod

    def poll(cls, context):

        return context.active_object is not None

    def execute(self, context):

        mesh_data = context.edit_object.data

        bmesh_data = bmesh.from_edit_mesh(mesh_data)

        max_angle = self.sharpness

        for edge in bmesh_data.edges:

            if edge.hide and not edge.select:

                continue

            edge_angle = edge.calc_face_angle(-1)

            if edge_angle > max_angle:

                edge.seam = True

        bmesh.update_edit_mesh(mesh_data, loop_triangles=False, destructive=False)

        return {'FINISHED'}

1 love
Reply
  • Louis Laurents(LLaurents) replied

    Fixed, float property typo: unit was set to units. removed the S and everything works.

    • 👍
    1 love
  • Adrian Bellworthy replied

    Well spotted these typo bugs can be difficult to spot.

    2 loves
  • Louis Laurents(LLaurents) replied

    Yeah, it still ran without any syntax errors. which confused me at first. The error only ran when invoking the operator. which makes sense now.

    1 love