Skip to content
Browse files

JSON plugin: Fixed writing of position for objects without ID

Normally all objects have an ID, except for object templates (where we
do not want to write a position), so this will rarely have been an
issue. Where it went wrong, is when you load an old map where objects as
part of tile collision shapes did not have IDs assigned yet, because if
you don't edit the tile collision shapes those objects will not get IDs
assigned. This in turn caused their position to not be saved.

Fixed by adjusting the check for whether an object is an object

  • Loading branch information...
bjorn committed May 1, 2019
1 parent cf1de18 commit b4066982077a072ed1d7bdbc589317c13091d13e
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/libtiled/maptovariantconverter.cpp
@@ -520,7 +520,7 @@ QVariant MapToVariantConverter::toVariant(const MapObject &object) const
if (!object.cell().isEmpty())
objectVariant[QLatin1String("gid")] = mGidMapper.cellToGid(object.cell());

if (id != 0) {
if (!object.isTemplateBase()) {
objectVariant[QLatin1String("x")] = object.x();
objectVariant[QLatin1String("y")] = object.y();

0 comments on commit b406698

Please sign in to comment.
You can’t perform that action at this time.