public override void OnInspectorGUI() { // Draws warning message for deprecated object with button for migration option MigrationTool.DrawDeprecated <BoundingBox, BoundsControlMigrationHandler>((BoundingBox)target); if (target != null) { // check if rigidbody is attached - if so show warning in case input profile is not configured for individual collider raycast BoundingBox boundingBox = (BoundingBox)target; Rigidbody rigidBody = boundingBox.GetComponent <Rigidbody>(); if (rigidBody != null) { MixedRealityInputSystemProfile profile = CoreServices.InputSystem?.InputSystemProfile; if (profile != null && profile.FocusIndividualCompoundCollider == false) { EditorGUILayout.Space(); // show warning and button to reconfigure profile EditorGUILayout.HelpBox($"When using Bounding Box in combination with Rigidbody 'Focus Individual Compound Collider' must be enabled in Input Profile.", UnityEditor.MessageType.Warning); if (GUILayout.Button($"Enable 'Focus Individual Compound Collider' in Input Profile")) { profile.FocusIndividualCompoundCollider = true; } EditorGUILayout.Space(); } } InspectorUIUtility.RenderHelpURL(target.GetType()); } DrawDefaultInspector(); }
public override void OnInspectorGUI() { if (target != null) { InspectorUIUtility.RenderHelpURL(target.GetType()); } DrawDefaultInspector(); }
public override void OnInspectorGUI() { serializedObject.Update(); if (target != null) { InspectorUIUtility.RenderHelpURL(target.GetType()); } bool trackedObjectChanged = false; EditorGUI.BeginChangeCheck(); InspectorUIUtility.DrawEnumSerializedProperty(trackedTargetProperty, TrackedTypeLabel, solverHandler.TrackedTargetType); if (!SolverHandler.IsValidTrackedObjectType(solverHandler.TrackedTargetType)) { InspectorUIUtility.DrawWarning(" Current Tracked Target Type value of \"" + Enum.GetName(typeof(TrackedObjectType), solverHandler.TrackedTargetType) + "\" is obsolete. Select MotionController or HandJoint values instead"); } if (trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.HandJoint || trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.MotionController) { EditorGUILayout.PropertyField(trackedHandnessProperty); if (trackedHandnessProperty.enumValueIndex > (int)Handedness.Both) { InspectorUIUtility.DrawWarning("Only Handedness values of None, Left, Right, and Both are valid"); } } if (trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.HandJoint) { EditorGUILayout.PropertyField(trackedHandJointProperty); } else if (trackedTargetProperty.enumValueIndex == (int)TrackedObjectType.CustomOverride) { EditorGUILayout.PropertyField(transformOverrideProperty); } EditorGUILayout.PropertyField(additionalOffsetProperty); EditorGUILayout.PropertyField(additionalRotationProperty); trackedObjectChanged = EditorGUI.EndChangeCheck(); EditorGUILayout.PropertyField(updateSolversProperty); serializedObject.ApplyModifiedProperties(); if (EditorApplication.isPlaying && trackedObjectChanged) { solverHandler.RefreshTrackedObject(); } }
public override void OnInspectorGUI() { if (target != null) { InspectorUIUtility.RenderHelpURL(target.GetType()); } serializedObject.Update(); using (var c = new EditorGUI.ChangeCheckScope()) { synchronizationSettingsFoldout = EditorGUILayout.Foldout(synchronizationSettingsFoldout, "Synchronization Settings", true); if (c.changed) { SessionState.SetBool(SynchronizationSettingsKey, synchronizationSettingsFoldout); } } if (!synchronizationSettingsFoldout) { return; } using (new EditorGUI.IndentLevelScope()) { if (DrawHandednessProperty) { var currentHandedness = (Handedness)handedness.enumValueIndex; var handIndex = currentHandedness == Handedness.Right ? 1 : 0; using (var c = new EditorGUI.ChangeCheckScope()) { var newHandednessIndex = EditorGUILayout.Popup(handedness.displayName, handIndex, HandednessLabels); if (c.changed) { currentHandedness = newHandednessIndex == 0 ? Handedness.Left : Handedness.Right; handedness.enumValueIndex = (int)currentHandedness; } } } EditorGUILayout.PropertyField(destroyOnSourceLost); EditorGUILayout.PropertyField(useSourcePoseData); if (!useSourcePoseData.boolValue) { EditorGUILayout.PropertyField(poseAction); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (target != null) { InspectorUIUtility.RenderHelpURL(target.GetType()); } serializedObject.Update(); using (var c = new EditorGUI.ChangeCheckScope()) { synchronizationSettingsFoldout = EditorGUILayout.Foldout(synchronizationSettingsFoldout, "Synchronization Settings", true); if (c.changed) { SessionState.SetBool(SynchronizationSettingsKey, synchronizationSettingsFoldout); } } if (!synchronizationSettingsFoldout) { return; } using (new EditorGUI.IndentLevelScope()) { if (DrawHandednessProperty) { Rect position = EditorGUILayout.GetControlRect(); var label = new GUIContent(handedness.displayName); using (new EditorGUI.PropertyScope(position, label, handedness)) { var currentHandedness = (Handedness)handedness.intValue; handedness.intValue = (int)(Handedness)EditorGUI.EnumPopup(position, label, currentHandedness, (value) => { return((Handedness)value == Handedness.Left || (Handedness)value == Handedness.Right); }); } } EditorGUILayout.PropertyField(destroyOnSourceLost); EditorGUILayout.PropertyField(useSourcePoseData); if (!useSourcePoseData.boolValue) { EditorGUILayout.PropertyField(useSourcePoseAsFallback); EditorGUILayout.PropertyField(poseAction); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { OnHeaderGUI(); ServiceFacade facade = (ServiceFacade)target; if (facade.Service == null) { // Facade has likely been destroyed return; } if (!MixedRealityToolkit.IsInitialized || !MixedRealityToolkit.Instance.HasActiveProfile) { return; } InitializeServiceInspectorLookup(); bool drawDataProviders = DrawDataProviders(facade.ServiceType); bool drawProfile = DrawProfile(facade.ServiceType); bool drawInspector = DrawInspector(facade); // Only draw the doc link if we didn't draw a profile // Profiles include doc links by default now if (!drawProfile) { InspectorUIUtility.RenderHelpURL(facade.ServiceType); } bool drewSomething = drawProfile | drawInspector | drawDataProviders; if (!drewSomething) { // If we haven't drawn anything at all, draw a label so people aren't confused. EditorGUILayout.HelpBox("No inspector has been defined for this service type.", MessageType.Info); } }
public override void OnInspectorGUI() { if (target != null) { InspectorUIUtility.RenderHelpURL(target.GetType()); } serializedObject.Update(); toolTipText = serializedObject.FindProperty("toolTipText"); backgroundPadding = serializedObject.FindProperty("backgroundPadding"); backgroundOffset = serializedObject.FindProperty("backgroundOffset"); contentScale = serializedObject.FindProperty("contentScale"); fontSize = serializedObject.FindProperty("fontSize"); anchor = serializedObject.FindProperty("anchor"); pivot = serializedObject.FindProperty("pivot"); contentParent = serializedObject.FindProperty("contentParent"); titleBar = serializedObject.FindProperty("titleBar"); titleBarBackground = serializedObject.FindProperty("titleBarBackground"); label = serializedObject.FindProperty("label"); toolTipLine = serializedObject.FindProperty("toolTipLine"); showBackground = serializedObject.FindProperty("showBackground"); showHighlight = serializedObject.FindProperty("showHighlight"); showConnector = serializedObject.FindProperty("showConnector"); tipState = serializedObject.FindProperty("tipState"); groupTipState = serializedObject.FindProperty("groupTipState"); masterTipState = serializedObject.FindProperty("masterTipState"); attachPointType = serializedObject.FindProperty("attachPointType"); attachPointOffset = serializedObject.FindProperty("attachPointOffset"); bool hasAnchor = anchor.objectReferenceValue != null; bool hasPivot = pivot.objectReferenceValue != null; bool hasContentParent = contentParent.objectReferenceValue != null; bool hasTitleBar = titleBar.objectReferenceValue != null; bool hasTitleBarBackground = titleBarBackground.objectReferenceValue != null; bool hasLabel = label.objectReferenceValue != null; bool hasToolTipLine = toolTipLine.objectReferenceValue != null; bool hasAllObjects = (hasAnchor & hasPivot & hasContentParent & hasLabel & hasToolTipLine & hasTitleBar & hasTitleBarBackground); editorSettingsFoldout = EditorGUILayout.Foldout(editorSettingsFoldout, EditorSettingsContent, true); SessionState.SetBool(EditorSettingsFoldoutKey, editorSettingsFoldout); if (editorSettingsFoldout) { EditorGUI.BeginChangeCheck(); DrawAttachPoints = EditorGUILayout.Toggle("Draw Attach Points", DrawAttachPoints); DrawHandles = EditorGUILayout.Toggle("Draw Handles", DrawHandles); if (DrawHandles) { EditAttachPoint = EditorGUILayout.Toggle("Edit Attach Point", EditAttachPoint); } if (EditorGUI.EndChangeCheck()) { SessionState.SetBool(DrawAttachPointsKey, DrawAttachPoints); SessionState.SetBool(DrawHandlesKey, DrawHandles); SessionState.SetBool(EditAttachPointKey, EditAttachPoint); } } contentSettingsFoldout = EditorGUILayout.Foldout(contentSettingsFoldout, ContentSettingsContent, true); SessionState.SetBool(ContentSettingsFoldoutKey, contentSettingsFoldout); if (contentSettingsFoldout) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(toolTipText); EditorGUILayout.PropertyField(backgroundPadding); EditorGUILayout.PropertyField(backgroundOffset); EditorGUILayout.PropertyField(contentScale); EditorGUILayout.PropertyField(fontSize); EditorGUILayout.PropertyField(attachPointOffset); EditorGUI.indentLevel--; } basicSettingsFoldout = EditorGUILayout.Foldout(basicSettingsFoldout, BasicSettingsContent, true); SessionState.SetBool(BasicSettingsFoldoutKey, basicSettingsFoldout); if (basicSettingsFoldout) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(showBackground); EditorGUILayout.PropertyField(showConnector); EditorGUILayout.PropertyField(showHighlight); EditorGUILayout.PropertyField(attachPointType); EditorGUI.indentLevel--; } groupSettingsFoldout = EditorGUILayout.Foldout(groupSettingsFoldout, GroupSettingsContent, true); SessionState.SetBool(GroupSettingsFoldoutKey, groupSettingsFoldout); if (groupSettingsFoldout) { EditorGUILayout.HelpBox("Higher states will override lower states unless set to 'None.'", MessageType.Info); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(masterTipState); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(groupTipState); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(tipState); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.LabelField("Final Tip State: " + (externalPlot.IsOn ? "On" : "Off"), EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUI.indentLevel--; } objectSettingsFoldout = EditorGUILayout.Foldout(objectSettingsFoldout, ObjectSettingsContent, true); SessionState.SetBool(ObjectSettingsFoldoutKey, objectSettingsFoldout); if (objectSettingsFoldout || !hasAllObjects) { EditorGUI.indentLevel++; if (!hasAllObjects) { EditorGUILayout.HelpBox("ToolTip will not function unless all objects are present.", MessageType.Warning); } EditorGUILayout.PropertyField(anchor); EditorGUILayout.PropertyField(pivot); EditorGUILayout.PropertyField(contentParent); EditorGUILayout.PropertyField(titleBar); EditorGUILayout.PropertyField(titleBarBackground); EditorGUILayout.PropertyField(label); EditorGUILayout.PropertyField(toolTipLine); EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (target != null) { serializedObject.Update(); // Help url InspectorUIUtility.RenderHelpURL(target.GetType()); // Data section using (var check = new EditorGUI.ChangeCheckScope()) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(autoConstraintSelection.boolValue == true ? autoMsg : manualMsg , UnityEditor.MessageType.Info); EditorGUILayout.Space(); int tab = autoConstraintSelection.boolValue == true ? 0 : 1; tab = GUILayout.Toolbar(tab, new string[] { "Auto Constraint Selection", "Manual Constraint Selection" }); EditorGUILayout.Space(); switch (tab) { case 0: autoConstraintSelection.boolValue = true; RenderAutoConstraintMenu(); break; case 1: bool oldAutoConstraintSelection = autoConstraintSelection.boolValue; autoConstraintSelection.boolValue = false; bool newAutoConstraintSelection = autoConstraintSelection.boolValue; // manual constraint selection was enabled if (newAutoConstraintSelection == false && oldAutoConstraintSelection != newAutoConstraintSelection) { // manual selection is active and manual list is empty -> auto populate with // existing constraints so user has a base to work on if (selectedConstraints.arraySize == 0) { var constraints = constraintManager.gameObject.GetComponents <TransformConstraint>(); foreach (var constraint in constraints) { int currentId = selectedConstraints.arraySize; selectedConstraints.InsertArrayElementAtIndex(currentId); selectedConstraints.GetArrayElementAtIndex(currentId).objectReferenceValue = constraint; } } } RenderManualConstraintMenu(); break; } // we render the instance id of this component so our highlighting function can distinguish between // the different instances of constraint manager - highlighting in the inspector is currently // only available for string search which causes problems with multiple components of the same type // attached to the same gameobject. EditorGUILayout.Space(); EditorGUILayout.LabelField("ComponentId: " + constraintManager.GetInstanceID(), EditorStyles.miniLabel); // deferred delete elements from array to not break unity layout for (int i = indicesToRemove.Count - 1; i > -1; i--) { var currentArraySize = selectedConstraints.arraySize; selectedConstraints.DeleteArrayElementAtIndex(indicesToRemove[i]); if (currentArraySize == selectedConstraints.arraySize) { selectedConstraints.DeleteArrayElementAtIndex(indicesToRemove[i]); } } indicesToRemove.Clear(); if (check.changed) { 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() { if (target != null) { // Notification section - first thing to show in bounds control component DrawRigidBodyWarning(); // Help url InspectorUIUtility.RenderHelpURL(target.GetType()); // Data section { EditorGUI.BeginChangeCheck(); // Initializes the target object of the bounds control to itself EditorGUILayout.PropertyField(targetObject); if (targetObject.objectReferenceValue == null) { targetObject.objectReferenceValue = boundsControl.gameObject; } // Checks that the targetObject has a box collider that this bounds control can manage if bounds override was not supplied, otherwise, raises a warning and prompts the user to add one if (boundsOverride.objectReferenceValue == null) { GameObject boundsTargetObject = targetObject.objectReferenceValue as GameObject; if (boundsTargetObject != null && boundsTargetObject.GetComponent <BoxCollider>() == null) { EditorGUILayout.HelpBox("No Box Collider assigned to the TargetObject and no Bounds Override assigned, add a Box Collider to enable proper interaction with the Bounds Control", MessageType.Warning); if (GUILayout.Button("Add Box Collider to Target Object")) { boundsTargetObject.AddComponent <BoxCollider>(); } } } 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.PropertyField(uniformScaleOnFlattenedAxis); 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 = ConstraintManagerInspector.DrawConstraintManagerFoldout(boundsControl.gameObject, enableConstraints, constraintManager, constraintsFoldout); 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(); ElasticsManagerInspector.DrawElasticsManagerLink(elasticsManager, boundsControl.gameObject); EditorGUILayout.Space(); EditorGUILayout.LabelField(new GUIContent("Debug", "Bounds Control Debug Section"), EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); { EditorGUILayout.PropertyField(hideElementsInHierarchyEditor); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } } }