Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mono: add constants to transform and vector structs #20901

Merged
merged 1 commit into from
Aug 14, 2018

Conversation

KellyThomas
Copy link
Contributor

@KellyThomas KellyThomas commented Aug 11, 2018

What this does:

This PR brings the constants offered by Transform, Transform2D, Vector2 and Vector3 into line with GDScript changes in #14704

For the vectors I have opted for Inf over Infinity to match the Mathf property, I am happy to change this if the full name is preferred.

This swaps the values of Vector2.Up/Vector2.Down, so that they match the new GDScript implementation.

What this doesn't do:

I was unable add X, Y, or Z to Plane as it conflicts with existing instance properties.

I was unable to add BlackCircle, WhiteCircle, BlackDiamond, or WhiteDiamond to StringExtensions due to lack of support for static extension properties.

I haven't looked at the named colors.

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nitpicky thing but otherwise it all looks good to me. 👍

private static readonly Vector2 negOne = new Vector2 (-1, -1);

private static readonly Vector2 up = new Vector2 (0, 1);
private static readonly Vector2 down = new Vector2 (0, -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my fault for implementing that incorrectly in the first place, sorry 😆. I didn't know Godot used "Y is down" for 2D until recently (I only use 3D myself).

@@ -1 +1 @@
7
9
Copy link
Member

@aaronfranke aaronfranke Aug 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seven to Nine?

It's fine as-is (after rebasing) if your other PR #20890 gets merged first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was probably a bit optimistic of me.

I've changed this back to 8 for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry too much about this. I will make this automatic.

@KellyThomas KellyThomas force-pushed the mono-consts branch 2 times, most recently from c04b96d to 5c0ee95 Compare August 13, 2018 03:37
@akien-mga akien-mga added this to the 3.1 milestone Aug 13, 2018
@akien-mga
Copy link
Member

CC @neikeq


// Constants
private static readonly Transform _identity = new Transform(Basis.Identity, Vector3.Zero);
private static readonly Transform _flipX = new Transform(new Basis(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)), Vector3.Zero);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a single white space after the comma (this can be found in a other cases below).

public static Transform Identity { get { return _identity; } }
public static Transform FlipX { get { return _flipX; } }
public static Transform FlipY { get { return _flipY; } }
public static Transform FlipZ { get { return _flipZ; } }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No alignment between fields and properties. Only a single white space to separate identifier from the assign token or the opening braces.

// Constants
private static readonly Transform _identity = new Transform(Basis.Identity, Vector3.Zero);
private static readonly Transform _flipX = new Transform(new Basis(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1)), Vector3.Zero);
private static readonly Transform _flipY = new Transform(new Basis(new Vector3( 1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)), Vector3.Zero);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No white space after the opening parenthesis.

@neikeq
Copy link
Contributor

neikeq commented Aug 14, 2018

Looks good, save for the formatting issues I mentioned.

@KellyThomas
Copy link
Contributor Author

Thanks, I've removed all alignment beyond the line indents. It should be clean now.

@neikeq neikeq merged commit ecd5d0a into godotengine:master Aug 14, 2018
@neikeq
Copy link
Contributor

neikeq commented Aug 14, 2018

Thanks!

@akien-mga
Copy link
Member

Now that Godot 3.1 has been released, we don't plan to cherry-pick new features and enhancements to the 3.0 branch, unless there is very strong support in favor of it. Removing cherrypick label for 3.0.

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

Successfully merging this pull request may close these issues.

4 participants