Skip to content

Commit

Permalink
Merge pull request godot-extended-libraries#58 from aaronfranke/tabs
Browse files Browse the repository at this point in the history
Replace spaces with tabs in all GDScript files
  • Loading branch information
willnationsdev authored Apr 26, 2020
2 parents 96f35b3 + f081a8b commit 936d80f
Show file tree
Hide file tree
Showing 31 changed files with 313 additions and 296 deletions.
4 changes: 2 additions & 2 deletions addons/godot-next/2d/geometry_2d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# license: MIT
# description: Draws a Shape2D using CollisionShape2D's editor plugin handles.
# notes:
# - Don't use it as direct child of CollisionBody2D classes unless you intent
# to use it as its CollisionShape2D.
# - Don't use it as direct child of CollisionBody2D classes unless you intent
# to use it as its CollisionShape2D.
tool
extends CollisionShape2D
class_name Geometry2D
Expand Down
38 changes: 19 additions & 19 deletions addons/godot-next/2d/trail_2d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
# author: willnationsdev
# brief description: Creates a variable-length trail that tracks the "target" node.
# API details:
# - Use CanvasItem.show_behind_parent or Node2D.z_index (Inspector) to control its layer visibility
# - 'target' and 'target_path' (the 'target vars') will update each other as they are modified
# - If you assign an empty 'target var', the value will automatically update to grab the parent.
# - To completely turn off the Trail2D, set its `trail_length` to 0
# - The node will automatically update its target vars when it is moved around in the tree
# - You can set the "persistence" mode to have it...
# - vanish the trail over time (Off)
# - persist the trail forever, unless modified directly (Always)
# - persist conditionally:
# - persist automatically during movement and then shrink over time when you stop
# - persist according to your own custom logic:
# - use `bool _should_grow()` to return under what conditions
# a point should be added underneath the target.
# - use `bool _should_shrink()` to return under what conditions
# the degen_rate should be removed from the trail's list of points.
# - Use CanvasItem.show_behind_parent or Node2D.z_index (Inspector) to control its layer visibility
# - 'target' and 'target_path' (the 'target vars') will update each other as they are modified
# - If you assign an empty 'target var', the value will automatically update to grab the parent.
# - To completely turn off the Trail2D, set its `trail_length` to 0
# - The node will automatically update its target vars when it is moved around in the tree
# - You can set the "persistence" mode to have it...
# - vanish the trail over time (Off)
# - persist the trail forever, unless modified directly (Always)
# - persist conditionally:
# - persist automatically during movement and then shrink over time when you stop
# - persist according to your own custom logic:
# - use `bool _should_grow()` to return under what conditions
# a point should be added underneath the target.
# - use `bool _should_shrink()` to return under what conditions
# the degen_rate should be removed from the trail's list of points.

extends Line2D
class_name Trail2D, "../icons/icon_trail_2d.svg"
Expand All @@ -26,14 +26,14 @@ class_name Trail2D, "../icons/icon_trail_2d.svg"
##### CONSTANTS #####

enum Persistence {
OFF, # Do not persist. Remove all points after the trail_length.
ALWAYS, # Always persist. Do not remove any points.
CONDITIONAL # Sometimes persist. Choose an algorithm for when to add and remove points.
OFF, # Do not persist. Remove all points after the trail_length.
ALWAYS, # Always persist. Do not remove any points.
CONDITIONAL, # Sometimes persist. Choose an algorithm for when to add and remove points.
}

enum PersistWhen {
ON_MOVEMENT, # Add points during movement and remove points when not moving.
CUSTOM # Override _should_grow() and _should_shrink() to define when to add/remove points.
CUSTOM, # Override _should_grow() and _should_shrink() to define when to add/remove points.
}

##### PROPERTIES #####
Expand Down
7 changes: 3 additions & 4 deletions addons/godot-next/3d/trail_3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# author: miziziziz
# brief description: Creates a variable-length trail on an ImmediateGeometry node.
# API details:
# - density_lengthwise: number of vertex loops in trail
# - density_around: number of vertexes in each loop
# - shape: curve used to shape trail, right click on this in inspector to see curve options
# - density_lengthwise: number of vertex loops in trail
# - density_around: number of vertexes in each loop
# - shape: curve used to shape trail, right click on this in inspector to see curve options

extends ImmediateGeometry
class_name Trail3D, "../icons/icon_trail_3d.svg"
Expand Down Expand Up @@ -117,4 +117,3 @@ func render_trail():
add_vertex(verts[verts.size() - 1][nxt])
add_vertex(last_p)
end()

14 changes: 7 additions & 7 deletions addons/godot-next/global/editor_tools.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# EditorTools
# author: willnationsdev
# brief_description: A utility for any features useful in the context of the Editor
# description: A utility for any features useful in the context of the Editor
tool
extends Reference
class_name EditorTools

static func is_in_edited_scene(p_node: Node):
if not p_node.is_inside_tree():
return false
var edited_scene := p_node.get_tree().edited_scene_root
if p_node == edited_scene:
return true
return edited_scene.is_parent_of(p_node)
if not p_node.is_inside_tree():
return false
var edited_scene := p_node.get_tree().edited_scene_root
if p_node == edited_scene:
return true
return edited_scene.is_parent_of(p_node)
2 changes: 1 addition & 1 deletion addons/godot-next/global/file_search.gd
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static func search_resources(p_types: PoolStringArray = ["Resource"], p_match_fu
##### PRIVATE METHODS #####

static func _this() -> Script:
return load(SELF_PATH) as Script
return load(SELF_PATH) as Script

# p_evaluator: A FileEvaluator type.
# p_from_dir: The starting location from which to scan.
Expand Down
6 changes: 3 additions & 3 deletions addons/godot-next/global/file_system_link.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# FileSystemLink
# author: willnationsdev
# brief_description: A utility for creating links (file/directory, symbolic/hard).
# description: A utility for creating links (file/directory, symbolic/hard).
# API details:
# - All methods' parameters are ordered in Unix fashion, {<target>,<linkpath>}
# - Methods are aliased so that the parameters are implied by the method name.
# - All methods' parameters are ordered in Unix fashion, {<target>,<linkpath>}
# - Methods are aliased so that the parameters are implied by the method name.
extends Reference
class_name FileSystemLink

Expand Down
9 changes: 5 additions & 4 deletions addons/godot-next/global/inspector_controls.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# InspectorControls
# author: xdgamestudios
# license: MIT
# description: A collection of classes and factory methods for generating
# Controls oriented towards editing data. Useful for modifying
# the EditorInspector or generating your own in-game data-editing
# tools.
# description:
# A collection of classes and factory methods for generating
# Controls oriented towards editing data. Useful for modifying
# the EditorInspector or generating your own in-game data-editing
# tools.
extends Reference
class_name InspectorControls

Expand Down
58 changes: 29 additions & 29 deletions addons/godot-next/global/physics_layers.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,41 @@ const _PHYSICS_2D_PREFIX : String = "2d_physics"
const _PHYSICS_3D_PREFIX : String = "3d_physics"

static func setup() -> void:
for prefix in [_PHYSICS_2D_PREFIX, _PHYSICS_3D_PREFIX]:
var path : String = "layer_names/".plus_file(prefix)
for i in range(1, 21):
var layer_path : String = path.plus_file(str("layer_", i))
var layer_name : String = ProjectSettings.get(layer_path)
for prefix in [_PHYSICS_2D_PREFIX, _PHYSICS_3D_PREFIX]:
var path : String = "layer_names/".plus_file(prefix)
for i in range(1, 21):
var layer_path : String = path.plus_file(str("layer_", i))
var layer_name : String = ProjectSettings.get(layer_path)

if(not layer_name):
layer_name = str("Layer ", i)
if(not layer_name):
layer_name = str("Layer ", i)

var layer_key : String = prefix.plus_file(layer_name)

_PHYSICS_LAYERS_BIT[layer_key] = i-1
var layer_key : String = prefix.plus_file(layer_name)
_PHYSICS_LAYERS_BIT[layer_key] = i-1

# Get the corresponding bit of the layer named <layer_name>
static func _get_physics_layer_index(layer_name: String) -> int:
if not _PHYSICS_LAYERS_BIT.has(layer_name):
setup()

assert (_PHYSICS_LAYERS_BIT.has(layer_name))
return _PHYSICS_LAYERS_BIT[layer_name]

if not _PHYSICS_LAYERS_BIT.has(layer_name):
setup()

assert (_PHYSICS_LAYERS_BIT.has(layer_name))
return _PHYSICS_LAYERS_BIT[layer_name]


# Get the layer that corresponds to to the combination of all the passed layer names.
static func get_physics_layer(layer_names: Array, layer_type : int = Physics2D) -> int:
var res : int = 0
for i in range(layer_names.size()):
var layer_bit : int = get_physics_layer_index(layer_names[i], layer_type)
res |= 1 << layer_bit
return res
var res: int = 0
for i in range(layer_names.size()):
var layer_bit : int = get_physics_layer_index(layer_names[i], layer_type)
res |= 1 << layer_bit
return res

static func get_physics_layer_index(layer_name: String, layer_type : int = Physics2D) -> int:
var res : int
match layer_type:
Physics2D:
res = _get_physics_layer_index(_PHYSICS_2D_PREFIX.plus_file(layer_name))
Physics3D:
res = _get_physics_layer_index(_PHYSICS_3D_PREFIX.plus_file(layer_name))
return res
var res : int
match layer_type:
Physics2D:
res = _get_physics_layer_index(_PHYSICS_2D_PREFIX.plus_file(layer_name))
Physics3D:
res = _get_physics_layer_index(_PHYSICS_3D_PREFIX.plus_file(layer_name))
return res
2 changes: 1 addition & 1 deletion addons/godot-next/global/singletons.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# license: MIT
# description: An API for accessing singletons
# deps:
# - singleton_cache.tres
# - singleton_cache.tres
tool
extends Reference
class_name Singletons
Expand Down
2 changes: 1 addition & 1 deletion addons/godot-next/gui/cycle.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cycle
# author: willnationsdev
# brief_description: Cycles through child nodes without any visibility or container effects.
# description: Cycles through child nodes without any visibility or container effects.

extends TabContainer
class_name Cycle, "../icons/icon_cycle.svg"
Expand Down
16 changes: 9 additions & 7 deletions addons/godot-next/gui/debug_label.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ extends Label
class_name DebugLabel
# author: Xrayez
# license: MIT
# description: A label which displays a list of property values in any Object
# instance, suitable for both in-game and editor debugging.
# description:
# A label which displays a list of property values in any Object
# instance, suitable for both in-game and editor debugging.
# usage:
# var debug_label = DebugLabel.new(node)
# debug_label.watchv(["position:x", "scale", "rotation"])
# var debug_label = DebugLabel.new(node)
# debug_label.watchv(["position:x", "scale", "rotation"])
#
# todo: Use RichTextLabel or custom drawing for color coding of core data types.
# Unfortunately, it doesn't compute its minimum size the same way as a Label
# todo:
# Use RichTextLabel or custom drawing for color coding of core data types.
# Unfortunately, it doesn't compute its minimum size the same way as a Label

# Assign a node via inspector. If empty, a parent node is inspected instead.
export var target_path := NodePath() setget set_target_path
Expand Down Expand Up @@ -41,7 +43,7 @@ func _init(p_target: Object = null) -> void:
if p_target != null:
target = p_target

# # TODO: RichTextLabel relevant overrides
# # TODO: RichTextLabel relevant overrides
# rect_clip_content = false
# scroll_active = false
# selection_enabled = true
Expand Down
16 changes: 8 additions & 8 deletions addons/godot-next/gui/v_box_item_list.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# VBoxItemList
# author: willnationsdev
# brief_description: Creates a vertical list of items that can be added or removed. Items are a user-specified Script or Scene Control.
# description: Creates a vertical list of items that can be added or removed. Items are a user-specified Script or Scene Control.
# API details:
# - The '_item_added' and '_item_removed' methods may be overridden for custom behaviors.
# - External nodes can connect to the 'item_added' and 'item_removed' signals for custom reactions.
# - Note that the node provided in the '_item_removed' virtual method and 'item_removed' signal is free'd after their conclusion.
# - Note that the virtual methods will execute just ahead of emitting their signal counterpart.
# - Items may define their own "_get_label" method which returns the string for their label text.
# - If either 'allow_reordering' or 'editable_labels' is true, labels will not be generated automatically via item_prefix + index.
# - The '_item_added' and '_item_removed' methods may be overridden for custom behaviors.
# - External nodes can connect to the 'item_added' and 'item_removed' signals for custom reactions.
# - Note that the node provided in the '_item_removed' virtual method and 'item_removed' signal is free'd after their conclusion.
# - Note that the virtual methods will execute just ahead of emitting their signal counterpart.
# - Items may define their own "_get_label" method which returns the string for their label text.
# - If either 'allow_reordering' or 'editable_labels' is true, labels will not be generated automatically via item_prefix + index.

extends VBoxContainer
class_name VBoxItemList, "../icons/icon_v_box_item_list.svg"
Expand All @@ -32,7 +32,7 @@ export var item_script: Script = null setget set_item_script
# The scene for the item. Incompatible with item_script.
export var item_scene: PackedScene = null setget set_item_scene
# label: The prefix text before enumeration, e.g. 'Item' results in Item 1, Item 2, etc.
# If empty, will generate no labels at all unless the item has '_get_label' implemented.
# If empty, will generate no labels at all unless the item has '_get_label' implemented.
export var item_prefix: String = "" setget set_item_prefix
# label: The color of the highlighted (hovered over) label.
export var label_tint: Color = Color(1, 1, 1, 1) setget set_label_tint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# DelegationInspectorPlugin
# author: willnationsdev and xdgamestudios
# license: MIT
# description: Attempts to call EditorInspectorPlugin 'parse' methods on every
# object that appears in an EditorInspector anywhere. Enables
# objects to define their own EditorInspector GUI logic without
# the need for additional plugins.
# description:
# Attempts to call EditorInspectorPlugin 'parse' methods on every
# object that appears in an EditorInspector anywhere. Enables
# objects to define their own EditorInspector GUI logic without
# the need for additional plugins.
tool
extends EditorInspectorPlugin

Expand Down
45 changes: 23 additions & 22 deletions addons/godot-next/nodes/callback_delegator.gd
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
# CallbackDelegator
# author: xdgamestudios
# license: MIT
# description: Manages a ResourceSet of resources and delegates Node callbacks to each instance.
# As a ResourceSet, only one element of any given type is allowed on a single elements node.
# description:
# Manages a ResourceSet of resources and delegates Node callbacks to each instance.
# As a ResourceSet, only one element of any given type is allowed on a single elements node.
# deps:
# - ResourceSet
# - PropertyInfo
# - ClassType
# - ResourceSet
# - PropertyInfo
# - ClassType
# usage:
# - Creating:
# elements = elements.new()
# - Adding elements:
# elements.add_element(MyResource) # Returns a new or pre-existing instance of the element or null if given an invalid element script.
# - Checking elements:
# elements.has_element(MyResource) # Returns true if the element exists in the collection.
# - Retrieving elements:
# elements.get_element(MyResource) # Returns the element instance of the given type or null if not in the collection.
# - Removing elements:
# elements.remove_element(MyResource) # Removes the element from the collection. Returns true if successful. Else, returns false.
# - Creating:
# elements = elements.new()
# - Adding elements:
# elements.add_element(MyResource) # Returns a new or pre-existing instance of the element or null if given an invalid element script.
# - Checking elements:
# elements.has_element(MyResource) # Returns true if the element exists in the collection.
# - Retrieving elements:
# elements.get_element(MyResource) # Returns the element instance of the given type or null if not in the collection.
# - Removing elements:
# elements.remove_element(MyResource) # Removes the element from the collection. Returns true if successful. Else, returns false.
# notes:
# - Public interface of each stored Resource type:
# - var owner: Node
# - func get_enabled() -> bool
# - Initialization Sequence:
# 1. _awake() called during _enter_tree() after CallbackDelegator initializes owner (for Unity familiarity).
# 2. _enter_tree() called immediately after (so they are virtually aliases for each other)
# 3. _ready() called during _ready().
# - Public interface of each stored Resource type:
# - var owner: Node
# - func get_enabled() -> bool
# - Initialization Sequence:
# 1. _awake() called during _enter_tree() after CallbackDelegator initializes owner (for Unity familiarity).
# 2. _enter_tree() called immediately after (so they are virtually aliases for each other)
# 3. _ready() called during _ready().
tool
extends Node
class_name CallbackDelegator
Expand Down
7 changes: 4 additions & 3 deletions addons/godot-next/nodes/message_dispatcher_wrapper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# author: MunWolf (Rikhardur Bjarni Einarsson)
# license: MIT
# copyright: Copyright (c) 2019 Rikhardur Bjarni Einarsson
# brief_description: A wrapper for MessageDispatcher that is extendable on a Node,
# people can also use this as a template to implement it on
# their own if they want to extend something else.
# description:
# A wrapper for MessageDispatcher that is extendable on a Node,
# people can also use this as a template to implement it on
# their own if they want to extend something else.

extends Node

Expand Down
2 changes: 1 addition & 1 deletion addons/godot-next/references/array_2d.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Array2D
# author: willnationsdev
# brief_description: A 2D Array class
# description: A 2D Array class
extends Reference
class_name Array2D

Expand Down
Loading

0 comments on commit 936d80f

Please sign in to comment.