Fixed bugs in PostNormalizedVectorDrawer#44
Merged
Conversation
Contributor
amechtley
commented
Nov 26, 2018
- Fixed exception when drawing control without having called GetPropertyHeight first
- Apply normalization twice to fix possible precision error (fixes issue where value might be normalized with magnitude slightly less than 1)
- Fixed bug where stale post-normalized values were applied to property when it was edited from another context (fixes issue where systems could not modify an entity's rotation while it was inspected)
- Assorted cleanup
- Fixed exception when drawing control without having called GetPropertyHeight first - Apply normalization twice to fix possible precision error (fixes issue where value might be normalized with magnitude slightly less than 1) - Fixed bug where stale post-normalized values were applied to property when it was edited from another context (fixes issue where systems could not modify an entity's rotation while it was inspected) - Assorted cleanup
amechtley
commented
Nov 26, 2018
| public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) | ||
| { | ||
| var guiData = m_GUIDataPerPropertyPath[property.propertyPath]; | ||
| var guiData = GetGUIData(property); |
Contributor
Author
There was a problem hiding this comment.
This call ensures drawing the property works if GetPropertyHeight() has not been called yet
amechtley
commented
Nov 26, 2018
| if (string.IsNullOrEmpty(label.tooltip)) | ||
| label.tooltip = Content.tooltip; | ||
|
|
||
| guiData.RebuildIfDirty(); |
Contributor
Author
There was a problem hiding this comment.
This method was added to solve the problem of serialized data getting updated from a different context, and then being overwritten by the pre-normalized data cached by the drawer
amechtley
commented
Nov 26, 2018
| sp.serializedObject.ApplyModifiedProperties(); | ||
| for (var i = 0; i < m_NumElements; ++i) | ||
| postNormalizedValue[i] = target.Key.FindPropertyRelative(m_ElementPaths[i]).doubleValue; | ||
| postNormalizedValue = normalize(normalize(postNormalizedValue)); |
Contributor
Author
There was a problem hiding this comment.
Double normalization fixes a problem where data were sometimes normalized with values slightly less than 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.