namespace DrawXXL { using UnityEngine; #if UNITY_EDITOR using UnityEditor; [CustomEditor(typeof(CrossProductVisualizer))] [CanEditMultipleObjects] public class CrossProductVisualizerInspector : VisualizerParentInspector { public override void OnInspectorGUI() { int indentLevel_before = EditorGUI.indentLevel; serializedObject.Update(); DrawConsumedLines("cross product"); SerializedProperty sP_colorOfVector1_forCrossProduct = serializedObject.FindProperty("colorOfVector1_forCrossProduct"); SerializedProperty sP_colorOfVector2_forCrossProduct = serializedObject.FindProperty("colorOfVector2_forCrossProduct"); SerializedProperty sP_colorOfResultVector_forCrossProduct = serializedObject.FindProperty("colorOfResultVector_forCrossProduct"); DrawSpecificationOf_customVector3_1("Input Vector 1 lhs (thumb of left hand)", false, null, false, false, true, false); DrawSpecificationOf_customVector3_2("Input Vector 2 rhs (index finger of left hand)", false, null, false, false, true, false); GUIStyle style_ofResultHeadline = new GUIStyle(); style_ofResultHeadline.richText = true; EditorGUILayout.LabelField("Cross Product Result (middle finger of left hand)", style_ofResultHeadline); EditorGUI.indentLevel++; Vector3 vector1_lhs_leftThumb = visualizerParentMonoBehaviour_unserialized.Get_customVector3_1_inGlobalSpaceUnits(); Vector3 vector2_rhs_leftIndexFinger = visualizerParentMonoBehaviour_unserialized.Get_customVector3_2_inGlobalSpaceUnits(); Vector3 crossProductResult = Vector3.Cross(vector1_lhs_leftThumb, vector2_rhs_leftIndexFinger); EditorGUILayout.Vector3Field(GUIContent.none, crossProductResult); EditorGUI.indentLevel--; GUILayout.Space(EditorGUIUtility.singleLineHeight); DrawColorSection(sP_colorOfVector1_forCrossProduct, sP_colorOfVector2_forCrossProduct, sP_colorOfResultVector_forCrossProduct); EditorGUILayout.PropertyField(serializedObject.FindProperty("linesWidth"), new GUIContent("Lines width")); Draw_DrawPosition3DOffset(); DrawCheckboxFor_drawOnlyIfSelected("cross product"); DrawCheckboxFor_hiddenByNearerObjects("cross product"); serializedObject.ApplyModifiedProperties(); EditorGUI.indentLevel = indentLevel_before; } void DrawColorSection(SerializedProperty sP_colorOfVector1_forCrossProduct, SerializedProperty sP_colorOfVector2_forCrossProduct, SerializedProperty sP_colorOfResultVector_forCrossProduct) { SerializedProperty sP_colorSection_isOutfolded = serializedObject.FindProperty("colorSection_isOutfolded"); sP_colorSection_isOutfolded.boolValue = EditorGUILayout.Foldout(sP_colorSection_isOutfolded.boolValue, "Colors", true); if (sP_colorSection_isOutfolded.boolValue) { EditorGUI.indentLevel++; SerializedProperty sP_colorOfAngle_forCrossProduct = serializedObject.FindProperty("colorOfAngle_forCrossProduct"); SerializedProperty sP_colorOfResultText_forCrossProduct = serializedObject.FindProperty("colorOfResultText_forCrossProduct"); SerializedProperty sP_colorOfResultPlane_forCrossProduct = serializedObject.FindProperty("colorOfResultPlane_forCrossProduct"); EditorGUILayout.PropertyField(sP_colorOfVector1_forCrossProduct, new GUIContent("Input Vector 1 (lhs)")); EditorGUILayout.PropertyField(sP_colorOfVector2_forCrossProduct, new GUIContent("Input Vector 2 (rhs)")); EditorGUILayout.PropertyField(sP_colorOfResultVector_forCrossProduct, new GUIContent("Result Vector")); EditorGUILayout.PropertyField(sP_colorOfResultText_forCrossProduct, new GUIContent("Result Text")); EditorGUILayout.PropertyField(sP_colorOfResultPlane_forCrossProduct, new GUIContent("Result Plane")); EditorGUILayout.PropertyField(sP_colorOfAngle_forCrossProduct, new GUIContent("Angle")); EditorGUI.indentLevel--; GUILayout.Space(EditorGUIUtility.singleLineHeight); } } } #endif }