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

JavaScript API should allow opening newly created assets without saving them #3160

Closed
bjorn opened this issue Oct 12, 2021 · 3 comments
Closed
Assignees
Labels
missing feature It's not just a feature, it's a feature that really should be there!

Comments

@bjorn
Copy link
Member

bjorn commented Oct 12, 2021

The JS extension API allows the creation of maps and tilesets, but the created map or tileset can't be opened without first saving it somewhere. It should be possible to open the created asset in Tiled and allow the user to choose where to save it and in which format.

See #1902 (comment).

@bjorn bjorn added the missing feature It's not just a feature, it's a feature that really should be there! label Oct 12, 2021
@bjorn bjorn self-assigned this Jan 26, 2022
@bjorn bjorn added this to Tiled 1.8 Jan 26, 2022
@bjorn bjorn moved this to Todo in Tiled 1.8 Jan 26, 2022
@bjorn
Copy link
Member Author

bjorn commented Jan 27, 2022

Hmm, the main issue with this is probably that for opened files, the EditableMap and EditableTileset instances are owned by the MapDocument and TilesetDocument instances on the C++ side, whereas for assets created by the script, they are owned by the scripting engine (where they are subject to garbage collection). But maybe we can change their ownership with QQmlEngine::setObjectOwnership once you try to "open" them.

@bjorn bjorn moved this from Todo to In Progress in Tiled 1.8 Jan 27, 2022
@bjorn bjorn closed this as completed in 91f6ceb Jan 27, 2022
Repository owner moved this from In Progress to Done in Tiled 1.8 Jan 27, 2022
@eishiya
Copy link
Contributor

eishiya commented Jan 27, 2022

How does this interact with Tilesets, which currently can't be used before being saved AFAIK?

@bjorn
Copy link
Member Author

bjorn commented Jan 27, 2022

How does this interact with Tilesets, which currently can't be used before being saved AFAIK?

It just... allows creating an unsaved tileset, which could then also be used... and when you save a map using the unsaved tileset, it'll probably just get embedded (see #3161 (comment)). I forgot to test it.

@bjorn bjorn moved this to Completed in Roadmap Feb 3, 2023
@bjorn bjorn added this to Roadmap Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing feature It's not just a feature, it's a feature that really should be there!
Projects
Archived in project
Status: Done
Development

No branches or pull requests

2 participants