Skip to content

Commit

Permalink
GUI templates and game commands
Browse files Browse the repository at this point in the history
Progress on refactoring the GI

Progress on working with 9 verbs

First draft of the Sierra GUI implementation

Created the `g.gd` script to test an approach for accessing the commands
defined for the graphic interface.
Moved the Toolbar folder to the popochiu template folder since that
component will be part of that GUI only.
Added a function to "replace" the default cursor. This still needs
improvements or a complete refactor.

GUI template selection in Setup popup

Refactorization of GUI template commands

This fixes a dependency generated when having the commands of the current GUI in the g.gd singleton. Now each GUI has its own commands Resource class.
Selecting the GUI template in the Setup popup is now working without bugs.

Changed Popochiu GUI template name to BASS

Usability improvements in 9 verb interface

Sound settings script moved to BASS' toolbar folder

History popup working again in BASS template

upd: Lines in History to RichTextLabel so one can uses colors to
highlight characters, commands and props.
fea: Improved the way BASS handles mouse positioning to open/close the
inventory and the settings.
upd: Renamed scene and script filenames from Toolbar to SettingsBar.

PopochiuPopup are now used by History, Save and Load and Sound settings.

upd: Updated the Settings popup for the 9 verb interface. Now it allows to
Save, Load, open the History, and update sound volumes.
upd: New appearance for Sound volumes sliders.
upd: Created Sound volumes component, so devs can use the sliders
without having to use a popup.
fea: Created Settings icon for settings button in 9 verb interface.
upd: Created cursor for UI elements in 9 verb interface.
fix: Opening the SaveAndLoad popup when saving no longer requires to
pass a String as a parameter.

upd: new style for 9 verb interface

Now it get closer to the style used in Thimbleweed Park.
fea: created icons for GUI templates in the Setup window.
fea: added option to 9 verb settings popup to choose between classic and
modern sentences.
fea: created sprites and style for CheckButton.

Sierra theme styles updated

This is for PanelContainers and Buttons.
Created inventory popup for Sierra GUI.
Created USE cursor for Sierra GUI.
Created top bar (hover text + score) panel for Sierra GUI.
Fixed some bugs in the Sierra GUI.
Working on making the inventory popup to work properly in Sierra GUI.

SystemText working again.

fix: showing the SystemText blocks interactions until players click
anywhere to close the panel.
upd: `G.display` changed to `G.show_system_text`.
fea: basic inventory functionality working in Sierra GUI. Players can
inspect items and select them for use. Once used, the item disappears
from the inventory grid.

First approach on having varios dialog text types

Devs can choose between Above character, Portrait and Caption.
The implementation is still hardcoded in various parts. Improvements
will come soon.

Fix: cursor behavior in Sierra inventory popup.

fix: the error related to set_name.call_deferred is now solved.
Working on fix for C singleton.

Fallback for commands improved

Code refactor and improvements for DialogText.

upd: Now the now supports the three display modes (Above character, Portrait
and Caption) by itself.
fix: #79 .
fix: Recognizing emotions in dialog lines for `E.queue` was not working.
upd: Added support for avatars with emotions in PopochiuCharacter.
upd: Portrait mode displays the avatar of the talking character (with
its corresponding emotion).

Improved CAPTION text style rendering.

Fixes and minor improvements in DialogText rendering.
Updated properties in scaling and layout for PopochiuInventoryItem.

9 verb inventory scroll working

It takes into account the size of each slot, the size of the gaps
between rows and the number of rows.
This inventory panel adds items to the i_inventory based on what the
scene tree has.
NEXT >> Make this as a component that can work in a popup (i.e. in the
Sierra inventory popup).

Progress on 9 verb inventory functionality

Can trigger commands on inventory items.
Can use inventory items with popochiu clickable and other inventory
items.

fea: Make suggested command to work

This applies for PopochiuClickable and PopochiuInventoryItem (which
suggested verb will be always LOOK AT).
fea: Try calling the left click version of a command before triggering
its fallback (this applies to PopochiuClickable and
PopochiuInventoryItem).

NEXT >> [9 verb] Make inventory container to re-arrange after removing an
inventory item.

fea: can remove items in 9 verb inventory

Removing the item also removes the slot it belongs to, which ensures the
container will re-arrange correctly. A new slot is created after
removing the item.

NEXT >> Allow to replace an item (useful for combining items).

fea: Adds method to replace an inventory item

The new inventory item replaces the one that calls the `replace` method
in the 9 verb interface.
fea: Cursor doesn't leave the screen when the mouse exits the game
window.

upd: Adjust styles and layout of 9 verb interface

upd: Inventory container component for Sierra GPI

Uses the component created for the 9 verb interface in the Inventory
popup of the Sierra template.

upd: Create scroll buttons for Sierra inventory.

upd: Work in Sierra inventory popup

Now players can select an inventory item (with the INTERACT command
active), close the popup, and use such item with clickables.

Create Settings popup for Sierra template.

Can change dialog style in Text options popup in Sierra template.
Can change dialog text speed with a slider in Text options popup in
Sierra template.
Create Sound options popup.

Create Sierra settings option to toggle auto-continue

Update style of text continue icon for Sierra template.
Create texture for QUIT button in Sierra template.
Sierra template now has buttons to quit the game.
Improvements in dialog_text component behavior and anchors setup.

Add function to E for registering commands

The 9 verb and Sierra commands' scripts now register their commands
using the created method.
PopochiuClickable and PopochiuInventoryItem now store the mouse button
index used in the last click.
Started to prepare everything to freeze the development of the 9 verb and Sierra templates.

NEXT >> Cursor refactor or Verb coin template creation.

Dialog menu working in 9 verb and Sierra templates

Change G.freed to G.unblocked.
DialogText no longer affects the Cursor. Now it triggers a signal so the
graphic interface decides what to do while a dialog line is played.
Create signal in D to know when a dialog starts.

Refactors Dialog menu

Now it works in 9 verb and Sierra templates.
It is a bit easier to modify the appearance of the Dialog menu.
Added more signals to PopochiuGraphicInterface in order to allow devs to
customize how to handle more interactions.

Remove G.continue_clicked

Connect to G.dialog_line_finished in PopochiuCharacter.say()
Create signal for listening when the system text is hidden.
Behavior improvements in 9 verb GUI.

Update in BASS GUI for setting the cursor

Set "popochiu_gui_component" group to GI components in order to start
building the UI tab in the dock.

Rename methods

Create InventoryGrid component

This is the type of inventory used by 9 verbs and Sierra templates.
upd: change `Cursor.set_cursor(int)` by `Cursor.show_cursor(String)`.

Create inventory grid component for 9 Verb template

Ready to start freezing development for PR creation.

Updated command handling

Both in PopochiuClickable and PopochiuInventoryItem. They will call
`_on_click` if not custom method is present in the object. Method
fallback should be manually called with `E.command_fallback()`.
Added script_name property to PopochiuCommands class. This can be used
to know which set of commands is the current one.

BASS template working with new commands approach

Fix various issues in the BASS template regarding cursor animations and
behavior with PopochiuClickable and PopochiuInventoryItem.
The reference to the current commands class is now in E.
Updated InventoryBar so it can react to the I.item_replaced signal.

Restore cursor property

Both in PopochiuClickable and PopochiuInventory Item.
Now variations for voices are defined by an array of AudioCueSound.

Fix and update in Setup popup

Now it shows a description of the selected template so devs can know a
bit more about each one.
If the selected template is the same that is currently active after
closing the Setup popup, no action is performed.
Add Popsy as a character to test a bug reported related to z-index.
Add GUI cursor to BASS cursors.

Improve GUI template change with confirmation popup

Created templates for GUI commands types.

Create script copies when selecting GUI template

A copy of the template scripts for the graphic interface and the
commands linked to it is created and placed in
res://popochiu/graphic_interface.
This makes sure devs can play with those scripts instead of modifying
those in the addons folder.

fea: Create a commands template script for the Empty template.

First draft of UI tab working.

It allows to add GUI components to the graphic interface scene.
Buttons in the UI panel show enable when the component they represent is
deleted from the graphic interface scene.

Change to Godot 4.1.2 and removed game scenes

Add buttons to open graphic interface script and commands script

upd: use PopochiuGroup for base components and popups in UI tab.

Change BASS template to SimpleClick template

Fix "Start with it" for inventory items.

fix: Devs can select items to start with in the Main tab.
fix: Setting an inventory item as active with `add_as_active` makes the
cursor take the appearance of the item.
fix: Text color changes when character talks in the Caption dialog
style.
fix: PopochiuInventoryItem.add was not showing InventoryBar.
fea: Added `is_pixel_art_game` property to ProjectSettings.
upd: When selecting Pixel in Game type (setup popup) the default texture
filter is set to TEXTURE_FILTER_NEAREST for props, characters and
inventory items.

Progress on improving code before merge

Better positioning of avatars in Portrait dialog style

Adressed all comments and sugestions made by @stickgrinder

Fix scene validation on Editor2D.

Created House, Goddiu, Popsy and Key for testing.

Sierra template fixes

Improve on copying the selected GUI template.

Fix on opening Sierra popups.

Warning for GUI template change when graphic_interface.tscn is open

DialogText is no longer an editable children in 9_verb_gi.tscn and
sierra_gi.tscn.
Add method to print normal messages in PopochiuUtils.

Add customization properties to InventoryGrid

Devs can define the number of columns, the visible rows, the scene to
use for slots, the horizontal and vertical gap sizes, if the UP and DOWN
buttons should be visible, if the component will scroll with the mouse
wheel.
Update Sierra and 9 verb inventory grids so they use the new
customization properties.
upd: refactor in Setup popup script for better code reading.

Post Alpha 5 rebase

Add button to create popochiu popups

This allows the creation of the scene and script for devs to make their
own popups. The created popup is added to the Popups node in the
graphic_interface scene.
upd: Change name of Empty template to Custom.
upd: Set groups for missing popochiu components and popups scenes.

Add ignored files

Create script to handle gui template operations

Copy dependencies to res://game/graphic_interface based on GUI template selection (#139)

* Progress on copying components when choosing GUI template

* Separate GUI copy operations into methods

Now the game is placed in `res://game` instead of `res://popochiu`.
=== Ready to work on moving components based on source scene dependencies ===

* Graphic interface dependencies point to game folder

Scene dependencies in `res://game/graphic_interface/graphic_interface.tscn` now point to the corresponding scene of the component in the `res://game/graphic_interface/components` folder.
When changing the GUI template, previous components are removed from the FileSystem.

* GUI components determined by group instead of scene path

Assign corresponding groups to all the components in the Sierra template.
Add .png files as part of copying components from the addon to the graphic interface folder in the game.
The .png files will need an extra validation to work properly. Same will apply to .theme files.

* GUI template change copies everything

Components and their scripts and dependencies are correclty moved to res://game/graphic_interface/
=== Ready to test updating the dependencies in each .tscn file ===

* Change dependency source check

Now dependencies are searched in the already copied files of res://game/graphic_interface instead of relying on the source files in res://addons/popochiu...

* Fix untracked files

* Copy components working

Ready to make more tests.

* Add progress window to GUI template change

The copy process ignores resources that were already copied.
Update reference to cursor PNG in SimpleClick template.

* Fix on shared resources when copying components

Fix double call on Setup close in Linux/MacOS

Update minimum size of Setup popup.
[fix] Use EditorInterface scale to update minimum and maximum size of Setup popup.

Copy component when adding it from UI tab

Now the dependencies of the selected component are copied to the graphic
interface folder in order to make customization easier.
UI tab now access EditorInterface directly instead of using the
_main_dock variable.

Improve scene instantiation for UI components

Adding the component no longer includes adding dependencies to its script or other resources.
The same applies for props created inside rooms using the importer. Should apply for other types, and also things created without the importer.
[upd] Translate to English the Spanish comments in PopochiuObjectRow.
[upd] Use EditorInterface singleton in PopochiuObjectRow.
[fix] Removing a whole room from the Popochiu panel works again.

Move CanvasEditorMenu for PopochiuClickable to its own scene

A script is also created to remove extra logic from popochiu_plugin.gd.

Use EditorInterface singleton instead of main_dock.ei

Same for EditorFileSystem (main_dock.fs)

Fix with progress animation when choosing Custom template

[fix] Multiply issue about Setup popup min and max size based on editor scale.
[fix] Double creation of progress panel.

Improve GUI template selection

Added a button to change the template inside the Setup popup instead of relying on closing it.
Update behavior of Popochiu editor popups so they render better.

Texture track no longer added when importing animations from Aseprite

Update flow of fallback interaction for PopochiuInventoryItem.on_click()
Sierra GI now selects the clicked inventory item by default when using
the Interact command.
SimpleClick GI selects an inventory item by default when clicked (same
as the Sierra GI).

Inventory item selected by default when clicked in 9 Verb template

Fix on deselecting invisible nodes

This was hapenning while editing the InteractionPolygon of PopochiuClickable objects.
[upd] When a character is added to a room, now its instance is properly created passing the correct instance flag.
[fix] Create room popup was not correctly updating the size of the RichTextLabel that shows the info about the files to create.
[fea] Editing the InteractionPolygon of a PopochiuClickable also stores its position so the edited data is stored in the room.

Change chain of interaction calls

This applies to PopochiuClickable and PopochiuInventoryItem. Now the function called by the mouse input interaction is the public method (i.e. on_click()), and this calls the virtual version of the method (i.e. _on_click()).
Command functions now should have the signature on_command_name() instead of _on_command_name().
[upd] Add regions to various scripts.

Create SierraBar and SierraMenu

SierraMenu was previously SierraTopMenu. SierraBar can be used to show the score of the game.
[upd] Improve feedback of SierraInventory when a command is selected.
[fea] Create public function in PopochiuGraphicInterface so one can get
a component by its name.
[upd] Assign class_names to each GUI template script.

Improve behavior of Sierra inventory

SierraMenu hides after opening the inventory or the settings popup.
[upd] Hide QUIT button in SierraMenu.
[upd] Blocking/Unblocking the graphic interface now also takes into account if is there a popup opened.
[fea] **G** singleton now has a `gui` variable to store a reference to
the graphic interface node.
[fea] PopochiuRoom scenes can now be played from their row in the main
tab.

Better feedback for Sierra inventory slots

[fea] Add "unselected" signal to PopochiuInventoryItem.
[upd] Minor improvements in GUI components copy process popup.

GUI components' theme now point to the _theme.tres file in the game

All the components that have a theme are overriden so the theme used
when copied to the graphic interface folder is the one in there.
[upd] All components in Sierra GUI scene use the sierra_theme.tres.
[upd] All components in 9 Verb GUI scene use the 9_verb_theme.tres.

Create GUI template buttons in Setup from directories

Now the buttons are not created in the SceneTree, but loaded based on
the folders in
res://addons/popochiu/engine/objects/graphic_interface/tempaltes
[fea] Create resource to define the title, description and icon of each
GUI template.

Fix button selection for current template in Setup popup
  • Loading branch information
mapedorr committed Jan 8, 2024
1 parent 71c3cf7 commit ef13012
Show file tree
Hide file tree
Showing 285 changed files with 17,490 additions and 4,014 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ data_*/

# Project-specific ignores
popochiu
popochiu/**
popochiu/**
game
game/**
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
@tool
extends HBoxContainer
## Used to show new buttons in the EditorPlugin.CONTAINER_CANVAS_EDITOR_MENU (the top bar in the
## 2D editor) to select specific nodes in PopochiuClickable objects.

var _types_helper: Resource = null
var _selected_node: Node = null
var _shown_helpers := []

@onready var btn_baseline: Button = %BtnBaseline
@onready var btn_walk_point: Button = %BtnWalkPoint
@onready var btn_interaction_polygon: Button = %BtnInteractionPolygon


#region Godot ######################################################################################
func _ready() -> void:
_types_helper = load('res://addons/popochiu/editor/helpers/popochiu_types_helper.gd')

# Connect to child signals
btn_baseline.pressed.connect(_select_baseline)
btn_walk_point.pressed.connect(_select_walk_point)
btn_interaction_polygon.pressed.connect(_select_interaction_polygon)

# Connect to singleton signals
EditorInterface.get_selection().selection_changed.connect(_check_nodes)

hide()


#endregion

#region Private ####################################################################################
func _select_walk_point() -> void:
btn_baseline.set_pressed_no_signal(false)
btn_interaction_polygon.set_pressed_no_signal(false)

EditorInterface.get_selection().clear()

var walk_point_helper: Marker2D = null

if _types_helper.is_prop(_selected_node)\
or _types_helper.is_hotspot(_selected_node):
walk_point_helper = _selected_node.get_node("WalkToHelper")
else:
walk_point_helper = _selected_node.get_node("../WalkToHelper")

EditorInterface.get_selection().add_node(walk_point_helper)


func _select_baseline() -> void:
btn_walk_point.set_pressed_no_signal(false)
btn_interaction_polygon.set_pressed_no_signal(false)

EditorInterface.get_selection().clear()

var baseline_helper: Line2D = null

if _types_helper.is_prop(_selected_node)\
or _types_helper.is_hotspot(_selected_node):
baseline_helper = _selected_node.get_node("BaselineHelper")
else:
baseline_helper = _selected_node.get_node("../BaselineHelper")

EditorInterface.get_selection().add_node(baseline_helper)


func _select_interaction_polygon() -> void:
btn_walk_point.set_pressed_no_signal(false)
btn_baseline.set_pressed_no_signal(false)

EditorInterface.get_selection().clear()

var collision_polygon: CollisionPolygon2D = null

if _types_helper.is_prop(_selected_node)\
or _types_helper.is_hotspot(_selected_node):
collision_polygon = _selected_node.get_node('InteractionPolygon')
else:
collision_polygon = _selected_node.get_node('../InteractionPolygon')

EditorInterface.get_selection().add_node(collision_polygon)
collision_polygon.get_parent().editing_polygon = true


# Toggles Clickable helpers in order to show walk-to-point, baseline and dialog
# position (PopochiuCharacter) only when a node of that type is selected in the
# scene tree.
func _check_nodes() -> void:
var deselect_helpers_buttons := false

if EditorInterface.get_selection().get_selected_nodes().is_empty():
deselect_helpers_buttons = true

# Deselect any BaselineHelper or WalkToPointHelper
if EditorInterface.get_selection().get_selected_nodes().size() > 1:
for node in EditorInterface.get_selection().get_selected_nodes():
if node.name in ["BaselineHelper", "WalkToHelper", "InteractionPolygon"]:
EditorInterface.get_selection().remove_node.call_deferred(node)
deselect_helpers_buttons = true

if deselect_helpers_buttons:
_deselect_buttons()

for n in _shown_helpers:
if is_instance_valid(n):
n.hide_helpers()

_shown_helpers.clear()

if not is_instance_valid(EditorInterface.get_selection()): return

for n in EditorInterface.get_selection().get_selected_nodes():
if n.has_method('show_helpers'):
n.show_helpers()
_shown_helpers.append(n)
elif n.get_parent().has_method('show_helpers'):
n.get_parent().show_helpers()
_shown_helpers.append(n.get_parent())

if not is_instance_valid(_types_helper): return

if EditorInterface.get_selection().get_selected_nodes().size() == 1:
_selected_node = EditorInterface.get_selection().get_selected_nodes()[0]

if _types_helper.is_prop(_selected_node)\
or _types_helper.is_hotspot(_selected_node)\
or _types_helper.is_prop(_selected_node.get_parent())\
or _types_helper.is_hotspot(_selected_node.get_parent()):
if _types_helper.is_prop(_selected_node)\
or _types_helper.is_hotspot(_selected_node):
_deselect_buttons()

show()
else:
hide()


func _deselect_buttons() -> void:
for button: Button in get_children():
button.set_pressed_no_signal(false)


#endregion
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[gd_scene load_steps=5 format=3 uid="uid://wd748u1vdybq"]

[ext_resource type="Texture2D" uid="uid://dasi6853uqkmu" path="res://addons/popochiu/icons/baseline.png" id="1_8j5rt"]
[ext_resource type="Script" path="res://addons/popochiu/editor/canvas_editor_menu/popochiu_canvas_editor_menu.gd" id="1_vs7c6"]
[ext_resource type="Texture2D" uid="uid://4ovxgn77a0ax" path="res://addons/popochiu/icons/walk_to_point.png" id="2_po7va"]
[ext_resource type="Texture2D" uid="uid://cesndtvbchw7v" path="res://addons/popochiu/icons/interaction_polygon.png" id="3_kma38"]

[node name="PopochiuCanvasEditorMenu" type="HBoxContainer"]
visible = false
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("1_vs7c6")

[node name="BtnBaseline" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Baseline"
toggle_mode = true
icon = ExtResource("1_8j5rt")

[node name="BtnWalkPoint" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Walk point"
toggle_mode = true
icon = ExtResource("2_po7va")

[node name="BtnInteractionPolygon" type="Button" parent="."]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Interaction Polygon"
toggle_mode = true
icon = ExtResource("3_kma38")
20 changes: 13 additions & 7 deletions addons/popochiu/editor/config/config.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ const _DEFAULT_PROP_CLICKABLE_ENABLED = 'popochiu/import/aseprite/new_props_clic
const _DEFAULT_WIPE_OLD_ANIMS_ENABLED = 'popochiu/import/aseprite/wipe_old_animations'


var ei: EditorInterface
var editor_settings: EditorSettings
var ei := EditorInterface
var editor_settings: EditorSettings = ei.get_editor_settings()

var _plugin_icons: Dictionary


# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ PUBLIC ░░░░
#region Public #####################################################################################
func initialize_editor_settings():
editor_settings = ei.get_editor_settings()
_initialize_editor_cfg(_ASEPRITE_IMPORTER_ENABLED_KEY, false, TYPE_BOOL)
_initialize_editor_cfg(_ASEPRITE_COMMAND_KEY, _default_command(), TYPE_STRING)
_initialize_editor_cfg(_REMOVE_SOURCE_FILES_KEY, true, TYPE_BOOL)
Expand All @@ -39,7 +38,9 @@ func initialize_project_settings():
ProjectSettings.save()


# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ SET & GET ░░░░
#endregion

#region SetGet #####################################################################################
func aseprite_importer_enabled() -> bool:
return _get_editor_setting(_ASEPRITE_IMPORTER_ENABLED_KEY, false)

Expand Down Expand Up @@ -76,8 +77,10 @@ func is_default_wipe_old_anims_enabled() -> bool:
return _get_project_setting(_DEFAULT_WIPE_OLD_ANIMS_ENABLED, true)



# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ PRIVATE ░░░░

#endregion

#region Private ####################################################################################
func _default_command() -> String:
return 'aseprite'

Expand Down Expand Up @@ -119,3 +122,6 @@ func _get_editor_setting(key: String, default_value):
func _get_project_setting(key: String, default_value):
var p = ProjectSettings.get_setting(key)
return p if p != null else default_value


#endregion
8 changes: 4 additions & 4 deletions addons/popochiu/editor/factories/factory_base_popochiu_obj.gd
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func _save_obj_scene(obj: Node) -> int:

# Load the scene to be get by the calling code
# Instancing the created .tscn file fixes #58
_scene = load(_path_scene).instantiate()
_scene = (load(_path_scene) as PackedScene).instantiate(PackedScene.GEN_EDIT_STATE_INSTANCE)

return ResultCodes.SUCCESS

Expand All @@ -201,9 +201,9 @@ func _save_obj_resource(obj: Resource) -> int:
## Makes a copy of the base scene for the object (e.g. popochiu_room.tscn,
## popochiu_inventory_item.tscn, popochiu_prop.tscn).
func _load_obj_base_scene() -> Node:
var obj = load(
BASE_SCENE_PATH % [_type_label, _type_label]
).instantiate()
var obj = (
load(BASE_SCENE_PATH % [_type_label, _type_label]) as PackedScene
).instantiate(PackedScene.GEN_EDIT_STATE_MAIN_INHERITED)

# The script is assigned first so that other properties will not be
# overwritten by that assignment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func create(obj_name: String) -> int:
new_obj.script_name = _pascal_name
new_obj.description = _pascal_name.capitalize()
new_obj.cursor = Constants.CURSOR_TYPE.TALK

if PopochiuResources.get_settings().is_pixel_art_game:
new_obj.get_node("Sprite2D").texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST


# ▓▓▓ END OF LOCAL CODE ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

# Save the scene (.tscn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func create(obj_name: String) -> int:
new_obj.description = _pascal_name.capitalize()
new_obj.cursor = Constants.CURSOR_TYPE.USE
new_obj.size_flags_vertical = new_obj.SIZE_SHRINK_CENTER

if PopochiuResources.get_settings().is_pixel_art_game:
new_obj.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST

# ▓▓▓ END OF LOCAL CODE ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

# Save the scene (.tscn)
Expand Down
3 changes: 3 additions & 0 deletions addons/popochiu/editor/factories/factory_popochiu_prop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func create(
new_obj.cursor = Constants.CURSOR_TYPE.ACTIVE
new_obj.clickable = is_interactive
new_obj.visible = is_visible

if PopochiuResources.get_settings().is_pixel_art_game:
new_obj.get_node("Sprite2D").texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST

if _snake_name in ['bg', 'background']:
new_obj.baseline =\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ func create(obj_name: String, room: PopochiuRoom) -> int:
# Create a NavigationRegion2D with its polygon as a child in the room scene
var perimeter := NavigationRegion2D.new()
perimeter.name = 'Perimeter'

var polygon := NavigationPolygon.new()
polygon.add_outline(PackedVector2Array([
Vector2(-10, -10), Vector2(10, -10), Vector2(10, 10), Vector2(-10, 10)
]))
polygon.make_polygons_from_outlines()
polygon.agent_radius = 0.0

perimeter.navpoly = polygon
perimeter.modulate = Color.GREEN

_add_visible_child(perimeter)
# ▓▓▓ END OF LOCAL CODE ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

Expand Down
3 changes: 2 additions & 1 deletion addons/popochiu/editor/helpers/popochiu_editor_helper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ class_name PopochiuEditorHelper
extends Resource
## Utils class for Editor related things.

static var ei: EditorInterface = null
static var ei := EditorInterface
static var undo_redo: EditorUndoRedoManager = null


static func select_node(node: Node) -> void:
ei.get_selection().clear()
ei.get_selection().add_node(node)
Loading

0 comments on commit ef13012

Please sign in to comment.