mapeditor/tiled

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Prompt to apply automapping rules when saving #3463

Seanba posted onGitHub

Is your feature request related to a problem? Please describe. When using live automapping I may end up with tiles just outside the Automapping Radius that are in a bad state. I have to remember to use the AutoMap menu item so that I can be sure that all tiles have rules applied to them.

Describe the solution you'd like Some kind of prompt or option that runs automapping when the map is saved.


This seems like it would be better implemented as a script, as this seems rather niche, useful only if your automapping radius is too low or if automapping while drawing is inconsistently used.

Such a script would look something like this:

let autoAutomapAction = tiled.registerAction("toggleAutoAutomap", function(action) {});
autoAutomapAction.checkable = true;
autoAutomapAction.checked= true;
autoAutomapAction.text = "Automap Reminders";
tiled.extendMenu("Map", [
    { action: "toggleAutoAutomap", before: "AutoMapWhileDrawing" }
]);

tiled.assetAboutToBeSaved.connect(function(asset) {
    if(autoAutomapAction.checked && asset.isTileMap) {
        //let automap = tiled.confirm("Would you like to apply automapping?");
        //if(automap)
            asset.automap();
    }
});

The main problem with this is that your preference isn't saved, it'll be reset to checked (or unchecked, if you remove the line that checks it) whenever you restart Tiled or otherwise reload scripts. You could save it to a file or custom property, but I leave that to you. If we ever get the option to add custom properties to projects, that would be a good way to store settings like this. A minor problem is that checkable actions look a little silly as their icon replaces the checkbox. That is a separate and hopefully easy-to-fix issue xP

posted by eishiya over 2 years ago

I think a prompt would get annoying fast, but I could imagine adding an "AutoMap on Save" option along with the "AutoMap While Drawing" option. In the meantime though, this is indeed something you could script as per @eishiya's example above. :-)

I think another solution might be to increase your "AutomappingRadius" so that it covers your entire map. Depending on the size of your map and number of rules this could be fast enough now.

posted by bjorn over 2 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests