Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiled 0.15.0 - Bug with automapping using collection of images #1202

Open
rickyp82 opened this issue Feb 12, 2016 · 5 comments
Open

Tiled 0.15.0 - Bug with automapping using collection of images #1202

rickyp82 opened this issue Feb 12, 2016 · 5 comments
Labels
bug Broken behavior.

Comments

@rickyp82
Copy link

Hi,

I use automap feature but instead of using a tileset I use a collection of images. I create 3 tile layers (regions, output_object, input_object) and 1 object layer (output_object_collision).

Then in my object layer (output_object_collision) I add some shapes and lines.

After that, in my level.tmx I use the automap. At that point, only some objects from the object layer appear. It looks like it depends on the size of the shapes (a rect using less than half the object area don't show and using lines don't appear either.
Here are some screenshots:

automap_rule
level1

Thanks

@Seanba
Copy link
Contributor

Seanba commented Feb 12, 2016

I would guess this is a problem due to the tile itself being larger than
the tile width and height for the map. In the cases that it does work, is
it because the output object overlaps with the bottom-left corner of the
tile?

On Fri, Feb 12, 2016 at 11:43 AM, rickyp82 notifications@github.com wrote:

Hi,

I use automap feature but instead of using a tileset I use a collection of
images. I create 3 tile layers (regions, output_object, input_object) and 1
object layer (output_object_collision).

Then in my object layer (output_object_collision) I add some shapes and
lines.

After that, in my level.tmx I use the automap. At that point, only some
objects from the object layer appear. It looks like it depends on the size
of the shapes (a rect using less than half the object area don't show and
using lines don't appear either.
Here are some screenshots:

[image: automap_rule]
https://cloud.githubusercontent.com/assets/17203179/13015270/297e3bec-d186-11e5-9ad4-dd4c18d10e72.png
[image: level1]
https://cloud.githubusercontent.com/assets/17203179/13015272/29839e0c-d186-11e5-8231-caf82005d3c2.png

Thanks


Reply to this email directly or view it on GitHub
#1202.

@bjorn
Copy link
Member

bjorn commented Feb 12, 2016

I'm guessing the automapping rule parsing is not correctly determining whether a certain object is part of a certain rule. Maybe @stefanbeller has some pointers as to where that could be fixed.

@bjorn bjorn added the bug Broken behavior. label Feb 12, 2016
@rickyp82
Copy link
Author

It worked when I was using a Tileset instead of a Collection of Images. But using collection of images is easier for me because I'm always using a full sprite to create my maps.

@bjorn
Copy link
Member

bjorn commented Mar 5, 2016

To make this easier to reproduce and possibly fix, could you share your tileset, map and automapping rules?

@stefanbeller
Copy link
Contributor

stefanbeller commented May 14, 2016

We'd need to fix AutomappingUtils#objectsInRegion which is called from AutoMapper::copyObjectRegion

const QList<MapObject*> objectsInRegion(ObjectGroup *layer,
                                        const QRegion &where)
{
    QList<MapObject*> ret;
    foreach (MapObject *obj, layer->objects()) {
        // TODO: we are checking bounds, which is only correct for rectangles and
        // tile objects. polygons and polylines are not covered correctly by this
        // erase method (we are in fact deleting too many objects)
        // TODO2: toAlignedRect may even break rects.
        const QRect rect = obj->boundsUseTile().toAlignedRect();

        // QRegion::intersects() returns false for empty regions even if they are
        // contained within the region, so we also check for containment of the
        // top left to include the case of zero size objects.
        if (where.intersects(rect) || where.contains(rect.topLeft()))
            ret += obj;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior.
Projects
None yet
Development

No branches or pull requests

4 participants