Fix integer vector mul/div operators and bindings.

* Vector2i and Vector3i mul/div by a float results in Vector2 and Vector3 respectively.
* Create specializations to allow proper bindings.

This fixes #44408 and supersedes #44441 and keeps the same rule of int <op> float returnig float, like with scalars.
This commit is contained in:
reduz
2022-02-03 22:16:58 +01:00
committed by Rémi Verschelde
parent fd0d2dcabf
commit 8c7268664d
9 changed files with 188 additions and 46 deletions
+6 -6
View File
@@ -89,12 +89,12 @@
</description>
</operator>
<operator name="operator *">
<return type="Vector2i" />
<return type="Vector2" />
<argument index="0" name="right" type="Vector2i" />
<description>
Multiplies each component of the [Vector2i] by the given [float] truncated to an integer.
Multiplies each component of the [Vector2i] by the given [float]. Returns a [Vector2].
[codeblock]
print(0.9 * Vector2i(10, 20)) # Prints "(0, 0)"
print(0.9 * Vector2i(10, 15)) # Prints "(9, 13.5)"
[/codeblock]
</description>
</operator>
@@ -106,12 +106,12 @@
</description>
</operator>
<operator name="operator *">
<return type="Vector3i" />
<return type="Vector3" />
<argument index="0" name="right" type="Vector3i" />
<description>
Multiplies each component of the [Vector3i] by the given [float] truncated to an integer.
Multiplies each component of the [Vector3i] by the given [float]. Returns a [Vector3].
[codeblock]
print(0.9 * Vector3i(10, 20, 30)) # Prints "(0, 0, 0)"
print(0.9 * Vector3i(10, 15, 20)) # Prints "(9, 13.5, 18)"
[/codeblock]
</description>
</operator>