Mapping tools WIP

This commit is contained in:
CenTdemeern1 2025-02-10 05:24:04 +01:00
parent 4199297261
commit 48253e4133
31 changed files with 900 additions and 4 deletions

View file

@ -1,12 +1,14 @@
shader_type spatial;
uniform sampler2D tilemap_camera: repeat_disable;
uniform float scale = 8;
uniform vec2 scale = vec2(8);
uniform vec2 offset = vec2(0);
void vertex() {
vec3 world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
vec2 pos = world_position.xz;
pos.y -= world_position.y;
pos += offset;
pos /= scale;
UV = pos;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://773fvksy2hdp"
path="res://.godot/imported/voronoi-cube.png-a1f9b93c2df6016ace96d3c0f8a65468.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Editor/voronoi-cube.png"
dest_files=["res://.godot/imported/voronoi-cube.png-a1f9b93c2df6016ace96d3c0f8a65468.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,14 @@
[gd_resource type="MeshLibrary" load_steps=3 format=3 uid="uid://wivhy7dy5i1n"]
[ext_resource type="Texture2D" uid="uid://773fvksy2hdp" path="res://Assets/Editor/voronoi-cube.png" id="1_rwoe1"]
[sub_resource type="BoxMesh" id="BoxMesh_q3bcf"]
[resource]
item/0/name = "Full Cube"
item/0/mesh = SubResource("BoxMesh_q3bcf")
item/0/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/shapes = []
item/0/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/navigation_layers = 1
item/0/preview = ExtResource("1_rwoe1")

View file

@ -2,9 +2,9 @@
[ext_resource type="TileSet" uid="uid://coub5ioem1v7o" path="res://Assets/tileset.tres" id="1_v8tdb"]
[ext_resource type="MeshLibrary" uid="uid://ctek5p2fwk8gc" path="res://Assets/Placeholders/3D/mesh_library.tres" id="2_hkfg0"]
[ext_resource type="Shader" path="res://Assets/Placeholders/3D/Project.gdshader" id="3_8af8g"]
[ext_resource type="Shader" path="res://Assets/Editor/Project.gdshader" id="3_8af8g"]
[sub_resource type="ViewportTexture" id="ViewportTexture_r414k"]
[sub_resource type="ViewportTexture" id="ViewportTexture_6xjcl"]
viewport_path = NodePath("SubViewport")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_e3oir"]
@ -12,7 +12,7 @@ resource_local_to_scene = true
render_priority = 0
shader = ExtResource("3_8af8g")
shader_parameter/scale = 8.0
shader_parameter/tilemap_camera = SubResource("ViewportTexture_r414k")
shader_parameter/tilemap_camera = SubResource("ViewportTexture_6xjcl")
[sub_resource type="BoxMesh" id="BoxMesh_03j8n"]
material = SubResource("ShaderMaterial_e3oir")

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m7 1v6h-6v2h6v6h2v-6h6v-2h-6v-6z"/></svg>

After

Width:  |  Height:  |  Size: 128 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://0ed20ix8ugpl"
path="res://.godot/imported/Add.svg-8040edfa4f8699d0a514bb9170ba578d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/Add.svg"
dest_files=["res://.godot/imported/Add.svg-8040edfa4f8699d0a514bb9170ba578d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
version="1.1"
id="svg1"
sodipodi:docname="PlaneMesh.svg"
inkscape:version="1.3.2 (091e20e, 2023-11-25)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="27.0625"
inkscape:cx="8"
inkscape:cy="8"
inkscape:window-width="1920"
inkscape:window-height="1080"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg1" />
<path
fill="none"
stroke="#ffca5f"
stroke-width="2"
d="m8 5 5 3-5 3-5-3z"
id="path1"
style="stroke:#fc7f7f;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bjaym0poii0lp"
path="res://.godot/imported/BasePlate.svg-4b97e5a0d6089afcd35ed595fe2c6c54.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/BasePlate.svg"
dest_files=["res://.godot/imported/BasePlate.svg-4b97e5a0d6089afcd35ed595fe2c6c54.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m8 9.669-3.536 2.583H7v2.537h2v-2.537h2.536zm0-3.314L4.464 3.772H7V1.235h2v2.537h2.536zm-7.296.73h14.591v1.831H.704z"/></svg>

After

Width:  |  Height:  |  Size: 212 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d3dtusyl30nq0"
path="res://.godot/imported/Collapse.svg-4f248181360e4ac0865c9973e661b2ed.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/Collapse.svg"
dest_files=["res://.godot/imported/Collapse.svg-4f248181360e4ac0865c9973e661b2ed.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 2H6m2 4v8M4 9l4 5 4-5"/></svg>

After

Width:  |  Height:  |  Size: 199 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bqmald1jy1a2c"
path="res://.godot/imported/Down.svg-f372b7cca346d21da6e294a5e170d35c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/Down.svg"
dest_files=["res://.godot/imported/Down.svg-f372b7cca346d21da6e294a5e170d35c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m8 16-3.5-2.5H7V11h2v2.5h2.5zM8 0 4.5 2.5H7V5h2V2.5h2.5zM1 7h14v2H1z"/></svg>

After

Width:  |  Height:  |  Size: 164 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cg40j0yoi1sq0"
path="res://.godot/imported/Expand.svg-cea13ac131c9bfa54e65e2534de4027a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/Expand.svg"
dest_files=["res://.godot/imported/Expand.svg-cea13ac131c9bfa54e65e2534de4027a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
version="1.1"
id="svg3"
sodipodi:docname="HeightMapShape3D.svg"
inkscape:version="1.3.2 (091e20e, 2023-11-25)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs3" />
<sodipodi:namedview
id="namedview3"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="52.41429"
inkscape:cx="7.393022"
inkscape:cy="8.8048507"
inkscape:window-width="1920"
inkscape:window-height="1080"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg3" />
<linearGradient
id="a"
x2="0"
y1="7"
y2="10"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#a2d2ff"
id="stop1"
style="stop-color:#ffa2a2;stop-opacity:1;" />
<stop
offset="1"
stop-color="#5fb2ff"
id="stop2"
style="stop-color:#fc7f7f;stop-opacity:1;" />
</linearGradient>
<path
fill="#5fb2ff"
d="m1 10 7 3 7-3-7-3z"
id="path2"
style="fill:#fc7f7f;fill-opacity:1" />
<path
fill="url(#a)"
d="M3 10c1-1 2-2 2-4s1-3 3-3 3 1 3 3 1 3 2 4z"
id="path3" />
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dhbqj6pa3geas"
path="res://.godot/imported/HeightMap.svg-8b4db60f40a4b87e465619d68a3f1b08.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/HeightMap.svg"
dest_files=["res://.godot/imported/HeightMap.svg-8b4db60f40a4b87e465619d68a3f1b08.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M2 1v14h8v-1H8v-4h2V8h4V6H9V1zm8 0v4h4z"/><path fill="#5fff97" d="M11 9v2H9v2h2v2h2v-2h2v-2h-2V9z"/></svg>

After

Width:  |  Height:  |  Size: 193 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://djvtp1nbp5ib5"
path="res://.godot/imported/New.svg-48ddecfdcb486cb2a23484b9c5d725f7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/New.svg"
dest_files=["res://.godot/imported/New.svg-48ddecfdcb486cb2a23484b9c5d725f7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16"
height="16"
version="1.1"
id="svg1"
sodipodi:docname="Refresh.svg"
inkscape:version="1.3.2 (091e20e, 2023-11-25)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="23.776466"
inkscape:cx="8.5799128"
inkscape:cy="8.3065332"
inkscape:window-width="1392"
inkscape:window-height="942"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="0"
inkscape:current-layer="svg1" />
<path
fill="#e0e0e0"
d="m 11,8 a 4,4 0 1 0 -4,4 v 2 a 6,6 0 1 1 6,-6 h 2 L 12,12 9,8 Z"
id="path1" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://df52p7ftdm52e"
path="res://.godot/imported/Refresh.svg-045b521bebc8968ffacd1f3d419799f8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/Refresh.svg"
dest_files=["res://.godot/imported/Refresh.svg-045b521bebc8968ffacd1f3d419799f8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#8da5f3" d="M8 2 6.25 3.375 8 4.75l1.75-1.375zm2.624 2.062-1.75 1.375 1.75 1.375 1.75-1.375Zm2.626 2.063L11.5 7.5l1.75 1.375L15 7.5ZM5.376 4.062l-1.75 1.375 1.75 1.375 1.75-1.375zM8 6.124 6.25 7.499 8 8.874l1.75-1.375zm2.626 2.063-1.75 1.375 1.75 1.375 1.75-1.375ZM2.75 6.125 1 7.5l1.75 1.375L4.5 7.5Zm2.624 2.062-1.75 1.375 1.75 1.375 1.75-1.375ZM8 10.25l-1.75 1.375L8 13l1.75-1.375z"/></svg>

After

Width:  |  Height:  |  Size: 468 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://71btnu3srsav"
path="res://.godot/imported/TileMap.svg-06eac9cf0e8a760e3cb4b7035235fd87.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/TileMap.svg"
dest_files=["res://.godot/imported/TileMap.svg-06eac9cf0e8a760e3cb4b7035235fd87.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 14h4m-2-4V2m4 5L8 2 4 7"/></svg>

After

Width:  |  Height:  |  Size: 200 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d21g7jrsdyc8p"
path="res://.godot/imported/Up.svg-8f5b8e04b97adc16f6123f132e6fef37.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/editor_helper/Up.svg"
dest_files=["res://.godot/imported/Up.svg-8f5b8e04b97adc16f6123f132e6fef37.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=2.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View file

@ -0,0 +1,150 @@
@tool
extends Control
#func _ready():
#EditorInterface.get_selection().selection_changed.connect(update_layer_number)
func _process(_delta):
update_layer_number()
func _on_expand_pressed():
var scene = get_scene()
if !is_scene_expanded(scene): return await error_not_expanded()
update_proj_map()
func _on_up_pressed():
move_up_or_down(1)
func _on_down_pressed():
move_up_or_down(-1)
func _on_edit_2d_pressed():
var scene = get_scene()
if !is_scene_expanded(scene): return await error_not_expanded()
focus_node(scene.get_node("TileMap").get_child(0))
func _on_edit_3d_pressed():
var scene = get_scene()
if !is_scene_expanded(scene): return await error_not_expanded()
update_proj_map()
focus_node(scene.get_node("HeightMap"))
func _on_update_pressed():
update_proj_map()
func _on_create_baseplate_pressed():
var scene = get_scene()
if !is_scene_expanded(scene): return await error_not_expanded()
var heightmap: GridMap = scene.get_node("HeightMap")
var maps = scene.get_node("TileMap")
var item_list = heightmap.mesh_library.get_item_list()
var cube = item_list[0]
print(cube)
for map: TileMapLayer in maps.get_children():
if map is not TileMapLayer: continue
for cell in map.get_used_cells():
heightmap.set_cell_item(Vector3i(cell.x, -1, cell.y), cube)
func move_up_or_down(direction: int):
var selection = EditorInterface.get_selection().get_selected_nodes()
if len(selection) != 1: return await error_not_editing_tilemap()
selection = selection[0]
if selection is GridMap:
#EditorCommandPalette
#var event = InputEventKey.new()
#event.physical_keycode = KEY_Q
#event.pressed = true
#Input.parse_input_event(event)
#event.pressed = false
#Input.parse_input_event(event)
#InputMap.action_get_events("floor")
var floor: Vector3 = selection.get(&"metadata/_editor_floor_")
floor.y += direction
selection.set(&"metadata/_editor_floor_", floor)
EditorInterface.save_scene()
EditorInterface.reload_scene_from_path(get_scene().scene_file_path)
update_proj_map()
elif selection is TileMapLayer:
var index = selection.get_index() + direction
if index == -1: return
var target = selection.get_parent().get_child(index)
if target != null: focus_node(target)
#update_layer_number()
func update_layer_number():
var s = "N/A ¯\\_(ツ)_/¯"
var selection = EditorInterface.get_selection().get_selected_nodes()
if len(selection) == 1:
selection = selection[0]
if selection is GridMap:
var v = selection.get(&"metadata/_editor_floor_").y
if v == -1:
s = "-1 (Baseplate)"
else:
s = str(v)
if selection is TileMapLayer:
s = str(selection.get_index())
$"VBoxContainer/Current Layer".text = "Current layer: %s" % s
func focus_node(node: Node):
var selection = EditorInterface.get_selection()
selection.clear()
selection.add_node(node)
func get_scene() -> Node:
return EditorInterface.get_edited_scene_root()
func is_scene_expanded(scene: Node) -> bool:
if !scene: return false
return scene.has_node("NotMinified")
func error(message: String):
var dialog = AcceptDialog.new()
dialog.dialog_text = message
EditorInterface.popup_dialog_centered(dialog)
await dialog.close_requested
dialog.queue_free()
func error_not_expanded():
error("This scene is not an expanded map!")
func error_not_editing_tilemap():
error("Please start editing a map before using this button!")
func heightmap_set_proj_map(height_map: GridMap, proj_vp: SubViewport, rect: Rect2i):
var ml = load("res://Assets/heightmap_meshlibrary.tres").duplicate()
var cube: BoxMesh = ml.get(&"item/0/mesh").duplicate()
var sm = ShaderMaterial.new()
sm.shader = load("res://Assets/Editor/Project.gdshader")
sm.set(&"shader_parameter/tilemap_camera", proj_vp.get_texture())
sm.set(&"shader_parameter/offset", -rect.position as Vector2)
sm.set(&"shader_parameter/scale", rect.size as Vector2)
cube.material = sm
ml.set(&"item/0/mesh", cube)
height_map.mesh_library = ml
func update_proj_map():
var scene = get_scene()
if !is_scene_expanded(scene): return error_not_expanded()
var maps = scene.get_node("TileMap").duplicate(0)
var proj_vp = scene.get_node("ProjectionViewport")
if proj_vp.has_node("TileMap"): proj_vp.get_node("TileMap").free()
proj_vp.add_child(maps)
#maps.owner = scene
var total_rect = Rect2i()
for map: TileMapLayer in maps.get_children():
if map is not TileMapLayer: continue
total_rect = total_rect.merge(map.get_used_rect())
#map.owner = scene
maps.position = total_rect.position * -128
proj_vp.size = total_rect.size.max(Vector2i.ONE) * 128
heightmap_set_proj_map(scene.get_node("HeightMap"), proj_vp, total_rect)

View file

@ -0,0 +1,98 @@
[gd_scene load_steps=11 format=3 uid="uid://d1bj8t8yjv2uj"]
[ext_resource type="Texture2D" uid="uid://d21g7jrsdyc8p" path="res://addons/editor_helper/Up.svg" id="1_pbfaa"]
[ext_resource type="Texture2D" uid="uid://djvtp1nbp5ib5" path="res://addons/editor_helper/New.svg" id="1_py207"]
[ext_resource type="Script" path="res://addons/editor_helper/dock.gd" id="1_t1280"]
[ext_resource type="Texture2D" uid="uid://d3dtusyl30nq0" path="res://addons/editor_helper/Collapse.svg" id="2_d6cq4"]
[ext_resource type="Texture2D" uid="uid://bqmald1jy1a2c" path="res://addons/editor_helper/Down.svg" id="2_ek7b6"]
[ext_resource type="Texture2D" uid="uid://cg40j0yoi1sq0" path="res://addons/editor_helper/Expand.svg" id="3_73lev"]
[ext_resource type="Texture2D" uid="uid://71btnu3srsav" path="res://addons/editor_helper/TileMap.svg" id="3_ri7dm"]
[ext_resource type="Texture2D" uid="uid://dhbqj6pa3geas" path="res://addons/editor_helper/HeightMap.svg" id="4_ie2iw"]
[ext_resource type="Texture2D" uid="uid://df52p7ftdm52e" path="res://addons/editor_helper/Refresh.svg" id="8_aph12"]
[ext_resource type="Texture2D" uid="uid://bjaym0poii0lp" path="res://addons/editor_helper/BasePlate.svg" id="10_l2bcy"]
[node name="Mapping" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_t1280")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="New" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Create new map"
icon = ExtResource("1_py207")
expand_icon = true
[node name="Minify" type="Button" parent="VBoxContainer"]
layout_mode = 2
tooltip_text = "Removes editor-only elements from the map."
text = "Minify map"
icon = ExtResource("2_d6cq4")
expand_icon = true
[node name="Expand" type="Button" parent="VBoxContainer"]
layout_mode = 2
tooltip_text = "Re-adds editor-only elements to the map."
text = "Expand map"
icon = ExtResource("3_73lev")
expand_icon = true
[node name="Current Layer" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Current layer: N/A ¯\\_(ツ)_/¯"
horizontal_alignment = 1
[node name="Up" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Go up a layer"
icon = ExtResource("1_pbfaa")
expand_icon = true
[node name="Down" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Go down a layer"
icon = ExtResource("2_ek7b6")
expand_icon = true
[node name="Edit 2D" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Edit 2D TileMap"
icon = ExtResource("3_ri7dm")
expand_icon = true
[node name="Edit 3D" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Edit 3D HeightMap"
icon = ExtResource("4_ie2iw")
expand_icon = true
[node name="Update" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Update projected map"
icon = ExtResource("8_aph12")
expand_icon = true
[node name="Create Baseplate" type="Button" parent="VBoxContainer"]
layout_mode = 2
text = "Create HeightMap baseplate"
icon = ExtResource("10_l2bcy")
expand_icon = true
[connection signal="pressed" from="VBoxContainer/Expand" to="." method="_on_expand_pressed"]
[connection signal="pressed" from="VBoxContainer/Up" to="." method="_on_up_pressed"]
[connection signal="pressed" from="VBoxContainer/Down" to="." method="_on_down_pressed"]
[connection signal="pressed" from="VBoxContainer/Edit 2D" to="." method="_on_edit_2d_pressed"]
[connection signal="pressed" from="VBoxContainer/Edit 3D" to="." method="_on_edit_3d_pressed"]
[connection signal="pressed" from="VBoxContainer/Update" to="." method="_on_update_pressed"]
[connection signal="pressed" from="VBoxContainer/Create Baseplate" to="." method="_on_create_baseplate_pressed"]

View file

@ -0,0 +1,12 @@
@tool
extends EditorPlugin
var dock
func _enter_tree():
dock = preload("res://addons/editor_helper/dock.tscn").instantiate()
add_control_to_dock(DOCK_SLOT_LEFT_UR, dock)
func _exit_tree():
remove_control_from_docks(dock)
dock.free()

View file

@ -0,0 +1,7 @@
[plugin]
name="Land Grifter Editor Helper"
description="Land Grifter Editor Helper, made to help with mapping"
author="Charlotte (CenTdemeern1)"
version=""
script="editor_helper.gd"

View file

@ -0,0 +1,62 @@
[gd_scene load_steps=8 format=4 uid="uid://cm7vfupftbsu8"]
[ext_resource type="TileSet" uid="uid://coub5ioem1v7o" path="res://Assets/tileset.tres" id="1_0y2ly"]
[ext_resource type="Texture2D" uid="uid://773fvksy2hdp" path="res://Assets/Editor/voronoi-cube.png" id="2_7oxkx"]
[ext_resource type="Shader" path="res://Assets/Editor/Project.gdshader" id="2_e7bie"]
[sub_resource type="ViewportTexture" id="ViewportTexture_qt304"]
viewport_path = NodePath("ProjectionViewport")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_qkhvu"]
render_priority = 0
shader = ExtResource("2_e7bie")
shader_parameter/scale = Vector2(7, 7)
shader_parameter/offset = Vector2(2, 2)
shader_parameter/tilemap_camera = SubResource("ViewportTexture_qt304")
[sub_resource type="BoxMesh" id="BoxMesh_ce6ak"]
material = SubResource("ShaderMaterial_qkhvu")
[sub_resource type="MeshLibrary" id="MeshLibrary_yl7gh"]
item/0/name = "Full Cube"
item/0/mesh = SubResource("BoxMesh_ce6ak")
item/0/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/shapes = []
item/0/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/navigation_layers = 1
item/0/preview = ExtResource("2_7oxkx")
[node name="Template" type="Node2D"]
metadata/_edit_lock_ = true
metadata/_edit_group_ = true
[node name="NotMinified" type="Node" parent="."]
[node name="TileMap" type="Node2D" parent="."]
metadata/_edit_lock_ = true
[node name="TileMapLayer" type="TileMapLayer" parent="TileMap"]
tile_map_data = PackedByteArray("AAD+/wEAAAAAAAAAAAD/////AAAAAAAAAAD//wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAQAAAAAAAAAAAABAAAAAwAAAAAAAAABAAEAAgAAAAAAAAABAAIAAQAAAAAAAAABAAMAAQAAAAAAAAABAAQAAAAAAAAAAAACAAAAAwAAAAAAAAACAAEAAgAAAAAAAAACAAIAAQAAAAAAAAACAAMAAQAAAAAAAAACAAQAAAAAAAAAAAADAAAAAAAAAAAAAAADAAEAAAAAAAAAAAADAAIAAAAAAAAAAAADAAMAAAAAAAAAAAADAAQAAAAAAAAAAAAEAAEAAAAAAAAAAAAEAAIAAAAAAAAAAAAEAAMAAAAAAAAAAAD+//7/AAAAAAAAAAD///7/AAAAAAAAAAAAAP7/AAAAAAAAAAABAP7/AAAAAAAAAAACAP7/AAAAAAAAAAACAP//AAAAAAAAAAADAP//AAAAAAAAAAADAP7/AAAAAAAAAAABAP//AAAAAAAAAAAAAP//AAAAAAAAAAD//wAAAAAAAAAAAAD+/wAAAAAAAAAAAAD+////AAAAAAAAAAA=")
tile_set = ExtResource("1_0y2ly")
[node name="TileMapLayer2" type="TileMapLayer" parent="TileMap"]
tile_set = ExtResource("1_0y2ly")
[node name="TileMapLayer3" type="TileMapLayer" parent="TileMap"]
tile_set = ExtResource("1_0y2ly")
[node name="TileMapLayer4" type="TileMapLayer" parent="TileMap"]
tile_set = ExtResource("1_0y2ly")
[node name="HeightMap" type="GridMap" parent="."]
mesh_library = SubResource("MeshLibrary_yl7gh")
cell_size = Vector3(1, 1, 1)
data = {
"cells": PackedInt32Array(-65536, 0, 0, -65535, 0, 0, -65536, 1, 0, -65535, 1, 0, -65535, 65535, 0, -65535, 65534, 0, -65536, 65534, 0, -1, 65534, 0, -1, 65535, 0, -1, 0, 0, -65536, 65535, 0, -2, 0, 0, -2, 1, 0, -1, 1, 0, -2, 65535, 0, -2, 65534, 0, -65536, 2, 0, -65536, 3, 0, -65536, 4, 0, -65535, 4, 0, -65535, 3, 0, -65535, 2, 0, -65534, 4, 0, -65534, 3, 0, -65534, 2, 0, -65534, 1, 0, -65534, 0, 0, -65533, 0, 0, -65532, 1, 0, -65532, 2, 0, -65533, 2, 0, -65533, 3, 0, -65533, 4, 0, -65533, 1, 0, -65532, 3, 0, -65534, 65535, 0, -65533, 65535, 0, -65534, 65534, 0, -65533, 65534, 0, 2, 3, 0, 1, 3, 0, 1, 2, 0, 2, 2, 0, 65538, 2, 0, 65537, 2, 0, 65537, 3, 0, 65538, 3, 0)
}
metadata/_edit_lock_ = true
metadata/_editor_floor_ = Vector3(0, -1, 0)
[node name="ProjectionViewport" type="SubViewport" parent="."]
disable_3d = true
size = Vector2i(896, 896)

View file

@ -13,3 +13,7 @@ config_version=5
config/name="Land Grifter"
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg"
[editor_plugins]
enabled=PackedStringArray("res://addons/editor_helper/plugin.cfg")