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

Add tile stamp memory with support for variations #969

Closed
bjorn opened this Issue Jun 1, 2015 · 5 comments

Comments

Projects
None yet
1 participant
@bjorn
Owner

bjorn commented Jun 1, 2015

This feature was suggested by a Tiled user and aims to increase mapping efficiency when dealing with multi-tile pieces (tile stamps). It can be time consuming to capture these stamps from the tileset or the map, especially when there are several variations that are expected to be used somewhat randomly.

A sketch was made showing how the UI could look. I'll aim for simplifying it where possible.

scan_variationmappingaejhd

A limited tile stamp memory is already available, by pressing Ctrl+1,2,3,... to store the current stamp and then pressing any of those numbers to make that stamp current. I'll aim to extend this system by adding persistency, a visual list, support for variations and support for more than 9 stored stamps.

@bjorn bjorn added the feature label Jun 1, 2015

@bjorn bjorn added this to the Tiled 0.13 milestone Jun 1, 2015

@bjorn bjorn changed the title from Add tile stamp memory with support for random variations to Add tile stamp memory with support for variations Jun 1, 2015

bjorn added a commit that referenced this issue Jun 1, 2015

Initial work on persistent tile stamps with variations
* Added TileStamp class, which represents a certain stamp with a name
  and one or more variations with a probability each.

* Added TileStampModel class, which provides the model that a view needs
  to display the list of available stamps and their variations.

* Added TileStampsDock class, which is the extra view in the user
  interface for showing and managing the stamps.

* Changed QuickStampManager to store its stamps in the TileStampModel,
  which allows quick stamps to be selected in the Tile Stamps view.

Issue #969
@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jun 1, 2015

Owner

So far, there are the low-level data classes, a basic stamps model and view and the rendering of the thumbnails of the stamps. Here's a screenshot of the current state:

main tmx - tiled_012

This is how far I got today. I'll see whether there may be bits of time during the week, and eventually I'll continue on this next Monday. Remaining tasks include:

  • Making the tile stamps persistent. I'll need to decide on a place to store them and how to store them.
  • Adding management actions like 'add stamp', 'remove stamp', 'add stamp variation' and 'remove stamp variation'.
  • Displaying variations in the view and making probability editable.
  • Actually using variations while drawing and taking into account their probability.
Owner

bjorn commented Jun 1, 2015

So far, there are the low-level data classes, a basic stamps model and view and the rendering of the thumbnails of the stamps. Here's a screenshot of the current state:

main tmx - tiled_012

This is how far I got today. I'll see whether there may be bits of time during the week, and eventually I'll continue on this next Monday. Remaining tasks include:

  • Making the tile stamps persistent. I'll need to decide on a place to store them and how to store them.
  • Adding management actions like 'add stamp', 'remove stamp', 'add stamp variation' and 'remove stamp variation'.
  • Displaying variations in the view and making probability editable.
  • Actually using variations while drawing and taking into account their probability.
@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jun 8, 2015

Owner

Today I pushed commits 92ec505, 76f01dd and c651d2b. It's less progress than I hoped I would make, but it was simply more work than I had anticipated.

Added functionality is that you can rename stamps, delete stamps and variations and edit the probability of variations. You can also see variations, but there is currently no way to add them yet. Under the hood good progress was made towards having the tools actually use the variations while painting.

I had initially expected to need at least three full days to finish this feature. It's been two now, and I'm still positive that it will become almost fully functional next Monday, though it will certainly require some polishing after that. In any case, without funding from patrons I would not be able to focus long enough to actually work on improvements like this. I'm really grateful for the support!

Owner

bjorn commented Jun 8, 2015

Today I pushed commits 92ec505, 76f01dd and c651d2b. It's less progress than I hoped I would make, but it was simply more work than I had anticipated.

Added functionality is that you can rename stamps, delete stamps and variations and edit the probability of variations. You can also see variations, but there is currently no way to add them yet. Under the hood good progress was made towards having the tools actually use the variations while painting.

I had initially expected to need at least three full days to finish this feature. It's been two now, and I'm still positive that it will become almost fully functional next Monday, though it will certainly require some polishing after that. In any case, without funding from patrons I would not be able to focus long enough to actually work on improvements like this. I'm really grateful for the support!

bjorn added a commit that referenced this issue Jun 15, 2015

Made the stamp tool work with tile stamp variations
Also fixed and improved several other things:

* A QSharedPointer<TileLayer> is now used by the brush preview and the
  FillTiles command to avoid needless copying of tile data and simplify
  memory management.

