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

Scripting API - Signal for when the active layer was changed #3246

Closed
BlaXun opened this issue Jan 18, 2022 · 4 comments
Closed

Scripting API - Signal for when the active layer was changed #3246

BlaXun opened this issue Jan 18, 2022 · 4 comments
Assignees
Labels
documentation Issue related to the Tiled Manual.

Comments

@BlaXun
Copy link

BlaXun commented Jan 18, 2022

I think it would be helpful if there was a signal emitted when the active layer was changed. That way we could enable/disable tools. For example I got tools that don't create tiles but objects. I'd like those tools to only be active when an object layer was chosen.

Another way to get this done would be to have a new property on tools such as "allowForObjectLayers", "allowForTileLayers". Would make it even easier for extension developers I assume

@bjorn
Copy link
Member

bjorn commented Jan 18, 2022

Already available but undocumented, this is covered by the signals TileMap.currentLayerChanged and TileMap.selectedLayersChanged.

Another way to get this done would be to have a new property on tools such as "allowForObjectLayers", "allowForTileLayers". Would make it even easier for extension developers I assume

But I agree this would be a rather more convenient approach!

@bjorn bjorn added the documentation Issue related to the Tiled Manual. label Jan 18, 2022
@eishiya
Copy link
Contributor

eishiya commented Jan 18, 2022

I love the idea of being able to specify layers for which the tool should be active (or perhaps inactive?). However, I wonder if it might perhaps be better to specify a single property like activateOn: [ObjectGroup, ImageLayer, GroupLayer], so that it's absence can less ambiguously mean "active for all layers".

It would be cool to have an additional property that decides whether to activate the tool when any of the selected layers are valid vs requiring all selected layers to be valid. Or I guess there can be one default behaviour, and if someone wants it different, they can override it in their script.

Perhaps in the future, if Tileset tools are ever added, this could be expanded with Tileset as an additional acceptable item.

@bjorn bjorn changed the title [Request] Scripting API - Signal for when the active layer was changed Scripting API - Signal for when the active layer was changed Jan 18, 2022
@bjorn bjorn self-assigned this Jan 19, 2022
@bjorn bjorn closed this as completed in 0c7b83d Jan 19, 2022
@bjorn
Copy link
Member

bjorn commented Jan 19, 2022

I love the idea of being able to specify layers for which the tool should be active (or perhaps inactive?).

Maybe you or @BlaXun would like to open a separate issue for this?

@eishiya
Copy link
Contributor

eishiya commented Jan 19, 2022

On it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issue related to the Tiled Manual.
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants