Эх сурвалжийг харах

Merge pull request #570 from aaronfranke/mr-k-inspired

Update the Drag and Drop demo and the Tween demo
Aaron Franke 4 жил өмнө
parent
commit
04e9afb4cf

BIN
2d/tween/icon.png


+ 74 - 77
2d/tween/main.gd

@@ -4,84 +4,80 @@ const trans_list = ["Linear", "Sine", "Quint", "Quart", "Quad", "Expo", "Elastic
 const eases_list = ["In", "Out", "InOut", "OutIn"]
 const modes_list = ["Move", "Color", "Scale", "Rotate", "Callback", "Follow", "Repeat", "Pause"]
 
-var state = {
-	trans = Tween.TRANS_LINEAR,
-	eases = Tween.EASE_IN,
-}
-
-onready var trans = $Trans
-onready var eases = $Eases
-onready var modes = $Modes
+var current_trans = Tween.TRANS_LINEAR
+var current_ease = Tween.EASE_IN
+
 onready var tween = $Tween
-onready var timeline = $Timeline
-onready var color_from_picker = $Colors/ColorFrom/Picker
-onready var color_to_picker = $Colors/ColorTo/Picker
-onready var sprite = $Tween/Area/Sprite
-onready var follow = $Tween/Area/Follow
-onready var follow_2 = $Tween/Area/Follow2
-onready var size = $Tween/Area.get_size()
+onready var trans_vbox = $Controls/Transitions
+onready var eases_vbox = $Controls/Eases
+onready var modes_vbox = $Controls/Modes
+onready var timeline = $Top/Timeline
+onready var color_from_picker = $Controls/ColorFrom/ColorPicker
+onready var color_to_picker = $Controls/ColorTo/ColorPicker
+onready var area_label = $Top/Area/RichTextLabel
+onready var sprite = $Top/Area/Sprite
+onready var follow = $Top/Area/Follow
+onready var follow_2 = $Top/Area/Follow2
+onready var size = $Top/Area.get_size()
+
+onready var move_mode = modes_vbox.get_node(@"Move")
+onready var color_mode = modes_vbox.get_node(@"Color")
+onready var scale_mode = modes_vbox.get_node(@"Scale")
+onready var rotate_mode = modes_vbox.get_node(@"Rotate")
+onready var callback_mode = modes_vbox.get_node(@"Callback")
+onready var follow_mode = modes_vbox.get_node(@"Follow")
+onready var repeat_mode = modes_vbox.get_node(@"Repeat")
+onready var paused_mode = modes_vbox.get_node(@"Pause")
 
 func _ready():
 	for index in range(trans_list.size()):
-		trans.get_node(trans_list[index]).connect("pressed", self, "on_trans_changed", [trans_list[index], index])
+		trans_vbox.get_node(trans_list[index]).connect("pressed", self, "on_trans_changed", [index])
 
 	for index in range(eases_list.size()):
-		eases.get_node(eases_list[index]).connect("pressed", self, "on_eases_changed", [eases_list[index], index])
+		eases_vbox.get_node(eases_list[index]).connect("pressed", self, "on_eases_changed", [index])
 
 	for index in range(modes_list.size()):
-		modes.get_node(modes_list[index]).connect("pressed", self, "on_modes_changed", [modes_list[index]])
+		modes_vbox.get_node(modes_list[index]).connect("pressed", self, "on_modes_changed", [index])
 
 	color_from_picker.set_pick_color(Color.red)
-	color_from_picker.connect("color_changed", self, "on_color_changed")
-
 	color_to_picker.set_pick_color(Color.cyan)
-	color_to_picker.connect("color_changed", self, "on_color_changed")
 
-	$Trans/Linear.set_pressed(true)
-	$Eases/In.set_pressed(true)
-	$Modes/Move.set_pressed(true)
-	$Modes/Repeat.set_pressed(true)
+	for node in [trans_vbox, eases_vbox, modes_vbox]:
+		node.get_child(1).set_pressed(true)
+	modes_vbox.get_node(@"Repeat").set_pressed(true)
 
 	reset_tween()
 
 
-func on_trans_changed(trans_name, index):
-	for index in range(trans_list.size()):
-		var pressed = trans_list[index] == trans_name
-		var btn = trans.get_node(trans_list[index])
-
-		btn.set_pressed(pressed)
-		set_mouse_filter(Control.MOUSE_FILTER_IGNORE if pressed else Control.MOUSE_FILTER_PASS)
+func on_trans_changed(index):
+	for i in range(trans_list.size()):
+		var btn = trans_vbox.get_node(trans_list[i])
+		btn.set_pressed(i == index)
 
-	state.trans = index
+	current_trans = index
 	reset_tween()
 
 
-func on_eases_changed(ease_name, index):
-	for index in range(eases_list.size()):
-		var pressed = eases_list[index] == ease_name
-		var btn = eases.get_node(eases_list[index])
-
-		btn.set_pressed(pressed)
-		set_mouse_filter(Control.MOUSE_FILTER_IGNORE if pressed else Control.MOUSE_FILTER_PASS)
+func on_eases_changed(index):
+	for i in range(eases_list.size()):
+		var btn = eases_vbox.get_node(eases_list[i])
+		btn.set_pressed(i == index)
 
-	state.eases = index
+	current_ease = index
 	reset_tween()
 
 
-func on_modes_changed(mode_name):
-	if mode_name == "pause":
-		if $Modes/Pause.is_pressed():
+func on_modes_changed(index):
+	if modes_list[index] == "Pause":
+		if paused_mode.is_pressed():
 			tween.stop_all()
-			timeline.set_mouse_filter(Control.MOUSE_FILTER_PASS)
 		else:
 			tween.resume_all()
-			timeline.set_mouse_filter(Control.MOUSE_FILTER_IGNORE)
 	else:
 		reset_tween()
 
 
-func on_color_changed(_color):
+func _on_ColorPicker_color_changed(_color):
 	reset_tween()
 
 
@@ -90,68 +86,69 @@ func reset_tween():
 	tween.reset_all()
 	tween.remove_all()
 
-	if $Modes/Move.is_pressed():
-		tween.interpolate_method(sprite, "set_position", Vector2(0, 0), Vector2(size.x, size.y), 2, state.trans, state.eases)
-		tween.interpolate_property(sprite, "position", Vector2(size.x, size.y), Vector2(0, 0), 2, state.trans, state.eases, 2)
-
-	if $Modes/Color.is_pressed():
-		tween.interpolate_method(sprite, "set_modulate", color_from_picker.get_pick_color(), color_to_picker.get_pick_color(), 2, state.trans, state.eases)
-		tween.interpolate_property(sprite, "modulate", color_to_picker.get_pick_color(), color_from_picker.get_pick_color(), 2, state.trans, state.eases, 2)
+	if move_mode.is_pressed():
+		# The first line moves from the top left to the bottom right, while
+		# the second line moves backwards afterwards (there is a delay of 2).
+		# These are different (_method vs _property) only for the sake of
+		# showcasing interpolation of both methods and properties.
+		# The syntax is (object, method/property name, from value, to value,
+		# duration, transition type, ease type, delay), last 3 optional.
+		tween.interpolate_method(sprite, "set_position", Vector2.ZERO, size, 2, current_trans, current_ease)
+		tween.interpolate_property(sprite, "position", size, Vector2.ZERO, 2, current_trans, current_ease, 2)
+
+	if color_mode.is_pressed():
+		tween.interpolate_method(sprite, "set_modulate", color_from_picker.get_pick_color(), color_to_picker.get_pick_color(), 2, current_trans, current_ease)
+		tween.interpolate_property(sprite, "modulate", color_to_picker.get_pick_color(), color_from_picker.get_pick_color(), 2, current_trans, current_ease, 2)
 	else:
 		sprite.set_modulate(Color.white)
 
-	if $Modes/Scale.is_pressed():
-		tween.interpolate_method(sprite, "set_scale", Vector2(0.5, 0.5), Vector2(1.5, 1.5), 2, state.trans, state.eases)
-		tween.interpolate_property(sprite, "scale", Vector2(1.5, 1.5), Vector2(0.5, 0.5), 2, state.trans, state.eases, 2)
+	if scale_mode.is_pressed():
+		tween.interpolate_method(sprite, "set_scale", Vector2(0.5, 0.5), Vector2(1.5, 1.5), 2, current_trans, current_ease)
+		tween.interpolate_property(sprite, "scale", Vector2(1.5, 1.5), Vector2(0.5, 0.5), 2, current_trans, current_ease, 2)
 	else:
 		sprite.set_scale(Vector2.ONE)
 
-	if $Modes/Rotate.is_pressed():
-		tween.interpolate_method(sprite, "set_rotation_degrees", 0, 360, 2, state.trans, state.eases)
-		tween.interpolate_property(sprite, "rotation_degrees", 360, 0, 2, state.trans, state.eases, 2)
+	if rotate_mode.is_pressed():
+		tween.interpolate_method(sprite, "set_rotation_degrees", 0, 360, 2, current_trans, current_ease)
+		tween.interpolate_property(sprite, "rotation_degrees", 360, 0, 2, current_trans, current_ease, 2)
 
-	if $Modes/Callback.is_pressed():
+	if callback_mode.is_pressed():
 		tween.interpolate_callback(self, 0.5, "on_callback", "0.5 seconds after")
 		tween.interpolate_callback(self, 0.2, "on_callback", "1.2 seconds after")
 
-	if $Modes/Follow.is_pressed():
+	if follow_mode.is_pressed():
 		follow.show()
 		follow_2.show()
 
-		tween.follow_method(follow, "set_position", Vector2(0, size.y), sprite, "get_position", 2, state.trans, state.eases)
-		tween.targeting_method(follow, "set_position", sprite, "get_position", Vector2(0, size.y), 2, state.trans, state.eases, 2)
+		tween.follow_method(follow, "set_position", Vector2(0, size.y), sprite, "get_position", 2, current_trans, current_ease)
+		tween.targeting_method(follow, "set_position", sprite, "get_position", Vector2(0, size.y), 2, current_trans, current_ease, 2)
 
-		tween.targeting_property(follow_2, "position", sprite, "position", Vector2(size.x, 0), 2, state.trans, state.eases)
-		tween.follow_property(follow_2, "position", Vector2(size.x, 0), sprite, "position", 2, state.trans, state.eases, 2)
+		tween.targeting_property(follow_2, "position", sprite, "position", Vector2(size.x, 0), 2, current_trans, current_ease)
+		tween.follow_property(follow_2, "position", Vector2(size.x, 0), sprite, "position", 2, current_trans, current_ease, 2)
 	else:
 		follow.hide()
 		follow_2.hide()
 
-	tween.set_repeat($Modes/Repeat.is_pressed())
+	tween.set_repeat(repeat_mode.is_pressed())
 	tween.start()
 	tween.seek(pos)
 
-	if $Modes/Pause.is_pressed():
+	if paused_mode.is_pressed():
 		tween.stop_all()
-		#get_node("timeline").set_ignore_mouse(false)
-		timeline.set_value(0)
-	else:
-		tween.resume_all()
-		#get_node("timeline").set_ignore_mouse(true)
 
 
-func _on_tween_step(_object, _key, elapsed, _value):
+func _on_Tween_tween_step(_object, _key, elapsed, _value):
 	var runtime = tween.get_runtime()
 	var ratio = 100 * (elapsed / runtime)
 	timeline.set_value(ratio)
 
 
-func _on_timeline_value_changed(value):
-	if !$Modes/Pause.is_pressed():
+func _on_Timeline_value_changed(value):
+	if not paused_mode.is_pressed():
 		return
 	var runtime = tween.get_runtime()
 	tween.seek(runtime * value / 100)
 
 
 func on_callback(arg):
-	$Tween/Area/Label.add_text("on_callback -> " + arg + "\n")
+	area_label.add_text("on_callback -> " + arg + "\n")

+ 284 - 255
2d/tween/main.tscn

@@ -1,358 +1,387 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=6 format=2]
 
 [ext_resource path="res://main.gd" type="Script" id=1]
 [ext_resource path="res://godot.png" type="Texture" id=2]
