Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-12-05 12:57:08 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-12-05 13:08:57 +0300
commit74361eebe68c03e73e2b3587988c9d68bd742fe0 (patch)
tree76bd621c3e3913a15b418a4e679dca2fa3ea6e6d /release/scripts/modules/bpy_extras/io_utils.py
parent80ffd7b4597cdb01b3595a22c4e0cc0d8f019471 (diff)
Fix T58772: Stray "forward" and "up" options in 2.8 import addons?
Nice side-effect of using new __annotations__ thingy to store dynamically-generated fields in a class: __annotations__ dict is not ensured to exist for a given class, so we may end up modifying on of the parents' one!
Diffstat (limited to 'release/scripts/modules/bpy_extras/io_utils.py')
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 4b28a9edf70..420c2bfc929 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -127,6 +127,11 @@ def orientation_helper(axis_forward='Y', axis_up='Z'):
with specified default values (axes).
"""
def wrapper(cls):
+ # Without that, we may end up adding those fields to some **parent** class' __annotations__ property
+ # (like the ImportHelper or ExportHelper ones)! See T58772.
+ if "__annotations__" not in cls.__dict__:
+ cls.__dict__["__annotations__"] = {}
+
def _update_axis_forward(self, context):
if self.axis_forward[-1] == self.axis_up[-1]:
self.axis_up = (self.axis_up[0:-1] +