Browse files

Fix for issue #4 Update breaking import on a new spritesheet

  • Loading branch information...
1 parent e429893 commit 4a78c8d1867b22a5620f5c1e2e980722fe03fa4a @ericraue committed May 6, 2012
View
2 assets/RagePixel/code/RagePixelCell.cs
@@ -10,7 +10,7 @@ public class RagePixelCell
public Rect uv;
public int delay;
- public string importAssetPath;
+ public string importAssetPath = "";
public void ClearUndoHistory()
{
View
7 assets/RagePixel/editor/RagePixelSpriteSheetEditorWindow.cs
@@ -672,7 +672,7 @@ public void UpdateCell(RagePixelCell cell, Texture2D spritesheetTexture)
public void ImportSprite(SpriteSheetImportTarget target)
{
string path = AssetDatabase.GetAssetPath(newTexture);
- Debug.Log("Path" + path);
+
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;
textureImporter.isReadable = true;
textureImporter.filterMode = FilterMode.Point;
@@ -706,14 +706,13 @@ public void ImportSprite(SpriteSheetImportTarget target)
case SpriteSheetImportTarget.NewSprite:
{
RagePixelRow row = spriteSheet.AddRow(newKey, newTexture.width, newTexture.height);
- row.InsertCell(0, newKey2);
- row.GetCell(0).importAssetPath = path;
+ row.InsertCell(0, newKey2).importAssetPath = path;
spriteSheetGUI.currentRowKey = newKey;
animStripGUI.currentCellKey = newKey2;
RagePixelUtil.RebuildAtlas(spriteSheet, true, "Import texture as new sprite");
-
+
Rect uvs = spriteSheet.GetRow(spriteSheetGUI.currentRowKey).GetCell(animStripGUI.currentCellKey).uv;
RagePixelUtil.CopyPixels(newTexture, new Rect(0f, 0f, 1f, 1f), spritesheetTexture, uvs);
break;

0 comments on commit 4a78c8d

Please sign in to comment.