nutti / fake-bpy-module

Fake Blender Python API module collection for the code completion.
MIT License
1.35k stars 96 forks source link

Object.rotation_euler components should be mutable #132

Closed Pyrolistical closed 1 year ago

Pyrolistical commented 1 year ago

System Information

Expected behavior

bpy.types.Object.rotation_euler is a vector of 3 components, each of which should be modifiable

From Blender console:

>>> type(bpy.data.objects['some object'])
<class 'bpy_types.Object'>

>>> type(bpy.data.objects['some object'].rotation_euler)
<class 'Euler'>

>>> bpy.data.objects['some object'].rotation_euler[0] = 1.5
>>> bpy.data.objects['some object'].rotation_euler[0]
1.5

Observe some object is rotated about 90 degrees around x-axis.

Description about the bug

in fake-bpy-modules/bpy/types.py class Object defines rotation_euler as:

rotation_euler: typing.Union[
    bpy_prop_array[float], typing.Sequence[float], typing.
    Tuple[float, float, float], 'mathutils.Vector'] = None

When attempting to set it, pylance gives the following 2 errors:

"__setitem__" method not defined on type "Sequence[float]"
"__setitem__" method not defined on type "Tuple[float, float, float]"

Additional comments

The workaround is to just add #type: ignore to the line

nutti commented 1 year ago

I think this issue seems a same logic of https://github.com/nutti/fake-bpy-module/issues/119#issuecomment-1304786775

nutti commented 1 year ago

This issue is now fixed.