feat: added expression value to every primitive
This commit is contained in:
parent
63c391593d
commit
2b04362ecc
6 changed files with 121 additions and 48 deletions
|
|
@ -95,8 +95,10 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||
load_path = "res://.godot/imported/point.svg-e68fd7c1e788d2c48d769cc58eba6e98.ctex"
|
||||
|
||||
[sub_resource type="PointPrimitive" id="PointPrimitive_5lcyj"]
|
||||
expression = "sloped_height"
|
||||
|
||||
[sub_resource type="PlanePrimitive" id="PlanePrimitive_5lcyj"]
|
||||
expression = "baseline"
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_3vi5u"]
|
||||
frequency = 0.0336
|
||||
|
|
@ -107,6 +109,7 @@ domain_warp_fractal_lacunarity = 5.512
|
|||
domain_warp_fractal_gain = 0.662
|
||||
|
||||
[sub_resource type="NoisePrimitive" id="NoisePrimitive_5lcyj"]
|
||||
expression = "previous_height + noise_sample"
|
||||
noise = SubResource("FastNoiseLite_3vi5u")
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_74j0u"]
|
||||
|
|
|
|||
|
|
@ -35,6 +35,36 @@ func _pressed() -> void:
|
|||
terrain.current_selected = null
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_2i6ni"]
|
||||
resource_name = "ExpressionEditor"
|
||||
script/source = "extends TextEdit
|
||||
|
||||
@onready var terrain : TerrainMeshEditor = $\"../../..\".terrain
|
||||
@onready var primitive : TerrainPrimitive = terrain.current_selected
|
||||
|
||||
var pushing_change : bool = false
|
||||
|
||||
func _ready():
|
||||
primitive.changed.connect(_primitive_changed)
|
||||
text_changed.connect(_text_changed)
|
||||
$ExpressionTimerBuffer.timeout.connect(_timeout)
|
||||
_primitive_changed()
|
||||
|
||||
func _primitive_changed():
|
||||
if not pushing_change and not has_focus():
|
||||
pushing_change = true
|
||||
self.text = primitive.expression
|
||||
pushing_change = false
|
||||
$\"../ExpressionError\".text = primitive.get_expression_error()
|
||||
|
||||
func _text_changed():
|
||||
if not pushing_change:
|
||||
$ExpressionTimerBuffer.start(2)
|
||||
|
||||
func _timeout():
|
||||
primitive.expression = text
|
||||
"
|
||||
|
||||
[node name="Primitive" type="MarginContainer" unique_id=905749607]
|
||||
offset_right = 302.0
|
||||
offset_bottom = 230.0
|
||||
|
|
@ -91,6 +121,24 @@ icon_alignment = 1
|
|||
expand_icon = true
|
||||
script = SubResource("GDScript_ivj30")
|
||||
|
||||
[node name="Expression" type="TextEdit" parent="VBoxContainer" unique_id=1154146381]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
placeholder_text = "expression"
|
||||
backspace_deletes_composite_character_enabled = true
|
||||
caret_blink = true
|
||||
caret_move_on_right_click = false
|
||||
draw_tabs = true
|
||||
draw_spaces = true
|
||||
script = SubResource("GDScript_2i6ni")
|
||||
|
||||
[node name="ExpressionTimerBuffer" type="Timer" parent="VBoxContainer/Expression" unique_id=1376932514]
|
||||
wait_time = 2.0
|
||||
|
||||
[node name="ExpressionError" type="Label" parent="VBoxContainer" unique_id=1840569033]
|
||||
layout_mode = 2
|
||||
text = "Error Text"
|
||||
|
||||
[connection signal="item_selected" from="VBoxContainer/BlendModeSelector" to="VBoxContainer/BlendModeSelector" method="_on_item_selected"]
|
||||
|
||||
[editable path="VBoxContainer/FloatEditor3"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue