-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue when exporting project (#128)
* Fix #109 Create script to be used by classes used in the Editor to replace the use of PopochiuUtils. Update the plugin version to show the proper name for Alpha 6. Minor UI improvement in node with buttons to select the BaselineHelper and WalkToPointHelper. Added comments to methods in PopochiuUtils. * Set agent_radius to 0 for NavigationPolygon in PopochiuWalkableArea Godot by default sets it to 10, which makes the polygon to be not fully used. Listen EditorUndoRedoManager.history_changed to bake navigation polygons in all PopochiuWalkableAreas so devs see the changes live without needing to click the Bake NavigationPolygon button. Update .gitignore commenting the lines related to the addons folder. * Add untracked files because .gitignore * Update plugin version and removed run/main_scene
- Loading branch information
Showing
16 changed files
with
81 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@tool | ||
class_name PopochiuEditorHelper | ||
extends Resource | ||
## Utils class for Editor related things. | ||
|
||
static var ei: EditorInterface = null | ||
static var undo_redo: EditorUndoRedoManager = null | ||
|
||
static func select_node(node: Node) -> void: | ||
ei.get_selection().clear() | ||
ei.get_selection().add_node(node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,50 @@ | ||
# Utility functions for Popochiu. | ||
@tool | ||
extends Node | ||
class_name PopochiuUtils | ||
|
||
static var ei: EditorInterface = null | ||
extends Node | ||
## Utility functions for Popochiu. | ||
|
||
|
||
## Used by the graphic interface to get the position of a `node` in the scene | ||
## in the transform space of the CanvasLayer where it is is rendered. | ||
static func get_screen_coords_for(node: Node) -> Vector2: | ||
return node.get_viewport().canvas_transform * node.get_global_position() | ||
|
||
|
||
# Gets a random element from an Array | ||
## Gets a random element from an Array. | ||
static func get_random_array_element(arr: Array): | ||
randomize() | ||
var idx := randi() % arr.size() | ||
|
||
return arr[idx] | ||
|
||
|
||
# Gets a random index from an Array | ||
## Gets a random index from an Array. | ||
static func get_random_array_idx(arr: Array) -> int: | ||
randomize() | ||
var idx := randi() % arr.size() | ||
|
||
return idx | ||
|
||
|
||
## Compares the name of two files `a` and `b` to check which one comes first in | ||
## alphabetical order. | ||
static func sort_by_file_name(a: String, b: String) -> bool: | ||
if a.get_file() < b.get_file(): | ||
return true | ||
return false | ||
|
||
|
||
## Overrides the font with `font_name` in a Control `node` with the Font received | ||
## in `font`. | ||
static func override_font(node: Control, font_name: String, font: Font) -> void: | ||
node.add_theme_font_override(font_name, font) | ||
|
||
|
||
static func select_node(node: Node) -> void: | ||
ei.get_selection().clear() | ||
ei.get_selection().add_node(node) | ||
|
||
|
||
## Prints the text in `msg` with the error style for Popochiu. | ||
static func print_error(msg: String) -> void: | ||
print_rich("[bgcolor=c46c71][color=ffffff][b][Popochiu][/b] %s[/color][/bgcolor]" % msg) | ||
|
||
|
||
## Prints the text in `msg` with the warning style for Popochiu. | ||
static func print_warning(msg: String) -> void: | ||
print_rich("[bgcolor=edf171][color=4a4a4a][b][Popochiu][/b] %s[/color][/bgcolor]" % msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters