private void CheckInitialization() { if (lineBase == null) { lineBase = GetComponent <BaseMixedRealityLineDataProvider>(); } if (lineBase == null) { Debug.LogError($"No Mixed Reality Line Data Provider found on {gameObject.name}. Did you forget to add a Line Data provider?"); } if (lineBase != null && (lineRenderers == null || lineRenderers.Length == 0)) { lineRenderers = lineBase.GetComponentsInChildren <BaseMixedRealityLineRenderer>(); } if (lineRenderers == null || lineRenderers.Length == 0) { Debug.LogError($"No Mixed Reality Line Renderers found on {gameObject.name}. Did you forget to add a Mixed Reality Line Renderer?"); } for (int i = 0; i < lineRenderers.Length; i++) { lineRenderers[i].enabled = true; } }
private void CheckInitialization() { if (lineBase == null) { lineBase = GetComponent <BaseMixedRealityLineDataProvider>(); } if (lineBase == null) { Debug.LogError($"No Mixed Reality Line Data Provider found on {gameObject.name}. Did you forget to add a Line Data provider?"); } if (gravityDistorter == null) { gravityDistorter = GetComponent <DistorterGravity>(); } if (lineBase != null && (lineRenderers == null || lineRenderers.Length == 0)) { lineRenderers = lineBase.GetComponentsInChildren <BaseMixedRealityLineRenderer>(); } if (lineRenderers == null || lineRenderers.Length == 0) { Debug.LogError($"No Mixed Reality Line Renderers found on {gameObject.name}. Did you forget to add a Mixed Reality Line Renderer?"); } }
/// <summary> /// virtual functions /// </summary> protected virtual void OnEnable() { // Get our line if it exists if (toolTipLine == null) { toolTipLine = gameObject.GetComponent <BaseMixedRealityLineDataProvider>(); } backgrounds.Clear(); foreach (IToolTipBackground background in GetComponents(typeof(IToolTipBackground))) { backgrounds.Add(background); } highlights.Clear(); foreach (IToolTipHighlight highlight in GetComponents(typeof(IToolTipHighlight))) { highlights.Add(highlight); } RefreshLocalContent(); contentParent.SetActive(false); ShowBackground = showBackground; ShowHighlight = showHighlight; ShowConnector = showConnector; }
/// <summary> /// virtual functions /// </summary> protected virtual void OnEnable() { ValidateHeirarchy(); // Get our line if it exists if (toolTipLine == null) { toolTipLine = gameObject.GetComponent <BaseMixedRealityLineDataProvider>(); } // Make sure the tool tip text isn't empty if (string.IsNullOrEmpty(toolTipText)) { toolTipText = " "; } backgrounds.Clear(); foreach (IToolTipBackground background in GetComponents(typeof(IToolTipBackground))) { backgrounds.Add(background); } highlights.Clear(); foreach (IToolTipHighlight highlight in GetComponents(typeof(IToolTipHighlight))) { highlights.Add(highlight); } RefreshLocalContent(); contentParent.SetActive(false); ShowBackground = showBackground; ShowHighlight = showHighlight; ShowConnector = showConnector; }
private void Awake() { if (RayLineData == null) { RayLineData = GetComponent <BaseMixedRealityLineDataProvider>(); } }
private void Awake() { _tractorBeamMaterialPropertyBlock = new MaterialPropertyBlock(); var parent = transform.parent; _lineRenderer = GetComponent <LineRenderer>(); _handRayLineRenderer = parent.GetComponent <LineRenderer>(); _lineDataProvider = parent.GetComponent <BaseMixedRealityLineDataProvider>(); UpdateLine(); Dissipate(); }
/// <summary> /// virtual functions /// </summary> protected virtual void OnEnable() { // Get our line if it exists if (toolTipLine == null) { toolTipLine = gameObject.GetComponent <BaseMixedRealityLineDataProvider>(); } RefreshLocalContent(); contentParent.SetActive(false); ShowBackground = showBackground; ShowOutline = showOutline; ShowConnector = showConnector; }
protected virtual void OnEnable() { basicSettingsFoldout = SessionState.GetBool(BasicSettingsFoldoutKey, basicSettingsFoldout); editorSettingsFoldout = SessionState.GetBool(EditorSettingsFoldoutKey, editorSettingsFoldout); rotationSettingsFoldout = SessionState.GetBool(RotationSettingsFoldoutKey, rotationSettingsFoldout); distortionSettingsFoldout = SessionState.GetBool(DistortionSettingsFoldoutKey, distortionSettingsFoldout); LinePreviewResolution = SessionState.GetInt(LinePreviewResolutionKey, LinePreviewResolution); DrawLinePoints = SessionState.GetBool(DrawLinePointsKey, DrawLinePoints); DrawLineRotations = SessionState.GetBool(DrawLineRotationsKey, DrawLineRotations); RotationArrowLength = SessionState.GetFloat(RotationArrowLengthKey, RotationArrowLength); DrawLineManualUpVectors = SessionState.GetBool(DrawLineManualUpVectorsKey, DrawLineManualUpVectors); ManualUpVectorLength = SessionState.GetFloat(ManualUpVectorLengthKey, ManualUpVectorLength); LineData = (BaseMixedRealityLineDataProvider)target; transformMode = serializedObject.FindProperty("transformMode"); customLineTransform = serializedObject.FindProperty("customLineTransform"); lineStartClamp = serializedObject.FindProperty("lineStartClamp"); lineEndClamp = serializedObject.FindProperty("lineEndClamp"); loops = serializedObject.FindProperty("loops"); rotationType = serializedObject.FindProperty("rotationMode"); flipUpVector = serializedObject.FindProperty("flipUpVector"); originOffset = serializedObject.FindProperty("originOffset"); manualUpVectorBlend = serializedObject.FindProperty("manualUpVectorBlend"); manualUpVectors = serializedObject.FindProperty("manualUpVectors"); velocitySearchRange = serializedObject.FindProperty("velocitySearchRange"); distorters = serializedObject.FindProperty("distorters"); distortionMode = serializedObject.FindProperty("distortionMode"); distortionStrength = serializedObject.FindProperty("distortionStrength"); distortionEnabled = serializedObject.FindProperty("distortionEnabled"); uniformDistortionStrength = serializedObject.FindProperty("uniformDistortionStrength"); manualUpVectorList = new ReorderableList(serializedObject, manualUpVectors, false, true, true, true); manualUpVectorList.drawElementCallback += DrawManualUpVectorListElement; manualUpVectorList.drawHeaderCallback += DrawManualUpVectorHeader; RenderLinePreview = LineData.gameObject.GetComponent <BaseMixedRealityLineRenderer>() == null; var newDistorters = LineData.gameObject.GetComponents <Distorter>(); distorters.arraySize = newDistorters.Length; for (int i = 0; i < newDistorters.Length; i++) { var distorterProperty = distorters.GetArrayElementAtIndex(i); distorterProperty.objectReferenceValue = newDistorters[i]; } serializedObject.ApplyModifiedProperties(); }
private void EnsureSetup() { if (follower == null) { follower = transform; } if (source == null) { source = GetComponent <BaseMixedRealityLineDataProvider>(); } if (source == null) { Debug.LogError($"Missing a Mixed Reality Line Data Provider for Line Follower on {gameObject.name}"); } }
protected virtual void OnDrawGizmos() { if (UnityEditor.Selection.activeGameObject == gameObject || Application.isPlaying) { return; } if (lineDataSource == null) { lineDataSource = gameObject.GetComponent <BaseMixedRealityLineDataProvider>(); } if (lineDataSource == null || !lineDataSource.enabled) { return; } GizmosDrawLineRenderer(); }
protected virtual void OnSceneGUI() { if (DrawAttachPoints) { Handles.color = Color.Lerp(Color.clear, Color.red, 0.5f); float scale = externalPlot.ContentScale * 0.01f; ToolTipUtility.GetAttachPointPositions(ref localAttachPointPositions, externalPlot.LocalContentSize); foreach (Vector3 attachPoint in localAttachPointPositions) { Handles.SphereHandleCap(0, externalPlot.ContentParentTransform.TransformPoint(attachPoint), Quaternion.identity, scale, EventType.Repaint); } } if (DrawHandles) { ExternalPlot externalPlot = (ExternalPlot)target; float handleSize = 0; float arrowSize = 0; BaseMixedRealityLineDataProvider line = externalPlot.GetComponent <BaseMixedRealityLineDataProvider>(); if (line == null) { Handles.color = Color.white; Handles.DrawDottedLine(externalPlot.AnchorPosition, externalPlot.AttachPointPosition, 5f); } EditorGUI.BeginChangeCheck(); Handles.color = Color.cyan; handleSize = HandleUtility.GetHandleSize(externalPlot.PivotPosition) * handleSizeMultiplier; arrowSize = handleSize * 2; Vector3 newPivotPosition = Handles.FreeMoveHandle(externalPlot.PivotPosition, Quaternion.identity, handleSize, Vector3.zero, Handles.SphereHandleCap); Handles.ArrowHandleCap(0, newPivotPosition, Quaternion.LookRotation(Vector3.up), arrowSize, EventType.Repaint); Handles.ArrowHandleCap(0, newPivotPosition, Quaternion.LookRotation(Vector3.forward), arrowSize, EventType.Repaint); Handles.ArrowHandleCap(0, newPivotPosition, Quaternion.LookRotation(Vector3.right), arrowSize, EventType.Repaint); Handles.color = Color.white; Handles.Label(newPivotPosition + (Vector3.up * arrowSize), "Pivot", EditorStyles.whiteLabel); Handles.color = Color.cyan; handleSize = HandleUtility.GetHandleSize(externalPlot.AnchorPosition) * handleSizeMultiplier; arrowSize = handleSize * 2; Vector3 newAnchorPosition = Handles.FreeMoveHandle(externalPlot.AnchorPosition, Quaternion.identity, HandleUtility.GetHandleSize(externalPlot.AnchorPosition) * handleSizeMultiplier, Vector3.zero, Handles.SphereHandleCap); Handles.ArrowHandleCap(0, newAnchorPosition, Quaternion.LookRotation(Vector3.up), arrowSize, EventType.Repaint); Handles.ArrowHandleCap(0, newAnchorPosition, Quaternion.LookRotation(Vector3.forward), arrowSize, EventType.Repaint); Handles.ArrowHandleCap(0, newAnchorPosition, Quaternion.LookRotation(Vector3.right), arrowSize, EventType.Repaint); Handles.color = Color.white; Handles.Label(newAnchorPosition + (Vector3.up * arrowSize), "Anchor", EditorStyles.whiteLabel); if (EditorGUI.EndChangeCheck()) { if (newAnchorPosition != externalPlot.AnchorPosition) { Undo.RegisterCompleteObjectUndo(externalPlot.Anchor.transform, "Moved Anchor"); externalPlot.Anchor.transform.position = newAnchorPosition; } if (newPivotPosition != externalPlot.PivotPosition) { Undo.RegisterCompleteObjectUndo(externalPlot.Pivot.transform, "Moved Pivot"); externalPlot.Pivot.transform.position = newPivotPosition; } } if (EditAttachPoint) { EditorGUI.BeginChangeCheck(); Handles.color = Color.cyan; handleSize = HandleUtility.GetHandleSize(externalPlot.AttachPointPosition) * handleSizeMultiplier; arrowSize = handleSize * 2; Vector3 newAttachPointPosition = Handles.FreeMoveHandle(externalPlot.AttachPointPosition, Quaternion.identity, HandleUtility.GetHandleSize(externalPlot.AttachPointPosition) * handleSizeMultiplier, Vector3.zero, Handles.SphereHandleCap); Handles.ArrowHandleCap(0, newAttachPointPosition, Quaternion.LookRotation(Vector3.up), arrowSize, EventType.Repaint); Handles.ArrowHandleCap(0, newAttachPointPosition, Quaternion.LookRotation(Vector3.forward), arrowSize, EventType.Repaint); Handles.ArrowHandleCap(0, newAttachPointPosition, Quaternion.LookRotation(Vector3.right), arrowSize, EventType.Repaint); Handles.color = Color.white; Handles.Label(newAttachPointPosition + (Vector3.up * arrowSize), "Attach Point", EditorStyles.whiteLabel); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(externalPlot, "Moved Attach Point"); Undo.RegisterCompleteObjectUndo(externalPlot.Anchor.transform, "Moved Attach Point"); externalPlot.AttachPointPosition = newAttachPointPosition; } } } }
private void Awake() { RayLineData = RayLineData ?? GetComponent <BaseMixedRealityLineDataProvider>(); }