protected override void OnGUI(Rect position, GUIContent label) { position = BeginLabeledBlock(metadata, position, label); Vector3 newValue; if (adaptiveWidth) { newValue = LudiqGUI.AdaptiveVector3Field(position, GUIContent.none, (Vector3)metadata.value); } else if (position.width <= Styles.compactThreshold) { newValue = LudiqGUI.CompactVector3Field(position, GUIContent.none, (Vector3)metadata.value); } else { newValue = EditorGUI.Vector3Field(position, GUIContent.none, (Vector3)metadata.value); } if (EndBlock(metadata)) { metadata.RecordUndo(); metadata.value = newValue; } }
protected override void OnControlGUI(Rect position) { EditorGUI.BeginChangeCheck(); Vector3 newValue; if (adaptiveWidth) { newValue = LudiqGUI.AdaptiveVector3Field(position, GUIContent.none, (Vector3)accessor.value); } else if (position.width <= Styles.compactThreshold) { newValue = LudiqGUI.CompactVector3Field(position, GUIContent.none, (Vector3)accessor.value); } else { newValue = EditorGUI.Vector3Field(position, GUIContent.none, (Vector3)accessor.value); } if (EditorGUI.EndChangeCheck()) { accessor.RecordUndo(); accessor.value = newValue; } }
protected override void OnGUI(Rect position, GUIContent label) { position = BeginBlock(metadata, position, label); var originPosition = new Rect ( position.x, position.y, position.width, EditorGUIUtility.singleLineHeight ); var directionPosition = new Rect ( position.x, originPosition.yMax + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight ); using (LudiqGUIUtility.labelWidth.Override(16)) { originPosition = PrefixLabel(metadata["origin"], originPosition, new GUIContent("O", "Origin")); directionPosition = PrefixLabel(metadata["direction"], directionPosition, new GUIContent("D", "Direction")); } Vector3 newOrigin; Vector3 newDirection; if (wideMode) { newOrigin = EditorGUI.Vector3Field(originPosition, GUIContent.none, (Vector3)metadata["origin"].value); newDirection = EditorGUI.Vector3Field(directionPosition, GUIContent.none, (Vector3)metadata["direction"].value); } else { newOrigin = LudiqGUI.CompactVector3Field(originPosition, GUIContent.none, (Vector3)metadata["origin"].value); newDirection = LudiqGUI.CompactVector3Field(directionPosition, GUIContent.none, (Vector3)metadata["direction"].value); } if (EndBlock(metadata)) { metadata.RecordUndo(); metadata.value = new Ray(newOrigin, newDirection); } }
protected override void OnControlGUI(Rect position) { EditorGUI.BeginChangeCheck(); var originPosition = new Rect ( position.x, position.y, position.width, EditorGUIUtility.singleLineHeight ); var directionPosition = new Rect ( position.x, originPosition.yMax + EditorGUIUtility.standardVerticalSpacing, position.width, EditorGUIUtility.singleLineHeight ); using (LudiqGUIUtility.labelWidth.Override(16)) { originPosition = PrefixLabel(originPosition, new GUIContent("O", "Origin")); directionPosition = PrefixLabel(directionPosition, new GUIContent("D", "Direction")); } Vector3 newOrigin; Vector3 newDirection; if (wideMode) { newOrigin = EditorGUI.Vector3Field(originPosition, GUIContent.none, (Vector3)originAccessor.value); newDirection = EditorGUI.Vector3Field(directionPosition, GUIContent.none, (Vector3)directionAccessor.value); } else { newOrigin = LudiqGUI.CompactVector3Field(originPosition, GUIContent.none, (Vector3)originAccessor.value); newDirection = LudiqGUI.CompactVector3Field(directionPosition, GUIContent.none, (Vector3)directionAccessor.value); } if (EditorGUI.EndChangeCheck()) { accessor.RecordUndo(); accessor.value = new Ray(newOrigin, newDirection); } }