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

Minor Refactoring and Cleanup #827

Merged
merged 13 commits into from
Aug 7, 2017
Merged

Minor Refactoring and Cleanup #827

merged 13 commits into from
Aug 7, 2017

Conversation

StephenHodgson
Copy link
Contributor

@StephenHodgson StephenHodgson commented Aug 3, 2017

  • Moved some classes that were not part of a proper namespace into one.
  • Cleaned up formatting and fixed misspellings.
  • Added LCA headers.
  • Updated UNITY_METRO to UNITY_WSA
  • Fixed support for UnityEngine.Windows.Speech

Minor formatting and cleanup.
Copy link
Contributor

@keveleigh keveleigh left a comment

Choose a reason for hiding this comment

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

I was starting work on a PR like this, so I'm happy to see it!

@@ -3,7 +3,7 @@

using UnityEngine;

#if UNITY_EDITOR || UNITY_WSA
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did all the UNITY_EDITOR directives get removed? It's useful to use these APIs in the editor when using Unity remoting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UNITY_EDITOR is redundant even when remoting

Copy link
Contributor

@keveleigh keveleigh Aug 3, 2017

Choose a reason for hiding this comment

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

Ahh, so this code will still run in the editor with the UNITY_WSA flag? Sweet, I didn't know that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really it shouldn't matter even when remoting because the build should already be WSA

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good


#if UNITY_EDITOR || UNITY_WSA
#if UNITY_WSA || UNITY_STANDALONE
Copy link
Contributor

Choose a reason for hiding this comment

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

UNITY_STANDALONE should probably be UNITY_STANDALONE_WIN, since I doubt the Windows Speech APIs will work on Mac or Linux :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. That's exactly what I was attempting to do lol

/// Editor extension class to enable multi-selection of the 'Draw Planes' and 'Destroy Planes' options in the Inspector.
/// </summary>
[CustomEditor(typeof(SurfaceMeshesToPlanes))]
public class PlaneTypesEnumEditor : Editor
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened to all this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was moved into it's own class.

Copy link
Contributor

@keveleigh keveleigh Aug 3, 2017

Choose a reason for hiding this comment

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

I wasn't able to find it anywhere in this PR. The only added file I see is SupportedInputInfo.cs (and its meta).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll double check. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, and added.

{
if (currentEvent.instanceBehavior == AudioEventInstanceBehavior.KillNewest)
if (currentEvent.AudioEventInstance == AudioEventInstanceBehavior.KillNewest)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this name change removes the word "Behavior", causing it to be less accurate and less clear what it's referring to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I'll update.

Keyboard.Instance.onTextUpdated += this.Keyboard_onTextUpdated;
Keyboard.Instance.onClosed += this.Keyboard_onClosed;
// Subscribe to keyboard delegates
Keyboard.Instance.OnTextUpdated += Keyboard_onTextUpdated;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably update Keyboard_onTextUpdated -> Keyboard_OnTextUpdated (and Keyboard_onClosed) as well.

@StephenHodgson
Copy link
Contributor Author

Thanks for the review @keveleigh, fixes are in.

Copy link
Contributor

@ForrestTrepte ForrestTrepte 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 tidying things up, Stephen!

@ForrestTrepte
Copy link
Contributor

Out of curiosity, is there a utility that you use for finding things such as spelling errors in comments?

@NeerajW NeerajW merged commit 500522b into microsoft:master Aug 7, 2017
@StephenHodgson
Copy link
Contributor Author

StephenHodgson commented Aug 7, 2017

@ForrestTrepte Resharper. But I don't use it all the time cause it's a resource hog.

@@ -727,6 +726,6 @@ public void RaiseDictationError(IInputSource source, uint sourceId, string dicta
}

#endregion // Dictation Events

#endif
Copy link

@Zod- Zod- Aug 8, 2017

Choose a reason for hiding this comment

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

Usage of RaiseDictationError, RaiseDictationHypothesis, RaiseDictationComplete and RaiseDictationResult also has to be wrapped like this.
Since I didn't wrap these before I also didn't realize they have to be wrapped where they are used in the DictationInputManager. Result and Complete are already wrapped so it just has to be extended a little bit to include Hypothesis and Error.

Getting 2 errors for those now in the Editor:

Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs(248,35): error CS1061: Type `HoloToolkit.Unity.InputModule.InputManager' does not contain a definition for `RaiseDictationError' and no extension method `RaiseDictationError' of type `HoloToolkit.Unity.InputModule.InputManager' could be found. Are you missing an assembly reference?
Assets/HoloToolkit/Input/Scripts/Microphone/DictationInputManager.cs(200,35): error CS1061: Type `HoloToolkit.Unity.InputModule.InputManager' does not contain a definition for `RaiseDictationHypothesis' and no extension method `RaiseDictationHypothesis' of type `HoloToolkit.Unity.InputModule.InputManager' could be found. Are you missing an assembly reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into it right now. Was this in standalone pc build, or wsa?

Copy link

@Zod- Zod- Aug 8, 2017

Choose a reason for hiding this comment

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

I just opened the project in Unity. Are those flags added when you change the target platform? If they are then probably neither. I'll get Unity on this machine and take a look.

Copy link
Contributor Author

@StephenHodgson StephenHodgson Aug 8, 2017

Choose a reason for hiding this comment

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

What's your build target platform?

Copy link

@Zod- Zod- Aug 8, 2017

Choose a reason for hiding this comment

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

Sorry took a bit longer, had to install unity on my machine at home. I tested it earlier on my workstation. I get the errors with android as the target platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries, I figured. Should be addressed in my latest PR

keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this pull request Aug 11, 2017
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.

6 participants