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

--Configuration support for Magnum Vector2, Vector4, Color3 and Color4, UserDefinedAttr support of str Lists #2028

Merged
merged 19 commits into from
Mar 23, 2023

Conversation

jturner65
Copy link
Contributor

@jturner65 jturner65 commented Mar 9, 2023

Motivation and Context

This PR adds Configuration support for Magnum Vector4. With regard to the user_defined attributes, the type for equivalently sized fields in JSON is determined by substring tags found in the numeric fields' labels - 'orient', 'quat', or 'rotat' will denote a quaternion for a size 4 numeric field, and otherwise the size 4 fields will be Magnum vector4 's.

These are some features that I worked on some before my last contract ended and felt would be useful to add now.

NOTE : I removed Explicit Color3 and Color4 since these were superfluous, but I retrained accessors that would treat Color3 and Color4 getter requests the same as Vector3 and Vector4 respectively.

NOTE : I also added support of user-defined attributes containing a list of variable length of strings, which was already specified as supported in the documentation :) .

How Has This Been Tested

All Python and C++ tests pass. C++ tests were added to exhaustively test label-based type inference.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@jturner65 jturner65 requested review from 0mdc and aclegg3 and removed request for 0mdc March 9, 2023 23:22
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 9, 2023
@jturner65 jturner65 requested review from 0mdc and mosra March 9, 2023 23:22
@jturner65 jturner65 changed the title --Minor fixes and Configuration support for Magnum Color3, Color4 and Vector4 --Minor fixes and Configuration support for Magnum Vector4 Mar 10, 2023
@jturner65 jturner65 changed the title --Minor fixes and Configuration support for Magnum Vector4 --Minor fixes and Configuration support for Magnum Vector4, Color3 and Color4 Mar 10, 2023
Copy link
Contributor

@0mdc 0mdc left a comment

Choose a reason for hiding this comment

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

Looks good to me!

We might want to consider supporting Mn::Vector2 as well.

@jturner65 jturner65 force-pushed the AttribFixAndVec4 branch 2 times, most recently from 3b67d2a to 1927d98 Compare March 16, 2023 16:46
@jturner65 jturner65 changed the title --Minor fixes and Configuration support for Magnum Vector4, Color3 and Color4 --Minor fixes and Configuration support for Magnum Vector2, Vector4, Color3 and Color4 Mar 16, 2023
…ctor4.

Note, to properly read from JSON into a color4 or a quaternion, the keyed-ConfigValue needs to be initialized on construction as the appropriate type
--Type of field is either determined by pre-existing field's type or by tag substrings in the label. Otherwise, defaults to Mn::Vector4.
--Folows the same precedent as Mn::Color4 - type of field will be specified by substrings "clr" or "color" in the label, name-insensitive.
The magnum vector3 and vector4 types can be queried as colors
--Added the ability to access vector config fields as colors, to expose special color functionality.
@jturner65 jturner65 marked this pull request as ready for review March 21, 2023 19:53
@jturner65 jturner65 requested a review from mosra March 22, 2023 14:48
@jturner65 jturner65 changed the title --Minor fixes and Configuration support for Magnum Vector2, Vector4, Color3 and Color4 --Configuration support for Magnum Vector2, Vector4, Color3 and Color4, UserDefinedAttr support of str Lists Mar 22, 2023
Copy link
Contributor

@aclegg3 aclegg3 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing and adding things here. Also appreciate the typo fixes throughout. :)

docs/pages/attributesJSON.rst Show resolved Hide resolved
@jturner65 jturner65 merged commit 7b99db7 into main Mar 23, 2023
@jturner65 jturner65 deleted the AttribFixAndVec4 branch March 23, 2023 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants