godot-camera-preview/cam_preview.gd

27 lines
436 B
GDScript3
Raw Normal View History

2022-06-05 20:17:02 +03:00
tool
extends Control
onready var window: Panel = $window
onready var vp: Viewport = $window/container/vp
onready var container: ViewportContainer = $window/container
func _ready():
resize_vp()
func get_vp() -> Viewport:
return vp
func toggle_window(toggle):
window.visible = toggle
func toggle_vp(toggle):
container.visible = toggle
func _on_window_resized():
resize_vp()
func resize_vp():
vp.size = window.rect_size