nutti / fake-bpy-module

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

Matrix.LocRotScale rotation argument missing None #134

Closed Road-hog123 closed 1 year ago

Road-hog123 commented 1 year ago

System Information

Expected Behavior

The typing for mathutils.Matrix.LocRotScale matches the documention, with a rotation argument typed Matrix | Quaternion | Euler | None.

Actual Behaviour

(method) def LocRotScale(
    location: Vector | None,
    rotation: Sequence[float] | Quaternion | Euler,
    scale: Vector | None
) -> Matrix
Argument of type "Euler | None" cannot be assigned to parameter "rotation" of type "Sequence[float] | Quaternion | Euler" in function "LocRotScale"
  Type "Euler | None" cannot be assigned to type "Sequence[float] | Quaternion | Euler"
    Type "None" cannot be assigned to type "Sequence[float] | Quaternion | Euler"
      Type "None" cannot be assigned to type "Sequence[float]"
      Type "None" cannot be assigned to type "Quaternion"
      Type "None" cannot be assigned to type "Euler"

LocRotScale(None, None, None) shouldn't raise any type errors—it returns a 4x4 identity matrix:

>>> Matrix.LocRotScale(None, None, None) == Matrix.Identity(4)
True

Additional comments

Object.location, .rotation_euler, .rotation_quaternion and .scale are Unions of Lists and Tuples of floats in addition to their Mathutils types, which means that passing them to LocRotScale raises yet further type errors—is this by design, or a separate issue that I should create an issue for? These are certainly not the only places these Union types are used for Mathutils types.

nutti commented 1 year ago

Fixed this issue now.