-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Transformations] New Transformations system which replaces the old Solvers+Constraints system #11323
Closed
Closed
[Transformations] New Transformations system which replaces the old Solvers+Constraints system #11323
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
50c58f0
Draft of new object manipulator implementation along with tests
RogPodge 68a4bc6
fixed bugged object manipulator test
RogPodge c18c3d5
fixing NewObjectManipulator and tests to pass
RogPodge d6346bb
Fixing unit tests
RogPodge 5860c89
Update com.microsoft.mrtk.spatialmanipulation/ObjectManipulator/Objec…
RogPodge 6c90dc7
addressing PR asks
RogPodge d21d80c
Merge branch 'SolverRefactor2' of https://github.com/RogPodge/MixedRe…
RogPodge c4a12ae
Refactoring the placementhub to improve usability
RogPodge ec8d0a2
Adjusted ITransformation to use MixedRealityTransform
RogPodge f49d7fb
revamping the new Object Manipulator Editor
RogPodge c9401e6
Merge branch 'mrtk3' of https://github.com/Microsoft/MixedRealityTool…
RogPodge c5dfe63
renaming the inspector to editor
RogPodge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
137 changes: 137 additions & 0 deletions
137
...rosoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/NewObjectManipulatorInspector.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.MixedReality.Toolkit.Editor; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor | ||
{ | ||
/// <summary> | ||
/// A custom inspector for ObjectManipulator used to separate | ||
/// ObjectManipulator options into distinct foldout panels. | ||
/// </summary> | ||
[CustomEditor(typeof(NewObjectManipulator))] | ||
[CanEditMultipleObjects] | ||
public class NewObjectManipulatorInspector : StatefulInteractableInspector | ||
{ | ||
private NewObjectManipulator instance; | ||
private SerializedProperty allowedManipulations; | ||
private SerializedProperty rotationAnchorNear; | ||
private SerializedProperty rotationAnchorFar; | ||
private SerializedProperty manipulationLogicTypes; | ||
private SerializedProperty selectMode; | ||
|
||
private SerializedProperty releaseBehavior; | ||
|
||
private SerializedProperty smoothingFar; | ||
private SerializedProperty smoothingNear; | ||
|
||
// These alias to the XRI First/Last Select Entered/Exited events | ||
private SerializedProperty manipulationStarted; | ||
private SerializedProperty manipulationEnded; | ||
|
||
protected override void OnEnable() | ||
{ | ||
base.OnEnable(); | ||
instance = target as NewObjectManipulator; | ||
allowedManipulations = SetUpProperty(nameof(allowedManipulations)); | ||
|
||
// Rotation anchor settings | ||
rotationAnchorNear = SetUpProperty(nameof(rotationAnchorNear)); | ||
rotationAnchorFar = SetUpProperty(nameof(rotationAnchorFar)); | ||
|
||
// Manipulation logic | ||
manipulationLogicTypes = SetUpProperty(nameof(manipulationLogicTypes)); | ||
|
||
// Physics | ||
releaseBehavior = SetUpProperty(nameof(releaseBehavior)); | ||
|
||
//Smoothing | ||
smoothingFar = SetUpProperty(nameof(smoothingFar)); | ||
smoothingNear = SetUpProperty(nameof(smoothingNear)); | ||
|
||
// Mirroring base XRI settings for easy access | ||
selectMode = serializedObject.FindProperty("m_SelectMode"); | ||
manipulationStarted = serializedObject.FindProperty("m_FirstSelectEntered"); | ||
manipulationEnded = serializedObject.FindProperty("m_LastSelectExited"); | ||
} | ||
|
||
static bool baseInteractableFoldout = false; | ||
static bool advancedSettingFoldout = false; | ||
static bool physicsFoldout = false; | ||
static bool smoothingFoldout = false; | ||
protected override void DrawProperties() | ||
{ | ||
EditorGUILayout.Space(); | ||
EditorGUILayout.LabelField("Object Manipulator Settings", EditorStyles.boldLabel); | ||
using (new EditorGUI.IndentLevelScope()) | ||
{ | ||
EditorGUILayout.PropertyField(allowedManipulations); | ||
|
||
// This is just the XRI SelectMode property, but renamed/aliased to avoid confusion. | ||
EditorGUILayout.PropertyField(selectMode, new GUIContent("Multiselect Mode", "Can the object can be grabbed by one interactor or multiple at a time?")); | ||
|
||
if (advancedSettingFoldout = EditorGUILayout.Foldout(advancedSettingFoldout, "Advanced Object Manipulator Settings", true, EditorStyles.foldoutHeader)) | ||
{ | ||
using (new EditorGUI.IndentLevelScope()) | ||
{ | ||
EditorGUILayout.PropertyField(rotationAnchorNear); | ||
EditorGUILayout.PropertyField(rotationAnchorFar); | ||
EditorGUILayout.PropertyField(manipulationLogicTypes); | ||
|
||
Rigidbody rb = instance.GetComponent<Rigidbody>(); | ||
if (physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true)) | ||
{ | ||
using (new EditorGUI.IndentLevelScope()) | ||
{ | ||
if (rb != null && !rb.isKinematic) | ||
{ | ||
EditorGUILayout.PropertyField(releaseBehavior); | ||
} | ||
else | ||
{ | ||
EditorGUILayout.HelpBox("Physics options disabled. If you wish to enable physics options, add a Rigidbody component to this object.", MessageType.Info); | ||
} | ||
} | ||
} | ||
|
||
smoothingFoldout = EditorGUILayout.Foldout(smoothingFoldout, "Smoothing", true); | ||
if (smoothingFoldout) | ||
{ | ||
using (new EditorGUI.IndentLevelScope()) | ||
{ | ||
EditorGUILayout.PropertyField(smoothingFar); | ||
EditorGUILayout.PropertyField(smoothingNear); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (baseInteractableFoldout = EditorGUILayout.Foldout(baseInteractableFoldout, "Stateful Interactable Settings", true, EditorStyles.foldoutHeader)) | ||
{ | ||
using (new EditorGUI.IndentLevelScope()) | ||
{ | ||
base.DrawProperties(); | ||
} | ||
} | ||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
|
||
static bool manipulationEventsFoldout = false; | ||
protected override void DrawInteractableEvents() | ||
{ | ||
if (manipulationEventsFoldout = EditorGUILayout.Foldout(manipulationEventsFoldout, "Manipulation Events", true)) | ||
{ | ||
// These events just alias to the existing XRI FirstSelectEntered/LastSelectExited events, | ||
// but are mirrored here for clarity + to be explicit that they can be used for manip start/end. | ||
EditorGUILayout.PropertyField(manipulationStarted, new GUIContent("Manipulation Started [FirstSelectEntered]", "Fired when manipulation starts.")); | ||
EditorGUILayout.PropertyField(manipulationEnded, new GUIContent("Manipulation Ended [LastSelectExited]", "Fired when manipulation ends.")); | ||
} | ||
|
||
base.DrawInteractableEvents(); | ||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...t.mrtk.spatialmanipulation/Editor/ObjectManipulator/NewObjectManipulatorInspector.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not calling into the
base
implementation okay here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, base will only return the height of the property without accounting for the children (i.e, a single line + field for most assets), while using the static method provides options for also including the children.