From 790a7c71418c0e052cfbb2993808703796287790 Mon Sep 17 00:00:00 2001
From: Unity Technologies <@unity>
Date: Tue, 8 Jun 2021 00:00:00 +0000
Subject: [PATCH] com.unity.2d.psdimporter@5.0.4 ## [5.0.4] - 2021-06-08 ###
Fixed - Fixed changing PSD Importer inspector fields causes
UnityEditor.ObjectPreview errors. (Case 1335593) - Fixed PSDImporter always
reimports .psb files when switching build platforms. (Case 1330376) - Fixed
inconsistency while importing
---
CHANGELOG.md | 6 ++++++
Editor/PSDImporter.cs | 19 +++++++++++--------
Editor/PSDImporterEditor.cs | 2 --
package.json | 10 +++++-----
4 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 430cdf8..9d913de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## [5.0.4] - 2021-06-08
+### Fixed
+- Fixed changing PSD Importer inspector fields causes UnityEditor.ObjectPreview errors. (Case 1335593)
+- Fixed PSDImporter always reimports .psb files when switching build platforms. (Case 1330376)
+- Fixed inconsistency while importing
+
## [5.0.3] - 2021-03-28
### Fixed
- Fixed package description
diff --git a/Editor/PSDImporter.cs b/Editor/PSDImporter.cs
index b0ca5d5..3a88097 100644
--- a/Editor/PSDImporter.cs
+++ b/Editor/PSDImporter.cs
@@ -21,7 +21,7 @@ namespace UnityEditor.U2D.PSD
///
/// ScriptedImporter to import Photoshop files
///
- [ScriptedImporter(5, "psb")]
+ [ScriptedImporter(5, "psb", AllowCaching = true)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.2d.psdimporter@latest")]
[MovedFrom("UnityEditor.Experimental.AssetImporters")]
public class PSDImporter : ScriptedImporter, ISpriteEditorDataProvider
@@ -768,7 +768,11 @@ void BuildGroupGameObject(List psdGroup, int index, Transform root)
}
if (psdGroup[index].gameObject != null)
+ {
psdGroup[index].gameObject.transform.SetParent(root);
+ psdGroup[index].gameObject.transform.SetSiblingIndex(root.childCount-1);
+ }
+
}
}
@@ -971,6 +975,7 @@ GameObject OnProducePrefab(string assetname, Sprite[] sprites, SpriteLibraryAsse
var currentCharacterData = characterData;
var spriteImportData = GetSpriteImportData();
root = new GameObject();
+ root.transform.SetSiblingIndex(0);
root.name = assetname + "_GO";
if (spriteLib != null)
root.AddComponent().spriteLibraryAsset = spriteLib;
@@ -1479,9 +1484,7 @@ SpriteLibraryAsset ProduceSpriteLibAsset(Sprite[] sprites)
{
if (!characterMode || m_SpriteCategoryList.categories == null)
return null;
- var sla = ScriptableObject.CreateInstance();
- sla.name = "Sprite Lib";
- sla.categories = m_SpriteCategoryList.categories.Select(x =>
+ var categories = m_SpriteCategoryList.categories.Select(x =>
new SpriteLibCategory()
{
name = x.name,
@@ -1495,11 +1498,11 @@ SpriteLibraryAsset ProduceSpriteLibAsset(Sprite[] sprites)
};
}).ToList()
}).ToList();
- sla.categories.RemoveAll(x => x.categoryList.Count == 0);
- if (sla.categories.Count > 0)
+ categories.RemoveAll(x => x.categoryList.Count == 0);
+ if(categories.Count > 0)
{
- sla.UpdateHashes();
- return sla;
+ // Always set version to 0 since we will never be updating this
+ return SpriteLibraryAsset.CreateAsset(categories, "Sprite Lib", 0);
}
return null;
}
diff --git a/Editor/PSDImporterEditor.cs b/Editor/PSDImporterEditor.cs
index 5c7b842..c8c4282 100644
--- a/Editor/PSDImporterEditor.cs
+++ b/Editor/PSDImporterEditor.cs
@@ -221,8 +221,6 @@ protected override void Apply()
AnalyticFactory.analytics.SendApplyEvent(evt);
m_TexturePlatformSettingsHelper.Apply();
base.Apply();
- Selection.activeObject = null;
- Unsupported.SceneTrackerFlushDirty();
PSDImportPostProcessor.currentApplyAssetPath = ((PSDImporter) target).assetPath;
}
diff --git a/package.json b/package.json
index 2264c81..15419b7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "com.unity.2d.psdimporter",
- "version": "5.0.3",
+ "version": "5.0.4",
"unity": "2021.1",
"displayName": "2D PSD Importer",
"description": "A ScriptedImporter for importing Adobe Photoshop PSB (Photoshop Big) file format. The ScriptedImporter is currently targeted for users who wants to create multi Sprite character animation using Unity 2D Animation Package.",
@@ -12,18 +12,18 @@
"category": "2D",
"dependencies": {
"com.unity.2d.common": "5.0.0",
- "com.unity.2d.animation": "6.0.3",
+ "com.unity.2d.animation": "6.0.4",
"com.unity.2d.sprite": "1.0.0"
},
"relatedPackages": {
- "com.unity.2d.psdimporter.tests": "5.0.3"
+ "com.unity.2d.psdimporter.tests": "5.0.4"
},
"upmCi": {
- "footprint": "5aba28318664e28475f9e448bb3d02a1eed2fca5"
+ "footprint": "1da681dad3757f9f1df6c28bb61147f39f94e47c"
},
"repository": {
"url": "https://github.cds.internal.unity3d.com/unity/2d.git",
"type": "git",
- "revision": "8752f08cdd2aa2a0153c9c70e2affdb28ccfe4bd"
+ "revision": "c6acc0f0e19f89c41e384fa1a602555072cbb8cc"
}
}