godot_experiments/station_info_panel/style1/site_panel.gd

35 lines
584 B
GDScript

@tool
extends Node3D
## 面板宽度,单位(m)
@export_range(1, 10) var panelWidth: float = 3:
get:
return panelWidth
set(v):
panelWidth = v
update()
## 面板高度,单位(m)
@export_range(0.1, 5) var panelHeight: float = 1:
get:
return panelHeight
set(v):
panelHeight = v
update()
var isReady: bool
func update():
if not isReady:
return
var vp = $SubViewport
$Plane.mesh.size.x = panelWidth
$Plane.mesh.size.y = panelHeight
$Plane.material_override.albedo_texture = vp.get_texture()
func _ready():
isReady = true
print("csPanel ready")
update()