Коммит 7bf707c4 создал по автору Durman's avatar Durman
Просмотр файлов

fix reading __annotations__ attribute in python 3.10

владелец 771a4b94
......@@ -43,7 +43,7 @@
bl_info = {
"name": "Sverchok",
"author": "sverchok-b3d@ya.ru various authors see https://github.com/nortikin/sverchok/graphs/contributors",
"version": (1, 0, 0),
"version": (1, 0, 1),
"blender": (2, 93, 0),
"location": "Node Editor",
"category": "Node",
......
......@@ -1192,9 +1192,11 @@ def extend_blender_class(cls):
Take into account that this decorator does not delete anything onto reload event
"""
bl_class = getattr(bpy.types, cls.__name__)
for base_cls in chain([cls], cls.__bases__[1:]):
if hasattr(base_cls, '__annotations__'):
for name, prop in base_cls.__annotations__.items():
for base_cls in chain([cls], cls.__bases__):
# https://docs.python.org/3/howto/annotations.html#accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older
# avoiding getting inherited annotations
if '__annotations__' in base_cls.__dict__:
for name, prop in base_cls.__dict__['__annotations__'].items():
setattr(bl_class, name, prop)
for key in (key for key in dir(base_cls) if not key.startswith('_')):
setattr(bl_class, key, getattr(base_cls, key))
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать