Skip to content

Commit

Permalink
refs #37: Rooms Aseprite importer preparatory code and PopochiuObject…
Browse files Browse the repository at this point in the history
…s creation refactoring (#64)

* refs #37: Squashed Room Importer and Objects creation refactoring.

refs #37: Preparation for refactoring of importer code.

refs #37: The plugin is now ready for the implementation of the Room importing logic.

refs #37: WIP refactoring the prop creation logic. It works but needs heavy polishing.

refs #37: Open #67 about the heavy polishing, in the meantime this reduce the passing-over of UI elements.

refs #37: Changed commit language.

refs #37: Refactored the region creation following the new template. Added a base class to limit code-duplication.

refs #37: Refactored the walkable areas too.

refs #37: Refactored the hotspots creation too.

refs #37: Project file updated to Godot 4.1

refs #37: Rooms creation have been refactored.

refs #37: Characters creation have been refactored.

refs #37: Inventory items creation have been refactored.

refs #37: Dialog creation have been refactored.

refs #37: some code dedup on type helpers.

refs #37: code dedup in helpers should be over. Also addressed annoying Godot 4.1 bug.

refs #37: all creation helpers have been renamed to factories.

refs #37: factories init methods changed to real constructors.

refs #37: renamed and added internal factories variables for better readability.

refs #37: Fixed inconsistency in inventory items file naming.

refs #37: Renamed local variables in factory classes.

refs #37: Switch to a success state return strategy to bubble feedback up to the popup.

refs #37: Fixed wrong ownership for room objects children bug.

refs #37: Cleaned up useless and hard-to-maintain references to the obj types in comments. Addresses PR comments by @carenalga.

refs #37: Renamed factories private members to reduce unnecessary verbosity.

refs #37: Solved error message about invalid ownership when creating room objects.

refs #37: WIP for rooms importer. This code is broken!

refs #37: WIP for rooms importer. This code is broken!

refs #37: WIP for rooms importer. This code is broken!

refs #37: A lot of code rewriting to make the base feature work. It works :)

refs #37: More work to get rid of strange execution errors.

refs #37: moving stuff in a desperate attempt to make this working in a predictable way.

refs #37: changed the importing flow strategy to circumvent a nasty error on linux with filesystem signals availability.

refs #37: off-by-one error fixed in animation frames range.

refs #37: fixed an error I probably inherited from another branch.

TEST1: messing with importer.

refs #37: worked around the console error when packing a scene with not-owned children (please see Godot GH-81982 for details).

refs #37: visibility toggle in the importer interface is now working as intended.

refs #37: all props now have an attached script, even the non-clickable ones; the importer is now able to update visibility and clickability status of already imported props.

refs #37: InteractionPolygons for props and hotspots have been moved in the scene and an edit button has been exposed in the toolbar to edit them.

Fix missing images when importing room from Aseprite (#110)

Store polygon for interaction in @export var

This will allow to keep the data of the polygon in the .tscn file of the
room so the InteractionPolygon.polygon data of each prop is overwritten
by the room both in runtime and while editing the room.

NOTE: The polygon of the InteractionPolygon in each prop is not saved in
the prop's scene file yet.

Add comments and broke some long lines

refs #37: InteractionPolygons icon is now more readable.

Fixes for post-import error message (#126)

* Fix Output error after importing room

* Fix error message after closing room import popup

The problem was caused because the popup was being added to the Room
tree. Now it is added to Popochiu's main dock.

* Temporary fix for bad row naming after import

* Imported prop image is placed in the prop's folder

Fix Aseprite importer section not showing in Inspector for room

refs #37: Added a feature flag to Editor Settings, to disable Aseprite Importer for those who does not use Aseprite.

refs #37: Fixed a warning related to EditorInterface being a singleton in 4.2.

* refs #37: Removed leftovers after squashing and rebasing over 2.0

* Fix post-rebase issues about main_dock

---------

Co-authored-by: carenalga <[email protected]>
  • Loading branch information
stickgrinder and mapedorr committed Feb 25, 2024
1 parent 263e782 commit 86e059a
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Addons other than Popochiu
# (we use some for development)
<<<<<<< HEAD
# addons/*
# !addons/popochiu/
=======
addons/*
!addons/popochiu/
>>>>>>> 87c52d8 (refs #37: Rooms Aseprite importer preparatory code and PopochiuObjects creation refactoring (#64))

# Godot-specific ignores
.import/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func init(config, aseprite: RefCounted, editor_file_system: EditorFileSystem = n
_file_system = editor_file_system
_aseprite = aseprite

# Public interfaces, dedicated to specific popochiu objects
func create_character_animations(character: Node, player: AnimationPlayer, options: Dictionary):
# Chores
_target_node = character
_player = player
_options = options

## Public interfaces, dedicated to specific popochiu objects
func create_character_animations(character: Node, player: AnimationPlayer, options: Dictionary):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const PopochiuDock := preload('res://addons/popochiu/editor/main_dock/popochiu_d
var _new_character_name := ''
var _factory: PopochiuCharacterFactory


#region Godot ######################################################################################
func _ready() -> void:
super()
Expand Down Expand Up @@ -61,7 +60,6 @@ func set_main_dock(node: Panel) -> void:

if not _main_dock: return


#endregion

#region Private ####################################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Creates a new hotspot in the room.
@tool
extends 'res://addons/popochiu/editor/popups/creation_popup.gd'
# Creates a new hotspot in the room.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func set_main_dock(node: Panel) -> void:

if not _main_dock: return


#endregion

#region Private ####################################################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://b6dm3xvvr7dvi"]

[ext_resource type="FontFile" uid="uid://dixh1egf7k2fb" path="res://addons/popochiu/fonts/monkeyisland_1991.ttf" id="1_o6vvl"]

[node name="DialogLine" type="Label"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("1_o6vvl")
text = "Dave: hola"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://2mnjw3qsi8hc"]

[ext_resource type="FontFile" uid="uid://dixh1egf7k2fb" path="res://addons/popochiu/fonts/monkeyisland_1991.ttf" id="1_i1qxr"]

[node name="InteractionLine" type="Label"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("1_i1qxr")
text = "Dave: hola"
131 changes: 131 additions & 0 deletions popochiu/rooms/house/room_house.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
[gd_scene load_steps=12 format=3 uid="uid://imgyvjiqcabs"]

[ext_resource type="Script" path="res://popochiu/rooms/house/room_house.gd" id="1_2rfwu"]
[ext_resource type="PackedScene" uid="uid://jrp1r8uco7vy" path="res://popochiu/rooms/house/props/background/prop_background.tscn" id="2_amufg"]
[ext_resource type="Script" path="res://popochiu/rooms/house/props/background/prop_background.gd" id="3_fxlxc"]
[ext_resource type="PackedScene" uid="uid://dbkathyetrso7" path="res://popochiu/rooms/house/props/door/prop_door.tscn" id="4_qpaur"]
[ext_resource type="Script" path="res://popochiu/rooms/house/props/door/prop_door.gd" id="5_h0lr0"]
[ext_resource type="PackedScene" uid="uid://mqwbrgbk0llc" path="res://popochiu/rooms/house/props/drawer/prop_drawer.tscn" id="6_uvcj4"]
[ext_resource type="Script" path="res://popochiu/rooms/house/props/drawer/prop_drawer.gd" id="7_o4euj"]
[ext_resource type="PackedScene" uid="uid://diukdigj0f4io" path="res://popochiu/rooms/house/props/table/prop_table.tscn" id="8_hg5ln"]
[ext_resource type="Script" path="res://popochiu/rooms/house/props/table/prop_table.gd" id="9_ktt1q"]
[ext_resource type="PackedScene" uid="uid://1467eig2vwbo" path="res://popochiu/rooms/house/props/toy_car/prop_toy_car.tscn" id="10_nkfsd"]
[ext_resource type="Script" path="res://popochiu/rooms/house/props/toy_car/prop_toy_car.gd" id="11_earee"]

[node name="RoomHouse" type="Node2D"]
script = ExtResource("1_2rfwu")
script_name = "House"
popochiu_placeholder = null
metadata/_popochiu_aseprite_config_ = {
"o_folder": "",
"o_name": "",
"only_visible_layers": false,
"op_exp": true,
"source": "res://popochiu/rooms/house/house.aseprite",
"tags": [{
"direction": "forward",
"from": 0,
"import": true,
"loops": true,
"prop_clickable": true,
"prop_visible": true,
"tag_name": "background",
"to": 1.0
}, {
"direction": "forward",
"from": 0,
"import": true,
"loops": true,
"prop_clickable": true,
"prop_visible": true,
"tag_name": "door",
"to": 2.0
}, {
"direction": "forward",
"from": 0,
"import": true,
"loops": true,
"prop_clickable": true,
"prop_visible": true,
"tag_name": "drawer",
"to": 2.0
}, {
"direction": "forward",
"from": 0,
"import": true,
"loops": true,
"prop_clickable": true,
"prop_visible": true,
"tag_name": "table",
"to": 1.0
}, {
"direction": "forward",
"from": 0,
"import": true,
"loops": true,
"prop_clickable": true,
"prop_visible": true,
"tag_name": "toy_car",
"to": 1.0
}],
"wipe_old_anims": true
}

[node name="WalkableAreas" type="Node2D" parent="."]

[node name="Props" type="Node2D" parent="."]

[node name="Background" type="Area2D" parent="Props" instance=ExtResource("2_amufg")]
z_index = -1
position = Vector2(160, 90)
script = ExtResource("3_fxlxc")
script_name = "Background"
description = "Background"
baseline = -90
cursor = 1
interaction_polygon = PackedVector2Array(-12, -12, 12, -12, 12, 12, -12, 12)
metadata/ANIM_NAME = "background"

[node name="Door" type="Area2D" parent="Props" instance=ExtResource("4_qpaur")]
position = Vector2(160, 90)
script = ExtResource("5_h0lr0")
script_name = "Door"
description = "Door"
cursor = 1
interaction_polygon = PackedVector2Array(-12, -12, 12, -12, 12, 12, -12, 12)
metadata/ANIM_NAME = "door"

[node name="Drawer" type="Area2D" parent="Props" instance=ExtResource("6_uvcj4")]
position = Vector2(160, 90)
script = ExtResource("7_o4euj")
script_name = "Drawer"
description = "Drawer"
cursor = 1
interaction_polygon = PackedVector2Array(-12, -12, 12, -12, 12, 12, -12, 12)
metadata/ANIM_NAME = "drawer"

[node name="Table" type="Area2D" parent="Props" instance=ExtResource("8_hg5ln")]
position = Vector2(160, 90)
script = ExtResource("9_ktt1q")
script_name = "Table"
description = "Table"
cursor = 1
interaction_polygon = PackedVector2Array(-12, -12, 12, -12, 12, 12, -12, 12)
metadata/ANIM_NAME = "table"

[node name="ToyCar" type="Area2D" parent="Props" instance=ExtResource("10_nkfsd")]
position = Vector2(160, 90)
script = ExtResource("11_earee")
script_name = "ToyCar"
description = "Toy Car"
cursor = 1
interaction_polygon = PackedVector2Array(-12, -12, 12, -12, 12, 12, -12, 12)
metadata/ANIM_NAME = "toy_car"

[node name="Hotspots" type="Node2D" parent="."]

[node name="Regions" type="Node2D" parent="."]

[node name="Markers" type="Node2D" parent="."]

[node name="Characters" type="Node2D" parent="."]
Binary file added popochiu/sources/aseprite/room_exterior.aseprite
Binary file not shown.

0 comments on commit 86e059a

Please sign in to comment.