+[ext_resource path="res://noto_sans_ui_regular.ttf" type="DynamicFontData" id=3]
 
-[node name="Main" type="Control"]
+[sub_resource type="DynamicFont" id=1]
+font_data = ExtResource( 3 )
+
+[sub_resource type="Theme" id=2]
+default_font = SubResource( 1 )
+
+[node name="Main" type="VBoxContainer"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+theme = SubResource( 2 )
+alignment = 1
+script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Tween" type="Tween" parent="."]
+repeat = true
+playback/repeat = true
+
+[node name="Top" type="VBoxContainer" parent="."]
+margin_left = 112.0
+margin_right = 912.0
+margin_bottom = 230.0
+rect_min_size = Vector2( 800, 230 )
+size_flags_horizontal = 6
+alignment = 2
+
+[node name="Area" type="Panel" parent="Top"]
+margin_top = 18.0
+margin_right = 800.0
+margin_bottom = 178.0
+rect_min_size = Vector2( 800, 160 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="RichTextLabel" type="RichTextLabel" parent="Top/Area"]
 anchor_left = 0.5
 anchor_top = 0.5
 anchor_right = 0.5
 anchor_bottom = 0.5
-margin_left = -512.0
-margin_top = -384.0
-margin_right = 512.0
-margin_bottom = 384.0
+margin_left = -120.0
+margin_top = -60.0
+margin_right = 120.0
+margin_bottom = 60.0
 size_flags_horizontal = 2
 size_flags_vertical = 2
-script = ExtResource( 1 )
 __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="Trans" type="VBoxContainer" parent="."]
-margin_left = 56.0
-margin_top = 288.0
-margin_right = 129.0
-margin_bottom = 614.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="Sprite" type="Sprite" parent="Top/Area"]
+z_index = 1
+texture = ExtResource( 2 )
 
-[node name="Linear" type="Button" parent="Trans"]
-margin_right = 48.0
-margin_bottom = 20.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
-toggle_mode = true
-text = "linear"
+[node name="Follow" type="Sprite" parent="Top/Area"]
+position = Vector2( 0, 160 )
+z_index = 1
+texture = ExtResource( 2 )
 
-[node name="Sine" type="Button" parent="Trans"]
-margin_top = 30.0
-margin_right = 39.0
-margin_bottom = 50.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
-toggle_mode = true
-text = "sine"
+[node name="Follow2" type="Sprite" parent="Top/Area"]
+position = Vector2( 800, 0 )
+z_index = 1
+texture = ExtResource( 2 )
 
-[node name="Quint" type="Button" parent="Trans"]
-margin_top = 60.0
-margin_right = 45.0
-margin_bottom = 80.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
-toggle_mode = true
-text = "quint"
+[node name="Timeline" type="HSlider" parent="Top"]
+margin_top = 182.0
+margin_right = 800.0
+margin_bottom = 230.0
+rect_min_size = Vector2( 0, 48 )
+size_flags_horizontal = 3
+value = 1.0
+ticks_on_borders = true
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="Quart" type="Button" parent="Trans"]
-margin_top = 90.0
-margin_right = 45.0
-margin_bottom = 110.0
-size_flags_horizontal = 2
+[node name="Controls" type="HBoxContainer" parent="."]
+margin_top = 234.0
+margin_right = 1024.0
+margin_bottom = 804.0
+rect_min_size = Vector2( 1000, 550 )
+custom_constants/separation = 20
+alignment = 1
+
+[node name="Modes" type="VBoxContainer" parent="Controls"]
+margin_left = 37.0
+margin_right = 110.0
+margin_bottom = 383.0
+rect_min_size = Vector2( 70, 0 )
+size_flags_vertical = 0
+custom_constants/separation = 16
+
+[node name="ModesLabel" type="Label" parent="Controls/Modes"]
+margin_right = 73.0
+margin_bottom = 23.0
+size_flags_horizontal = 3
+text = "Modes"
+align = 1
+
+[node name="Move" type="Button" parent="Controls/Modes"]
+margin_top = 39.0
+margin_right = 73.0
+margin_bottom = 68.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "quart"
+text = "move"
 
-[node name="Quad" type="Button" parent="Trans"]
-margin_top = 120.0
-margin_right = 43.0
-margin_bottom = 140.0
-size_flags_horizontal = 2
+[node name="Color" type="Button" parent="Controls/Modes"]
+margin_top = 84.0
+margin_right = 73.0
+margin_bottom = 113.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "quad"
+text = "color"
 
-[node name="Expo" type="Button" parent="Trans"]
-margin_top = 150.0
-margin_right = 43.0
-margin_bottom = 170.0
-size_flags_horizontal = 2
+[node name="Scale" type="Button" parent="Controls/Modes"]
+margin_top = 129.0
+margin_right = 73.0
+margin_bottom = 158.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "expo"
+text = "scale"
 
-[node name="Elastic" type="Button" parent="Trans"]
-margin_top = 180.0
-margin_right = 54.0
-margin_bottom = 200.0
-size_flags_horizontal = 2
+[node name="Rotate" type="Button" parent="Controls/Modes"]
+margin_top = 174.0
+margin_right = 73.0
+margin_bottom = 203.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "elastic"
+text = "rotate"
 
-[node name="Cubic" type="Button" parent="Trans"]
-margin_top = 210.0
-margin_right = 46.0
-margin_bottom = 230.0
-size_flags_horizontal = 2
+[node name="Callback" type="Button" parent="Controls/Modes"]
+margin_top = 219.0
+margin_right = 73.0
+margin_bottom = 248.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "cubic"
+text = "callback"
 
-[node name="Circ" type="Button" parent="Trans"]
-margin_top = 240.0
-margin_right = 35.0
-margin_bottom = 260.0
-size_flags_horizontal = 2
+[node name="Follow" type="Button" parent="Controls/Modes"]
+margin_top = 264.0
+margin_right = 73.0
+margin_bottom = 293.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "circ"
+text = "follow"
 
-[node name="Bounce" type="Button" parent="Trans"]
-margin_top = 270.0
-margin_right = 59.0
-margin_bottom = 290.0
-size_flags_horizontal = 2
+[node name="Repeat" type="Button" parent="Controls/Modes"]
+margin_top = 309.0
+margin_right = 73.0
+margin_bottom = 338.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "bounce"
+text = "repeat"
 
-[node name="Back" type="Button" parent="Trans"]
-margin_top = 300.0
-margin_right = 41.0
-margin_bottom = 320.0
-size_flags_horizontal = 2
+[node name="Pause" type="Button" parent="Controls/Modes"]
+margin_top = 354.0
+margin_right = 73.0
+margin_bottom = 383.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "back"
+text = "pause"
 
-[node name="Eases" type="VBoxContainer" parent="."]
-margin_left = 152.0
-margin_top = 288.0
+[node name="Transitions" type="VBoxContainer" parent="Controls"]
+margin_left = 130.0
 margin_right = 215.0
-margin_bottom = 404.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+margin_bottom = 518.0
+rect_min_size = Vector2( 70, 0 )
+size_flags_vertical = 0
+custom_constants/separation = 16
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="In" type="Button" parent="Eases"]
-margin_right = 24.0
-margin_bottom = 20.0
-size_flags_horizontal = 2
+[node name="TransLabel" type="Label" parent="Controls/Transitions"]
+margin_right = 85.0
+margin_bottom = 23.0
+text = "Transitions"
+align = 1
+
+[node name="Linear" type="Button" parent="Controls/Transitions"]
+margin_top = 39.0
+margin_right = 85.0
+margin_bottom = 68.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "in"
+text = "linear"
 
-[node name="Out" type="Button" parent="Eases"]
-margin_top = 30.0
-margin_right = 33.0
-margin_bottom = 50.0
-size_flags_horizontal = 2
+[node name="Sine" type="Button" parent="Controls/Transitions"]
+margin_top = 84.0
+margin_right = 85.0
+margin_bottom = 113.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "out"
+text = "sine"
 
-[node name="InOut" type="Button" parent="Eases"]
-margin_top = 60.0
-margin_right = 51.0
-margin_bottom = 80.0
-size_flags_horizontal = 2
+[node name="Quint" type="Button" parent="Controls/Transitions"]
+margin_top = 129.0
+margin_right = 85.0
+margin_bottom = 158.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "in_out"
+text = "quint"
 
-[node name="OutIn" type="Button" parent="Eases"]
-margin_top = 90.0
-margin_right = 51.0
-margin_bottom = 110.0
-size_flags_horizontal = 2
+[node name="Quart" type="Button" parent="Controls/Transitions"]
+margin_top = 174.0
+margin_right = 85.0
+margin_bottom = 203.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "out_in"
+text = "quart"
 
-[node name="Modes" type="VBoxContainer" parent="."]
-margin_left = 240.0
-margin_top = 288.0
-margin_right = 317.0
-margin_bottom = 524.0
-size_flags_horizontal = 2
+[node name="Quad" type="Button" parent="Controls/Transitions"]
+margin_top = 219.0
+margin_right = 85.0
+margin_bottom = 248.0
 size_flags_vertical = 2
+toggle_mode = true
+text = "quad"
 
-[node name="Move" type="Button" parent="Modes"]
-margin_right = 48.0
-margin_bottom = 20.0
-size_flags_horizontal = 2
+[node name="Expo" type="Button" parent="Controls/Transitions"]
+margin_top = 264.0
+margin_right = 85.0
+margin_bottom = 293.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "move"
+text = "expo"
 
-[node name="Color" type="Button" parent="Modes"]
-margin_top = 30.0
-margin_right = 44.0
-margin_bottom = 50.0
-size_flags_horizontal = 2
+[node name="Elastic" type="Button" parent="Controls/Transitions"]
+margin_top = 309.0
+margin_right = 85.0
+margin_bottom = 338.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "color"
+text = "elastic"
 
-[node name="Scale" type="Button" parent="Modes"]
-margin_top = 60.0
-margin_right = 45.0
-margin_bottom = 80.0
-size_flags_horizontal = 2
+[node name="Cubic" type="Button" parent="Controls/Transitions"]
+margin_top = 354.0
+margin_right = 85.0
+margin_bottom = 383.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "scale"
+text = "cubic"
 
-[node name="Rotate" type="Button" parent="Modes"]
-margin_top = 90.0
-margin_right = 50.0
-margin_bottom = 110.0
-size_flags_horizontal = 2
+[node name="Circ" type="Button" parent="Controls/Transitions"]
+margin_top = 399.0
+margin_right = 85.0
+margin_bottom = 428.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "rotate"
+text = "circ"
 
-[node name="Callback" type="Button" parent="Modes"]
-margin_top = 120.0
-margin_right = 63.0
-margin_bottom = 140.0
-size_flags_horizontal = 2
+[node name="Bounce" type="Button" parent="Controls/Transitions"]
+margin_top = 444.0
+margin_right = 85.0
+margin_bottom = 473.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "callback"
+text = "bounce"
 
-[node name="Follow" type="Button" parent="Modes"]
-margin_top = 150.0
-margin_right = 50.0
-margin_bottom = 170.0
-size_flags_horizontal = 2
+[node name="Back" type="Button" parent="Controls/Transitions"]
+margin_top = 489.0
+margin_right = 85.0
+margin_bottom = 518.0
 size_flags_vertical = 2
 toggle_mode = true
-text = "follow"
+text = "back"
 
-[node name="Repeat" type="Button" parent="Modes"]
-margin_top = 180.0
-margin_right = 53.0
-margin_bottom = 200.0
-size_flags_horizontal = 2
+[node name="Eases" type="VBoxContainer" parent="Controls"]
+margin_left = 235.0
+margin_right = 305.0
+margin_bottom = 203.0
+rect_min_size = Vector2( 70, 0 )
+size_flags_vertical = 0
+custom_constants/separation = 16
+
+[node name="EasesLabel" type="Label" parent="Controls/Eases"]
+margin_right = 70.0
+margin_bottom = 23.0
+size_flags_horizontal = 3
+text = "Eases"
+align = 1
+
+[node name="In" type="Button" parent="Controls/Eases"]
+margin_top = 39.0
+margin_right = 70.0
+margin_bottom = 68.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "repeat"
+text = "in"
 
-[node name="Pause" type="Button" parent="Modes"]
-margin_top = 210.0
-margin_right = 50.0
-margin_bottom = 230.0
-size_flags_horizontal = 2
+[node name="Out" type="Button" parent="Controls/Eases"]
+margin_top = 84.0
+margin_right = 70.0
+margin_bottom = 113.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
 toggle_mode = true
-text = "pause"
+text = "out"
 
-[node name="Colors" type="HBoxContainer" parent="."]
-margin_left = 352.0
-margin_top = 273.0
-margin_right = 1008.0
-margin_bottom = 753.0
-size_flags_horizontal = 2
+[node name="InOut" type="Button" parent="Controls/Eases"]
+margin_top = 129.0
+margin_right = 70.0
+margin_bottom = 158.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
-custom_constants/separation = 40
-__meta__ = {
-"_edit_use_anchors_": false
-}
+toggle_mode = true
+text = "in_out"
 
-[node name="ColorFrom" type="VBoxContainer" parent="Colors"]
-margin_right = 308.0
-margin_bottom = 480.0
-rect_min_size = Vector2( 0, 320 )
-size_flags_horizontal = 2
+[node name="OutIn" type="Button" parent="Controls/Eases"]
+margin_top = 174.0
+margin_right = 70.0
+margin_bottom = 203.0
+size_flags_horizontal = 3
 size_flags_vertical = 2
+toggle_mode = true
+text = "out_in"
 
-[node name="Label" type="Label" parent="Colors/ColorFrom"]
-margin_right = 74.0
-margin_bottom = 14.0
+[node name="ColorFrom" type="VBoxContainer" parent="Controls"]
+margin_left = 325.0
+margin_right = 646.0
+margin_bottom = 570.0
+rect_min_size = Vector2( 320, 570 )
+size_flags_vertical = 0
+
+[node name="Label" type="Label" parent="Controls/ColorFrom"]
+margin_right = 89.0
+margin_bottom = 23.0
 size_flags_horizontal = 2
 size_flags_vertical = 0
 text = "Color From:"
 
-[node name="Picker" type="ColorPicker" parent="Colors/ColorFrom"]
-margin_top = 18.0
-margin_right = 308.0
-margin_bottom = 480.0
-rect_min_size = Vector2( 0, 320 )
+[node name="ColorPicker" type="ColorPicker" parent="Controls/ColorFrom"]
+margin_top = 27.0
+margin_right = 321.0
+margin_bottom = 539.0
 size_flags_horizontal = 2
 size_flags_vertical = 2
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="ColorTo" type="VBoxContainer" parent="Colors"]
-margin_left = 348.0
-margin_right = 656.0
-margin_bottom = 480.0
-rect_min_size = Vector2( 0, 320 )
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorTo" type="VBoxContainer" parent="Controls"]
+margin_left = 666.0
+margin_right = 987.0
+margin_bottom = 570.0
+rect_min_size = Vector2( 320, 570 )
+rect_clip_content = true
+size_flags_vertical = 0
 
-[node name="Label" type="Label" parent="Colors/ColorTo"]
-margin_right = 56.0
-margin_bottom = 14.0
+[node name="Label" type="Label" parent="Controls/ColorTo"]
+margin_right = 68.0
+margin_bottom = 23.0
 size_flags_horizontal = 2
 size_flags_vertical = 0
 text = "Color To:"
 
-[node name="Picker" type="ColorPicker" parent="Colors/ColorTo"]
-margin_top = 18.0
-margin_right = 308.0
-margin_bottom = 480.0
-rect_min_size = Vector2( 0, 320 )
+[node name="ColorPicker" type="ColorPicker" parent="Controls/ColorTo"]
+margin_top = 27.0
+margin_right = 321.0
+margin_bottom = 539.0
 size_flags_horizontal = 2
 size_flags_vertical = 2
-
-[node name="Tween" type="Tween" parent="."]
-repeat = true
-playback/repeat = true
-
-[node name="Area" type="Panel" parent="Tween"]
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-margin_left = -420.0
-margin_top = -352.0
-margin_right = 444.0
-margin_bottom = -152.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
-
-[node name="Label" type="RichTextLabel" parent="Tween/Area"]
-margin_left = 176.0
-margin_top = 24.0
-margin_right = 552.0
-margin_bottom = 160.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
-
-[node name="Sprite" type="Sprite" parent="Tween/Area"]
-texture = ExtResource( 2 )
-
-[node name="Follow" type="Sprite" parent="Tween/Area"]
-position = Vector2( 0, 184 )
-texture = ExtResource( 2 )
-
-[node name="Follow2" type="Sprite" parent="Tween/Area"]
-position = Vector2( 736, 0 )
-texture = ExtResource( 2 )
-
-[node name="Timeline" type="HSlider" parent="."]
-anchor_left = 0.5
-anchor_top = 0.5
-anchor_right = 0.5
-anchor_bottom = 0.5
-margin_left = -416.0
-margin_top = -144.0
-margin_right = 416.0
-margin_bottom = -128.0
-size_flags_horizontal = 2
-value = 1.0
-ticks_on_borders = true
 __meta__ = {
 "_edit_use_anchors_": false
 }