* When moving the mouse fast, only one regionEdited signal is emitted
  for the entire movement. This especially speeds up the applying of
  automapping rules.

* Line drawing was improved a bit by always keeping the initially placed
  location stable, by reversing the points if necessary.

* You can now click multiple times with the stamp brush in order to
  trigger the picking of a random variation.

* Fixed a memory leak in the terrain brush.

Issue #969

bjorn added a commit that referenced this issue Jun 15, 2015

Allow extending existing quick stamps with variations
By pressing Ctrl + Shift + <1-9>, the quick stamp is extended instead
of replaced. When such a quick stamp is selected, the stamp brush will
choose random variations while painting.

Issue #969

@bjorn bjorn self-assigned this Jun 19, 2015

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jul 6, 2015

Owner

So, two weeks ago I spent the day doing a large cleanup regarding the memory management of tilesets (a3e77a3). Last week, I've cleaned that up some more (14a68b6), then I added UI actions for adding and removing stamps and variations (03defeb), made the Python plugin compile again (76ff87e), made sure missing tilesets get added to the map again (5e7c197) and made the tile stamp variation probability be taken into account (853f893). Finally I merged the wip/tilestamps branch into master to get the feature included in the daily builds in order to maybe get some feedback, but no feedback has arrived so far.

Now, the main remaining task is the persistency of the tile stamps. One reason why this is still pending is because it is tricky to decide where to store it. On the one hand, the stamps are closely related to the tilesets so embedding them or storing them alongside would make sense. On the other hand, stamps can be captured from the map as well and as such can contain references to any number of tilesets. Since the stamps are definitely something you'd want to share with others in your project, I think the only real option that remains is to introduce some kind of project file.

Owner

bjorn commented Jul 6, 2015

So, two weeks ago I spent the day doing a large cleanup regarding the memory management of tilesets (a3e77a3). Last week, I've cleaned that up some more (14a68b6), then I added UI actions for adding and removing stamps and variations (03defeb), made the Python plugin compile again (76ff87e), made sure missing tilesets get added to the map again (5e7c197) and made the tile stamp variation probability be taken into account (853f893). Finally I merged the wip/tilestamps branch into master to get the feature included in the daily builds in order to maybe get some feedback, but no feedback has arrived so far.

Now, the main remaining task is the persistency of the tile stamps. One reason why this is still pending is because it is tricky to decide where to store it. On the one hand, the stamps are closely related to the tilesets so embedding them or storing them alongside would make sense. On the other hand, stamps can be captured from the map as well and as such can contain references to any number of tilesets. Since the stamps are definitely something you'd want to share with others in your project, I think the only real option that remains is to introduce some kind of project file.

bjorn added a commit that referenced this issue Jul 13, 2015

Made tile stamps persistent
The default persistent stamps location is some location appropriate for
persistent application data, depending on the operating system. The user
can set an alternative location, for example a directory inside his
project.

Issue #969
@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jul 13, 2015

Owner

For now, I ended up not using a project file but rather just an additional configuration option: the path at which to store the tile stamps.

Owner

bjorn commented Jul 13, 2015

For now, I ended up not using a project file but rather just an additional configuration option: the path at which to store the tile stamps.

bjorn added a commit that referenced this issue Jul 13, 2015

Display the sum of stamp variation probabilities
Can be useful when you wonder what the effective probability of a stamp
really is.

Issue #969

bjorn added a commit that referenced this issue Jul 13, 2015

Added button for duplicating stamps
This can be useful to trying out different probabilities or
adding/removing variations without losing the previous stamp definition.

Issue #969

bjorn added a commit that referenced this issue Jul 13, 2015

Fixed two small problems when deleting variations
* Avoid repainting issue in QTreeView
* Make sure saving is triggered

Issue #969

bjorn added a commit that referenced this issue Jul 13, 2015

Display tile stamps sorted by name
They are kept sorted when they are renamed.

Issue #969

bjorn added a commit that referenced this issue Jul 13, 2015

Trigger editing of tile stamp name when stamp is created
Saves some clicking and is consistent with behavior when adding new
layers.

Issue #969
@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jul 13, 2015

Owner

Even though there's bound to be more small improvements to be made, this feature is now considered done. Here's a screenshot of the current status:

057-1 tmx tiled_024

Owner

bjorn commented Jul 13, 2015

Even though there's bound to be more small improvements to be made, this feature is now considered done. Here's a screenshot of the current status:

057-1 tmx tiled_024

@bjorn bjorn closed this Jul 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment