Beispiel #1
0
        private void DrawProceduralField(TilesetBrush brush, Tileset tileset)
        {
            using (var content = ControlContent.WithTrailableTip(
                       TileLang.ParticularText("Property", "Procedural"),
                       TileLang.Text("Allows individual atlas brushes to override property of tileset.")
                       )) {
                // Need to make width of "Procedural" popup shorter.
                GUILayout.BeginHorizontal(GUILayout.Width(200));
                InheritYesNo newProcedural = (InheritYesNo)EditorGUILayout.EnumPopup(content, brush.procedural);
                if (newProcedural != brush.procedural)
                {
                    brush.procedural = newProcedural;

                    if (!brush.IsProcedural)
                    {
                        // Ensure that required procedural mesh exists!
                        if (BrushUtility.EnsureTilesetMeshExists(tileset, brush.tileIndex))
                        {
                            AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(tileset.tileMeshAsset));
                        }
                    }
                }

                Rect position = GUILayoutUtility.GetLastRect();
                GUI.Label(new Rect(position.x + position.width, position.y, 100, position.height), "= " + (brush.IsProcedural ? TileLang.Text("Procedural") : TileLang.Text("Non-Procedural")), EditorStyles.miniLabel);

                GUILayout.EndHorizontal();

                ExtraEditorGUI.TrailingTip(content);
            }
        }
Beispiel #2
0
        protected virtual void DrawTilesetBrushInfoActions()
        {
            this.DrawProceduralField(this.TilesetBrush, this.TilesetBrush.Tileset);

            if (this.TilesetBrush.Tileset.GetTileMesh(this.TilesetBrush.tileIndex) != null)
            {
                RotorzEditorGUI.MiniFieldDescription(TileLang.Text("Non-procedural mesh has been generated."));
            }
            else if (!this.TilesetBrush.IsProcedural)
            {
                EditorGUILayout.HelpBox(TileLang.Text("Non-procedural mesh asset is missing."), MessageType.Warning, true);
                if (GUILayout.Button(TileLang.ParticularText("Action", "Repair")))
                {
                    // Ensure that required procedural mesh exists!
                    if (BrushUtility.EnsureTilesetMeshExists(this.TilesetBrush.Tileset, this.TilesetBrush.tileIndex))
                    {
                        AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(this.TilesetBrush.Tileset.tileMeshAsset));
                    }

                    GUIUtility.ExitGUI();
                }
            }
        }