mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-22 05:23:14 +00:00
Hide and show dynamics properties when dynamics are enabled
This commit is contained in:
parent
b620cf2a9e
commit
94fdfd8f02
3 changed files with 47 additions and 14 deletions
|
@ -14,8 +14,8 @@ var alpha_locked := false
|
||||||
# Dynamics
|
# Dynamics
|
||||||
var stabilizer_enabled := false
|
var stabilizer_enabled := false
|
||||||
var stabilizer_value := 16
|
var stabilizer_value := 16
|
||||||
var dynamics_alpha: int = Dynamics.NONE
|
var dynamics_alpha := Dynamics.NONE
|
||||||
var dynamics_size: int = Dynamics.NONE
|
var dynamics_size := Dynamics.NONE
|
||||||
var pen_pressure := 1.0
|
var pen_pressure := 1.0
|
||||||
var pen_pressure_min := 0.2
|
var pen_pressure_min := 0.2
|
||||||
var pen_pressure_max := 0.8
|
var pen_pressure_max := 0.8
|
||||||
|
|
|
@ -18,6 +18,8 @@ enum { ALPHA, SIZE }
|
||||||
@onready var size_velocity_button: Button = $"%SizeVelocityButton"
|
@onready var size_velocity_button: Button = $"%SizeVelocityButton"
|
||||||
@onready var pressure_preview: ProgressBar = $"%PressurePreview"
|
@onready var pressure_preview: ProgressBar = $"%PressurePreview"
|
||||||
@onready var velocity_preview: ProgressBar = $"%VelocityPreview"
|
@onready var velocity_preview: ProgressBar = $"%VelocityPreview"
|
||||||
|
@onready var limits_header: HBoxContainer = %LimitsHeader
|
||||||
|
@onready var thresholds_header: HBoxContainer = %ThresholdsHeader
|
||||||
@onready var alpha_group := alpha_pressure_button.button_group
|
@onready var alpha_group := alpha_pressure_button.button_group
|
||||||
@onready var size_group := size_pressure_button.button_group
|
@onready var size_group := size_pressure_button.button_group
|
||||||
|
|
||||||
|
@ -117,7 +119,7 @@ func _on_Dynamics_pressed() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_Dynamics_toggled(
|
func _on_Dynamics_toggled(
|
||||||
button_pressed: bool, button: BaseButton, property: int, dynamic: int
|
button_pressed: bool, button: BaseButton, property: int, dynamic: Tools.Dynamics
|
||||||
) -> void:
|
) -> void:
|
||||||
var final_dynamic := dynamic
|
var final_dynamic := dynamic
|
||||||
if not button.button_pressed:
|
if not button.button_pressed:
|
||||||
|
@ -127,7 +129,22 @@ func _on_Dynamics_toggled(
|
||||||
Tools.dynamics_alpha = final_dynamic
|
Tools.dynamics_alpha = final_dynamic
|
||||||
SIZE:
|
SIZE:
|
||||||
Tools.dynamics_size = final_dynamic
|
Tools.dynamics_size = final_dynamic
|
||||||
|
var has_alpha_dynamic := Tools.dynamics_alpha != Tools.Dynamics.NONE
|
||||||
|
var has_size_dynamic := Tools.dynamics_size != Tools.Dynamics.NONE
|
||||||
|
var has_pressure_dynamic := (
|
||||||
|
Tools.dynamics_alpha == Tools.Dynamics.PRESSURE
|
||||||
|
or Tools.dynamics_size == Tools.Dynamics.PRESSURE
|
||||||
|
)
|
||||||
|
var has_velocity_dynamic := (
|
||||||
|
Tools.dynamics_alpha == Tools.Dynamics.VELOCITY
|
||||||
|
or Tools.dynamics_size == Tools.Dynamics.VELOCITY
|
||||||
|
)
|
||||||
|
limits_header.visible = has_alpha_dynamic or has_size_dynamic
|
||||||
|
thresholds_header.visible = limits_header.visible
|
||||||
|
get_tree().set_group(&"VisibleOnAlpha", "visible", has_alpha_dynamic)
|
||||||
|
get_tree().set_group(&"VisibleOnSize", "visible", has_size_dynamic)
|
||||||
|
get_tree().set_group(&"VisibleOnPressure", "visible", has_pressure_dynamic)
|
||||||
|
get_tree().set_group(&"VisibleOnVelocity", "visible", has_velocity_dynamic)
|
||||||
var texture_button: TextureRect = button.get_node("TextureRect")
|
var texture_button: TextureRect = button.get_node("TextureRect")
|
||||||
var file_name := "check.png"
|
var file_name := "check.png"
|
||||||
if !button.button_pressed:
|
if !button.button_pressed:
|
||||||
|
|
|
@ -168,6 +168,7 @@ texture = ExtResource("6")
|
||||||
[node name="DynamicsPanel" type="PopupPanel" parent="."]
|
[node name="DynamicsPanel" type="PopupPanel" parent="."]
|
||||||
canvas_item_default_texture_filter = 0
|
canvas_item_default_texture_filter = 0
|
||||||
size = Vector2i(300, 334)
|
size = Vector2i(300, 334)
|
||||||
|
visible = true
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="DynamicsPanel"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="DynamicsPanel"]
|
||||||
offset_left = 4.0
|
offset_left = 4.0
|
||||||
|
@ -286,6 +287,8 @@ texture = ExtResource("7")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="LimitsHeader" type="HBoxContainer" parent="DynamicsPanel/VBoxContainer"]
|
[node name="LimitsHeader" type="HBoxContainer" parent="DynamicsPanel/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="DynamicsPanel/VBoxContainer/LimitsHeader"]
|
[node name="Label" type="Label" parent="DynamicsPanel/VBoxContainer/LimitsHeader"]
|
||||||
|
@ -301,12 +304,14 @@ size_flags_horizontal = 3
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
columns = 3
|
columns = 3
|
||||||
|
|
||||||
[node name="AlphaLabel" type="Label" parent="DynamicsPanel/VBoxContainer/LimitContainer"]
|
[node name="AlphaLabel" type="Label" parent="DynamicsPanel/VBoxContainer/LimitContainer" groups=["VisibleOnAlpha"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "Alpha"
|
text = "Alpha"
|
||||||
|
|
||||||
[node name="AlphaMin" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer"]
|
[node name="AlphaMin" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer" groups=["VisibleOnAlpha"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
|
@ -324,7 +329,8 @@ script = ExtResource("5")
|
||||||
prefix = "Start"
|
prefix = "Start"
|
||||||
snap_step = 0.1
|
snap_step = 0.1
|
||||||
|
|
||||||
[node name="AlphaMax" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer"]
|
[node name="AlphaMax" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer" groups=["VisibleOnAlpha"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
|
@ -342,12 +348,14 @@ script = ExtResource("5")
|
||||||
prefix = "End"
|
prefix = "End"
|
||||||
snap_step = 0.1
|
snap_step = 0.1
|
||||||
|
|
||||||
[node name="SizeLabel" type="Label" parent="DynamicsPanel/VBoxContainer/LimitContainer"]
|
[node name="SizeLabel" type="Label" parent="DynamicsPanel/VBoxContainer/LimitContainer" groups=["VisibleOnSize"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
text = "Size"
|
text = "Size"
|
||||||
|
|
||||||
[node name="SizeMin" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer"]
|
[node name="SizeMin" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer" groups=["VisibleOnSize"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
|
@ -364,7 +372,8 @@ stretch_margin_bottom = 3
|
||||||
script = ExtResource("5")
|
script = ExtResource("5")
|
||||||
prefix = "Start"
|
prefix = "Start"
|
||||||
|
|
||||||
[node name="SizeMax" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer"]
|
[node name="SizeMax" type="TextureProgressBar" parent="DynamicsPanel/VBoxContainer/LimitContainer" groups=["VisibleOnSize"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
|
@ -382,6 +391,8 @@ script = ExtResource("5")
|
||||||
prefix = "End"
|
prefix = "End"
|
||||||
|
|
||||||
[node name="ThresholdsHeader" type="HBoxContainer" parent="DynamicsPanel/VBoxContainer"]
|
[node name="ThresholdsHeader" type="HBoxContainer" parent="DynamicsPanel/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="DynamicsPanel/VBoxContainer/ThresholdsHeader"]
|
[node name="Label" type="Label" parent="DynamicsPanel/VBoxContainer/ThresholdsHeader"]
|
||||||
|
@ -397,11 +408,13 @@ size_flags_horizontal = 3
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
columns = 2
|
columns = 2
|
||||||
|
|
||||||
[node name="ThresholdPressureLabel" type="Label" parent="DynamicsPanel/VBoxContainer/ThresholdContainer"]
|
[node name="ThresholdPressureLabel" type="Label" parent="DynamicsPanel/VBoxContainer/ThresholdContainer" groups=["VisibleOnPressure"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Pressure"
|
text = "Pressure"
|
||||||
|
|
||||||
[node name="ThresholdPressure" parent="DynamicsPanel/VBoxContainer/ThresholdContainer" instance=ExtResource("8")]
|
[node name="ThresholdPressure" parent="DynamicsPanel/VBoxContainer/ThresholdContainer" groups=["VisibleOnPressure"] instance=ExtResource("8")]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
start = 0.2
|
start = 0.2
|
||||||
|
@ -426,12 +439,15 @@ anchor_bottom = 0.0
|
||||||
offset_right = 1.0
|
offset_right = 1.0
|
||||||
offset_bottom = 23.0
|
offset_bottom = 23.0
|
||||||
|
|
||||||
[node name="ThresholdVelocityLabel" type="Label" parent="DynamicsPanel/VBoxContainer/ThresholdContainer"]
|
[node name="ThresholdVelocityLabel" type="Label" parent="DynamicsPanel/VBoxContainer/ThresholdContainer" groups=["VisibleOnVelocity"]]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Velocity"
|
text = "Velocity"
|
||||||
|
|
||||||
[node name="ThresholdVelocity" parent="DynamicsPanel/VBoxContainer/ThresholdContainer" instance=ExtResource("8")]
|
[node name="ThresholdVelocity" parent="DynamicsPanel/VBoxContainer/ThresholdContainer" groups=["VisibleOnVelocity"] instance=ExtResource("8")]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
start = 0.2
|
start = 0.2
|
||||||
end = 0.8
|
end = 0.8
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue