Skip to content

Comments

feat: implement scripting API access to user's tile size preferences#4343

Open
abhinavs1920 wants to merge 1 commit intomapeditor:masterfrom
abhinavs1920:feat/tilesize
Open

feat: implement scripting API access to user's tile size preferences#4343
abhinavs1920 wants to merge 1 commit intomapeditor:masterfrom
abhinavs1920:feat/tilesize

Conversation

@abhinavs1920
Copy link

Resolves Issue #4222

This PR exposes user tile size preferences to the scripting API, allowing scripts to read and modify the default tile dimensions used in the New Map and New Tileset dialogs.

Scripts can now access these preferences through tiled.preferences:

mapTileWidth / mapTileHeight - default tile size for new maps
tilesetTileWidth / tilesetTileHeight - default tile size for new tilesets
The implementation adds a new ScriptPreferences class that wraps the existing session options, making them accessible to the scripting engine. Session options that were previously scoped locally in dialog files have been moved to a shared header (sessionoptions.h) so they can be accessed from the scripting layer.

This is useful for scripts that want to create maps or tilesets programmatically using the user's preferred tile dimensions, or for scripts that need to temporarily adjust these defaults.

I am also adding the screenshot to show successful working of the feature.

image

Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
@abhinavs1920
Copy link
Author

Hey @bjorn, I’ve added the PR. I just realized someone else has been assigned to it, if it’s not mergeable, I’d really appreciate any feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant