コード例 #1
0
        void drawSplineMode(ClayObject clayObj)
        {
            EditorGUI.BeginChangeCheck();

            int subdivs = EditorGUILayout.IntField("subdivs", clayObj.getSplineSubdiv());

            var list = this.serializedObject.FindProperty("splinePoints");

            EditorGUILayout.PropertyField(list, new GUIContent("spline points"), true);

            if (EditorGUI.EndChangeCheck())
            {
                this.serializedObject.ApplyModifiedProperties();

                clayObj.setSplineSubdiv(subdivs);

                UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
            }
        }
コード例 #2
0
        void drawSplineMode(ClayObject clayObj)
        {
            EditorGUI.BeginChangeCheck();

            int subdivs = EditorGUILayout.IntField("subdivs", clayObj.getSplineSubdiv());

            GUILayout.BeginHorizontal();

            int numPoints = clayObj.splinePoints.Count - 2;

            EditorGUILayout.LabelField("control points: " + numPoints);

            if (GUILayout.Button(new GUIContent("+", "")))
            {
                clayObj.addSplineControlPoint();
            }

            if (GUILayout.Button(new GUIContent("-", "")))
            {
                clayObj.removeLastSplineControlPoint();
            }

            GUILayout.EndHorizontal();

            // var list = this.serializedObject.FindProperty("splinePoints");
            // EditorGUILayout.PropertyField(list, new GUIContent("spline points"), true);

            if (EditorGUI.EndChangeCheck())
            {
                // this.serializedObject.ApplyModifiedProperties();

                clayObj.setSplineSubdiv(subdivs);

                UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
            }
        }