-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Comments
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 I added some UI mockups |
Is this issue still open for GSoC students ? |
@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. |
@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. |
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. |
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
* 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
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
* 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
Initial support for projects has been released in today's new development snapshot. |
The session is currently implicit, being either the default session or a project-based session saved alongside a project. It stores the list of open files, the active file, recent files and the last state for previously opened files. This makes it easier to switch between different projects, which swaps all these things along with it. Also improved the start location for the open file dialog, which now starts at the active file, then the first recent file and finally the user home directory (instead of starting at the current working directory, usually at the binary). Issue #1665
Sessions have been introduced with the latest snapshot, which should make switching between projects quite comfortable since there will be a separate list of open files, recent files and editor states for each project. The handling of sessions is currently completely hidden from the user. Things I noticed that need to be improved:
Of course there are many other things that need to be improved. Feedback is welcome! |
By default a folder called "extensions" in the same folder as the .tiled-project file will be added to the extensions path. This folder can be changed in the new Project Properties dialog. The script engine will reset when switching projects also causes a change in the extensions path, as well as when changing the extensions path of the current project. Issue #1665
This causes Tiled to resume the associated session. The session is no longer created as part of the preferences, which allows it to be initialized after we have parsed the command line parameters. Issue #1665
Watch the folders for changes and automatically trigger a (slightly delayed) re-scan of changed folders. Ideally, only actually changed folders would need to be re-scanned, but that could be an optimization for later. Currently a top-level folder is entirely re-scanned when any file or directory is added or removed within in. Also fixed that selection and vertical scroll position is not lost when refreshing the view, by restoring it after each refresh. Issue #1665
Right, that will always try to open the file so it only works with maps or tilesets. It should indeed check for project as well, thanks! |
Is now changed in Project Properties rather than being stored as a global preference. Issue #1665
Alright, a lot has happened to projects and sessions in the past two months. I've gone over the original ideas from @griest024 once again to see if I've missed anything important.
This one is new but I think also essential:
So, a few more things to do before we can close this issue! |
Also added a %projectpath variable for use when setting up a command. Issue #1665
I've split off two remaining issues so that this issue can be closed. There's many things that could still be improved in the support for projects of course (like #2901). Long live the projects! |
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
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
Directory Data
Paths relative to the project file that define a number of important directories including
File Data
Paths relative to the project file that point to files included in this project.
Miscellaneous Data
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.
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:
In addition to the above options, the context menu should also include:
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.
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
The text was updated successfully, but these errors were encountered: