-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
14 changed files
with
45 additions
and
51 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
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