-
-
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
Scripting: Enabled creating images and using them #2787
Conversation
@samhocevar I just finished this up and haven't gotten around to testing it nor documenting it, but this should give you quite a few options for getting image data into Tiled and setting it on tilesets or individual tiles, so hopefully it will help with porting your PICO-8 extension to JS. With this change, images can be dynamically created from JS in three ways:
There are also the methods for modifying the palette. |
For future reference, I provided feedback for this feature in #2695 (comment) and resolved current conflicts for this PR in #2906 |
Thanks @samhocevar! Your help is really appreciated and I'll make sure to get around to reviewing this tomorrow. I'll find out tomorrow but just a quick question, was there anything that stood out while resolving the conflicts? Because I'd prefer to rebase the change instead of merging. Not that it matters much because we can also squash when merging back to |
Thanks for the reply! A rebase would be harmless; the conflicts just arose in |
Now a script can create an image, either directly or by loading from a file or data or based on raw data. Then, the image can be passed to Tileset.loadFromImage or Tile.setImage. Related to issue #2695
79e8e26
to
5221ebc
Compare
I've fixed this in 9124a7c.
Yeah, I'm not quite how to handle this, including how to handle undo when setting the image this way, or saving. I guess in case of saving this could lead to storing the image embedded in the file. I'll need to look into this before it can be merged. |
Also made some enums used when scaling images available to the script.
@samhocevar For now I just documented that If there are any problems with the current API, please let me know! |
@samhocevar I noticed that you currently have the following code: But this is the order which doesn't work, right? |
* `Image` seems to be new to Tiled 1.5: https://doc.mapeditor.org/en/latest/reference/scripting/#image * fix some out of order commands, mentioned here: mapeditor/tiled#2787 (comment) * The thing with #123abc seems to work now
Now a script can create an image, either directly or by loading from a file or data or based on raw data. Then, the image can be passed to Tileset.loadFromImage or Tile.setImage.
Related to issue #2695