2018-07-28 21:21:05 +02:00
|
|
|
tool
|
|
|
|
extends ViewportContainer
|
|
|
|
|
|
|
|
const ENVIRONMENTS = [
|
|
|
|
"experiment", "lobby", "night", "park", "schelde"
|
|
|
|
]
|
|
|
|
|
|
|
|
func _ready():
|
2018-07-29 23:43:24 +02:00
|
|
|
var m = $MaterialPreview/Objects/Cube.get_surface_material(0).duplicate()
|
|
|
|
$MaterialPreview/Objects/Cube.set_surface_material(0, m)
|
|
|
|
$MaterialPreview/Objects/Cylinder.set_surface_material(0, m)
|
2018-07-28 21:21:05 +02:00
|
|
|
$ObjectRotate.play("rotate")
|
2018-07-29 11:55:17 +02:00
|
|
|
_on_Environment_item_selected($Environment.selected)
|
2018-07-28 21:21:05 +02:00
|
|
|
|
|
|
|
func _on_Environment_item_selected(id):
|
|
|
|
$MaterialPreview/WorldEnvironment.environment.background_sky.panorama = load("res://addons/procedural_material/panoramas/"+ENVIRONMENTS[id]+".hdr")
|
2018-07-29 19:19:35 +02:00
|
|
|
|
|
|
|
func _on_Model_item_selected(id):
|
|
|
|
var model = $Model.get_item_text(id)
|
|
|
|
for c in $MaterialPreview/Objects.get_children():
|
|
|
|
c.visible = (c.get_name() == model)
|
2018-07-29 23:43:24 +02:00
|
|
|
|
|
|
|
func get_materials():
|
|
|
|
return [ $MaterialPreview/Objects/Cube.get_surface_material(0) ]
|
2018-08-05 18:46:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Preview_item_rect_changed():
|
|
|
|
$MaterialPreview.size = rect_size
|