Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix number * FVector#745

Open
dfb wants to merge 1 commit into20tab:master20tab/UnrealEnginePython:masterfrom
dfb:pr_fvectormultdfb/UnrealEnginePython:pr_fvectormultCopy head branch name to clipboard
Open

Fix number * FVector#745
dfb wants to merge 1 commit into20tab:master20tab/UnrealEnginePython:masterfrom
dfb:pr_fvectormultdfb/UnrealEnginePython:pr_fvectormultCopy head branch name to clipboard

Conversation

@dfb
Copy link
Contributor

@dfb dfb commented Jun 19, 2019

If you have an FVector and multiply it by a number, you get the expected results (a new vector scaled by the given number). But if you reverse the order of the arguments (and do number * FVector), the returned vector is garbage.

I verified that ue_py_fvector_mul in UEPyFVector.cpp is being called in both scenarios, but the problem is that that function assumes that the 'self' parameter will always be the FVector object, which is not the case, unfortunately. The Python docs say:

Note Binary and ternary functions must check the type of all their operands, and implement the necessary conversions (at least one of the operands is an instance of the defined type). If the operation is not defined for the given operands, binary and ternary functions must return Py_NotImplemented, if another error occurred they must return NULL and set an exception.

This patch changes the multiplication function to handle either case, and does the same for FVector2D. It's likely that other wrapper objects that implement the Python number protocol will have to change too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.