Expy-Kit icon indicating copy to clipboard operation
Expy-Kit copied to clipboard

You make_annotation break all addpresetbase custom preset operators

Open schroef opened this issue 1 year ago • 2 comments

Had issues suddenly after installing this addon. I took me a while to find the cause. Its this annotation "@make_annotations"

class ExecutePresetArmatureRetarget(ExecutePreset):
    """Apply a Bone Retarget Preset"""
    bl_idname = "object.expy_kit_armature_preset_apply"
    bl_label = "Apply Bone Retarget Preset"
    preset_menu = "VIEW3D_MT_retarget_presets"
    bl_options = {'REGISTER', 'UNDO', 'INTERNAL'}

    filepath = StringProperty(
        subtype='FILE_PATH',
        options={'SKIP_SAVE', 'HIDDEN'},
    )
    menu_idname = StringProperty(
        name="Menu ID Name",
        description="ID name of the menu this was called from",
        options={'SKIP_SAVE', 'HIDDEN'},
    )

    def execute(self, context):
        # passing filepath via the menu, also super uses menu_idname vs preset_menu
        self.menu_idname = self.preset_menu
        preset_class = getattr(bpy.types, self.menu_idname)
        preset_class.filepath = self.filepath
        # in 2.7x there is no callbacks, so we call them manually
        preset_class.reset_cb_va(context)
        _ = super().execute(context)
        preset_class.post_cb_va(context)
        return _

Disabling this addon make them work again When the addon is enabled and i use any addon with custom preset operator, i get this error

WARN (bpy.rna): C:\Users\blender\git\blender-v430\blender.git\source\blender\python\intern\bpy_rna.cc:8733 bpy_class_call: unable to get Python class for RNA struct 'SCRIPT_OT_execute_preset'

Note, this error now shows 4.3 but it actually happened in bl 4.1.1 i tested 4.3 because a developer asked me to test that version; see here; https://projects.blender.org/blender/blender/issues/128721#issuecomment-1313578

schroef avatar Oct 08 '24 20:10 schroef