-
-
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
Automapping: Restricting rules.txt rules by map name #3014
Comments
What about referencing automapping rules from maps instead? A single rule file reference should suffice, which can include other rule files if desired to avoid duplication. If we do need to extend the |
I like specifying rules files from map instead of the other way around. |
Referencing rules from maps would be convenient for projects with only a few maps or situations where each map is unique in its rule set, but when you have many maps split into a few categories, referencing maps from rule files is more convenient, especially since it means that when you create a new map, you don't have to worry about setting up the rules for it, the correct ones will be applied automatically as long as it follows the naming convention you establish in rules.txt. I also think it's annoying to have a bunch of different rules.txts floating around. And unless the associations are stored in the Project rather than in the maps, it's clutter xP However, if it is done as Project properties, I think that opens up some great possibilities for an editor within Tiled, allowing both per-map associations that can easily be accessed within Tiled, and name-based ones like in my suggestion. Personally, I've never been fond of the fact that we even need a rules.txt and that it can't be edited from within Tiled, and now Projects are a great opportunity to get rid of it as a requirement. |
I've decided to implement the original request. I may implement a way to refer to rule files from maps or from specific layers later, but it seems to me that this is rather independent of this
For now I am just supporting a single glob pattern and no regex, and the matching happens only against the map file name, not the full path. A comma is a valid file name character, though multiple patterns could also be supported using |
@bjorn This still needs to be documented, so I think it's a little early to close the issue xP Here's a draft of the first half of the Setting It Up section in the Automapping docs, expanded to describe this feature:
I also took the opportunity to mention Project rule files and when those are used, and corrected an "i.e." to "e.g.", since different rule text files aren't necessarily in different directories. |
Btw, I wondered if I should document the behavior of the file name filter in combination with includes, but I considered it a bit too involved and maybe not very relevant. For what it's worth, its behavior is:
|
That is the behaviour I expect :D I agree that it's too involved and not often relevant, so even though ideally I think everything should be documented, maybe it's something better suited to my tip sheet than to the official docs. |
(Reposting this feature suggestion from Discord, where it's been buried by the sands of
timechat.)It would be convenient if rules.txt could have sections in it that limit the automapping rules in them to applying only to some maps, e.g.
Map names are a pretty simple way to go about this, since most people already name their maps in some systematic way. Map-name based logic is also not new to Tiled, it already appears in World files.
Benefits of limiting rules to a subset of maps within rules.txt:
*jungle*
maps, instead of requiring the user to use a special "yes, apply jungle details in this area" layer.I realise that restricting rules to specific maps or groups of maps can be mostly achieved by putting the different maps in subdirectories and putting different rules.txt in each subdirectory, but this means the user would have to organize their files around their appearance rather than based on whatever other system they may prefer, and special cases like "fakeTownDungeon.tmx" in the example have to be in their own subdirectory.
Although my example above has a single match string for each section, I think multiples should be allowed, e.g.
dungeon*, cave*, finalBoss.tmx
. It would also be neat to support regex in this, but I don't think it's necessary, as plain names and simple wildcards are enough in most cases for dealing with map names. Unlike in World files, there are no additional parameters here that need to be extracted from the names.The text was updated successfully, but these errors were encountered: