Skip to content

Instantly share code, notes, and snippets.

@thabetx
Last active August 28, 2017 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thabetx/57cbf9c3fcb62ebe95c457678ba3f4b1 to your computer and use it in GitHub Desktop.
Save thabetx/57cbf9c3fcb62ebe95c457678ba3f4b1 to your computer and use it in GitHub Desktop.
Google Summer of Code 2017: Reusable Object Templates Final Report

Summary

This project aims to create a template system in Tiled. Any created object can be saved as a template. These templates can be instantiated elsewhere as objects that inherit the template’s properties.

Code and Work Details

These are the pull requests created during the project period (Note that all of these changes are merged into the master branch):

Reusable Object Templates #1587

This is the first PR of the project, it was inappropriately titled, but its main purpose was creating the new template format and adding functionality to read and write the new files.

The new format provides a way for Tiled to store the saved objects with their properties in order to allow using them later in map files. Also provided a way to test saving a template group by selecting multiple objects and creating a template group from them.

Templates Dock #1612

Added the Templates View which enables browsing the exiting template groups in the form of a tree view. Also enabled saving an object as template to a chosen template group.

Template Instances #1623

This PR adds the ability for Tiled to read and display template instances inside the map.

Creating Template Instances #1652

Added a template instance creation tool similar to the insert tile object tool. Also enabled dragging and dropping from the templates dock into the map.

Creating Template Instances

Editing Templates #1663

The goal of this PR was to be able to edit the templates and reflect those edits in the map. A new view is embedded into the Templates View to show the template and allow graphical editing, also the properties can be edited through the properties dock.

Editing Templates

Templates Dock Enhancements #1666

This PR adds some convenience features to the templates dock and template saving, most importantly:

  • Allow opening an existing template group.
  • Allow using object name for the template name.
  • Allow creating a new group while saving a template.

Add JSON Support for Reusable Object Templates #1667

This PR adds JSON format support for saving the template group files as well as adding support for reading and writing template instances in JSON maps.

Add Templates Docs #1703

Added documentation for the templates functionality to the official documentation

Various Improvements for Templates #1698

This PR adds improves the usability of the templates in Tiled, mainly:

  • Enable detaching template instances from the template.
  • Disable some tools when using templates.
  • Convert an object to a template instance after saving it as a template.
  • Select all instances in the current map when a template is selected.
  • Change the format from ttx to something to tgx.

Other Links

  • Introduction and discussion about the project on the forum.

  • Detailed description of the project as well as a the description of all the features is available at the official documentation.

Future Work

The core functionality of the project is done and is available for usage but there are still many improvements that could be added:

  • Resetting overridden properties.
  • Locking template properties.
  • Handling wrong file paths.
  • Managing template groups, e.g. removing a template or a template group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment