Browse Source

2.5D Editor Viewport for GDScript

Aaron Franke 5 years ago
parent
commit
cc68af17af
60 changed files with 914 additions and 163 deletions
  1. 6 0
      .github/CODEOWNERS
  2. 0 0
      misc/2.5d/addons/node25d/icons/node_25d.png
  3. 3 3
      misc/2.5d/addons/node25d/icons/node_25d.png.import
  4. 0 0
      misc/2.5d/addons/node25d/icons/node_25d_icon.png
  5. 3 3
      misc/2.5d/addons/node25d/icons/node_25d_icon.png.import
  6. 0 0
      misc/2.5d/addons/node25d/icons/shadow_math_25d.png
  7. 3 3
      misc/2.5d/addons/node25d/icons/shadow_math_25d.png.import
  8. 0 0
      misc/2.5d/addons/node25d/icons/shadow_math_25d_icon.png
  9. 3 3
      misc/2.5d/addons/node25d/icons/shadow_math_25d_icon.png.import
  10. 0 0
      misc/2.5d/addons/node25d/icons/y_sort_25d.png
  11. 34 0
      misc/2.5d/addons/node25d/icons/y_sort_25d.png.import
  12. 0 0
      misc/2.5d/addons/node25d/icons/y_sort_25d_icon.png
  13. 34 0
      misc/2.5d/addons/node25d/icons/y_sort_25d_icon.png.import
  14. 0 34
      misc/2.5d/addons/node25d/icons/ysort25d_icon.png.import
  15. 105 0
      misc/2.5d/addons/node25d/main_screen/gizmo_25d.gd
  16. 23 0
      misc/2.5d/addons/node25d/main_screen/gizmo_25d.tscn
  17. 173 0
      misc/2.5d/addons/node25d/main_screen/main_screen_25d.tscn
  18. 3 0
      misc/2.5d/addons/node25d/main_screen/view_mode_button_group.tres
  19. 147 0
      misc/2.5d/addons/node25d/main_screen/viewport_25d.gd
  20. 32 5
      misc/2.5d/addons/node25d/node25d_plugin.gd
  21. 1 1
      misc/2.5d/addons/node25d/node_25d.gd
  22. 1 1
      misc/2.5d/addons/node25d/shadow_math_25d.gd
  23. 1 1
      misc/2.5d/addons/node25d/y_sort_25d.gd
  24. 4 4
      misc/2.5d/assets/cube/cube.tscn
  25. 2 2
      misc/2.5d/assets/cube/cube_math.gd
  26. 2 2
      misc/2.5d/assets/cube/cube_point.tscn
  27. 34 11
      misc/2.5d/assets/demo_scene.tscn
  28. 4 4
      misc/2.5d/assets/platform/platform.tscn
  29. 10 10
      misc/2.5d/assets/platform/platform_sprite.gd
  30. 0 34
      misc/2.5d/assets/platform/textures/41226408-platform-texture.jpg.import
  31. 0 0
      misc/2.5d/assets/platform/textures/forty_five.png
  32. 34 0
      misc/2.5d/assets/platform/textures/forty_five.png.import
  33. 0 0
      misc/2.5d/assets/platform/textures/front_side.png
  34. 34 0
      misc/2.5d/assets/platform/textures/front_side.png.import
  35. 0 0
      misc/2.5d/assets/platform/textures/oblique_y.png
  36. 34 0
      misc/2.5d/assets/platform/textures/oblique_y.png.import
  37. 0 0
      misc/2.5d/assets/platform/textures/oblique_z.png
  38. 34 0
      misc/2.5d/assets/platform/textures/oblique_z.png.import
  39. 0 0
      misc/2.5d/assets/platform/textures/top_down.png
  40. 3 3
      misc/2.5d/assets/platform/textures/top_down.png.import
  41. 7 4
      misc/2.5d/assets/player/player_25d.tscn
  42. 1 1
      misc/2.5d/assets/player/player_math_25d.gd
  43. 0 0
      misc/2.5d/assets/player/player_sprite.gd
  44. 9 6
      misc/2.5d/assets/shadow/shadow_25d.tscn
  45. 10 10
      misc/2.5d/assets/shadow/shadow_sprite.gd
  46. 0 0
      misc/2.5d/assets/shadow/textures/forty_five.png
  47. 34 0
      misc/2.5d/assets/shadow/textures/forty_five.png.import
  48. 0 0
      misc/2.5d/assets/shadow/textures/front_side.png
  49. 34 0
      misc/2.5d/assets/shadow/textures/front_side.png.import
  50. BIN
      misc/2.5d/assets/shadow/textures/obliqueZ.png
  51. 0 0
      misc/2.5d/assets/shadow/textures/oblique_y.png
  52. 3 3
      misc/2.5d/assets/shadow/textures/oblique_y.png.import
  53. BIN
      misc/2.5d/assets/shadow/textures/oblique_z.png
  54. 34 0
      misc/2.5d/assets/shadow/textures/oblique_z.png.import
  55. 0 0
      misc/2.5d/assets/shadow/textures/top_down.png
  56. 3 3
      misc/2.5d/assets/shadow/textures/top_down.png.import
  57. 0 0
      misc/2.5d/assets/ui/control_hints.gd
  58. 2 2
      misc/2.5d/assets/ui/overlay.tscn
  59. 2 2
      misc/2.5d/assets/ui/overlay_cube.tscn
  60. 8 8
      misc/2.5d/project.godot

+ 6 - 0
.github/CODEOWNERS

@@ -0,0 +1,6 @@
+# Lines starting with '#' are comments.
+# Each line is a file pattern followed by one or more owners.
+# Owners can be @users, @org/teams or emails
+
+/misc/2.5d           @aaronfranke
+/mono/2.5d           @aaronfranke

+ 0 - 0
misc/2.5d/addons/node25d/icons/node25d.png → misc/2.5d/addons/node25d/icons/node_25d.png


+ 3 - 3
misc/2.5d/addons/node25d/icons/ysort25d.png.import → misc/2.5d/addons/node25d/icons/node_25d.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/ysort25d.png-d31f6d31844267009448064818383c0d.stex"
+path="res://.import/node_25d.png-72e45d8600ccbde01c6d9ad51f5fc530.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://addons/node25d/icons/ysort25d.png"
-dest_files=[ "res://.import/ysort25d.png-d31f6d31844267009448064818383c0d.stex" ]
+source_file="res://addons/node25d/icons/node_25d.png"
+dest_files=[ "res://.import/node_25d.png-72e45d8600ccbde01c6d9ad51f5fc530.stex" ]
 
 [params]
 

+ 0 - 0
misc/2.5d/addons/node25d/icons/node25d_icon.png → misc/2.5d/addons/node25d/icons/node_25d_icon.png


+ 3 - 3
misc/2.5d/addons/node25d/icons/node25d_icon.png.import → misc/2.5d/addons/node25d/icons/node_25d_icon.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/node25d_icon.png-075c4b266c832f0f269670bad017ac93.stex"
+path="res://.import/node_25d_icon.png-2ad780313818706789bbb15408797db2.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://addons/node25d/icons/node25d_icon.png"
-dest_files=[ "res://.import/node25d_icon.png-075c4b266c832f0f269670bad017ac93.stex" ]
+source_file="res://addons/node25d/icons/node_25d_icon.png"
+dest_files=[ "res://.import/node_25d_icon.png-2ad780313818706789bbb15408797db2.stex" ]
 
 [params]
 

+ 0 - 0
misc/2.5d/addons/node25d/icons/shadowmath25d.png → misc/2.5d/addons/node25d/icons/shadow_math_25d.png


+ 3 - 3
misc/2.5d/addons/node25d/icons/shadowmath25d.png.import → misc/2.5d/addons/node25d/icons/shadow_math_25d.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/shadowmath25d.png-829bb9aabf7e847ec9c9f29f41353471.stex"
+path="res://.import/shadow_math_25d.png-333790a3285ee4c26792088985815eba.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://addons/node25d/icons/shadowmath25d.png"
-dest_files=[ "res://.import/shadowmath25d.png-829bb9aabf7e847ec9c9f29f41353471.stex" ]
+source_file="res://addons/node25d/icons/shadow_math_25d.png"
+dest_files=[ "res://.import/shadow_math_25d.png-333790a3285ee4c26792088985815eba.stex" ]
 
 [params]
 

+ 0 - 0
misc/2.5d/addons/node25d/icons/shadowmath25d_icon.png → misc/2.5d/addons/node25d/icons/shadow_math_25d_icon.png


+ 3 - 3
misc/2.5d/addons/node25d/icons/shadowmath25d_icon.png.import → misc/2.5d/addons/node25d/icons/shadow_math_25d_icon.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/shadowmath25d_icon.png-2b9af3adf31a4021b98dae0a81fb9294.stex"
+path="res://.import/shadow_math_25d_icon.png-f286bd905218b9a04121a430c1fdd042.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://addons/node25d/icons/shadowmath25d_icon.png"
-dest_files=[ "res://.import/shadowmath25d_icon.png-2b9af3adf31a4021b98dae0a81fb9294.stex" ]
+source_file="res://addons/node25d/icons/shadow_math_25d_icon.png"
+dest_files=[ "res://.import/shadow_math_25d_icon.png-f286bd905218b9a04121a430c1fdd042.stex" ]
 
 [params]
 

+ 0 - 0
misc/2.5d/addons/node25d/icons/ysort25d.png → misc/2.5d/addons/node25d/icons/y_sort_25d.png


