1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 00:59:47 +00:00

Start working on a noise generator node

Used for shaders that need noise textures.

Still WIP. needs the nodes to set their appropriate values when setting a noise texture. Which means I'll probably have to re-write the whole thing, yay :D
This commit is contained in:
Emmanouil Papadeas 2024-12-17 03:21:23 +02:00
parent 618d5f4916
commit 0f53fc32fe
7 changed files with 710 additions and 26 deletions

View file

@ -4,6 +4,7 @@ extends RefCounted
const VALUE_SLIDER_V2_TSCN := preload("res://src/UI/Nodes/Sliders/ValueSliderV2.tscn")
const BASIS_SLIDERS_TSCN := preload("res://src/UI/Nodes/Sliders/BasisSliders.tscn")
const GRADIENT_EDIT_TSCN := preload("res://src/UI/Nodes/GradientEdit.tscn")
const NOISE_GENERATOR := preload("res://src/UI/Nodes/NoiseGeneratorDialog.tscn")
static func create_ui_for_shader_uniforms(
@ -261,12 +262,32 @@ static func create_ui_for_shader_uniforms(
curve_edit.curve = params[u_name].curve
else:
curve_edit.set_default_curve()
params[u_name] = CurveEdit.to_texture(curve_edit.curve)
curve_edit.value_changed.connect(
func(curve: Curve): value_changed.call(CurveEdit.to_texture(curve), u_name)
)
hbox.add_child(curve_edit)
elif u_name.begins_with("noise_"):
var noise_generator_dialog := NOISE_GENERATOR.instantiate() as AcceptDialog
noise_generator_dialog.always_on_top = true
var noise_generator := noise_generator_dialog.get_child(0) as NoiseGenerator
if params.has(u_name) and params[u_name] is NoiseTexture2D:
noise_generator.noise_texture = params[u_name]
else:
params[u_name] = noise_generator.noise_texture
noise_generator.value_changed.connect(
func(noise_texture: NoiseTexture2D): value_changed.call(noise_texture, u_name)
)
parent_node.add_child(noise_generator_dialog)
var button := Button.new()
button.text = "Generate noise"
button.pressed.connect(noise_generator_dialog.popup_centered)
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
hbox.add_child(button)
else: ## Simple texture
var file_dialog := FileDialog.new()
file_dialog.always_on_top = true
file_dialog.file_mode = FileDialog.FILE_MODE_OPEN_FILE
file_dialog.access = FileDialog.ACCESS_FILESYSTEM
file_dialog.size = Vector2(384, 281)

View file

@ -0,0 +1,141 @@
class_name NoiseGenerator
extends ScrollContainer
signal value_changed(noise_texture: NoiseTexture2D)
var noise_texture: NoiseTexture2D:
set(value):
noise_texture = value
if not is_instance_valid(noise_texture.noise):
noise_texture.noise = FastNoiseLite.new()
if not is_instance_valid(preview):
await ready
preview.texture = noise_texture
@onready var preview := %Preview as TextureRect
func _init() -> void:
noise_texture = NoiseTexture2D.new()
func _on_size_slider_value_changed(value: Vector2) -> void:
noise_texture.width = value.x
noise_texture.height = value.y
value_changed.emit(noise_texture)
func _on_invert_check_box_toggled(toggled_on: bool) -> void:
noise_texture.invert = toggled_on
value_changed.emit(noise_texture)
func _on_in_3d_space_check_box_toggled(toggled_on: bool) -> void:
noise_texture.in_3d_space = toggled_on
value_changed.emit(noise_texture)
func _on_seamless_check_box_toggled(toggled_on: bool) -> void:
noise_texture.seamless = toggled_on
value_changed.emit(noise_texture)
func _on_normal_map_check_box_toggled(toggled_on: bool) -> void:
noise_texture.as_normal_map = toggled_on
value_changed.emit(noise_texture)
func _on_normalize_check_box_toggled(toggled_on: bool) -> void:
noise_texture.normalize = toggled_on
value_changed.emit(noise_texture)
func _on_gradient_edit_updated(gradient: Gradient, _cc: bool) -> void:
noise_texture.color_ramp = gradient
value_changed.emit(noise_texture)
func _on_noise_type_option_button_item_selected(index: FastNoiseLite.NoiseType) -> void:
(noise_texture.noise as FastNoiseLite).noise_type = index
value_changed.emit(noise_texture)
func _on_seed_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).seed = value
value_changed.emit(noise_texture)
func _on_frequency_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).frequency = value
value_changed.emit(noise_texture)
func _on_offset_slider_value_changed(value: Vector3) -> void:
(noise_texture.noise as FastNoiseLite).offset = value
value_changed.emit(noise_texture)
func _on_fractal_type_option_button_item_selected(index: FastNoiseLite.FractalType) -> void:
(noise_texture.noise as FastNoiseLite).fractal_type = index
value_changed.emit(noise_texture)
func _on_fractal_octaves_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).fractal_octaves = value
value_changed.emit(noise_texture)
func _on_fractal_lacunarity_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).fractal_lacunarity = value
value_changed.emit(noise_texture)
func _on_fractal_gain_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).fractal_gain = value
value_changed.emit(noise_texture)
func _on_fractal_weighted_strength_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).fractal_weighted_strength = value
value_changed.emit(noise_texture)
func _on_domain_warp_enabled_check_box_toggled(toggled_on: bool) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_enabled = toggled_on
value_changed.emit(noise_texture)
func _on_domain_warp_type_option_button_item_selected(index: FastNoiseLite.DomainWarpType) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_type = index
value_changed.emit(noise_texture)
func _on_domain_warp_amplitude_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_amplitude = value
value_changed.emit(noise_texture)
func _on_domain_warp_frequency_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_frequency = value
value_changed.emit(noise_texture)
func _on_domain_warp_fractal_type_option_button_item_selected(
index: FastNoiseLite.DomainWarpFractalType
) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_fractal_type = index
value_changed.emit(noise_texture)
func _on_domain_warp_fractal_octaves_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_fractal_octaves = value
value_changed.emit(noise_texture)
func _on_domain_warp_fractal_lacunarity_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_fractal_lacunarity = value
value_changed.emit(noise_texture)
func _on_domain_warp_fractal_gain_slider_value_changed(value: float) -> void:
(noise_texture.noise as FastNoiseLite).domain_warp_fractal_gain = value
value_changed.emit(noise_texture)

View file

@ -0,0 +1,505 @@
[gd_scene load_steps=7 format=3 uid="uid://be14ffwmcp5xy"]
[ext_resource type="PackedScene" uid="uid://bbnqcxa20a5a5" path="res://src/UI/Nodes/Sliders/ValueSliderV2.tscn" id="1_evt0j"]
[ext_resource type="Script" path="res://src/UI/Nodes/Sliders/ValueSlider.gd" id="1_pm12o"]
[ext_resource type="Script" path="res://src/UI/Nodes/NoiseGenerator.gd" id="1_uxdt4"]
[ext_resource type="PackedScene" uid="uid://bn4aw27dj7pwi" path="res://src/UI/Nodes/GradientEdit.tscn" id="2_nxkb0"]
[ext_resource type="PackedScene" uid="uid://dpoteid430evf" path="res://src/UI/Nodes/Sliders/ValueSliderV3.tscn" id="3_ffklk"]
[ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="4_r1f12"]
[node name="NoiseGenerator" type="ScrollContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_uxdt4")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
[node name="VSplitContainer" type="VSplitContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="Preview" type="TextureRect" parent="VBoxContainer/VSplitContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_vertical = 3
expand_mode = 1
stretch_mode = 5
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/VSplitContainer"]
layout_mode = 2
columns = 2
[node name="SizeLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Size:"
[node name="SizeSlider" parent="VBoxContainer/VSplitContainer/GridContainer" instance=ExtResource("1_evt0j")]
layout_mode = 2
value = Vector2(512, 512)
min_value = Vector2(1, 1)
max_value = Vector2(1024, 1024)
allow_greater = true
show_ratio = true
grid_columns = 2
suffix_x = "px"
suffix_y = "px"
[node name="InvertLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Invert:"
[node name="InvertCheckBox" type="CheckBox" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "On"
[node name="In3DSpaceLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "In 3D space:"
[node name="In3DSpaceCheckBox" type="CheckBox" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "On"
[node name="SeamlessLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Seamless:"
[node name="SeamlessCheckBox" type="CheckBox" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "On"
[node name="NormalMapLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Normal map:"
[node name="NormalMapCheckBox" type="CheckBox" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "On"
[node name="NormalizeLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Normalize:"
[node name="NormalizeCheckBox" type="CheckBox" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
button_pressed = true
text = "On"
[node name="ColorRampLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Color ramp:"
[node name="GradientEdit" parent="VBoxContainer/VSplitContainer/GridContainer" instance=ExtResource("2_nxkb0")]
layout_mode = 2
[node name="NoiseTypeLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Noise type:"
[node name="NoiseTypeOptionButton" type="OptionButton" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
selected = 1
item_count = 6
popup/item_0/text = "Simplex"
popup/item_1/text = "Simplex Smooth"
popup/item_1/id = 1
popup/item_2/text = "Cellural"
popup/item_2/id = 2
popup/item_3/text = "Perlin"
popup/item_3/id = 3
popup/item_4/text = "Value Cubic"
popup/item_4/id = 4
popup/item_5/text = "Value"
popup/item_5/id = 5
[node name="SeedLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Seed:"
[node name="SeedSlider" type="TextureProgressBar" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
max_value = 1024.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
[node name="FrequencyLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Frequency:"
[node name="FrequencySlider" type="TextureProgressBar" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = 0.001
max_value = 1.0
step = 0.001
value = 0.001
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
snap_step = 0.1
[node name="OffsetLabel" type="Label" parent="VBoxContainer/VSplitContainer/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Offset:"
[node name="OffsetSlider" parent="VBoxContainer/VSplitContainer/GridContainer" instance=ExtResource("3_ffklk")]
layout_mode = 2
min_value = Vector3(-1000, -1000, -1000)
max_value = Vector3(1000, 1000, 1000)
grid_columns = 3
[node name="FractalOptions" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
theme_type_variation = &"CollapsibleContainer"
script = ExtResource("4_r1f12")
text = "Fractal"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/FractalOptions"]
visible = false
layout_mode = 2
columns = 2
[node name="FractalTypeLabel" type="Label" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Type:"
[node name="FractalTypeOptionButton" type="OptionButton" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
selected = 0
item_count = 4
popup/item_0/text = "None"
popup/item_1/text = "FBM"
popup/item_1/id = 1
popup/item_2/text = "Ridged"
popup/item_2/id = 2
popup/item_3/text = "Ping-Pong"
popup/item_3/id = 3
[node name="FractalOctavesLabel" type="Label" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Octaves:"
[node name="FractalOctavesSlider" type="TextureProgressBar" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = 1.0
max_value = 10.0
value = 5.0
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
[node name="FractalLacunarityLabel" type="Label" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lacunarity:"
[node name="FractalLacunaritySlider" type="TextureProgressBar" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = -50.0
max_value = 50.0
value = 2.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
[node name="FractalGainLabel" type="Label" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Gain:"
[node name="FractalGainSlider" type="TextureProgressBar" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = -20.0
max_value = 20.0
step = 0.001
value = 0.5
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
snap_step = 0.01
[node name="FractalWeightedStrengthLabel" type="Label" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Weighted Strength:"
[node name="FractalWeightedStrengthSlider" type="TextureProgressBar" parent="VBoxContainer/FractalOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
max_value = 1.0
step = 0.01
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
snap_step = 0.1
[node name="DomainWarpOptions" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
theme_type_variation = &"CollapsibleContainer"
script = ExtResource("4_r1f12")
text = "Domain Warp"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/DomainWarpOptions"]
visible = false
layout_mode = 2
columns = 2
[node name="DomainWarpEnabledLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Enabled:"
[node name="DomainWarpEnabledCheckBox" type="CheckBox" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "On"
[node name="DomainWarpTypeLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Type:"
[node name="DomainWarpTypeOptionButton" type="OptionButton" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
selected = 0
item_count = 3
popup/item_0/text = "Simplex"
popup/item_1/text = "Simplex Reduced"
popup/item_1/id = 1
popup/item_2/text = "Basic Grid"
popup/item_2/id = 2
[node name="DomainWarpAmplitudeLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Amplitude:"
[node name="DomainWarpAmplitudeSlider" type="TextureProgressBar" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
value = 30.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
[node name="DomainWarpFrequencyLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Frequency:"
[node name="DomainWarpFrequencySlider" type="TextureProgressBar" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = -20.0
max_value = 20.0
step = 0.001
value = 0.05
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
snap_step = 0.01
[node name="DomainWarpFractalTypeLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Fractal type:"
[node name="DomainWarpFractalTypeOptionButton" type="OptionButton" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
selected = 0
item_count = 3
popup/item_0/text = "None"
popup/item_1/text = "Progressive"
popup/item_1/id = 1
popup/item_2/text = "Independent"
popup/item_2/id = 2
[node name="DomainWarpFractalOctavesLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Fractal octaves:"
[node name="DomainWarpFractalOctavesSlider" type="TextureProgressBar" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = 1.0
max_value = 10.0
value = 5.0
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
[node name="DomainWarpFractalLacunarityLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Fractal lacunarity:"
[node name="DomainWarpFractalLacunaritySlider" type="TextureProgressBar" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = -50.0
max_value = 50.0
value = 6.0
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
[node name="DomainWarpFractalGainLabel" type="Label" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Fractal gain:"
[node name="DomainWarpFractalGainSlider" type="TextureProgressBar" parent="VBoxContainer/DomainWarpOptions/GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
min_value = -20.0
max_value = 20.0
step = 0.001
value = 0.5
allow_greater = true
allow_lesser = true
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource("1_pm12o")
snap_step = 0.01
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/GridContainer/SizeSlider" to="." method="_on_size_slider_value_changed"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/GridContainer/InvertCheckBox" to="." method="_on_invert_check_box_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/GridContainer/In3DSpaceCheckBox" to="." method="_on_in_3d_space_check_box_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/GridContainer/SeamlessCheckBox" to="." method="_on_seamless_check_box_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/GridContainer/NormalMapCheckBox" to="." method="_on_normal_map_check_box_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/GridContainer/NormalizeCheckBox" to="." method="_on_normalize_check_box_toggled"]
[connection signal="updated" from="VBoxContainer/VSplitContainer/GridContainer/GradientEdit" to="." method="_on_gradient_edit_updated"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/GridContainer/NoiseTypeOptionButton" to="." method="_on_noise_type_option_button_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/GridContainer/SeedSlider" to="." method="_on_seed_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/GridContainer/FrequencySlider" to="." method="_on_frequency_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/GridContainer/OffsetSlider" to="." method="_on_offset_slider_value_changed"]
[connection signal="item_selected" from="VBoxContainer/FractalOptions/GridContainer/FractalTypeOptionButton" to="." method="_on_fractal_type_option_button_item_selected"]
[connection signal="value_changed" from="VBoxContainer/FractalOptions/GridContainer/FractalOctavesSlider" to="." method="_on_fractal_octaves_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/FractalOptions/GridContainer/FractalLacunaritySlider" to="." method="_on_fractal_lacunarity_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/FractalOptions/GridContainer/FractalGainSlider" to="." method="_on_fractal_gain_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/FractalOptions/GridContainer/FractalWeightedStrengthSlider" to="." method="_on_fractal_weighted_strength_slider_value_changed"]
[connection signal="toggled" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpEnabledCheckBox" to="." method="_on_domain_warp_enabled_check_box_toggled"]
[connection signal="item_selected" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpTypeOptionButton" to="." method="_on_domain_warp_type_option_button_item_selected"]
[connection signal="value_changed" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpAmplitudeSlider" to="." method="_on_domain_warp_amplitude_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpFrequencySlider" to="." method="_on_domain_warp_frequency_slider_value_changed"]
[connection signal="item_selected" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpFractalTypeOptionButton" to="." method="_on_domain_warp_fractal_type_option_button_item_selected"]
[connection signal="value_changed" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpFractalOctavesSlider" to="." method="_on_domain_warp_fractal_octaves_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpFractalLacunaritySlider" to="." method="_on_domain_warp_fractal_lacunarity_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/DomainWarpOptions/GridContainer/DomainWarpFractalGainSlider" to="." method="_on_domain_warp_fractal_gain_slider_value_changed"]

View file

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=3 uid="uid://buixtfobyc3df"]
[ext_resource type="PackedScene" uid="uid://be14ffwmcp5xy" path="res://src/UI/Nodes/NoiseGenerator.tscn" id="1_wso7i"]
[node name="NoiseGeneratorDialog" type="AcceptDialog"]
title = "Generate noise"
size = Vector2i(500, 500)
[node name="NoiseGenerator" parent="." instance=ExtResource("1_wso7i")]
offset_left = 8.0
offset_top = 8.0
offset_right = -8.0
offset_bottom = -49.0
size_flags_horizontal = 3
size_flags_vertical = 3

View file

@ -25,11 +25,13 @@ signal ratio_toggled(button_pressed: bool)
min_value = val
$GridContainer/X.min_value = val.x
$GridContainer/Y.min_value = val.y
value = value # Call value setter
@export var max_value := Vector2(100.0, 100.0):
set(val):
max_value = val
$GridContainer/X.max_value = val.x
$GridContainer/Y.max_value = val.y
value = value # Call value setter
@export var step := 1.0:
set(val):
step = val

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=6 format=3 uid="uid://bbnqcxa20a5a5"]
[ext_resource type="Script" path="res://src/UI/Nodes/Sliders/ValueSlider.gd" id="1"]
[ext_resource type="Script" path="res://src/UI/Nodes/Sliders/ValueSliderV2.gd" id="2"]
@ -9,62 +9,60 @@
[node name="ValueSliderV2" type="HBoxContainer"]
offset_right = 45.0
offset_bottom = 52.0
script = ExtResource( 2 )
script = ExtResource("2")
[node name="GridContainer" type="GridContainer" parent="."]
offset_right = 45.0
offset_bottom = 52.0
layout_mode = 2
size_flags_horizontal = 3
[node name="X" type="TextureProgressBar" parent="GridContainer"]
offset_right = 45.0
offset_bottom = 24.0
custom_minimum_size = Vector2( 32, 24 )
mouse_default_cursor_shape = 2
custom_minimum_size = Vector2(32, 24)
layout_mode = 2
size_flags_horizontal = 3
theme_type_variation = "ValueSlider"
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource( 1 )
script = ExtResource("1")
prefix = "X:"
[node name="Y" type="TextureProgressBar" parent="GridContainer"]
offset_top = 28.0
offset_right = 45.0
offset_bottom = 52.0
custom_minimum_size = Vector2( 32, 24 )
mouse_default_cursor_shape = 2
custom_minimum_size = Vector2(32, 24)
layout_mode = 2
size_flags_horizontal = 3
theme_type_variation = "ValueSlider"
focus_mode = 2
mouse_default_cursor_shape = 2
theme_type_variation = &"ValueSlider"
nine_patch_stretch = true
stretch_margin_left = 3
stretch_margin_top = 3
stretch_margin_right = 3
stretch_margin_bottom = 3
script = ExtResource( 1 )
script = ExtResource("1")
prefix = "Y:"
[node name="Ratio" type="Control" parent="."]
visible = false
offset_left = 36.0
offset_right = 52.0
offset_bottom = 52.0
custom_minimum_size = Vector2( 16, 0 )
custom_minimum_size = Vector2(16, 0)
layout_mode = 2
[node name="RatioGuides" type="NinePatchRect" parent="Ratio" groups=["UIButtons"]]
custom_minimum_size = Vector2(9, 0)
layout_mode = 0
anchor_bottom = 1.0
offset_right = 9.0
custom_minimum_size = Vector2( 9, 0 )
texture = ExtResource( 4 )
region_rect = Rect2( 0, 0, 9, 44 )
texture = ExtResource("4")
region_rect = Rect2(0, 0, 9, 44)
patch_margin_top = 15
patch_margin_bottom = 13
[node name="RatioButton" type="TextureButton" parent="Ratio" groups=["UIButtons"]]
unique_name_in_owner = true
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@ -76,8 +74,8 @@ offset_bottom = 8.0
tooltip_text = "Lock aspect ratio"
mouse_default_cursor_shape = 2
toggle_mode = true
texture_normal = ExtResource( 3 )
texture_pressed = ExtResource( 5 )
texture_normal = ExtResource("3")
texture_pressed = ExtResource("5")
[connection signal="value_changed" from="GridContainer/X" to="." method="_on_X_value_changed"]
[connection signal="value_changed" from="GridContainer/Y" to="." method="_on_Y_value_changed"]

View file

@ -27,12 +27,14 @@ signal ratio_toggled(button_pressed: bool)
$GridContainer/X.min_value = val.x
$GridContainer/Y.min_value = val.y
$GridContainer/Z.min_value = val.z
value = value # Call value setter
@export var max_value := Vector3(100.0, 100.0, 100.0):
set(val):
max_value = val
$GridContainer/X.max_value = val.x
$GridContainer/Y.max_value = val.y
$GridContainer/Z.max_value = val.z
value = value # Call value setter
@export var step := 1.0:
set(val):
step = val