XTDStudios / DMT

Dynamically Mapping Textures
101 stars 13 forks source link

Original bounding box is lost when creating texture atlas -> MovieClip shows frames in the wrong positions #1

Closed yurishkuro closed 11 years ago

yurishkuro commented 11 years ago

I tried using DMT to play a simple artist-drawn frame-by-frame animation in a Starling app, but the individual frames are being displayed in the wrong positions, e.g. everything seems to be flushed left and up against the origin position of the DMT movie clip.

I tried setting a pivot point, but it had no effect. It seems the problem is that when rendering individual frames DMT extracts the bounding rectangle from Flash movie clip for each frame correctly, but it doesn't record for later, so that when the final Texture Atlas is built, it only has the 'region' rectangle for the frame, but not the 'frame' rectangle, using Starling's TextureAtlas terminology.

XTDStudios commented 11 years ago

This is the only limitation that we currently have on MovieClip. This bug is annoying and will be fixed.

Thanks Gil

yurishkuro commented 11 years ago

Thank you, Gil. Let me know if I can help, I've spent some time looking at the DMT source code.

You say "annoying", does it mean there's a workaround at the moment?

XTDStudios commented 11 years ago

We had the same problem in one of our games, and I solved it by moving the display object in the code after it was created by DMT... In my case it was in the center of the DisplayObject so it was easy... but on MovieClips that change each frame it will be "Annoying"

I have a simple solution (Workaround):

We will fix it eventually.

yurishkuro commented 11 years ago

Hi again, I wasn't sure how to follow your suggestion, could you please elaborate on the last point? The object I end up with is StarlingMovieClipProxy, which stores the frames as textures and they don't have pivot points. Are you suggesting adjusting the pivot of the whole movie clip? Which, I assume, would have to be done on every frame.

Thanks!

XTDStudios commented 11 years ago

We have a new branch that we test the new MovieClips feature! check it out and let me know if you are having issues https://github.com/XTDStudios/DMT/tree/MovieClips

XTDStudios commented 11 years ago

Fixed on MovieClipsbranch, and now merged MovieClips back into trunk

yurishkuro commented 11 years ago

The new version works perfectly with my movie clips, all frames are aligned correctly and the pivot point of the movie clip is also correct. Thank you very much for the fix!