Пример #1
0
        private void DrawAtlasDetailsGUI()
        {
            bool invalidateMetrics = false;

            this.clearPreviews = false;

            GUILayout.BeginHorizontal();
            {
                EditorGUI.BeginChangeCheck();
                {
                    this.DrawAtlasTextureField();
                    GUILayout.Space(15f);
                    this.DrawAtlasParametersGUI();
                    GUILayout.Space(20f);
                    this.DrawEdgeCorrectionGUI();
                    GUILayout.FlexibleSpace();
                }
                invalidateMetrics = EditorGUI.EndChangeCheck();
            }
            GUILayout.EndHorizontal();

            // Metrics must be recalculated if any changes have been made.
            if (this.clearPreviews || invalidateMetrics)
            {
                AutotileExpanderUtility.ApplyTileSizeConstraints(s_SelectedAutotileLayout, this.autotileTextureUncompressed, s_InnerJoins, ref this.tileWidth, ref this.tileHeight, ref s_BorderSize);
                this.RecalculateMetrics();

                // Previews only need to be refreshed when tile size or atlas is changed.
                if (this.clearPreviews)
                {
                    this.ClearExpandedAutotileArtwork();
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Apply constraints to tile width, height and border inputs.
 /// </summary>
 private void ApplyAutotileConstraintsToInputs()
 {
     AutotileExpanderUtility.ApplyTileSizeConstraints(
         layout: this.autotileTileset.AutotileLayout,
         artwork: this.inputNewAutotileArtworkUncompressed,
         innerJoins: this.autotileTileset.HasInnerJoins,
         tileWidth: ref this.inputTileWidth,
         tileHeight: ref this.inputTileHeight,
         border: ref this.inputBorderSize
         );
 }
Пример #3
0
        private void ExpandAutotileArtwork(int borderSize = 0)
        {
            this.ClearExpandedAutotileArtwork();

            AutotileExpanderUtility.ApplyTileSizeConstraints(s_SelectedAutotileLayout, this.autotileTextureUncompressed, s_InnerJoins, ref this.tileWidth, ref this.tileHeight, ref s_BorderSize);

            if (this.autotileTextureUncompressed != null)
            {
                this.atlasTexture           = AutotileExpanderUtility.ExpandAutotileArtwork(s_SelectedAutotileLayout, this.autotileTextureUncompressed, this.tileWidth, this.tileHeight, s_InnerJoins, borderSize, s_EnableClampEdges);
                this.atlasTexture.hideFlags = HideFlags.HideAndDontSave;
            }

            int atlasWidth = 0, atlasHeight = 0;

            if (this.atlasTexture != null)
            {
                atlasWidth  = this.atlasTexture.width;
                atlasHeight = this.atlasTexture.height;
            }

            this.metrics.Calculate(atlasWidth, atlasHeight, this.tileWidth, this.tileHeight, borderSize, s_Delta);
        }