Skip to content

Commit

Permalink
YY plugin: Fixed positioning of objects on isometric maps
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn committed Feb 28, 2024
1 parent 77611b6 commit 12dbd59
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
* Scripting: Added Tileset.imageFileName and ImageLayer.imageFileName
* Scripting: Made Tileset.margin and Tileset.tileSpacing writable
* Scripting: Restored compatibility for MapObject.polygon (#3845)
* TMX format: Embedded images are now also supported on tilesets and image layers
* JSON format: Fixed tile order when loading a tileset using the old format
* Godot export: Added support for exporting objects (by Rick Yorgason, #3615)
* Godot export: Use Godot 4.2 tile transformation flags (by Rick Yorgason, #3895)
* Godot export: Fixed positioning of tile collision shapes (by Ryan Petrie, #3862)
* Godot 4 plugin: Added support for exporting objects (by Rick Yorgason, #3615)
* Godot 4 plugin: Use Godot 4.2 tile transformation flags (by Rick Yorgason, #3895)
* Godot 4 plugin: Fixed positioning of tile collision shapes (by Ryan Petrie, #3862)
* GameMaker 2 plugin: Fixed positioning of objects on isometric maps
* tmxrasterizer: Added --hide-object and --show-object arguments (by Lars Luz, #3819)
* tmxrasterizer: Added --frames and --frame-duration arguments to export animated maps as multiple images (#3868)
* tmxviewer: Added support for viewing JSON maps (#3866)
Expand All @@ -18,7 +20,6 @@
* Fixed mouse handling issue when zooming while painting (#3863)
* Fixed possible crash after a scripted tool disappears while active
* Fixed updating of used tilesets after resizing map (#3884)
* TMX format: Embedded images are now also supported on tilesets and image layers
* AppImage: Updated to Sentry 0.6.7

### Tiled 1.10.2 (4 August 2023)
Expand Down
1 change: 0 additions & 1 deletion src/libtiled/tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#include "tileset.h"

#include "imagecache.h"
#include "tile.h"
#include "tilesetmanager.h"
#include "wangset.h"
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/yy/yyplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,10 +1003,12 @@ static std::unique_ptr<GMRLayer> processObjectGroup(const ObjectGroup *objectGro
instance.scaleX = takeProperty(props, "scaleX", instance.scaleX);
instance.scaleY = takeProperty(props, "scaleY", instance.scaleY);

QPointF pos = context.renderer->pixelToScreenCoords(mapObject->position());

// Adjust the position based on the origin
QTransform transform;
transform.rotate(mapObject->rotation());
const QPointF pos = mapObject->position() + transform.map(origin);
pos += transform.map(origin);

// TODO: Support creation code - takeProperty(props, "code", QString());
// Would need to be written out as a separate file
Expand Down Expand Up @@ -1093,10 +1095,12 @@ static std::unique_ptr<GMRLayer> processObjectGroup(const ObjectGroup *objectGro
// GameMaker, taking into account the rotation.
origin -= alignmentOffset(mapObject->size(), mapObject->alignment());

QPointF pos = context.renderer->pixelToScreenCoords(mapObject->position());

// Adjust the position based on the origin
QTransform transform;
transform.rotate(mapObject->rotation());
const QPointF pos = mapObject->position() + transform.map(origin);
pos += transform.map(origin);

g.colour = optionalProperty(mapObject, "colour", color);
// TODO: g.inheritedItemId
Expand Down

0 comments on commit 12dbd59

Please sign in to comment.