Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bitsofbas

Pages: [1]
1
Support / Re: Importing huge .tmx throws error
« on: February 10, 2014, 05:52:44 pm »
Like a charm! Thanks!

2
Support / Importing huge .tmx throws error
« on: February 09, 2014, 01:08:28 pm »
Hi,

I'd like to import a big .tmx map ( 3 layers, 4 high, 2000 wide ) but it's throwing an error.
The same map, with a drastically reduced width, works ok.

Is there a solution to get it to work with larger maps?

Cheers,
bas


Code: [Select]
IndexOutOfRangeException: Array index is out of range.
tk2dRuntime.TileMap.Layer.FindChunkAndCoordinate (Int32 x, Int32 y, System.Int32& offset) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:372)
tk2dRuntime.TileMap.Layer.GetRawTileValue (Int32 x, Int32 y, System.Int32& value) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:384)
tk2dRuntime.TileMap.Layer.GetTileFlags (Int32 x, Int32 y) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:428)
tk2dRuntime.TileMap.Layer.SetTile (Int32 x, Int32 y, Int32 tile) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:450)
tk2dEditor.TileMap.Importer.PopulateTilemap (.tk2dTileMap tileMap) (at Assets/TK2DROOT/tk2dTileMap/Editor/Importer/tk2dTileMapImporter.cs:179)
tk2dEditor.TileMap.Importer.Import (.tk2dTileMap tileMap, Format format) (at Assets/TK2DROOT/tk2dTileMap/Editor/Importer/tk2dTileMapImporter.cs:242)
tk2dTileMapEditor.DrawSettingsPanel () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:818)
tk2dTileMapEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1218)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/Inspector/InspectorWindow.cs:850)
UnityEditor.DockArea:OnGUI()

3
Support / Re: Import from TexturePacker spritesheet
« on: May 12, 2013, 02:30:29 pm »
Oh noes! I thought everything was working just fine now, but I'm still getting errors when changing my TexturePacker atlas.

Most of the animations keep working, but their sprites have been changed. Others simply crash with this error:

Code: [Select]
IndexOutOfRangeException: Array index is out of range.
tk2dEditor.SpriteAnimationEditor.TimelineEditor.DrawFrameGroupEx (Rect r, .tk2dSpriteAnimationClip clip, tk2dEditor.SpriteAnimationEditor.FrameGroup fg, Boolean highlighted, Boolean showTime, Boolean playHighlight) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:525)
tk2dEditor.SpriteAnimationEditor.TimelineEditor.DrawFrameGroups (Int32 controlId, Rect frameGroupRect, .tk2dSpriteAnimationClip clip, System.Collections.Generic.List`1 frameGroups, Single clipTimeMarker) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:211)
tk2dEditor.SpriteAnimationEditor.TimelineEditor.Draw (Int32 windowWidth, .tk2dSpriteAnimationClip clip, System.Collections.Generic.List`1 frameGroups, Single clipTimeMarker) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipTimelineEditor.cs:158)
tk2dEditor.SpriteAnimationEditor.ClipEditor.Draw (Int32 windowWidth) (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationClipEditor.cs:564)
tk2dSpriteAnimationEditorPopup.OnGUI () (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteAnimationEditor/tk2dSpriteAnimationEditorPopup.cs:480)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

The changed atlas sprites are not part of any animation, but they obviously do change the order of the sprite atlas data ( looks like TexturePacker exports the sprites alphabetically, so adding a new sprite starting with "a" changes the positions of all other sprites ) It's as if the animation is keeping track of the sprites by sequential index instead of by name. If that makes sense.

Any ideas what could be happening here? Or what to do about it?

( Worst case scenario, I could use an additional file describing the contents of each animation and use that to build the Animation object from scratch every time I have to refresh. Skipping your Animation editor. )

4
Support / Re: Import from TexturePacker spritesheet
« on: May 11, 2013, 07:12:21 pm »
Yup, much better now! I've updated the file from a couple of posts back.

Thanks!

5
Support / Re: Import from TexturePacker spritesheet
« on: May 11, 2013, 02:54:07 pm »
So I've changed some things to get the prefab replaced instead of newly created. Truth is, I don't notice much of a difference.

What worries me is that after replacing the Sprite Collection Prefab, upon opening the Animation editor and adding a new clip, the default Collection is set to "-" ( the dropdown can be changed to the real Collection though ). This is the same behaviour I got before changing the Prefab replacing/overwriting code.