-[connection signal="tween_step" from="Tween" to="." method="_on_tween_step"]
-[connection signal="value_changed" from="Timeline" to="." method="_on_timeline_value_changed"]
+[connection signal="tween_step" from="Tween" to="." method="_on_Tween_tween_step"]
+[connection signal="value_changed" from="Top/Timeline" to="." method="_on_Timeline_value_changed"]
+[connection signal="color_changed" from="Controls/ColorFrom/ColorPicker" to="." method="_on_ColorPicker_color_changed"]
+[connection signal="color_changed" from="Controls/ColorTo/ColorPicker" to="." method="_on_ColorPicker_color_changed"]

BIN
2d/tween/noto_sans_ui_regular.ttf


+ 1 - 1
2d/tween/project.godot

@@ -27,7 +27,7 @@ gdscript/warnings/return_value_discarded=false
 
 [display]
 
-window/size/height=768
+window/size/height=800
 window/dpi/allow_hidpi=true
 window/stretch/mode="2d"
 window/stretch/aspect="expand"

BIN
2d/tween/screenshots/tween.png


+ 1 - 1
3d/README.md

@@ -4,4 +4,4 @@ These demos are all 3D, but otherwise do not have a common theme.
 
 Languages: All are GDScript
 
-Renderers: Truck Town and Physics Tests are GLES 2, the rest are GLES 3
+Renderers: Truck Town, Physics Tests, and Waypoints are GLES 2, the rest are GLES 3

+ 1 - 1
3d/ik/fps/example_player.gd

@@ -209,7 +209,7 @@ func process_movement(delta):
 # Mouse based camera movement
 func _input(event):
 
-	if event is InputEventMouseMotion && Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
+	if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
 
 		rotate_y(deg2rad(event.relative.x * MOUSE_SENSITIVITY * -1))
 		camera_holder.rotate_x(deg2rad(event.relative.y * MOUSE_SENSITIVITY))

+ 99 - 67
gui/drag_and_drop/drag_and_drop.tscn

@@ -11,6 +11,7 @@ margin_left = -512.0
 margin_top = -300.0
 margin_right = 512.0
 margin_bottom = 300.0
+rect_pivot_offset = Vector2( 512, 300 )
 size_flags_horizontal = 2
 size_flags_vertical = 2
 __meta__ = {
@@ -19,100 +20,131 @@ __meta__ = {
 }
 
 [node name="Information" type="Label" parent="."]
-margin_left = 250.0
-margin_top = 140.0
-margin_right = 761.0
-margin_bottom = 154.0
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+margin_left = -300.0
+margin_top = -180.0
+margin_right = 300.0
+margin_bottom = -150.0
 size_flags_horizontal = 2
 size_flags_vertical = 0
 text = "Drag colors from button to button, or change button colors and drag them again."
+align = 1
 
-[node name="ColorPickerButton0" type="ColorPickerButton" parent="."]
-margin_left = 304.0
-margin_top = 193.0
-margin_right = 400.0
-margin_bottom = 257.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="GridContainer" type="GridContainer" parent="."]
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+margin_left = -250.0
+margin_top = -150.0
+margin_right = 250.0
+margin_bottom = 200.0
+columns = 3
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ColorPickerButton0" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 33.0
+margin_top = 25.0
+margin_right = 129.0
+margin_bottom = 89.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0.671032, 0.605183, 0, 1 )
 script = ExtResource( 1 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="ColorPickerButton1" type="ColorPickerButton" parent="."]
-margin_left = 464.0
-margin_top = 193.0
-margin_right = 560.0
-margin_bottom = 257.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton1" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 201.0
+margin_top = 25.0
+margin_right = 297.0
+margin_bottom = 89.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0, 0.797347, 0.741037, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton2" type="ColorPickerButton" parent="."]
-margin_left = 624.0
-margin_top = 193.0
-margin_right = 720.0
-margin_bottom = 257.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton2" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 369.0
+margin_top = 25.0
+margin_right = 465.0
+margin_bottom = 89.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0.443924, 0, 0.632923, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton3" type="ColorPickerButton" parent="."]
-margin_left = 304.0
-margin_top = 289.0
-margin_right = 400.0
-margin_bottom = 353.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton3" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 33.0
+margin_top = 143.0
+margin_right = 129.0
+margin_bottom = 207.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 1, 1, 1, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton4" type="ColorPickerButton" parent="."]
-margin_left = 464.0
-margin_top = 289.0
-margin_right = 560.0
-margin_bottom = 353.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton4" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 201.0
+margin_top = 143.0
+margin_right = 297.0
+margin_bottom = 207.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 1, 0.933842, 0, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton5" type="ColorPickerButton" parent="."]
-margin_left = 624.0
-margin_top = 289.0
-margin_right = 720.0
-margin_bottom = 353.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton5" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 369.0
+margin_top = 143.0
+margin_right = 465.0
+margin_bottom = 207.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0.287293, 0.886362, 0.122933, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton6" type="ColorPickerButton" parent="."]
-margin_left = 304.0
-margin_top = 385.0
-margin_right = 400.0
-margin_bottom = 449.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton6" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 33.0
+margin_top = 261.0
+margin_right = 129.0
+margin_bottom = 325.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0.908461, 0, 0.88789, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton7" type="ColorPickerButton" parent="."]
-margin_left = 464.0
-margin_top = 385.0
-margin_right = 560.0
-margin_bottom = 449.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton7" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 201.0
+margin_top = 261.0
+margin_right = 297.0
+margin_bottom = 325.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0, 0.283703, 0, 1 )
 script = ExtResource( 1 )
 
