diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-02-21 13:21:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-02-21 14:37:53 +0300 |
commit | 08dbc4f996e4e95f3ab64f7bb3e1193700c585f5 (patch) | |
tree | 8f9d121258c5f88cf825aa6e3030ccc7bbe983cd /intern/cycles/blender/addon | |
parent | de67e3c0c02e9d08022cff58338099d287505f91 (diff) |
PyAPI: use postponed annotations to support Python 3.10
Support Python 3.10a5 or 3.9x with support explicitly enabled.
- Enable Python's postponed annotations for Blender's RNA classes
types registered on startup.
- Using postponed annotations has implications for how they are defined,
since they must evaluate in the modules name-space instead of the
classes name-space. See changes to annotations in `release/scripts`.
- Use `from __future__ import annotations` at the top of the module
to ensure the script will run with Python 3.10.
- Old logic is kept since it could be used if PEP-649 is supported.
Resolves T83626
Ref D10474
Diffstat (limited to 'intern/cycles/blender/addon')
-rw-r--r-- | intern/cycles/blender/addon/__init__.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/operators.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/osl.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/presets.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 9 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/version_update.py | 1 |
8 files changed, 11 insertions, 5 deletions
diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index b1deb5cb64e..10b95133912 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations bl_info = { "name": "Cycles Render Engine", diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 7595261f523..dfa696714fb 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations def _is_using_buggy_driver(): diff --git a/intern/cycles/blender/addon/operators.py b/intern/cycles/blender/addon/operators.py index 087e5b666a5..dca727e316e 100644 --- a/intern/cycles/blender/addon/operators.py +++ b/intern/cycles/blender/addon/operators.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations import bpy from bpy.types import Operator diff --git a/intern/cycles/blender/addon/osl.py b/intern/cycles/blender/addon/osl.py index 4c6e7952491..d4c3c447951 100644 --- a/intern/cycles/blender/addon/osl.py +++ b/intern/cycles/blender/addon/osl.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations import bpy import _cycles diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py index 78a8605e93f..04b18b38927 100644 --- a/intern/cycles/blender/addon/presets.py +++ b/intern/cycles/blender/addon/presets.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations from bl_operators.presets import AddPresetBase from bpy.types import Operator diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index dd218d93d32..0708c371a0e 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations import bpy from bpy.props import ( @@ -841,7 +842,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): ('MEGA', "Mega", ""), ('SPLIT', "Split", ""), ), - update=_devices_update_callback + update=CyclesRenderSettings._devices_update_callback ) debug_opencl_device_type: EnumProperty( @@ -855,11 +856,9 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): ('GPU', "GPU", ""), ('ACCELERATOR', "Accelerator", ""), ), - update=_devices_update_callback + update=CyclesRenderSettings._devices_update_callback ) - del _devices_update_callback - debug_use_opencl_debug: BoolProperty(name="Debug OpenCL", default=False) debug_opencl_mem_limit: IntProperty( @@ -1481,7 +1480,7 @@ class CyclesPreferences(bpy.types.AddonPreferences): compute_device_type: EnumProperty( name="Compute Device Type", description="Device to use for computation (rendering with Cycles)", - items=get_device_types, + items=CyclesPreferences.get_device_types, ) devices: bpy.props.CollectionProperty(type=CyclesDeviceSettings) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 4576cf4e413..68f6291b373 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations import bpy from bpy_extras.node_utils import find_node_input diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py index cdff3c2b915..aeecc265399 100644 --- a/intern/cycles/blender/addon/version_update.py +++ b/intern/cycles/blender/addon/version_update.py @@ -15,6 +15,7 @@ # # <pep8 compliant> +from __future__ import annotations import bpy import math |