Beispiel #1
0
        private void DrawTab1()
        {
            ValidatePaintables();

            if (paintables.Count > 0)
            {
                paintableIndex = P3dHelper.Mod(paintableIndex, paintables.Count);

                var paintable = paintables[paintableIndex];

                EditorGUILayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(paintables.Count <= 1);
                if (GUILayout.Button("<", GUILayout.Width(20.0f)))
                {
                    paintableIndex -= 1; Repaint();
                }
                EditorGUI.EndDisabledGroup();
                if (GUILayout.Button((paintableIndex + 1) + "/" + paintables.Count + " " + paintable.Root.name))
                {
                    Selection.activeGameObject = paintable.Root; EditorGUIUtility.PingObject(paintable.Root);
                }
                EditorGUI.BeginDisabledGroup(paintables.Count <= 1);
                if (GUILayout.Button(">", GUILayout.Width(20.0f)))
                {
                    paintableIndex += 1; Repaint();
                }
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.EndHorizontal();

                if (CanPaint() == false)
                {
                    EditorGUILayout.HelpBox("Pick a texture you want to paint by expanding it and then locking it.", MessageType.Info);
                }

                var renderer  = paintable.Root.GetComponent <Renderer>();
                var materials = renderer.sharedMaterials;

                for (var i = 0; i < materials.Length; i++)
                {
                    EditorGUILayout.Separator();

                    materials[i] = DrawMaterial(paintable, materials[i], i);
                }

                renderer.sharedMaterials = materials;
            }
            else
            {
                EditorGUILayout.HelpBox("Before you can pick a texture, you need to lock at least one object.", MessageType.Info);
            }
        }