-[node name="ColorPickerButton8" type="ColorPickerButton" parent="."]
-margin_left = 624.0
-margin_top = 385.0
-margin_right = 720.0
-margin_bottom = 449.0
-size_flags_horizontal = 2
-size_flags_vertical = 2
+[node name="ColorPickerButton8" type="ColorPickerButton" parent="GridContainer"]
+margin_left = 369.0
+margin_top = 261.0
+margin_right = 465.0
+margin_bottom = 325.0
+rect_min_size = Vector2( 96, 64 )
+size_flags_horizontal = 6
+size_flags_vertical = 6
 color = Color( 0, 0, 0.178211, 1 )
 script = ExtResource( 1 )

+ 2 - 2
loading/multiple_threads_loading/resource_queue.gd

@@ -84,7 +84,7 @@ func _wait_for_resource(res, path):
 		VisualServer.sync()
 		OS.delay_usec(16000) # Wait approximately 1 frame.
 		_lock("wait_for_resource")
-		if queue.size() == 0 || queue[0] != res:
+		if queue.size() == 0 or queue[0] != res:
 			return pending[path]
 		_unlock("wait_for_resource")
 
@@ -123,7 +123,7 @@ func thread_process():
 		var ret = res.poll()
 		_lock("process_check_queue")
 
-		if ret == ERR_FILE_EOF || ret != OK:
+		if ret == ERR_FILE_EOF or ret != OK:
 			var path = res.get_meta("path")
 			if path in pending: # Else, it was already retrieved.
 				pending[res.get_meta("path")] = res.get_resource()

+ 1 - 1
misc/2.5d/assets/player/player_math_25d.gd

@@ -30,7 +30,7 @@ func _horizontal_movement(delta):
 	var localX = Vector3.RIGHT
 	var localZ = Vector3.BACK
 
-	if isometric_controls && is_equal_approx(Node25D.SCALE * 0.86602540378, _parent_node25d.get_basis()[0].x):
+	if isometric_controls and is_equal_approx(Node25D.SCALE * 0.86602540378, _parent_node25d.get_basis()[0].x):
 		localX = Vector3(0.70710678118, 0, -0.70710678118)
 		localZ = Vector3(0.70710678118, 0, 0.70710678118)
 

+ 1 - 1
misc/2.5d/assets/player/player_sprite.gd

@@ -102,7 +102,7 @@ func _check_movement() -> bool:
 
 	# Check for isometric controls and add more to movement accordingly.
 	# For efficiency, only check the X axis since this X axis value isn't used anywhere else.
-	if !_parent_math.isometric_controls && is_equal_approx(Node25D.SCALE * 0.86602540378, _parent_node25d.get_basis()[0].x):
+	if !_parent_math.isometric_controls and is_equal_approx(Node25D.SCALE * 0.86602540378, _parent_node25d.get_basis()[0].x):
 		if Input.is_action_pressed("move_right"):
 			z += 1
 		if Input.is_action_pressed("move_left"):

+ 3 - 3
mobile/multitouch_cubes/GestureArea.gd

@@ -24,8 +24,8 @@ func _ready():
 
 func _gui_input(event):
 	# We must start touching inside, but we can drag or unpress outside.
-#	if !(event is InputEventScreenDrag ||
-#		(event is InputEventScreenTouch && (!event.pressed || get_global_rect().has_point(event.position)))):
+#	if !(event is InputEventScreenDrag or
+#		(event is InputEventScreenTouch and (!event.pressed or get_global_rect().has_point(event.position)))):
 #		return
 
 	var finger_count = base_state.size()
@@ -75,7 +75,7 @@ func _gui_input(event):
 		# Two fingers => To pinch-zoom and rotate around Z.
 		# Accept unpress or drag.
 		if event is InputEventScreenTouch:
-			if !event.pressed && base_state.has(event.index):
+			if !event.pressed and base_state.has(event.index):
 				# Some known touching finger released.
 
 				# Remove released finger from the base state.