Closed Pyrolistical closed 1 year ago
bpy.types.Object.data should be of type bpy.types.Mesh
bpy.types.Object.data
bpy.types.Mesh
From Blender console:
>>> type(bpy.data.objects['some object']) <class 'bpy_types.Object'> >>> type(bpy.data.objects['some object'].data) <class 'bpy_types.Mesh'>
in fake-bpy-modules/bpy/types.py class Object defines data as:
class Object
data
data: 'ID' = None
I believe it should be Mesh as the workaround is to cast data
Mesh
from typing import cast mesh = cast(Mesh, some_object.data) bpy.data.meshes.remove(mesh, do_unlink=True)
bpy.types.Object.data depends on the type of object (i.e. bpy.types.Camera for Camera object). We could not assume the specific type, and cast is needed for this case.
bpy.types.Camera
System Information
Expected behavior
bpy.types.Object.data
should be of typebpy.types.Mesh
From Blender console:
Description about the bug
in fake-bpy-modules/bpy/types.py
class Object
definesdata
as:Additional comments
I believe it should be
Mesh
as the workaround is to cast data