Skip to content

Commit

Permalink
Allow editing tile draw offset.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase-san committed Oct 5, 2022
1 parent fb65a96 commit a2ab700
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tiled/propertybrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,13 @@ void PropertyBrowser::addTileProperties()
imageRectProperty->setEnabled(mTilesetDocument && tile->tileset()->isCollection());
imageRectProperty->setAttribute(QLatin1String("constraint"), tile->image().rect());

QtVariantProperty *drawOffsetProperty = addProperty(TileDrawOffsetProperty,
QMetaType::QPoint,
tr("Draw Offset"),
groupProperty);
drawOffsetProperty->setAttribute(QLatin1String("singleStep"), 1);
drawOffsetProperty->setEnabled(mTilesetDocument);

addProperty(groupProperty);
}

Expand Down Expand Up @@ -1988,10 +1995,11 @@ void PropertyBrowser::updateProperties()
mIdToProperty[IdProperty]->setValue(tile->id());
mIdToProperty[WidthProperty]->setValue(tileSize.width());
mIdToProperty[HeightProperty]->setValue(tileSize.height());
mIdToProperty[TileProbabilityProperty]->setValue(tile->probability());
mIdToProperty[TileDrawOffsetProperty]->setValue(tile->drawOffset());
if (QtVariantProperty *imageSourceProperty = mIdToProperty.value(ImageSourceProperty))
imageSourceProperty->setValue(QVariant::fromValue(FilePath { tile->imageSource() }));
mIdToProperty[ImageRectProperty]->setValue(tile->imageRect());
mIdToProperty[TileProbabilityProperty]->setValue(tile->probability());
break;
}
case Object::WangSetType: {
Expand Down
1 change: 1 addition & 0 deletions src/tiled/propertybrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class PropertyBrowser : public QtTreePropertyBrowser
AllowFlipVerticallyProperty,
AllowRotateProperty,
PreferUntransformedProperty,
TileDrawOffsetProperty,
};

void addMapProperties();
Expand Down

0 comments on commit a2ab700

Please sign in to comment.