Skip to content
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

Tiled Projects #1665

Open
griest024 opened this issue Jul 27, 2017 · 7 comments
Open

Tiled Projects #1665

griest024 opened this issue Jul 27, 2017 · 7 comments
Assignees
Labels
Projects
Milestone

Comments

@griest024
Copy link

@griest024 griest024 commented Jul 27, 2017

Apologies if this is a duplicate issue. It is at least partially duplicated by a number of issues (#945, #233, #70). However many of those issues are quite old and don't pertain to Tiled 1.x. In addition, those issues bring up a number of good ideas but I think it would be good to bring them together in one place and codify them into a concrete proposal.

Proposal

Tiled should have projects.

Data Structure

A project is a data structure that can be dumped to a .json file or an XML-based file similar to .tmx.

A project contains a number of fields including:

"Orphan" Data

Data that doesn't belong to any particular data structure such as

  • Commands
  • Object types

Note on orphan data merge strategy: I think it still makes sense to have globally defined commands and object types available in projects. In the case where there is a conflict, the project data should take precedence.

Session Data

Edit: After looking at this again, it doesn't make sense for session data to be kept in a project file. It should instead be kept in some kind of workspace file, similar to the behavior of sublime text and other IDEs.

Data that describes the state that the project was last in

  • Open files: which files are open as tabs
  • Current file: which file is currently being edited
  • Current file history: the edit history of the current file (possible performance concerns)
  • Currently selected object, tile, map, or tileset whose properties are displayed

Directory Data

Paths relative to the project file that define a number of important directories including

  • Image directory: if this is defined, all paths pointing to images (like in tilesets) are relative to this directory.
  • Tileset directory: if this is defined, all paths pointing to tilesets (like in maps) are relative to this directory.

File Data

Paths relative to the project file that point to files included in this project.

  • Tilesets
  • Maps

Miscellaneous Data

  • Custom properties: similar to other data structures, a project should allow for custom properties

UI

Along with the project data structure, this proposal includes UI changes. These changes make it easier to interact with the project data structure and its members directly.

Project Properties

A project should enumerate its members in the property browser, similar to other data structures (map, tileset, etc.)

Project Browser

The UI should include a new panel (widget?) called the project browser. This panel is an accordion, and lists the 4 major components of a project: maps, tilesets, commands, and object types. Each accordion section includes a list with multi-select capability.

image

An asterisk denotes that a file has unsaved changes, like the tab.

Map and tileset list items should have a context menu with the following items whose functions are identical to those in the file submenu:

  • Open
  • Export (This would effectively close #1117)
  • Export As...
  • Save
  • Save As...

In addition to the above options, the context menu should also include:

  • Remove from Project: removes the file from the project
  • Delete: removes the file from the project and then deletes it.

Project Menu

When a project is open, a project menu section should be present. This would be consistent with the menu design for other top-level data structures.

image

Behavior

Add Files to Project

There are several important considerations when designing this feature. A user may want to try out an idea in a new map, but doesn't want his/her project polluted with files they don't intend to use. On the other hand, manually adding files to a project may get tedious, and having open files that are not part of the project goes against the philosophy of a project.

Option 1: Automatically Add Files on Open

When a map or tileset file is opened by any means, it is added to the currently open project, if there is one and if it has not already been added. This option will probably include the fewest number of UI changes.

Option 2: Manually Add Files

An option must be manually selected in order to trigger the adding of a file to a map. This will include adding context menu options to the tabs and to the map file browser as well as options to the main menu bar.

Option 3: User Configurable

Whether or not files are automatically added is manually configured by the user.

Option 4: Monitor Directory

Tiled monitors the tileset and map directories (if present) for compatible files. This option seems difficult to implement and prone to bugs. There are also some performance concerns, though they could be remedied by caching files and/or only checking the type field for an appropriate value.

Curating File Data

When project content, such as a map or tileset, is not at its specified location, the user should be given the choice to locate the file or remove the file from the project.

Advantages

  • Switching between large batches of related maps and tilesets is as easy as opening a single file.
  • Collaboration on games is easier, as commands and object types can be shared and version controlled.
  • File size is reduced (especially in collection tilesets) as paths can be shortened.
  • Changing directory structure of your tilesets or images does not pwn your files, as the change can be reflected in a single change of the relevant directory data in the project.
@bjorn

This comment has been minimized.

Copy link
Owner

@bjorn bjorn commented Jul 28, 2017

Thanks a lot for opening an issue about this and summarizing in such extensiveness the uses of a project file! Indeed, this is something I've been wanting to add since a long time already and if I don't have time for it for Tiled 1.1 (which is planned to contain all the work from the GSoC students), then it will certainly be part of the plan for Tiled 1.2.

@bjorn bjorn added the feature label Jul 28, 2017
@griest024

This comment has been minimized.

Copy link
Author

@griest024 griest024 commented Jul 29, 2017

@bjorn I added some UI mockups

@satu0king

This comment has been minimized.

Copy link
Contributor

@satu0king satu0king commented Jan 14, 2018

Is this issue still open for GSoC students ?

@ketanhwr

This comment has been minimized.

Copy link
Contributor

@ketanhwr ketanhwr commented Jan 15, 2018

@satu0king this particular project is a big one! It might take some time, and I'll suggest starting out with some other ones.

Still, it's open to everyone, feel free to give it some time, but this is not as easy as it seems.

@bjorn

This comment has been minimized.

Copy link
Owner

@bjorn bjorn commented Jan 16, 2018

@satu0king I'm still hopeful that there will be time to get at least part of this implemented for Tiled 1.2, which would be before the GSoC 2018 starts. But it may be that I'm too optimistic (since @ketanhwr is right), in which case it could become a GSoC project if we see a strong candidate with a realistic proposal.

@bjorn

This comment has been minimized.

Copy link
Owner

@bjorn bjorn commented Sep 2, 2018

Just an update since I noticed I wrote Tiled 1.2 in earlier comments. Mainly due to fulfilling several priority requests from major patrons, this feature did not make it for Tiled 1.2. It is now part of the roadmap for Tiled 1.3, and I don't plan to shift it again.

@bjorn bjorn moved this from Future to Tiled 1.3 (next feature release) in Roadmap Oct 19, 2018
@bjorn bjorn pinned this issue Dec 13, 2018
@bjorn bjorn moved this from Tiled 1.3 (next feature release) to Tiled 1.4 in Roadmap May 14, 2019
@bjorn bjorn unpinned this issue Aug 5, 2019
@bjorn bjorn added this to the Tiled 1.4 milestone Aug 5, 2019
@bjorn bjorn pinned this issue Nov 12, 2019
@bjorn bjorn self-assigned this Nov 26, 2019
bjorn added a commit that referenced this issue Nov 27, 2019
The initial project is simply a list of folders. Each folder is scanned
recursively for files that seem to be one of the supported formats
(based on their file extension).

Since there's no automatic refresh at the moment, the Project menu
contains an action to trigger the refresh manually.

The last open project is automatically loaded on startup.

There's no way yet to remove folders from a project. Need to edit the
file by hand for now.

Issue #1665
bjorn added a commit that referenced this issue Dec 4, 2019
* Added Recent Projects menu
* Added action to remove a folder from the project
* Added small tool bar at bottom of Project view
* Don't reset project model when adding/removing folders
* Improved suggested file name and location for first project

Issue #1665
bjorn added a commit that referenced this issue Dec 4, 2019
The initial project is simply a list of folders. Each folder is scanned
recursively for files that seem to be one of the supported formats
(based on their file extension).

Since there's no automatic refresh at the moment, the Project menu
contains an action to trigger the refresh manually.

The last open project is automatically loaded on startup.

There's no way yet to remove folders from a project. Need to edit the
file by hand for now.

Issue #1665
bjorn added a commit that referenced this issue Dec 4, 2019
* Added Recent Projects menu
* Added action to remove a folder from the project
* Added small tool bar at bottom of Project view
* Don't reset project model when adding/removing folders
* Improved suggested file name and location for first project

Issue #1665
@bjorn

This comment has been minimized.

Copy link
Owner

@bjorn bjorn commented Dec 4, 2019

Initial support for projects has been released in today's new development snapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Roadmap
  
Tiled 1.4
4 participants
You can’t perform that action at this time.