public override void OnInspectorGUI() { EditorGUILayout.PropertyField(hostTransform); EditorGUILayout.PropertyField(manipulationType); EditorGUILayout.PropertyField(allowFarManipulation); var handedness = (ManipulationHandFlags)manipulationType.intValue; EditorGUILayout.Space(); GUIStyle style = EditorStyles.foldout; FontStyle previousStyle = style.fontStyle; style.fontStyle = FontStyle.Bold; oneHandedFoldout = EditorGUILayout.Foldout(oneHandedFoldout, "One Handed Manipulation", true); if (oneHandedFoldout) { if (handedness.HasFlag(ManipulationHandFlags.OneHanded)) { EditorGUILayout.PropertyField(oneHandRotationModeNear); EditorGUILayout.PropertyField(oneHandRotationModeFar); } else { EditorGUILayout.HelpBox("One handed manipulation disabled. If you wish to enable one handed manipulation select it as a Manipulation Type above.", MessageType.Info); } } EditorGUILayout.Space(); twoHandedFoldout = EditorGUILayout.Foldout(twoHandedFoldout, "Two Handed Manipulation", true); if (twoHandedFoldout) { if (handedness.HasFlag(ManipulationHandFlags.TwoHanded)) { EditorGUILayout.PropertyField(twoHandedManipulationType); } else { EditorGUILayout.HelpBox("Two handed manipulation disabled. If you wish to enable two handed manipulation select it as a Manipulation Type above.", MessageType.Info); } } var mh = (ObjectManipulator)target; var rb = mh.HostTransform.GetComponent <Rigidbody>(); EditorGUILayout.Space(); constraintsFoldout = InspectorUIUtility.DrawComponentTypeFoldout <TransformConstraint>(mh.gameObject, constraintsFoldout, "Constraint"); EditorGUILayout.Space(); physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true); if (physicsFoldout) { if (rb != null) { EditorGUILayout.PropertyField(releaseBehavior); EditorGUILayout.PropertyField(useForcesForNearManipulation); } else { EditorGUILayout.HelpBox("Physics options disabled. If you wish to enable physics options, add a Rigidbody component to this object.", MessageType.Info); } } EditorGUILayout.Space(); smoothingFoldout = EditorGUILayout.Foldout(smoothingFoldout, "Smoothing", true); if (smoothingFoldout) { EditorGUILayout.PropertyField(smoothingFar); EditorGUILayout.PropertyField(smoothingNear); EditorGUILayout.PropertyField(moveLerpTime); EditorGUILayout.PropertyField(rotateLerpTime); EditorGUILayout.PropertyField(scaleLerpTime); } EditorGUILayout.Space(); eventsFoldout = EditorGUILayout.Foldout(eventsFoldout, "Manipulation Events", true); if (eventsFoldout) { EditorGUILayout.PropertyField(onManipulationStarted); EditorGUILayout.PropertyField(onManipulationEnded); EditorGUILayout.PropertyField(onHoverEntered); EditorGUILayout.PropertyField(onHoverExited); } EditorGUILayout.Space(); Microsoft.MixedReality.Toolkit.Experimental.Editor.ElasticsManagerInspector.DrawElasticsManagerLink(elasticsManager, mh.gameObject); EditorGUILayout.Space(); // reset foldouts style style.fontStyle = previousStyle; serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (target != null) { // Notification section - first thing to show in bounds control component DrawRigidBodyWarning(); // Help url InspectorUIUtility.RenderHelpURL(target.GetType()); // Data section { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(targetObject); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Behavior"), EditorStyles.boldLabel); EditorGUILayout.PropertyField(activationType); EditorGUILayout.PropertyField(boundsOverride); EditorGUILayout.PropertyField(boundsCalculationMethod); EditorGUILayout.PropertyField(controlPadding); EditorGUILayout.PropertyField(flattenAxis); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Smoothing"), EditorStyles.boldLabel); EditorGUILayout.PropertyField(smoothingActive); EditorGUILayout.PropertyField(scaleLerpTime); EditorGUILayout.PropertyField(rotateLerpTime); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Visuals", "Bounds Control Visual Configurations"), EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); using (new EditorGUI.IndentLevelScope()) { showBoxConfiguration = InspectorUIUtility.DrawScriptableFoldout <BoxDisplayConfiguration>(boxDisplayConfiguration, "Box Configuration", showBoxConfiguration); showScaleHandlesConfiguration = InspectorUIUtility.DrawScriptableFoldout <ScaleHandlesConfiguration>(scaleHandlesConfiguration, "Scale Handles Configuration", showScaleHandlesConfiguration); showRotationHandlesConfiguration = InspectorUIUtility.DrawScriptableFoldout <RotationHandlesConfiguration>(rotationHandlesConfiguration, "Rotation Handles Configuration", showRotationHandlesConfiguration); showTranslationHandlesConfiguration = InspectorUIUtility.DrawScriptableFoldout <TranslationHandlesConfiguration>(translationHandlesConfiguration, "Translation Handles Configuration", showTranslationHandlesConfiguration); showLinksConfiguration = InspectorUIUtility.DrawScriptableFoldout <LinksConfiguration>(linksConfiguration, "Links Configuration", showLinksConfiguration); showProximityConfiguration = InspectorUIUtility.DrawScriptableFoldout <ProximityEffectConfiguration>(proximityEffectConfiguration, "Proximity Configuration", showProximityConfiguration); } EditorGUILayout.Space(); constraintsFoldout = InspectorUIUtility.DrawComponentTypeFoldout <TransformConstraint>(boundsControl.gameObject, constraintsFoldout, "Constraint"); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Events", "Bounds Control Events"), EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); { EditorGUILayout.PropertyField(rotateStartedEvent); EditorGUILayout.PropertyField(rotateStoppedEvent); EditorGUILayout.PropertyField(scaleStartedEvent); EditorGUILayout.PropertyField(scaleStoppedEvent); EditorGUILayout.PropertyField(translateStartedEvent); EditorGUILayout.PropertyField(translateStoppedEvent); } EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Debug", "Bounds Control Debug Section"), EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); { EditorGUILayout.PropertyField(hideElementsInHierarchyEditor); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } } }
public override void OnInspectorGUI() { EditorGUILayout.PropertyField(hostTransform); EditorGUILayout.PropertyField(manipulationType); EditorGUILayout.PropertyField(allowFarManipulation); var handedness = (ManipulationHandFlags)manipulationType.intValue; EditorGUILayout.Space(); GUIStyle style = EditorStyles.foldout; FontStyle previousStyle = style.fontStyle; style.fontStyle = FontStyle.Bold; oneHandedFoldout = EditorGUILayout.Foldout(oneHandedFoldout, "One Handed Manipulation", true); if (oneHandedFoldout) { if (handedness.HasFlag(ManipulationHandFlags.OneHanded)) { EditorGUILayout.PropertyField(oneHandRotationModeNear); EditorGUILayout.PropertyField(oneHandRotationModeFar); } else { EditorGUILayout.HelpBox("One handed manipulation disabled. If you wish to enable one handed manipulation select it as a Manipulation Type above.", MessageType.Info); } } EditorGUILayout.Space(); twoHandedFoldout = EditorGUILayout.Foldout(twoHandedFoldout, "Two Handed Manipulation", true); if (twoHandedFoldout) { if (handedness.HasFlag(ManipulationHandFlags.TwoHanded)) { EditorGUILayout.PropertyField(twoHandedManipulationType); } else { EditorGUILayout.HelpBox("Two handed manipulation disabled. If you wish to enable two handed manipulation select it as a Manipulation Type above.", MessageType.Info); } } var mh = (ObjectManipulator)target; var rb = mh.HostTransform.GetComponent <Rigidbody>(); EditorGUILayout.Space(); constraintsFoldout = InspectorUIUtility.DrawComponentTypeFoldout <TransformConstraint>(mh.gameObject, constraintsFoldout, "Constraint"); EditorGUILayout.Space(); physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true); if (physicsFoldout) { if (rb != null) { EditorGUILayout.PropertyField(releaseBehavior); EditorGUILayout.PropertyField(useForcesForNearManipulation); } else { EditorGUILayout.HelpBox("Physics options disabled. If you wish to enable physics options, add a Rigidbody component to this object.", MessageType.Info); } } EditorGUILayout.Space(); smoothingFoldout = EditorGUILayout.Foldout(smoothingFoldout, "Smoothing", true); if (smoothingFoldout) { EditorGUILayout.PropertyField(smoothingFar); EditorGUILayout.PropertyField(smoothingNear); EditorGUILayout.PropertyField(moveLerpTime); EditorGUILayout.PropertyField(rotateLerpTime); EditorGUILayout.PropertyField(scaleLerpTime); } EditorGUILayout.Space(); elasticsFoldout = EditorGUILayout.Foldout(elasticsFoldout, "Elastics", true); if (elasticsFoldout) { // This two-way enum cast is required because EnumFlagsField does not play nicely with // SerializedProperties and custom enum flags. var newElasticTypesValue = EditorGUILayout.EnumFlagsField("Manipulation types using elastic feedback: ", (TransformFlags)elasticTypes.intValue); elasticTypes.intValue = (int)(TransformFlags)newElasticTypesValue; // If the particular elastic type is requested, we offer the user the ability // to configure the elastic system. TransformFlags currentFlags = (TransformFlags)elasticTypes.intValue; translationElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>( "Translation Elastic", translationElasticFoldout, translationElasticConfigurationObject, translationElasticExtent, TransformFlags.Move, currentFlags); rotationElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>( "Rotation Elastic", rotationElasticFoldout, rotationElasticConfigurationObject, rotationElasticExtent, TransformFlags.Rotate, currentFlags); scaleElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>( "Scale Elastic", scaleElasticFoldout, scaleElasticConfigurationObject, scaleElasticExtent, TransformFlags.Scale, currentFlags); } EditorGUILayout.Space(); eventsFoldout = EditorGUILayout.Foldout(eventsFoldout, "Manipulation Events", true); if (eventsFoldout) { EditorGUILayout.PropertyField(onManipulationStarted); EditorGUILayout.PropertyField(onManipulationEnded); EditorGUILayout.PropertyField(onHoverEntered); EditorGUILayout.PropertyField(onHoverExited); } // reset foldouts style style.fontStyle = previousStyle; serializedObject.ApplyModifiedProperties(); }