+ 34 - 0
misc/2.5d/addons/node25d/icons/y_sort_25d.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/y_sort_25d.png-2e15f3765afd8b0136201cb9dea4049b.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/node25d/icons/y_sort_25d.png"
+dest_files=[ "res://.import/y_sort_25d.png-2e15f3765afd8b0136201cb9dea4049b.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/addons/node25d/icons/ysort25d_icon.png → misc/2.5d/addons/node25d/icons/y_sort_25d_icon.png


+ 34 - 0
misc/2.5d/addons/node25d/icons/y_sort_25d_icon.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/y_sort_25d_icon.png-48050bfa8b299992a68b4f1e12bd5d44.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://addons/node25d/icons/y_sort_25d_icon.png"
+dest_files=[ "res://.import/y_sort_25d_icon.png-48050bfa8b299992a68b4f1e12bd5d44.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 34
misc/2.5d/addons/node25d/icons/ysort25d_icon.png.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="StreamTexture"
-path="res://.import/ysort25d_icon.png-7203736c3c997b4f31f7b878b0530dfd.stex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://addons/node25d/icons/ysort25d_icon.png"
-dest_files=[ "res://.import/ysort25d_icon.png-7203736c3c997b4f31f7b878b0530dfd.stex" ]
-
-[params]
-
-compress/mode=0
-compress/lossy_quality=0.7
-compress/hdr_mode=0
-compress/bptc_ldr=0
-compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0

+ 105 - 0
misc/2.5d/addons/node25d/main_screen/gizmo_25d.gd

@@ -0,0 +1,105 @@
+tool
+extends Node2D
+
+# Not pixel perfect for all axes in all modes, but works well enough.
+# Rounding is not done until after the movement is finished.
+const ROUGHLY_ROUND_TO_PIXELS = true
+
+# Set when the node is created.
+var node_25d: Node25D
+var spatial_node
+
+# Input from Viewport25D, represents if the mouse is clicked.
+var wants_to_move = false
+
+# Used to control the state of movement.
+var _moving = false
+var _start_position = Vector2()
+
+# Stores state of closest or currently used axis.
+var dominant_axis
+
+onready var lines_root = $Lines
+onready var lines = [$Lines/X, $Lines/Y, $Lines/Z]
+
+func _process(_delta):
+	if !lines:
+		return # Somehow this node hasn't been set up yet.
+	if !node_25d:
+		return # We're most likely viewing the Gizmo25D scene.
+	# While getting the mouse position works in any viewport, it doesn't do
+	# anything significant unless the mouse is in the 2.5D viewport.
+	var mouse_position = get_local_mouse_position()
+	if !_moving:
+		# If the mouse is farther than this many pixels, it won't grab anything.
+		var closest_distance = 20.0
+		dominant_axis = -1
+		for i in range(3):
+			lines[i].modulate.a = 0.8 # Unrelated, but needs a loop too.
+			var distance = _distance_to_segment_at_index(i, mouse_position)
+			if distance < closest_distance:
+				closest_distance = distance
+				dominant_axis = i
+		if dominant_axis == -1:
+			# If we're not hovering over a line, ensure they are placed correctly.
+			lines_root.global_position = node_25d.global_position
+			return
+	
+	lines[dominant_axis].modulate.a = 1
+	if !wants_to_move:
+		_moving = false
+	elif wants_to_move and !_moving:
+		_moving = true
+		_start_position = mouse_position
+	
+	if _moving:
+		# Change modulate of unselected axes.
+		lines[(dominant_axis + 1) % 3].modulate.a = 0.5
+		lines[(dominant_axis + 2) % 3].modulate.a = 0.5
+		# Calculate mouse movement and reset for next frame.
+		var mouse_diff = mouse_position - _start_position
+		_start_position = mouse_position
+		# Calculate movement.
+		var projected_diff = mouse_diff.project(lines[dominant_axis].points[1])
+		var movement = projected_diff.length() / Node25D.SCALE
+		if is_equal_approx(PI, projected_diff.angle_to(lines[dominant_axis].points[1])):
+			movement *= -1
+		# Apply movement.
+		spatial_node.transform.origin += spatial_node.transform.basis[dominant_axis] * movement
+	else:
+		# Make sure the gizmo is located at the object.
+		global_position = node_25d.global_position
+		if ROUGHLY_ROUND_TO_PIXELS:
+			spatial_node.transform.origin = (spatial_node.transform.origin * Node25D.SCALE).round() / Node25D.SCALE
+	# Move the gizmo lines appropriately.
+	lines_root.global_position = node_25d.global_position
+	node_25d.property_list_changed_notify()
+
+
+# Initializes after _ready due to the onready vars, called manually in Viewport25D.gd.
+# Sets up the points based on the basis values of the Node25D.
+func initialize():
+	var basis = node_25d.get_basis()
+	for i in range(3):
+		lines[i].points[1] = basis[i] * 3
+	global_position = node_25d.global_position
+	spatial_node = node_25d.get_child(0)
+
+
+# Figures out if the mouse is very close to a segment. This method is
+# specialized for this script, it assumes that each segment starts at
+# (0, 0) and it provides a deadzone around the origin.
+func _distance_to_segment_at_index(index, point):
+	if !lines:
+		return INF
+	if point.length_squared() < 400:
+		return INF
+	
+	var segment_end = lines[index].points[1]
+	var length_squared = segment_end.length_squared()
+	if length_squared < 400:
+		return INF
+	
+	var t = clamp(point.dot(segment_end) / length_squared, 0, 1)
+	var projection = t * segment_end
+	return point.distance_to(projection)

+ 23 - 0
misc/2.5d/addons/node25d/main_screen/gizmo_25d.tscn

@@ -0,0 +1,23 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://addons/node25d/main_screen/gizmo_25d.gd" type="Script" id=1]
+
+[node name="Gizmo25D" type="Node2D"]
+script = ExtResource( 1 )
+
+[node name="Lines" type="Node2D" parent="."]
+
+[node name="X" type="Line2D" parent="Lines"]
+modulate = Color( 1, 1, 1, 0.8 )
+points = PoolVector2Array( 0, 0, 100, 0 )
+default_color = Color( 0.91, 0.273, 0, 1 )
+
+[node name="Y" type="Line2D" parent="Lines"]
+modulate = Color( 1, 1, 1, 0.8 )
+points = PoolVector2Array( 0, 0, 0, -100 )
+default_color = Color( 0, 0.91, 0.273, 1 )
+
+[node name="Z" type="Line2D" parent="Lines"]
+modulate = Color( 1, 1, 1, 0.8 )
+points = PoolVector2Array( 0, 0, 0, 100 )
+default_color = Color( 0.3, 0, 1, 1 )

+ 173 - 0
misc/2.5d/addons/node25d/main_screen/main_screen_25d.tscn

@@ -0,0 +1,173 @@
+[gd_scene load_steps=5 format=2]
+
+[ext_resource path="res://addons/node25d/main_screen/viewport_25d.gd" type="Script" id=1]
+[ext_resource path="res://addons/node25d/main_screen/view_mode_button_group.tres" type="ButtonGroup" id=2]
+
+[sub_resource type="ViewportTexture" id=1]
+viewport_path = NodePath("Viewport25D/Viewport2D")
+
+[sub_resource type="ViewportTexture" id=2]
+viewport_path = NodePath("Viewport25D/ViewportOverlay")
+
+[node name="MainScreen25D" type="VBoxContainer"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+size_flags_horizontal = 3
+size_flags_vertical = 3
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="TopBar" type="HBoxContainer" parent="."]
+margin_right = 1600.0
+margin_bottom = 32.0
+rect_min_size = Vector2( 0, 32 )
+size_flags_horizontal = 3
+
+[node name="ViewModeButtons" type="HBoxContainer" parent="TopBar"]
+margin_right = 798.0
+margin_bottom = 32.0
+size_flags_horizontal = 3
+
+[node name="45Degree" type="CheckBox" parent="TopBar/ViewModeButtons"]
+margin_right = 94.0
+margin_bottom = 32.0
+pressed = true
+group = ExtResource( 2 )
+text = "45 Degree"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Isometric" type="CheckBox" parent="TopBar/ViewModeButtons"]
+margin_left = 98.0
+margin_right = 188.0
+margin_bottom = 32.0
+group = ExtResource( 2 )
+text = "Isometric"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="TopDown" type="CheckBox" parent="TopBar/ViewModeButtons"]
+margin_left = 192.0
+margin_right = 283.0
+margin_bottom = 32.0
+group = ExtResource( 2 )
+text = "Top Down"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="FrontSide" type="CheckBox" parent="TopBar/ViewModeButtons"]
+margin_left = 287.0
+margin_right = 379.0
+margin_bottom = 32.0
+group = ExtResource( 2 )
+text = "Front Side"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ObliqueY" type="CheckBox" parent="TopBar/ViewModeButtons"]
+margin_left = 383.0
+margin_right = 473.0
+margin_bottom = 32.0
+group = ExtResource( 2 )
+text = "Oblique Y"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ObliqueZ" type="CheckBox" parent="TopBar/ViewModeButtons"]
+margin_left = 477.0
+margin_right = 568.0
+margin_bottom = 32.0
+group = ExtResource( 2 )
+text = "Oblique Z"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Zoom" type="HBoxContainer" parent="TopBar"]
+margin_left = 802.0
+margin_right = 1600.0
+margin_bottom = 32.0
+size_flags_horizontal = 3
+alignment = 2
+
+[node name="ZoomOut" type="Button" parent="TopBar/Zoom"]
+margin_left = 680.0
+margin_right = 710.0
+margin_bottom = 32.0
+rect_min_size = Vector2( 30, 0 )
+text = "-"
+
+[node name="ZoomPercent" type="Label" parent="TopBar/Zoom"]
+margin_left = 714.0
+margin_top = 9.0
+margin_right = 764.0
+margin_bottom = 23.0
+rect_min_size = Vector2( 50, 0 )
+text = "100%"
+align = 1
+clip_text = true
+
+[node name="ZoomReset" type="Button" parent="TopBar/Zoom/ZoomPercent"]
+modulate = Color( 1, 1, 1, 0 )
+anchor_right = 1.0
+anchor_bottom = 1.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="ZoomIn" type="Button" parent="TopBar/Zoom"]
+margin_left = 768.0
+margin_right = 798.0
+margin_bottom = 32.0
+rect_min_size = Vector2( 30, 0 )
+text = "+"
+
+[node name="Viewport25D" type="ColorRect" parent="."]
+margin_top = 36.0
+margin_right = 1600.0
+margin_bottom = 900.0
+rect_clip_content = true
+size_flags_horizontal = 3
+size_flags_vertical = 3
+color = Color( 0.301961, 0.301961, 0.301961, 1 )
+script = ExtResource( 1 )
+
+[node name="Viewport2D" type="Viewport" parent="Viewport25D"]
+size = Vector2( 1600, 864 )
+transparent_bg = true
+disable_3d = true
+usage = 1
+render_target_v_flip = true
+
+[node name="ViewportOverlay" type="Viewport" parent="Viewport25D"]
+size = Vector2( 1600, 864 )
+transparent_bg = true
+disable_3d = true
+usage = 1
+render_target_v_flip = true
+
+[node name="ViewportTexture" type="TextureRect" parent="Viewport25D"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+texture = SubResource( 1 )
+expand = true
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Overlay" type="TextureRect" parent="Viewport25D/ViewportTexture"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+texture = SubResource( 2 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+[connection signal="pressed" from="TopBar/Zoom/ZoomOut" to="Viewport25D" method="_on_ZoomOut_pressed"]
+[connection signal="pressed" from="TopBar/Zoom/ZoomPercent/ZoomReset" to="Viewport25D" method="_on_ZoomReset_pressed"]
+[connection signal="pressed" from="TopBar/Zoom/ZoomIn" to="Viewport25D" method="_on_ZoomIn_pressed"]

+ 3 - 0
misc/2.5d/addons/node25d/main_screen/view_mode_button_group.tres

@@ -0,0 +1,3 @@
+[gd_resource type="ButtonGroup" format=2]
+
+[resource]

+ 147 - 0
misc/2.5d/addons/node25d/main_screen/viewport_25d.gd

@@ -0,0 +1,147 @@
+tool
+extends Control
+
+var zoom_level := 0
+var is_panning = false
+var pan_center: Vector2
+var viewport_center: Vector2
+var view_mode_index := 0
+
+var editor_interface: EditorInterface # Set in node25d_plugin.gd
+var moving = false
+
+onready var viewport_2d = $Viewport2D
+onready var viewport_overlay = $ViewportOverlay
+onready var view_mode_button_group: ButtonGroup = $"../TopBar/ViewModeButtons/45Degree".group
+onready var zoom_label: Label = $"../TopBar/Zoom/ZoomPercent"
+onready var gizmo_25d_scene = preload("res://addons/node25d/main_screen/gizmo_25d.tscn")
+
+func _ready():
+	# Give Godot a chance to fully load the scene. Should take two frames.
+	yield(get_tree(), "idle_frame")
+	yield(get_tree(), "idle_frame")
+	var edited_scene_root = get_tree().edited_scene_root
+	if !edited_scene_root:
+		# Godot hasn't finished loading yet, so try loading the plugin again.
+		editor_interface.set_plugin_enabled("node25d", false)
+		editor_interface.set_plugin_enabled("node25d", true)
+		return
+	# Alright, we're loaded up. Now check if we have a valid world and assign it.
+	var world_2d = edited_scene_root.get_viewport().world_2d
+	if world_2d == get_viewport().world_2d:
+		return # This is the MainScreen25D scene opened in the editor!
+	viewport_2d.world_2d = world_2d
+
+
+func _process(delta):
+	if !editor_interface: # Something's not right... bail!
+		return
+	
+	# View mode polling.
+	var view_mode_changed_this_frame = false
+	var new_view_mode = view_mode_button_group.get_pressed_button().get_index()
+	if view_mode_index != new_view_mode:
+		view_mode_index = new_view_mode
+		view_mode_changed_this_frame = true
+		_recursive_change_view_mode(get_tree().edited_scene_root)
+	
+	# Zooming.
+	if Input.is_mouse_button_pressed(BUTTON_WHEEL_UP):
+		zoom_level += 1
+	elif Input.is_mouse_button_pressed(BUTTON_WHEEL_DOWN):
+		zoom_level -= 1
+	var zoom = _get_zoom_amount()
+	
+	# Viewport size.
+	var size = get_global_rect().size
+	viewport_2d.size = size
+	
+	# Viewport transform.
+	var viewport_trans = Transform2D.IDENTITY
+	viewport_trans.x *= zoom
+	viewport_trans.y *= zoom
+	viewport_trans.origin = viewport_trans.basis_xform(viewport_center) + size / 2
+	viewport_2d.canvas_transform = viewport_trans
+	viewport_overlay.canvas_transform = viewport_trans
+	
+	# Delete unused gizmos.
+	var selection = editor_interface.get_selection().get_selected_nodes()
+	var overlay_children = viewport_overlay.get_children()
+	for overlay_child in overlay_children:
+		var contains = false
+		for selected in selection:
+			if selected == overlay_child.node_25d and !view_mode_changed_this_frame:
+				contains = true
+		if !contains:
+			overlay_child.queue_free()
+	
+	# Add new gizmos.
+	for selected in selection:
+		if selected is Node25D:
+			var new = true
+			for overlay_child in overlay_children:
+				if selected == overlay_child.node_25d:
+					new = false
+			if new:
+				var gizmo = gizmo_25d_scene.instance()
+				viewport_overlay.add_child(gizmo)
+				gizmo.node_25d = selected
+				gizmo.initialize()
+
+
+# This only accepts input when the mouse is inside of the 2.5D viewport.
+func _gui_input(event):
+	if event is InputEventMouseButton:
+		if event.is_pressed():
+			if event.button_index == BUTTON_WHEEL_UP:
+				zoom_level += 1
+				accept_event()
+			elif event.button_index == BUTTON_WHEEL_DOWN:
+				zoom_level -= 1
+				accept_event()
+			elif event.button_index == BUTTON_MIDDLE:
+				is_panning = true
+				pan_center = viewport_center - event.position
+				accept_event()
+			elif event.button_index == BUTTON_LEFT:
+				var overlay_children = viewport_overlay.get_children()
+				for overlay_child in overlay_children:
+					overlay_child.wants_to_move = true
+				accept_event()
+		elif event.button_index == BUTTON_MIDDLE:
+			is_panning = false
+			accept_event()
+		elif event.button_index == BUTTON_LEFT:
+			var overlay_children = viewport_overlay.get_children()
+			for overlay_child in overlay_children:
+				overlay_child.wants_to_move = false
+			accept_event()
+	elif event is InputEventMouseMotion:
+		if is_panning:
+			viewport_center = pan_center + event.position
+			accept_event()
+
+
+func _recursive_change_view_mode(current_node):
+	if current_node.has_method("set_view_mode"):
+		current_node.set_view_mode(view_mode_index)
+	for child in current_node.get_children():
+		_recursive_change_view_mode(child)
+
+
+func _get_zoom_amount():
+	var zoom_amount = pow(1.05476607648, zoom_level) # 13th root of 2
+	zoom_label.text = str(round(zoom_amount * 1000) / 10) + "%"
+	return zoom_amount
+
+
+func _on_ZoomOut_pressed():
+	zoom_level -= 1
+
+
+func _on_ZoomIn_pressed():
+	zoom_level += 1
+
+
+func _on_ZoomReset_pressed():
+	zoom_level = 0

+ 32 - 5
misc/2.5d/addons/node25d/node25d_plugin.gd

@@ -1,16 +1,43 @@
 tool
 extends EditorPlugin
 
+const MainPanel = preload("res://addons/node25d/main_screen/main_screen_25d.tscn")
+
+var main_panel_instance
 
 func _enter_tree():
-	# When this plugin node enters tree, add the custom types
-	add_custom_type("Node25D", "Node2D", preload("Node25D.gd"), preload("icons/node25d_icon.png"))
-	add_custom_type("YSort25D", "Node", preload("YSort25D.gd"), preload("icons/ysort25d_icon.png"))
-	add_custom_type("ShadowMath25D", "KinematicBody", preload("ShadowMath25D.gd"), preload("icons/shadowmath25d_icon.png"))
+	main_panel_instance = MainPanel.instance()
+	main_panel_instance.get_child(1).editor_interface = get_editor_interface()
+	
+	# Add the main panel to the editor's main viewport.
+	get_editor_interface().get_editor_viewport().add_child(main_panel_instance)
+	
+	# Hide the main panel.
+	make_visible(false)
+	# When this plugin node enters tree, add the custom types.
+	add_custom_type("Node25D", "Node2D", preload("node_25d.gd"), preload("icons/node_25d_icon.png"))
+	add_custom_type("YSort25D", "Node", preload("y_sort_25d.gd"), preload("icons/y_sort_25d_icon.png"))
+	add_custom_type("ShadowMath25D", "KinematicBody", preload("shadow_math_25d.gd"), preload("icons/shadow_math_25d_icon.png"))
 
 
 func _exit_tree():
-	# When the plugin node exits the tree, remove the custom types
+	main_panel_instance.queue_free()
+	# When the plugin node exits the tree, remove the custom types.
 	remove_custom_type("ShadowMath25D")
 	remove_custom_type("YSort25D")
 	remove_custom_type("Node25D")
+
+
+func has_main_screen():
+	return true
+
+
+func make_visible(visible):
+	if visible:
+		main_panel_instance.show()
+	else:
+		main_panel_instance.hide()
+
+
+func get_plugin_name():
+	return "2.5D"

+ 1 - 1
misc/2.5d/addons/node25d/Node25D.gd → misc/2.5d/addons/node25d/node_25d.gd

@@ -2,7 +2,7 @@
 # The transformation of its 2D form is controlled by its 3D child.
 tool
 extends Node2D
-class_name Node25D, "res://addons/node25d/icons/node25d_icon.png"
+class_name Node25D, "res://addons/node25d/icons/node_25d_icon.png"
 
 # SCALE is the number of 2D units in one 3D unit. Ideally, but not necessarily, an integer.
 const SCALE = 32

+ 1 - 1
misc/2.5d/addons/node25d/ShadowMath25D.gd → misc/2.5d/addons/node25d/shadow_math_25d.gd

@@ -3,7 +3,7 @@
 # is below the target object in the scene tree (not as a child).
 tool
 extends KinematicBody
-class_name ShadowMath25D, "res://addons/node25d/icons/shadowmath25d_icon.png"
+class_name ShadowMath25D, "res://addons/node25d/icons/shadow_math_25d_icon.png"
 
 # The maximum distance below objects that shadows will appear (in 3D units).
 var shadow_length = 1000.0

+ 1 - 1
misc/2.5d/addons/node25d/YSort25D.gd → misc/2.5d/addons/node25d/y_sort_25d.gd

@@ -4,7 +4,7 @@
 # sorting is delayed by one frame.
 tool
 extends Node # Note: NOT Node2D, Node25D, or YSort
-class_name YSort25D, "res://addons/node25d/icons/ysort25d_icon.png"
+class_name YSort25D, "res://addons/node25d/icons/y_sort_25d_icon.png"
 
 # Whether or not to automatically call sort() in _process().
 export(bool) var sort_enabled := true

+ 4 - 4
misc/2.5d/assets/cube/Cube.tscn → misc/2.5d/assets/cube/cube.tscn

@@ -1,9 +1,9 @@
 [gd_scene load_steps=5 format=2]
 
-[ext_resource path="res://addons/node25d/icons/ysort25d_icon.png" type="Texture" id=1]
-[ext_resource path="res://assets/ui/OverlayCube.tscn" type="PackedScene" id=2]
-[ext_resource path="res://assets/cube/CubeMath.gd" type="Script" id=3]
-[ext_resource path="res://addons/node25d/YSort25D.gd" type="Script" id=4]
+[ext_resource path="res://addons/node25d/icons/y_sort_25d_icon.png" type="Texture" id=1]
+[ext_resource path="res://assets/ui/overlay_cube.tscn" type="PackedScene" id=2]
+[ext_resource path="res://assets/cube/cube_math.gd" type="Script" id=3]
+[ext_resource path="res://addons/node25d/y_sort_25d.gd" type="Script" id=4]
 
 [node name="Cube" type="Node2D"]
 

+ 2 - 2
misc/2.5d/assets/cube/CubeMath.gd → misc/2.5d/assets/cube/cube_math.gd

@@ -1,6 +1,6 @@
 extends Spatial
 
-onready var _cube_point_scene: PackedScene = preload("res://assets/cube/CubePoint.tscn")
+onready var _cube_point_scene: PackedScene = preload("res://assets/cube/cube_point.tscn")
 
 onready var _parent = get_parent()
 var _is_parent_ready := false
@@ -29,7 +29,7 @@ func _process(delta):
 	
 	if Input.is_action_just_pressed("view_cube_demo"):
 		# warning-ignore:return_value_discarded
-		get_tree().change_scene("res://assets/DemoScene.tscn")
+		get_tree().change_scene("res://assets/demo_scene.tscn")
 		return
 	
 	if _is_parent_ready:

+ 2 - 2
misc/2.5d/assets/cube/CubePoint.tscn → misc/2.5d/assets/cube/cube_point.tscn

@@ -1,7 +1,7 @@
 [gd_scene load_steps=4 format=2]
 
-[ext_resource path="res://addons/node25d/Node25D.gd" type="Script" id=1]
-[ext_resource path="res://addons/node25d/icons/node25d_icon.png" type="Texture" id=2]
+[ext_resource path="res://addons/node25d/node_25d.gd" type="Script" id=1]
+[ext_resource path="res://addons/node25d/icons/node_25d_icon.png" type="Texture" id=2]
 [ext_resource path="res://assets/cube/godot.png" type="Texture" id=3]
 
 [node name="CubePoint" type="Node2D"]

+ 34 - 11
misc/2.5d/assets/DemoScene.tscn → misc/2.5d/assets/demo_scene.tscn

@@ -1,14 +1,14 @@
 [gd_scene load_steps=13 format=2]
 
-[ext_resource path="res://assets/ui/Overlay.tscn" type="PackedScene" id=1]
-[ext_resource path="res://assets/player/Player25D.tscn" type="PackedScene" id=2]
-[ext_resource path="res://assets/shadow/Shadow25D.tscn" type="PackedScene" id=3]
-[ext_resource path="res://addons/node25d/Node25D.gd" type="Script" id=4]
-[ext_resource path="res://addons/node25d/icons/node25d_icon.png" type="Texture" id=5]
-[ext_resource path="res://assets/platform/textures/fortyfive.png" type="Texture" id=6]
-[ext_resource path="res://assets/platform/PlatformSprite.gd" type="Script" id=7]
-[ext_resource path="res://addons/node25d/YSort25D.gd" type="Script" id=8]
-[ext_resource path="res://addons/node25d/icons/ysort25d_icon.png" type="Texture" id=9]
+[ext_resource path="res://assets/ui/overlay.tscn" type="PackedScene" id=1]
+[ext_resource path="res://assets/player/player_25d.tscn" type="PackedScene" id=2]
+[ext_resource path="res://assets/shadow/shadow_25d.tscn" type="PackedScene" id=3]
+[ext_resource path="res://addons/node25d/node_25d.gd" type="Script" id=4]
+[ext_resource path="res://addons/node25d/icons/node_25d_icon.png" type="Texture" id=5]
+[ext_resource path="res://assets/platform/textures/forty_five.png" type="Texture" id=6]
+[ext_resource path="res://assets/platform/platform_sprite.gd" type="Script" id=7]
+[ext_resource path="res://addons/node25d/y_sort_25d.gd" type="Script" id=8]
+[ext_resource path="res://addons/node25d/icons/y_sort_25d_icon.png" type="Texture" id=9]
 
 [sub_resource type="BoxShape" id=1]
 extents = Vector3( 5, 0.5, 5 )
@@ -24,16 +24,17 @@ extents = Vector3( 5, 0.5, 5 )
 [node name="Overlay" parent="." instance=ExtResource( 1 )]
 
 [node name="Player25D" parent="." instance=ExtResource( 2 )]
-position = Vector2( 0, 0 )
+position = Vector2( 0, -226.274 )
 z_index = -3952
 
 [node name="Shadow25D" parent="." instance=ExtResource( 3 )]
 visible = true
-position = Vector2( 0, 0 )
+position = Vector2( 1.00261e-06, 11.2685 )
 z_index = -3958
 spatial_position = Vector3( 3.13315e-08, -0.498, 3.13315e-08 )
 
 [node name="Platform0" type="Node2D" parent="."]
+position = Vector2( -256, -113.137 )
 z_index = -3954
 script = ExtResource( 4 )
 __meta__ = {
@@ -58,6 +59,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform1" type="Node2D" parent="."]
+position = Vector2( -256, -339.411 )
 z_index = -3956
 script = ExtResource( 4 )
 __meta__ = {
@@ -82,6 +84,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform2" type="Node2D" parent="."]
+position = Vector2( 0, 22.6274 )
 z_index = -3962
 script = ExtResource( 4 )
 __meta__ = {
@@ -106,6 +109,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform3" type="Node2D" parent="."]
+position = Vector2( 320, 22.6274 )
 z_index = -3960
 script = ExtResource( 4 )
 __meta__ = {
@@ -130,6 +134,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform4" type="Node2D" parent="."]
+position = Vector2( 0, -203.647 )
 z_index = -3966
 script = ExtResource( 4 )
 __meta__ = {
@@ -154,6 +159,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform5" type="Node2D" parent="."]
+position = Vector2( 320, -113.137 )
 z_index = -3984
 script = ExtResource( 4 )
 __meta__ = {
@@ -178,6 +184,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform6" type="Node2D" parent="."]
+position = Vector2( 320, 113.137 )
 z_index = -3982
 script = ExtResource( 4 )
 __meta__ = {
@@ -202,6 +209,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform7" type="Node2D" parent="."]
+position = Vector2( 320, 339.411 )
 z_index = -3978
 script = ExtResource( 4 )
 __meta__ = {
@@ -226,6 +234,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform20" type="Node2D" parent="."]
+position = Vector2( 320, 565.685 )
 z_index = -3976
 script = ExtResource( 4 )
 __meta__ = {
@@ -250,6 +259,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform21" type="Node2D" parent="."]
+position = Vector2( 320, 791.96 )
 z_index = -3972
 script = ExtResource( 4 )
 __meta__ = {
@@ -274,6 +284,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform22" type="Node2D" parent="."]
+position = Vector2( 320, 1018.23 )
 z_index = -3970
 script = ExtResource( 4 )
 __meta__ = {
@@ -298,6 +309,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform9" type="Node2D" parent="."]
+position = Vector2( 640, 339.411 )
 z_index = -3974
 script = ExtResource( 4 )
 __meta__ = {
@@ -322,6 +334,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform10" type="Node2D" parent="."]
+position = Vector2( 896, 294.156 )
 z_index = -3994
 script = ExtResource( 4 )
 __meta__ = {
@@ -346,6 +359,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform11" type="Node2D" parent="."]
+position = Vector2( 896, 520.431 )
 z_index = -3992
 script = ExtResource( 4 )
 __meta__ = {
@@ -370,6 +384,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform12" type="Node2D" parent="."]
+position = Vector2( 896, 746.705 )
 z_index = -3988
 script = ExtResource( 4 )
 __meta__ = {
@@ -394,6 +409,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform13" type="Node2D" parent="."]
+position = Vector2( 576, 746.705 )
 z_index = -3990
 script = ExtResource( 4 )
 __meta__ = {
@@ -418,6 +434,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform14" type="Node2D" parent="."]
+position = Vector2( 256, 746.705 )
 z_index = -3996
 script = ExtResource( 4 )
 __meta__ = {
@@ -442,6 +459,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform15" type="Node2D" parent="."]
+position = Vector2( -64, 746.705 )
 z_index = -3998
 script = ExtResource( 4 )
 __meta__ = {
@@ -466,6 +484,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform23" type="Node2D" parent="."]
+position = Vector2( -384, 746.705 )
 z_index = -4000
 script = ExtResource( 4 )
 __meta__ = {
@@ -490,6 +509,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform16" type="Node2D" parent="."]
+position = Vector2( -320, 565.685 )
 z_index = -3980
 script = ExtResource( 4 )
 __meta__ = {
@@ -514,6 +534,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform19" type="Node2D" parent="."]
+position = Vector2( -320, 339.411 )
 z_index = -3986
 script = ExtResource( 4 )
 __meta__ = {
@@ -538,6 +559,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform17" type="Node2D" parent="."]
+position = Vector2( -480, 248.902 )
 z_index = -3964
 script = ExtResource( 4 )
 __meta__ = {
@@ -562,6 +584,7 @@ texture = ExtResource( 6 )
 script = ExtResource( 7 )
 
 [node name="Platform18" type="Node2D" parent="."]
+position = Vector2( -480, 22.6274 )
 z_index = -3968
 script = ExtResource( 4 )
 __meta__ = {

+ 4 - 4
misc/2.5d/assets/platform/Platform.tscn → misc/2.5d/assets/platform/platform.tscn

@@ -1,9 +1,9 @@
 [gd_scene load_steps=6 format=2]
 
-[ext_resource path="res://addons/node25d/Node25D.gd" type="Script" id=1]
-[ext_resource path="res://addons/node25d/icons/node25d_icon.png" type="Texture" id=2]
-[ext_resource path="res://assets/platform/textures/fortyfive.png" type="Texture" id=3]
-[ext_resource path="res://assets/platform/PlatformSprite.gd" type="Script" id=4]
+[ext_resource path="res://addons/node25d/node_25d.gd" type="Script" id=1]
+[ext_resource path="res://addons/node25d/icons/node_25d_icon.png" type="Texture" id=2]
+[ext_resource path="res://assets/platform/textures/forty_five.png" type="Texture" id=3]
+[ext_resource path="res://assets/platform/platform_sprite.gd" type="Script" id=4]
 
 [sub_resource type="BoxShape" id=1]
 extents = Vector3( 5, 0.5, 5 )

+ 10 - 10
misc/2.5d/assets/platform/PlatformSprite.gd → misc/2.5d/assets/platform/platform_sprite.gd

@@ -1,12 +1,12 @@
 tool
 extends Sprite
 
-onready var _fortyFive = preload("res://assets/platform/textures/fortyfive.png")
+onready var _forty_five = preload("res://assets/platform/textures/forty_five.png")
 onready var _isometric = preload("res://assets/platform/textures/isometric.png")
-onready var _topDown = preload("res://assets/platform/textures/topdown.png")
-onready var _frontSide = preload("res://assets/platform/textures/frontside.png")
-onready var _obliqueY = preload("res://assets/platform/textures/obliqueY.png")
-onready var _obliqueZ = preload("res://assets/platform/textures/obliqueZ.png")
+onready var _top_down = preload("res://assets/platform/textures/top_down.png")
+onready var _front_side = preload("res://assets/platform/textures/front_side.png")
+onready var _oblique_y = preload("res://assets/platform/textures/oblique_y.png")
+onready var _oblique_z = preload("res://assets/platform/textures/oblique_z.png")
 
 func _process(_delta):
 	if Input.is_action_pressed("forty_five_mode"):
@@ -26,14 +26,14 @@ func _process(_delta):
 func set_view_mode(view_mode_index):
 	match view_mode_index:
 		0: # 45 Degrees
-			texture = _fortyFive;
+			texture = _forty_five;
 		1: # Isometric
 			texture = _isometric
 		2: # Top Down
-			texture = _topDown
+			texture = _top_down
 		3: # Front Side
-			texture = _frontSide
+			texture = _front_side
 		4: # Oblique Y
-			texture = _obliqueY
+			texture = _oblique_y
 		5: # Oblique Z
-			texture = _obliqueZ
+			texture = _oblique_z

+ 0 - 34
misc/2.5d/assets/platform/textures/41226408-platform-texture.jpg.import

@@ -1,34 +0,0 @@
-[remap]
-
-importer="texture"
-type="StreamTexture"
-path="res://.import/41226408-platform-texture.jpg-baf3b2df9182218f8ceff003f894b1db.stex"
-metadata={
-"vram_texture": false
-}
-
-[deps]
-
-source_file="res://assets/platform/textures/41226408-platform-texture.jpg"
-dest_files=[ "res://.import/41226408-platform-texture.jpg-baf3b2df9182218f8ceff003f894b1db.stex" ]
-
-[params]
-
-compress/mode=0
-compress/lossy_quality=0.7
-compress/hdr_mode=0
-compress/bptc_ldr=0
-compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
-process/fix_alpha_border=true
-process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/platform/textures/fortyfive.png → misc/2.5d/assets/platform/textures/forty_five.png


+ 34 - 0
misc/2.5d/assets/platform/textures/forty_five.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/forty_five.png-d90cd8ed1241c4a5270d87a83aafe24d.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/platform/textures/forty_five.png"
+dest_files=[ "res://.import/forty_five.png-d90cd8ed1241c4a5270d87a83aafe24d.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/platform/textures/frontside.png → misc/2.5d/assets/platform/textures/front_side.png


+ 34 - 0
misc/2.5d/assets/platform/textures/front_side.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/front_side.png-057b43bb7270572907c729580068368b.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/platform/textures/front_side.png"
+dest_files=[ "res://.import/front_side.png-057b43bb7270572907c729580068368b.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/platform/textures/obliqueY.png → misc/2.5d/assets/platform/textures/oblique_y.png


+ 34 - 0
misc/2.5d/assets/platform/textures/oblique_y.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/oblique_y.png-ed89b3ef35707993300443a84f7ebbd1.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/platform/textures/oblique_y.png"
+dest_files=[ "res://.import/oblique_y.png-ed89b3ef35707993300443a84f7ebbd1.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/platform/textures/obliqueZ.png → misc/2.5d/assets/platform/textures/oblique_z.png


+ 34 - 0
misc/2.5d/assets/platform/textures/oblique_z.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/oblique_z.png-270f041a55370c5ba68850a072597e97.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/platform/textures/oblique_z.png"
+dest_files=[ "res://.import/oblique_z.png-270f041a55370c5ba68850a072597e97.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/platform/textures/topdown.png → misc/2.5d/assets/platform/textures/top_down.png


+ 3 - 3
misc/2.5d/assets/shadow/textures/obliqueY.png.import → misc/2.5d/assets/platform/textures/top_down.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/obliqueY.png-676e0b47cedb4b1159610d662414d70c.stex"
+path="res://.import/top_down.png-3df3f4c204d6337fdc9aa208196ed940.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://assets/shadow/textures/obliqueY.png"
-dest_files=[ "res://.import/obliqueY.png-676e0b47cedb4b1159610d662414d70c.stex" ]
+source_file="res://assets/platform/textures/top_down.png"
+dest_files=[ "res://.import/top_down.png-3df3f4c204d6337fdc9aa208196ed940.stex" ]
 
 [params]
 

+ 7 - 4
misc/2.5d/assets/player/Player25D.tscn → misc/2.5d/assets/player/player_25d.tscn

@@ -1,10 +1,10 @@
 [gd_scene load_steps=7 format=2]
 
-[ext_resource path="res://addons/node25d/Node25D.gd" type="Script" id=1]
-[ext_resource path="res://addons/node25d/icons/node25d_icon.png" type="Texture" id=2]
-[ext_resource path="res://assets/player/PlayerMath25D.gd" type="Script" id=3]
+[ext_resource path="res://addons/node25d/node_25d.gd" type="Script" id=1]
+[ext_resource path="res://addons/node25d/icons/node_25d_icon.png" type="Texture" id=2]
+[ext_resource path="res://assets/player/player_math_25d.gd" type="Script" id=3]
 [ext_resource path="res://assets/player/textures/jump.png" type="Texture" id=4]
-[ext_resource path="res://assets/player/PlayerSprite.gd" type="Script" id=5]
+[ext_resource path="res://assets/player/player_sprite.gd" type="Script" id=5]
 
 [sub_resource type="BoxShape" id=1]
 extents = Vector3( 0.5, 1, 0.5 )
@@ -24,6 +24,9 @@ script = ExtResource( 3 )
 
 [node name="CollisionShape" type="CollisionShape" parent="PlayerMath25D"]
 shape = SubResource( 1 )
+__meta__ = {
+"_edit_lock_": true
+}
 
 [node name="PlayerSprite" type="Sprite" parent="."]
 scale = Vector2( 1, 0.75 )

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

@@ -12,7 +12,7 @@ func _process(delta):
 	
 	if Input.is_action_just_pressed("view_cube_demo"):
 		#warning-ignore:return_value_discarded
-		get_tree().change_scene("res://assets/cube/Cube.tscn")
+		get_tree().change_scene("res://assets/cube/cube.tscn")
 		return
 	
 	if Input.is_action_just_pressed("toggle_isometric_controls"):

+ 0 - 0
misc/2.5d/assets/player/PlayerSprite.gd → misc/2.5d/assets/player/player_sprite.gd


+ 9 - 6
misc/2.5d/assets/shadow/Shadow25D.tscn → misc/2.5d/assets/shadow/shadow_25d.tscn

@@ -1,11 +1,11 @@
 [gd_scene load_steps=8 format=2]
 
-[ext_resource path="res://addons/node25d/Node25D.gd" type="Script" id=1]
-[ext_resource path="res://addons/node25d/icons/node25d_icon.png" type="Texture" id=2]
-[ext_resource path="res://addons/node25d/ShadowMath25D.gd" type="Script" id=3]
-[ext_resource path="res://addons/node25d/icons/shadowmath25d_icon.png" type="Texture" id=4]
-[ext_resource path="res://assets/shadow/textures/fortyfive.png" type="Texture" id=5]
-[ext_resource path="res://assets/shadow/ShadowSprite.gd" type="Script" id=6]
+[ext_resource path="res://addons/node25d/node_25d.gd" type="Script" id=1]
+[ext_resource path="res://addons/node25d/icons/node_25d_icon.png" type="Texture" id=2]
+[ext_resource path="res://addons/node25d/shadow_math_25d.gd" type="Script" id=3]
+[ext_resource path="res://addons/node25d/icons/shadow_math_25d_icon.png" type="Texture" id=4]
+[ext_resource path="res://assets/shadow/textures/forty_five.png" type="Texture" id=5]
+[ext_resource path="res://assets/shadow/shadow_sprite.gd" type="Script" id=6]
 
 [sub_resource type="BoxShape" id=1]
 extents = Vector3( 0.5, 0.001, 0.5 )
@@ -30,6 +30,9 @@ __meta__ = {
 
 [node name="CollisionShape" type="CollisionShape" parent="ShadowMath25D"]
 shape = SubResource( 1 )
+__meta__ = {
+"_edit_lock_": true
+}
 
 [node name="ShadowSprite" type="Sprite" parent="."]
 scale = Vector2( 0.5, 0.5 )

+ 10 - 10
misc/2.5d/assets/shadow/ShadowSprite.gd → misc/2.5d/assets/shadow/shadow_sprite.gd

@@ -1,12 +1,12 @@
 tool
 extends Sprite
 
-onready var _fortyFive = preload("res://assets/shadow/textures/fortyfive.png")
+onready var _forty_five = preload("res://assets/shadow/textures/forty_five.png")
 onready var _isometric = preload("res://assets/shadow/textures/isometric.png")
-onready var _topDown = preload("res://assets/shadow/textures/topdown.png")
-onready var _frontSide = preload("res://assets/shadow/textures/frontside.png")
-onready var _obliqueY = preload("res://assets/shadow/textures/obliqueY.png")
-onready var _obliqueZ = preload("res://assets/shadow/textures/obliqueZ.png")
+onready var _top_down = preload("res://assets/shadow/textures/top_down.png")
+onready var _front_side = preload("res://assets/shadow/textures/front_side.png")
+onready var _oblique_y = preload("res://assets/shadow/textures/oblique_y.png")
+onready var _oblique_z = preload("res://assets/shadow/textures/oblique_z.png")
 
 func _process(_delta):
 	if Input.is_action_pressed("forty_five_mode"):
@@ -26,14 +26,14 @@ func _process(_delta):
 func set_view_mode(view_mode_index):
 	match view_mode_index:
 		0: # 45 Degrees
-			texture = _fortyFive;
+			texture = _forty_five;
 		1: # Isometric
 			texture = _isometric
 		2: # Top Down
-			texture = _topDown
+			texture = _top_down
 		3: # Front Side
-			texture = _frontSide
+			texture = _front_side
 		4: # Oblique Y
-			texture = _obliqueY
+			texture = _oblique_y
 		5: # Oblique Z
-			texture = _obliqueZ
+			texture = _oblique_z

+ 0 - 0
misc/2.5d/assets/shadow/textures/fortyfive.png → misc/2.5d/assets/shadow/textures/forty_five.png


+ 34 - 0
misc/2.5d/assets/shadow/textures/forty_five.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/forty_five.png-22dcfa54db51531b3612f686997a3fbe.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/shadow/textures/forty_five.png"
+dest_files=[ "res://.import/forty_five.png-22dcfa54db51531b3612f686997a3fbe.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/shadow/textures/frontside.png → misc/2.5d/assets/shadow/textures/front_side.png


+ 34 - 0
misc/2.5d/assets/shadow/textures/front_side.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/front_side.png-1470842d27848ecf4de63924b0b98f42.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/shadow/textures/front_side.png"
+dest_files=[ "res://.import/front_side.png-1470842d27848ecf4de63924b0b98f42.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

BIN
misc/2.5d/assets/shadow/textures/obliqueZ.png


+ 0 - 0
misc/2.5d/assets/shadow/textures/obliqueY.png → misc/2.5d/assets/shadow/textures/oblique_y.png


+ 3 - 3
misc/2.5d/addons/node25d/icons/node25d.png.import → misc/2.5d/assets/shadow/textures/oblique_y.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/node25d.png-deca325dc1330ad07256305d79ddc3ba.stex"
+path="res://.import/oblique_y.png-47d60a179a2cdeff15364f0e389e6008.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://addons/node25d/icons/node25d.png"
-dest_files=[ "res://.import/node25d.png-deca325dc1330ad07256305d79ddc3ba.stex" ]
+source_file="res://assets/shadow/textures/oblique_y.png"
+dest_files=[ "res://.import/oblique_y.png-47d60a179a2cdeff15364f0e389e6008.stex" ]
 
 [params]
 

BIN
misc/2.5d/assets/shadow/textures/oblique_z.png


+ 34 - 0
misc/2.5d/assets/shadow/textures/oblique_z.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/oblique_z.png-d8378bf8b95f890e76162d62a82022de.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/shadow/textures/oblique_z.png"
+dest_files=[ "res://.import/oblique_z.png-d8378bf8b95f890e76162d62a82022de.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 0 - 0
misc/2.5d/assets/shadow/textures/topdown.png → misc/2.5d/assets/shadow/textures/top_down.png


+ 3 - 3
misc/2.5d/assets/shadow/textures/obliqueZ.png.import → misc/2.5d/assets/shadow/textures/top_down.png.import

@@ -2,15 +2,15 @@
 
 importer="texture"
 type="StreamTexture"
-path="res://.import/obliqueZ.png-95b7e7a176541fda8f2db67045ba0ad7.stex"
+path="res://.import/top_down.png-a3a98721249636eff54d8113d6075229.stex"
 metadata={
 "vram_texture": false
 }
 
 [deps]
 
-source_file="res://assets/shadow/textures/obliqueZ.png"
-dest_files=[ "res://.import/obliqueZ.png-95b7e7a176541fda8f2db67045ba0ad7.stex" ]
+source_file="res://assets/shadow/textures/top_down.png"
+dest_files=[ "res://.import/top_down.png-a3a98721249636eff54d8113d6075229.stex" ]
 
 [params]
 

+ 0 - 0
misc/2.5d/assets/ui/ControlHints.gd → misc/2.5d/assets/ui/control_hints.gd


+ 2 - 2
misc/2.5d/assets/ui/Overlay.tscn → misc/2.5d/assets/ui/overlay.tscn

@@ -1,6 +1,6 @@
 [gd_scene load_steps=2 format=2]
 
-[ext_resource path="res://assets/ui/ControlHints.gd" type="Script" id=1]
+[ext_resource path="res://assets/ui/control_hints.gd" type="Script" id=1]
 
 [node name="Overlay" type="CanvasLayer"]
 
@@ -18,7 +18,7 @@ rect_min_size = Vector2( 500, 50 )
 text = "
 Controls: WASD to move,  Space to jump,  R to reset,  Shift to walk,  T to toggle isometric controls,  C to view cube demo,  Tab to toggle hints.
 
-UIOPKL to change view mode.  U = Forty Five deg,   I = Isometric,  
+UIOJKL to change view mode.  U = Forty Five deg,   I = Isometric,  
 O = Top Down,   J = Front Side,   K = Oblique Y,   L = Oblique Z
 
 Not every view mode is meant to be good, it's just to showcase what the system can do.

+ 2 - 2
misc/2.5d/assets/ui/OverlayCube.tscn → misc/2.5d/assets/ui/overlay_cube.tscn

@@ -1,6 +1,6 @@
 [gd_scene load_steps=2 format=2]
 
-[ext_resource path="res://assets/ui/ControlHints.gd" type="Script" id=1]
+[ext_resource path="res://assets/ui/control_hints.gd" type="Script" id=1]
 
 [node name="Overlay" type="CanvasLayer"]
 
@@ -18,7 +18,7 @@ rect_min_size = Vector2( 500, 50 )
 text = "
 Controls: WASDQE to rotate,  R to reset,  C to return to the world,  Tab to toggle hints.
 
-UIOPKL to change view mode.  U = Forty Five deg,   I = Isometric,  
+UIOKL to change view mode.  U = Forty Five deg,   I = Isometric,  
 O = Top Down,   K = Oblique Y,   L = Oblique Z
 
 Not every view mode is meant to be good, it's just to showcase what the system can do.

+ 8 - 8
misc/2.5d/project.godot

@@ -12,34 +12,34 @@ _global_script_classes=[ {
 "base": "Node2D",
 "class": "Node25D",
 "language": "GDScript",
-"path": "res://addons/node25d/Node25D.gd"
+"path": "res://addons/node25d/node_25d.gd"
 }, {
 "base": "KinematicBody",
 "class": "PlayerMath25D",
 "language": "GDScript",
-"path": "res://assets/player/PlayerMath25D.gd"
+"path": "res://assets/player/player_math_25d.gd"
 }, {
 "base": "KinematicBody",
 "class": "ShadowMath25D",
 "language": "GDScript",
-"path": "res://addons/node25d/ShadowMath25D.gd"
+"path": "res://addons/node25d/shadow_math_25d.gd"
 }, {
 "base": "Node",
 "class": "YSort25D",
 "language": "GDScript",
-"path": "res://addons/node25d/YSort25D.gd"
+"path": "res://addons/node25d/y_sort_25d.gd"
 } ]
 _global_script_class_icons={
-"Node25D": "res://addons/node25d/icons/node25d_icon.png",
+"Node25D": "res://addons/node25d/icons/node_25d_icon.png",
 "PlayerMath25D": "",
-"ShadowMath25D": "res://addons/node25d/icons/shadowmath25d_icon.png",
-"YSort25D": "res://addons/node25d/icons/ysort25d_icon.png"
+"ShadowMath25D": "res://addons/node25d/icons/shadow_math_25d_icon.png",
+"YSort25D": "res://addons/node25d/icons/y_sort_25d_icon.png"
 }
 
 [application]
 
 config/name="2.5D Demo (GDScript)"
-run/main_scene="res://assets/DemoScene.tscn"
+run/main_scene="res://assets/demo_scene.tscn"
 config/icon="res://icon.png"
 
 [display]