示例#1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            var standing = target as UncroppedStanding;

            useCaptureBox = GUILayout.Toggle(useCaptureBox, "Use Capture Box");
            if (useCaptureBox)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Capture Box");
                captureBox = EditorGUILayout.RectIntField(captureBox);
                GUILayout.EndHorizontal();
            }

            if (GUILayout.Button("Auto Crop All"))
            {
                foreach (var cropper in standing.GetComponentsInChildren <SpriteCropper>())
                {
                    var texture = cropper.sprite.texture;
                    if (useCaptureBox)
                    {
                        cropper.boundRect.xMin = captureBox.xMin;
                        cropper.boundRect.yMin = texture.height - captureBox.yMax;
                        cropper.boundRect.size = captureBox.size;
                    }
                    else
                    {
                        cropper.boundRect.min    = Vector2Int.zero;
                        cropper.boundRect.width  = texture.width;
                        cropper.boundRect.height = texture.height;
                    }

                    SpriteCropperEditor.AutoCrop(cropper);
                }
            }

            if (GUILayout.Button("Write Cropped Textures"))
            {
                WriteCroppedTexture(standing);
            }

            if (GUILayout.Button("Generate Metadata"))
            {
                GenerateMetadata(standing);
            }
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var standing = target as UncroppedStanding;

            if (GUILayout.Button("Auto Crop All"))
            {
                foreach (var cropper in standing.GetComponentsInChildren <SpriteCropper>())
                {
                    SpriteCropperEditor.AutoCrop(cropper);
                }
            }

            if (GUILayout.Button("Write Cropped Textures"))
            {
                WriteCropResult(standing);
            }

            if (GUILayout.Button("Generate Metadata"))
            {
                GenerateMetaData(standing);
            }
        }