Пример #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            base.OnInspectorGUI();

            ShapeEditors.ArcShapeEditor(angleA, angleB, radius, segments);
            ShapeEditors.RendererEditor(colorMode, blendMode, color, colorsList, gradient, rendererType, billboardMethod, quadLineAlignment, quadLineThickness);

            if (EditorGUI.EndChangeCheck())
            {
                arcShape.MarkDirty();
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #2
0
        public override void OnEnable()
        {
            base.OnEnable();

            arcShape = ((ArcShapeSO)scriptableObject).shape;

            angleA   = shape.FindPropertyRelative("angleA");
            angleB   = shape.FindPropertyRelative("angleB");
            radius   = shape.FindPropertyRelative("radius");
            segments = shape.FindPropertyRelative("segments");

            colorMode         = shape.FindPropertyRelative("colorMode");
            blendMode         = shape.FindPropertyRelative("blendMode");
            color             = shape.FindPropertyRelative("color");
            colors            = shape.FindPropertyRelative("colors");
            gradient          = shape.FindPropertyRelative("gradient");
            rendererType      = shape.FindPropertyRelative("rendererType");
            billboardMethod   = shape.FindPropertyRelative("billboardMethod");
            quadLineAlignment = shape.FindPropertyRelative("quadLineAlignment");
            quadLineThickness = shape.FindPropertyRelative("quadLineThickness");

            colorsList = new ReorderableList(serializedObject, colors, true, true, true, true)
            {
                drawHeaderCallback  = (Rect rect) => { EditorGUI.LabelField(rect, $"Colors ({colors.arraySize})"); },
                drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    rect.y     += 2;
                    rect.height = EditorGUIUtility.singleLineHeight;
                    EditorGUI.PropertyField(rect, colors.GetArrayElementAtIndex(index));
                    rect.y += 2;
                },
                onReorderCallback = (ReorderableList list) => { arcShape.MarkDirty(); }
            };
            colorsList.list = arcShape.colors;

            SceneView.duringSceneGui += DuringSceneGUI;
        }