Page MenuHome

Regression when accessing python prop defined in AddonPreferences
Closed, ArchivedPublic

Description

System Information
Operating system: Linux-5.10.34-1-MANJARO-x86_64-with-glibc2.33 64 Bits
Graphics card: GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.73.01

Blender Version
Broken: version: 2.93.0 Beta, branch: master, commit date: 2021-05-07 14:51, hash: rB9cdf11676ecd
Worked: 2.92

Short description of error
In previous blender released we could access properties defined in bpy.types.AddonPreferences no problem, but in 2.93 caling:

bpy.context.preferences.addons['addon'].preferences.path

Gives this:

Addon code that worked ok in 2.92:

bl_info = {
    "name": "addon",
    "blender": (2, 93, 0),
    "category": "Object",
}

import bpy

class AddonPrefs(bpy.types.AddonPreferences):
   bl_idname = __name__

   path = bpy.props.StringProperty(
       name="Location Something",
       default='test',
   )



def register():
    bpy.utils.register_class(AddonPrefs)


def unregister():
    bpy.utils.unregister_class(AddonPrefs)


if __name__ == "__main__":
    register()

Exact steps for others to reproduce the error
1.Install attached minimal addon example.

  1. call : bpy.context.preferences.addons['addon'].preferences.path - from console
  2. we should get string but we get some class as an result.

Event Timeline

Campbell Barton (campbellbarton) closed this task as Archived.EditedMay 10 2021, 7:55 AM

This was removed intentionally, updated release notes:
https://wiki.blender.org/wiki/Reference/Release_Notes/2.93/Python_API

Replace path = bpy.props.StringProperty( with path: bpy.props.StringProperty(.

rBafa5da9ce02b: Cleanup: remove check for non-annotation properties in classes