Exemple #1
0
    // ######################## UNITY EVENT FUNCTIONS ######################## //
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUI.BeginChangeCheck();
        MultiObjectEditorGUI.Vector3Field(serializedObject, "_size", "Size");
        if (EditorGUI.EndChangeCheck())
        {
            UpdateVolumes();
        }

        EditorGUI.BeginChangeCheck();
        SerializedProperty pivot = serializedObject.FindProperty("_pivot");

        EditorGUI.showMixedValue = pivot.hasMultipleDifferentValues;
        Vector3 p = EditorGUILayout.Vector3Field("Pivot", pivot.vector3Value);

        EditorGUI.showMixedValue = false;
        if (EditorGUI.EndChangeCheck())
        {
            p.x = Mathf.Clamp01(p.x);
            p.y = Mathf.Clamp01(p.y);
            p.z = Mathf.Clamp01(p.z);
            pivot.vector3Value = p;
            UpdateVolumes();
        }

        if (GUILayout.Button(new GUIContent("Update",
                                            "Click when you added Objects to the Clip Volume or when the Changes you did to the Size did not affect rendering for some reason to Update manually (note that this is purely for convenience in the Editor, as soon as you enter playmode everything will update automatically)"))
            )
        {
            UpdateVolumes();
        }
        serializedObject.ApplyModifiedProperties();
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        SpriteSwapper spriteSwapper = (SpriteSwapper)target;

        MultiObjectEditorGUI.ObjectField(serializedObject, "HighlightedSprite", "Highlighted Sprite", typeof(Sprite), true);
        MultiObjectEditorGUI.ObjectField(serializedObject, "PressedSprite", "Pressed Sprite", typeof(Sprite), true);
        MultiObjectEditorGUI.ObjectField(serializedObject, "DisabledSprite", "Disabled Sprite", typeof(Sprite), true);
        serializedObject.ApplyModifiedProperties();
    }
Exemple #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUI.BeginChangeCheck();

        MultiObjectEditorGUI.FloatField(serializedObject, "_projectionDist", "Projection Distance");


        EditorGUILayout.BeginHorizontal();

        EditorGUIUtility.labelWidth = 70;
        EditorGUILayout.LabelField("W Rotation");
        EditorGUIUtility.labelWidth = 30;

        SerializedProperty wRot = serializedObject.FindProperty("_wRot");

        MultiObjectEditorGUI.FloatField(wRot.FindPropertyRelative("XW"), "XW");
        MultiObjectEditorGUI.FloatField(wRot.FindPropertyRelative("YW"), "YW");
        MultiObjectEditorGUI.FloatField(wRot.FindPropertyRelative("ZW"), "ZW");
        EditorGUIUtility.labelWidth = 0;

        EditorGUILayout.EndHorizontal();



        if (EditorGUI.EndChangeCheck() || Event.current.keyCode == KeyCode.Return)
        {
            foreach (Object t in targets)
            {
                Hypercube tess = t as Hypercube;
                tess.UpdateMesh();
            }
        }

        serializedObject.ApplyModifiedProperties();
    }
Exemple #4
0
    public override void OnInspectorGUI()
    {
        // update serializedObject and get path
        serializedObject.Update();
        _path = target as Path;


        // display presampling options
        EditorGUILayout.LabelField("Presampling", EditorStyles.whiteLabel);
        AutoPresampleInEditMode =
            EditorGUILayout.Toggle(new GUIContent("Auto Presample in Editmode", "If true, the Path gets automatically presampled for uniform interpolation along it whenever something changes"),
                                   AutoPresampleInEditMode);

        EditorGUILayout.Space();
        EditorGUI.BeginChangeCheck();
        bool autoPresample =
            EditorGUILayout.Toggle(new GUIContent("Auto Presample in Playmode", "If true, the Path gets automatically presampled for uniform interpolation along it whenever something changes"),
                                   _path.AutoPresample);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(_path, "Toggle Auto Presample");
            EditorUtility.SetDirty(_path);
            _path.AutoPresample = autoPresample;
        }


        MultiObjectEditorGUI.Toggle(serializedObject, "_presampleOnAwake",
                                    new GUIContent("Presample On Awake", "If true, the Path gets automatically presampled for uniform interpolation along it on Awake"));

        MultiObjectEditorGUI.FloatField(serializedObject, "_presampleSearchStepSize",
                                        new GUIContent("Search Step Size", "Interpolation step size relativ to the path length for resampling for uniform interpolation"));
        MultiObjectEditorGUI.IntField(serializedObject, "_presampleResolution", new GUIContent("Presample Resolution", "Resolution of the presampled curve for uniform interpolation"));
        if (GUILayout.Button("Delete Presampeled Points"))
        {
            Undo.RecordObject(_path, "Delete Presample");
            SerializedProperty linearPoints = serializedObject.FindProperty("LinearPoints");
            linearPoints.ClearArray();
            EditorUtility.SetDirty(_path);
        }



        GUILayout.Space(50);


        // looping
        EditorGUI.BeginChangeCheck();
        bool loop = EditorGUILayout.Toggle("Loop", _path.IsLoop);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(_path, "Toggle Loop");
            EditorUtility.SetDirty(_path);
            _path.IsLoop = loop;
            if (AutoPresampleInEditMode)
            {
                _path.Presample();
            }
        }


        // display inspector for the currently selected point
        if (SelectedIndex >= 0 && SelectedIndex < _path.ControlPointCount)
        {
            DrawSelectedPointInspector();
            EditorGUILayout.Space();
        }

        // buttons
        if (GUILayout.Button("Add Segment"))
        {
            Undo.RecordObject(_path, "Add Segment");
            _path.AddSegment();
            EditorUtility.SetDirty(_path);
            if (AutoPresampleInEditMode)
            {
                _path.Presample();
            }
        }

        if (GUILayout.Button("Remove Segment"))
        {
            Undo.RecordObject(_path, "Remove Segment");
            _path.RemoveSegment();
            EditorUtility.SetDirty(_path);
            if (AutoPresampleInEditMode)
            {
                _path.Presample();
            }
        }

        EditorGUILayout.Space();
        if (GUILayout.Button(new GUIContent("Presample", "This calculates a number of points along the path to allow uniform interpolation along the path"), GUILayout.Height(50)))
        {
            Undo.RecordObject(_path, "Presample Path");
            _path.Presample();
            EditorUtility.SetDirty(_path);
        }

        // save serialized Object
        serializedObject.ApplyModifiedProperties();
    }