godot_experiments/experiments/psd_panel.gd

27 lines
806 B
GDScript3
Raw Normal View History

2024-04-19 13:15:35 +08:00
@tool
extends Node3D
@export_range(0.2, 20, 0.2) var repeat_times: float = 1
2024-04-27 10:02:45 +08:00
@export_range(10, 200) var panel_width: float = 100
#get:
#return panel_width
#set(value):
#panel_width = value
#initial(panel_width, panel_height, repeat_times, station_names)
@export_range(1, 5) var panel_height: float = 2
@export var panel_color: Color = Color.WHITE
@export var station_names: Array[String] = []
2024-04-27 10:02:45 +08:00
func initial(panelWidth, panelHeight, repeat, stations):
var vp = $LabelTexture
2024-04-27 10:02:45 +08:00
#vp.set_clear_mode(SubViewport.CLEAR_MODE_ONCE)
2024-04-27 10:02:45 +08:00
$Plane.mesh.size.x = panelWidth
$Plane.mesh.size.y = panelHeight
$Plane.material_override.albedo_texture = vp.get_texture()
2024-04-27 10:02:45 +08:00
$Plane.material_override.uv1_scale = Vector3(repeat, 1, 1)
func _ready():
initial(panel_width, panel_height, repeat_times, station_names)