The "-" seems to be the name for a "transient sprite collection", as you call it in your code @ tk2dSpriteGuiUtility.cs line 231. - I'm not sure if this is just an insignificant remainder of instantiating a SpriteCollection by code, or if it could be responsible for losing my animations the other day.

Thanks, and sorry to keep bugging you with this.

6
Support / Re: Import from TexturePacker spritesheet
« on: May 10, 2013, 06:31:50 pm »
Awesome! Thanks! I'll update the script tomorrow for those who downloaded it.

7
Support / Re: Import from TexturePacker spritesheet
« on: May 10, 2013, 04:34:29 pm »
The font thing doesn't look too complicated, so I'll just assume it can be done and delay the actual coding until my game really needs it.

In the meantime a more pressing matter has surged; I'm experiencing disastrous side effects on my SpriteAnimation when using my script from the beginning of this thread. -- The problem seems to be that upon updating the SpriteCollectionData, my animation clips sometimes get orphaned from their Collection ( and just opening a clip makes the whole animation editor crash, so I can't fix the broken clips and have to start from scratch with all the animations ).

Can it be that when running my script twice and overwriting a previous SpriteCollectionData, I should copy a certain unique identifier value from the old to the new one? If so, which variable would that be?

Thanks again!

8
Support / Re: Import from TexturePacker spritesheet
« on: May 09, 2013, 03:24:14 pm »
by the time its in texture packer you've already lost all the rest of the information required for the font...
I still have my bmfont xml though and the fonts are not fragmented in TexturePacker ( which is not optimal, but probably more comfortable to keep things together ) so just by knowing my font-area offset in the atlas, I can track all the characters.

Like last time, I don't immediately understand what you mean, but I'm sure it will start making sense as I start investigating.

Thanks again!

9
Support / Re: Import from TexturePacker spritesheet
« on: May 09, 2013, 02:59:45 pm »
Ok, got it. Sizing to fit screen etc is probably more basic-Unity related, so I'll just read up on that on my own.

Another question I'd like to ask... To run as little textures as possible, my bitmap font is also in the TexturePacker atlas. You think it's possible to hook that into your font classes somehow? Can you give me a hint about where to start ( if at all ) ?

Cheers,
bas

10
Support / Re: Import from TexturePacker spritesheet
« on: May 08, 2013, 05:25:48 pm »
Is that "native resolution" a value I can get from somewhere? Or do I just put a static value in?

Thanks for your help!

11
Support / Re: Import from TexturePacker spritesheet
« on: May 08, 2013, 04:56:23 pm »
Man, I learned a LOT today! I think I've managed to follow your ( in my eyes, cryptic ;-) steps and I think I actually made something which works. Unity really is a joy to work with :-)

Just in case someone is looking to do the same, I'm attaching the .cs

Instructions:
* DISCLAMER: USE AT YOUR OWN RISK. This is one of the first things I ever wrote in Unity, so it wouldn't hurt to have a look at the script and make sure for yourself it's safe to use.
* Add the .cs to a folder named Editor
* Create your .png and .bytes files in TexturePacker. They should both have the same name
* Select from within Unity the png atlas file(s)
* From the menu: 2D Toolkit/Make TexturePacker Sprite Collection

Now you'll find a new Material and the Sprite Collection in the same folder.


One question though, I did this:

Code: [Select]
tk2dRuntime.SpriteCollectionSize scs = tk2dRuntime.SpriteCollectionSize.Explicit( 1, 640 );
But I'm not sure those are the best values to use. Any suggestions?


edit: Updated version. Don't use the previous one!

12
Support / Re: Import from TexturePacker spritesheet
« on: May 08, 2013, 09:40:48 am »
I'm afraid this is a little over my head at this stage. Just starting out with Unity and 2dtk and I haven't quite yet touched editor scripting.

Going to give it a shot though because I would really like this to work. It would be great if you could give me some more details on how to do this, but obviously I completely understand if you don't :-)

Thanks!

13
Support / Import from TexturePacker spritesheet
« on: May 07, 2013, 05:33:27 pm »
Hi!

Just started Unity and 2dtk a couple of days ago, so please be gentle :-)

I've got a sprite sheet created in TexturePacker ( which reads animations created in flash and also filters identical frames and more goodness ) so I wanted to use this sprite sheet with 2dtk, but I can only find info on doing this at runtime. As the sheet contains a whole bunch of animations, I'd prefer importing this sheet straight into the editor so I can set up my animations.

How can I do this ( if possible at all )?

Cheers,
bas

Pages: [1]