AutoMapping: Removed the "touched layers" optimization
The "AutoMap While Drawing" had an optimization where it skipped entire rule maps when none of their input layers had been "touched". This was based on the assumption that its rules would not need to be re-evaluated anyway.
Unfortunately, we can't make this assumption in general. The effect of certain rules might be relevant even if none of their input or output layers have been touched.
Had a go with this using my enormous set of Automapping rules. None of the rules were affected negatively by the optimization. Removing the optimization has made Automap While Drawing even with a 1x1 brush noticeably more sluggish. It's still acceptable, but less pleasant than before, when it was practically instant.
I wonder if perhaps the optimization could be brought back, but with a rule map property like "NeverSkip" (previously discussed in https://github.com/mapeditor/tiled/issues/3313) that'll force that rule map to be used even if its layers weren't touched, so that those rules that are impacted negatively by the optimisation have some recourse.
I wonder if perhaps the optimization could be brought back, but with a rule map property like "NeverSkip" (previously discussed in #3313) that'll force that rule map to be used even if its layers weren't touched
With this generic name I'm a bit worried it might be understood as a way to make an exception for file name filters. Although, such an exception isn't needed at that level because it can be made by temporarily resetting the filter. In the end I guess that's a documentation issue (and another reason to enable tooltips on custom properties).
It could be named something else, especially since Automapping properties are automatically suggested and don't need to be typed and can thus be fairly descriptive, the only drawback to long names is that they're only helpful for English-speakers. Tooltips would be good even for basic names in combination with translations.
"NeverSkip" being generic is a potential problem in case other, orthogonal optimisations are added in the future. Might even be cool to have a "SkipOptimizations" property that's a bunch of flags for different skippable optimizations. Perhaps if we have a boolean property "SkipOptimizations" (or "IgnoreOptimizations") for now, it could be converted to flags later if needed.