Skip to content

Export bounds fix - #908

Merged
TokisanGames merged 3 commits into
TokisanGames:mainfrom
rpgshooter:export-bounds-fix
Jul 25, 2026
Merged

Export bounds fix#908
TokisanGames merged 3 commits into
TokisanGames:mainfrom
rpgshooter:export-bounds-fix

Conversation

@rpgshooter

@rpgshooter rpgshooter commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Admin edit: Renamed enums, changed importer script to select slices or regions, and set r16 exports to use _master_height_range instead of normalized per file so all regions/slices are consistent.


Fixes #821

Adds bounded export functionality to export_image() and layered_to_image() with automatic 16k chunking support.

New ExportMode enum:

  • EXPORT_SLICES (default) - Exports full terrain, auto-chunked at 16k boundaries
  • EXPORT_REGIONS - Exports each region as a separate file

Modified functions:

  • export_image(file_name, map_type, mode) - Added optional mode parameter
  • layered_to_image(map_type, bounds) - Added optional Rect2i bounds parameter

Output logging includes:

  • Filename
  • Size (pixels)
  • Position (pixel and world coordinates)

Usage

var data = terrain.get_data()

# Sliced export (default) - auto-chunks if terrain > 16k
data.export_image("res://terrain.exr", Terrain3DRegion.TYPE_HEIGHT)

# Per-region export - one file per region
data.export_image("res://terrain.exr", Terrain3DRegion.TYPE_HEIGHT, Terrain3DData.EXPORT_PER_REGION)

# Direct bounded export
var img = data.layered_to_image(Terrain3DRegion.TYPE_HEIGHT, Rect2i(0, 0, 8192, 8192))

File naming

  • Sliced: filename_00_00.exr, filename_01_00.exr, etc.
  • Per-region: filename_00_00.exr, filename_00-01.exr (handles negative coords)
  • Single chunk/region: no suffix added

Backward compatible

Default parameters maintain existing behavior - no changes required for existing code.

@rpgshooter

Copy link
Copy Markdown
Contributor Author

This is a draft and needs to be squashed, there shouldnt be 200+ additions, merge at same time as pr for c# stuff

@TokisanGames TokisanGames added bug Something isn't working enhancement New feature or request labels Dec 20, 2025
@TokisanGames TokisanGames added this to the 1.1 milestone Dec 20, 2025
@rpgshooter

Copy link
Copy Markdown
Contributor Author

Once 9c692a7 and 3eb9146, are squashed, should be good to merge, once all checks are good

@TokisanGames TokisanGames moved this from 1.1 to In Progress in Terrain3D Roadmap Dec 21, 2025
@rpgshooter
rpgshooter marked this pull request as ready for review January 6, 2026 01:28
@TokisanGames TokisanGames moved this from In Progress to 1.1 in Terrain3D Roadmap May 27, 2026
@TokisanGames TokisanGames self-assigned this May 27, 2026
@TokisanGames TokisanGames moved this from 1.1 to In Progress in Terrain3D Roadmap May 27, 2026
@TokisanGames TokisanGames moved this from In Progress to 1.1 in Terrain3D Roadmap Jul 18, 2026
@TokisanGames

Copy link
Copy Markdown
Owner

Great work. Thanks for the patience in reviewing it. I made some tweaks renaming variables that I felt made more sense, a few fixes, adding the option to the importer script, and setting r16 to use _master_height_range instead of being normalized per file as before.

@TokisanGames
TokisanGames merged commit 9518b50 into TokisanGames:main Jul 25, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from 1.1 to Done in Terrain3D Roadmap Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Export bounds

2 participants