Crop Stomp: HD textures! + animation tweaks

This commit is contained in:
Jenny Crowe 2022-03-16 02:40:53 -07:00
parent 8455cc4c30
commit b849c9e426
11 changed files with 409 additions and 317 deletions

View file

@ -0,0 +1,78 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class SpritesheetScaler : EditorWindow {
Object source;
int multiplier = 1;
// Creates a new option in "Windows"
[MenuItem ("Window/Scale spritesheet pivots and slices")]
static void Init () {
// Get existing open window or if none, make a new one:
SpritesheetScaler window = (SpritesheetScaler)EditorWindow.GetWindow (typeof (SpritesheetScaler));
window.Show();
}
void OnGUI () {
GUILayout.BeginHorizontal ();
GUILayout.Label ("Source texture:", EditorStyles.boldLabel);
source = EditorGUILayout.ObjectField(source, typeof(Texture2D), false, GUILayout.Width(220));
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
GUILayout.Label ("Multiplier:", EditorStyles.boldLabel);
multiplier = EditorGUILayout.IntField(multiplier, GUILayout.Width(220));
GUILayout.EndHorizontal ();
GUILayout.Space (25f);
if (GUILayout.Button ("Scale pivots and slices")) {
ScalePivotsAndSlices();
}
}
void ScalePivotsAndSlices()
{
if (!source || (multiplier <= 0)) {
Debug.Log("Missing one object");
return;
}
if (source.GetType () != typeof(Texture2D)) {
Debug.Log (source + "needs to be Texture2D!");
return;
}
string sourcePath = AssetDatabase.GetAssetPath(source);
TextureImporter ti1 = AssetImporter.GetAtPath(sourcePath) as TextureImporter;
bool wasReadable = ti1.isReadable;
ti1.isReadable = true;
ti1.spritePixelsPerUnit *= multiplier;
List <SpriteMetaData> newData = new List <SpriteMetaData> ();
Debug.Log ("Amount of slices found: " + ti1.spritesheet.Length);
for (int i = 0; i < ti1.spritesheet.Length; i++) {
SpriteMetaData d = ti1.spritesheet[i];
d.rect = ScaleRect(d.rect, multiplier);
d.border *= multiplier;
newData.Add(d);
}
ti1.spritesheet = newData.ToArray();
ti1.isReadable = wasReadable;
AssetDatabase.ImportAsset(sourcePath, ImportAssetOptions.ForceUpdate);
}
Rect ScaleRect(Rect source, int mult)
{
var newRect = new Rect();
newRect.Set(source.x * mult, source.y * mult, source.width * mult, source.height * mult);
return newRect;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1392057031b1d5a4ab986a08bbbf92d8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -575,7 +575,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3306990414045802303}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.06, z: 0}
m_LocalPosition: {x: 0, y: 0.05, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5949227026914035662}

View file

@ -20,7 +20,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.23, y: 0.385, z: 0}
value: {x: 0.227, y: 0.42, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -29,7 +29,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.033333335
value: {x: 0.26, y: 0.395, z: 0}
value: {x: 0.26, y: 0.433, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -38,7 +38,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.05
value: {x: 0.26, y: 0.395, z: 0}
value: {x: 0.26, y: 0.425, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -47,7 +47,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.06666667
value: {x: 0.285, y: 0.395, z: 0}
value: {x: 0.28, y: 0.415, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -271,7 +271,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.23
value: 0.227
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -298,7 +298,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.06666667
value: 0.285
value: 0.28
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -317,7 +317,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.385
value: 0.42
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -326,7 +326,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.033333335
value: 0.395
value: 0.433
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -335,7 +335,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.395
value: 0.425
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -344,7 +344,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.06666667
value: 0.395
value: 0.415
inSlope: Infinity
outSlope: Infinity
tangentMode: 103

View file

@ -63,7 +63,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.125, y: 0.125, z: 0}
value: {x: 0.13, y: 0.125, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -72,7 +72,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.05
value: {x: 0.12, y: 0.145, z: 0}
value: {x: 0.128, y: 0.14, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -81,7 +81,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.1
value: {x: 0.125, y: 0.155, z: 0}
value: {x: 0.136, y: 0.15, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -90,7 +90,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.15
value: {x: 0.12, y: 0.145, z: 0}
value: {x: 0.122, y: 0.145, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -314,7 +314,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.125
value: 0.13
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -323,7 +323,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.12
value: 0.128
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -332,7 +332,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.1
value: 0.125
value: 0.136
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -341,7 +341,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.15
value: 0.12
value: 0.122
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -369,7 +369,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.145
value: 0.14
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -378,7 +378,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.1
value: 0.155
value: 0.15
inSlope: Infinity
outSlope: Infinity
tangentMode: 103

View file

@ -63,7 +63,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.09, y: 0.085, z: 0}
value: {x: 0.098, y: 0.12, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -72,7 +72,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.05
value: {x: 0.115, y: 0.085, z: 0}
value: {x: 0.119, y: 0.115, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -81,7 +81,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.1
value: {x: 0.09, y: 0.115, z: 0}
value: {x: 0.096, y: 0.14, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -90,7 +90,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.15
value: {x: 0.095, y: 0.115, z: 0}
value: {x: 0.102, y: 0.15, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -314,7 +314,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.09
value: 0.098
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -323,7 +323,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.115
value: 0.119
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -332,7 +332,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.1
value: 0.09
value: 0.096
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -341,7 +341,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.15
value: 0.095
value: 0.102
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -360,7 +360,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.085
value: 0.12
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -369,7 +369,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.085
value: 0.115
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -378,7 +378,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.1
value: 0.115
value: 0.14
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -387,7 +387,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.15
value: 0.115
value: 0.15
inSlope: Infinity
outSlope: Infinity
tangentMode: 103

View file

@ -63,7 +63,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.035, y: 0.02, z: 0}
value: {x: 0.039, y: 0.02, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -72,7 +72,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.016666668
value: {x: 0, y: 0, z: 0}
value: {x: 0.004, y: -0.01, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -81,7 +81,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.05
value: {x: 0.01, y: 0, z: 0}
value: {x: 0.015, y: 0, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -90,7 +90,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.083333336
value: {x: 0, y: 0, z: 0}
value: {x: -0.005, y: 0.025, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -305,7 +305,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.035
value: 0.039
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -314,7 +314,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.016666668
value: 0
value: 0.004
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -323,7 +323,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.01
value: 0.015
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -332,7 +332,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
value: -0.005
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -360,7 +360,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.016666668
value: 0
value: -0.01
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -378,7 +378,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
value: 0.025
inSlope: Infinity
outSlope: Infinity
tangentMode: 103

View file

@ -63,7 +63,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.045, y: 0.06, z: 0}
value: {x: 0.045, y: 0.03, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -81,7 +81,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.05
value: {x: 0.005, y: 0.01, z: 0}
value: {x: 0.008, y: 0.01, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -332,7 +332,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.05
value: 0.005
value: 0.008
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -360,7 +360,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.06
value: 0.03
inSlope: Infinity
outSlope: Infinity
tangentMode: 103

View file

@ -63,7 +63,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.2, y: -0.2, z: 0}
value: {x: 0.21, y: -0.2, z: 0}
inSlope: {x: Infinity, y: Infinity, z: 0}
outSlope: {x: Infinity, y: Infinity, z: 0}
tangentMode: 0
@ -72,7 +72,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.4
value: {x: 0.1, y: -0.17, z: 0}
value: {x: 0.103, y: -0.17, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -81,7 +81,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.43333334
value: {x: 0.045, y: -0.02, z: 0}
value: {x: 0.05, y: -0.02, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -90,7 +90,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.46666667
value: {x: 0, y: 0.08, z: 0}
value: {x: 0.006, y: 0.04, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -314,7 +314,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.2
value: 0.21
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -323,7 +323,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.4
value: 0.1
value: 0.103
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -332,7 +332,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.43333334
value: 0.045
value: 0.05
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -341,7 +341,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.46666667
value: 0
value: 0.006
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -387,7 +387,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.46666667
value: 0.08
value: 0.04
inSlope: Infinity
outSlope: Infinity
tangentMode: 103

View file

@ -63,7 +63,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0.2, y: -0.18, z: 0}
value: {x: 0.204, y: -0.15, z: 0}
inSlope: {x: Infinity, y: Infinity, z: 0}
outSlope: {x: Infinity, y: Infinity, z: 0}
tangentMode: 0
@ -72,7 +72,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.4
value: {x: 0.1, y: -0.14, z: 0}
value: {x: 0.105, y: -0.07, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -81,7 +81,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.43333334
value: {x: 0.055, y: 0, z: 0}
value: {x: 0.063, y: 0.03, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -90,7 +90,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.46666667
value: {x: 0.02, y: 0.05, z: 0}
value: {x: 0.02, y: 0.03, z: 0}
inSlope: {x: Infinity, y: Infinity, z: Infinity}
outSlope: {x: Infinity, y: Infinity, z: Infinity}
tangentMode: 0
@ -314,7 +314,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.2
value: 0.204
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -323,7 +323,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.4
value: 0.1
value: 0.105
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -332,7 +332,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.43333334
value: 0.055
value: 0.063
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -360,7 +360,7 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: -0.18
value: -0.15
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -369,7 +369,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.4
value: -0.14
value: -0.07
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -378,7 +378,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.43333334
value: 0
value: 0.03
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
@ -387,7 +387,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.46666667
value: 0.05
value: 0.03
inSlope: Infinity
outSlope: Infinity
tangentMode: 103