From 7526e600376a9bc8ddf1366045d53590276234d0 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:35:36 +0000 Subject: [PATCH] Work around parser regression in latest Godot 4 beta --- terrain/terrain_instance_3d.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/terrain/terrain_instance_3d.gd b/terrain/terrain_instance_3d.gd index f844714..62c65fa 100644 --- a/terrain/terrain_instance_3d.gd +++ b/terrain/terrain_instance_3d.gd @@ -15,13 +15,13 @@ enum PaintSlot { PAINT_3, } -var _albedo_maps: Array[Texture2D] = [null, null, null, null] +var _albedo_maps: Array[Texture2D] = [] var _material := ShaderMaterial.new() var _mesh := PlaneMesh.new() -var _normal_maps: Array[Texture2D] = [null, null, null, null] +var _normal_maps: Array[Texture2D] = [] ## ## Range of the height channel value, ranging from [code]0.0[/code] to [code]100.0[/code]. @@ -54,6 +54,11 @@ var size := Vector2i.ONE: size = value func _init() -> void: + var paint_channels := PaintSlot.values().size() + + _albedo_maps.resize(paint_channels) + _normal_maps.resize(paint_channels) + _material.shader = _SHADER _mesh.surface_set_material(0, _material)