//void ShowValueEvent(ValueListener Valuelistener, int i) //{ // EditorGUILayout.BeginHorizontal(); // drive.ValueEventsBools[i] = EditorGUILayout.BeginFoldoutHeaderGroup(drive.ValueEventsBools[i], "Positive Bounds"); // EditorGUILayout.EndFoldoutHeaderGroup(); // ShowRangeArea(ref valueEvent); // if (ShowRemoveButton(valueEvent)) // return null; // EditorGUILayout.EndHorizontal(); // if (drive.ValueEventsBools[i]) // ShowValueEvents(valueEvent.booleanAction); // return valueEvent; //} //private void ShowValueEvents(BooleanAction booleanAction) //{ // var serializedAction = new SerializedObject(booleanAction); // var activated = serializedAction.FindProperty("Activated"); // var valueChanged = serializedAction.FindProperty("ValueChanged"); // var deactivated = serializedAction.FindProperty("Deactivated"); // EditorGUILayout.PropertyField(activated); // EditorGUILayout.PropertyField(valueChanged); // EditorGUILayout.PropertyField(deactivated); // serializedAction.ApplyModifiedProperties(); //} //void ShowRangeArea(ref FloatRangeListener rangeListener) //{ // MyEditorTools.BeginHorizontal(); // FloatRange tempRange = rangeListener; // tempRange.minimum = EditorGUILayout.FloatField(tempRange.minimum, EditorStyles.numberField, miniFeildWidth); // EditorGUILayout.MinMaxSlider(ref tempRange.minimum, ref tempRange.maximum, 0, 1); // tempRange.maximum = EditorGUILayout.FloatField(tempRange.maximum, EditorStyles.numberField, miniFeildWidth); // if (tempRange.maximum > 1) // tempRange.maximum = 1; // valueEvent.floatToBoolean.SetActivationRange(tempRange); // MyEditorTools.EndHorizontal(); //} //bool ShowRemoveButton(ValueListener listener) //{ // if (GUILayout.Button("-", EditorStyles.miniButtonLeft, miniButtonWidth)) // { // //RemoveMap(mapping); // return true; // } // return false; //} private void OnSceneGUI() { drive = (DrivePort)target; if (drive.driveType == DrivePort.DriveTypes.Directional) { Vector3 center = drive.transform.position; Quaternion rot = drive.transform.localRotation; dirHandle.axes = drive.axis; EditorGUI.BeginChangeCheck(); driveBounds = new Bounds(drive.transform.position, drive.range); var newBounds = dirHandle.DrawHandle(drive.transform.position, rot, drive.range, drive.axis); if (!newBounds.Equals(driveBounds)) { Undo.RecordObject(drive, "Update Center and Range"); Undo.RecordObject(drive.transform, "Update Center and Range"); drive.transform.position = drive.transform.localToWorldMatrix.MultiplyPoint3x4(newBounds.center); drive.range = newBounds.size; } } else if (drive.driveType == DrivePort.DriveTypes.Rotational) { RotationalDriveHandle.QuanternionViewer(drive.transform.position, drive.transform.rotation, drive.targetIndex); } //RotationalDriveHandle.QuanternionViewer(drive.globalStart, drive.transform.rotation, Vector3.zero); }
public override void OnInspectorGUI() { windowSkin = new GUIStyle(GUI.skin.window); windowSkin.alignment = TextAnchor.UpperLeft; windowSkin.padding = new RectOffset(20, 0, 0, 0); base.OnInspectorGUI(); drive = (DrivePort)target; SerializedProperty size = serializedObject.FindProperty("range"); SerializedProperty axisValueEvents = serializedObject.FindProperty("axisValueEvents"); SerializedProperty vec3ValueEvents = serializedObject.FindProperty("vec3ValueEvents"); for (int i = 0; i < axisValueEvents.arraySize; i++) { SerializedProperty valueListener = axisValueEvents.GetArrayElementAtIndex(i); ShowValueListener(valueListener); } for (int i = 0; i < vec3ValueEvents.arraySize; i++) { SerializedProperty valueListener = vec3ValueEvents.GetArrayElementAtIndex(i); ShowValueListener(valueListener); } GUILayout.Label($"Axis Listeners: {axisValueEvents.arraySize} \n" + $"regular float listners {vec3ValueEvents.arraySize}"); //GUILayout.Label($"{(InputManagerNew.hands)handedness.intValue} InputManager Maps: " + // $"{inputMappingsProperty.arraySize}, Interactor: {manager.interactor != null} " + // $"(grabMap({manager.grabMap != null}))"); if (GUILayout.Button("Add FloatRange")) { drive.gameObject.AddComponent <AxisValueListener>(); } if (GUILayout.Button("Add Vector3 Range")) { drive.gameObject.AddComponent <Vector3RangeListener>(); } }