@@ -102,10 +102,12 @@ static void fixTextureSize(string imagePath){
102
102
if ( max > sizes [ i ] && max <= sizes [ nextI ] )
103
103
fitSize = sizes [ nextI ] ;
104
104
}
105
+
105
106
if ( importer . maxTextureSize != fitSize ) {
106
107
Debug . LogWarning ( "change default size to " + fitSize + " for " + imagePath ) ;
107
108
importer . maxTextureSize = fitSize ;
108
109
}
110
+
109
111
foreach ( string platform in platforms ) {
110
112
int maxTextureSize ;
111
113
TextureImporterFormat textureFormat ;
@@ -129,7 +131,6 @@ public static void updateImporters(SpineMultiatlas multiatlas, string directory,
129
131
Texture2D tex = AssetDatabase . LoadAssetAtPath ( imagePath , typeof ( Texture2D ) ) as Texture2D ;
130
132
Vector2 atlasSize = new Vector2 ( tex . width , tex . height ) ;
131
133
TextureImporter importer = TextureImporter . GetAtPath ( imagePath ) as TextureImporter ;
132
- importer . maxTextureSize = 2048 ;
133
134
importer . spritesheet = getSpriteMetadata ( spineAtlas , atlasSize ) ;
134
135
importer . textureType = TextureImporterType . Sprite ;
135
136
importer . spriteImportMode = SpriteImportMode . Multiple ;
@@ -209,23 +210,23 @@ public static void swap2Float(ref float float1, ref float float2){
209
210
float2 = tmp ;
210
211
}
211
212
212
- public static GameObject buildSceleton ( SpineData data , int pixelsPerUnit , out Dictionary < string , GameObject > boneGOByName , out Dictionary < string , Slot > slotByName ) {
213
+ public static GameObject buildSceleton ( string name , SpineData data , int pixelsPerUnit , out Dictionary < string , GameObject > boneGOByName , out Dictionary < string , Slot > slotByName ) {
213
214
float ratio = 1.0f / ( float ) pixelsPerUnit ;
214
215
boneGOByName = new Dictionary < string , GameObject > ( ) ;
215
216
slotByName = new Dictionary < string , Slot > ( ) ;
216
- GameObject rootGO = null ;
217
+ GameObject rootGO = new GameObject ( name ) ;
217
218
foreach ( SpineBone bone in data . bones ) {
218
219
GameObject go = new GameObject ( bone . name ) ;
219
220
boneGOByName . Add ( bone . name , go ) ;
220
221
}
221
222
222
223
foreach ( SpineBone bone in data . bones ) {
223
224
GameObject go = boneGOByName [ bone . name ] ;
224
- if ( bone . parent == null ) {
225
- rootGO = go ;
226
- continue ;
227
- }
228
- go . transform . parent = boneGOByName [ bone . parent ] . transform ;
225
+ if ( bone . parent == null )
226
+ go . transform . parent = rootGO . transform ;
227
+ else
228
+ go . transform . parent = boneGOByName [ bone . parent ] . transform ;
229
+
229
230
Vector3 position = new Vector3 ( ( float ) bone . x * ratio , ( float ) bone . y * ratio , 0.0f ) ;
230
231
Vector3 scale = new Vector3 ( ( float ) bone . scaleX , ( float ) bone . scaleY , 1.0f ) ;
231
232
Quaternion rotation = Quaternion . Euler ( 0 , 0 , ( float ) bone . rotation ) ;
0 commit comments