mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
4c75ca8565
Added blend modes (Dissolve, Multiply, Screen, Overlay, Hard Light, Soft Light). Fixed color popup position in the GradientEditor. Fixed initial panoram shown in preview.
30 lines
1.0 KiB
GDScript
30 lines
1.0 KiB
GDScript
tool
|
|
extends ViewportContainer
|
|
|
|
var preview_material = null
|
|
var preview_maximized = false
|
|
|
|
const ENVIRONMENTS = [
|
|
"experiment", "lobby", "night", "park", "schelde"
|
|
]
|
|
|
|
func _ready():
|
|
preview_material = ShaderMaterial.new()
|
|
preview_material.shader = Shader.new()
|
|
preview_material.shader.set_code("shader_type spatial;\nvoid fragment() {\n ALBEDO=vec3(0.5);\n}\n")
|
|
$MaterialPreview/Objects/Cube.set_surface_material(0, preview_material)
|
|
$MaterialPreview/Objects/Cylinder.set_surface_material(0, preview_material)
|
|
$ObjectRotate.play("rotate")
|
|
_on_Environment_item_selected($Environment.selected)
|
|
|
|
func _on_SelectedPreview_gui_input(ev):
|
|
if ev is InputEventMouseButton && ev.button_index == 1 && ev.doubleclick:
|
|
if preview_maximized:
|
|
$SelectedPreviewAnimation.play("minimize")
|
|
else:
|
|
$SelectedPreviewAnimation.play("maximize")
|
|
preview_maximized = !preview_maximized
|
|
|
|
func _on_Environment_item_selected(id):
|
|
$MaterialPreview/WorldEnvironment.environment.background_sky.panorama = load("res://addons/procedural_material/panoramas/"+ENVIRONMENTS[id]+".hdr")
|