Skip to content

Improve the Image chopping algorithm for sprite import. #248

@audinowho

Description

@audinowho

def chopImgToPieceLocs(img, transparent):

When a Pokemon sprite wan file is imported, every frame gets chopped up into pieces such that it can be assembled by metaframe data.
The method responsible for this is called chopImgToPieceLocs.
Pieces can be 8x8, 16x8, 8x16, etc.

Currently, the function just returns one piece containing the whole sprite if it's small enough (it usually is), or a collection of pieces that divide the sprite into as few pieces as possible.

This approach does not take advantage of the ability for one piece to be referenced in multiple parts of a sprite. For example: the symmetrical legs of a large Pokemon can be chopped into their own pieces and then collapsed into a single leg texture that is drawn normally for the left side, and then flipped for the right side. This can spell the difference between a sprite being too big to import, or being just small enough to import.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions