@Zylann First and foremost I want to say I love your terrain plugin. I have spent the last couple of days working on improving it to do a vertex paint mode. I'm currently a bit stuck and I think you are probably the only person in the world who can actually help.
Modifying the menu to have a a vertex button and a dropper tool was the easy part:
Image attatched:

The reason I am doing this is because last year I was halfway through developing my very own game using the blender game engine and switched to the Uchronia blender fork. During my development I stumbled across a way of using vertex colors to map seemeless terrain types. I was previously told it was only possible to seemlessly blend 4 terrain types, by using combinations of sin and cosine nodes I have managed to do 8, now 9 thanks to makign use of normals similiar to how your terrain engine has green and brown tiles. So if there is a slope it does this rocky texture.
As you can see from when I hooked up vertex color to diffuse this is what the terrain actually looks like just to further verify I am not lying or have cheated this process in any way shape or form:
Here is how I linked up the nodes in the shader graph mode:
I have found a way to change vertex colors within your terrain editor albeit crudely from code directly in the "_generate_mesh_at" function in terrain.gd using the lines of code:
var meshData = MeshDataTool.new()
meshData.create_from_surface(mesh, 0)
var vertexindex = meshData.get_vertex_count()
var vertexcolor = Color(0.0, 0.0, 1.0)
for i in range(0,vertexindex):
meshData.set_vertex_color(i, vertexcolor)
This sets the terrain to Blue ( like you didn't know that already! :) )
I've tried to rewrite the entire data structure from 2D arrays to 3D arrays.
Your previous structure had grid[x][y] which would return a vector3 if I'm not mistaken. I'm trying to rewrite it so that it can store grid[x][y][z] where z has 5 var's [x][y][0] is the vector3, 1 2 3 4 are going to be red green blue and alpha floats.
Anyway I've spent a long time trying to rewrite the code adding lots of [0]'s trying to trace the code back and I'm now really stuck and lost. I would really appreciate your help
Here's one of the error messages:

I have some code pastes of the work in progress I have done
modified terrain.gd: https://paste.ee/p/APYa8
modified terrain_brush.gd: https://paste.ee/p/NCICL
modified terrain_plugin.gf: https://paste.ee/p/Kg7np
And most importantly modified terrain_utils.gd: https://paste.ee/p/btrAc
Please obi wan kenobi you are my only hope