Skip to content

Commit

Permalink
Merge pull request #183 from mphe/housekeeping
Browse files Browse the repository at this point in the history
Housekeeping
  • Loading branch information
mphe authored Feb 16, 2025
2 parents 0d42c4d + ceae325 commit 148f3ee
Show file tree
Hide file tree
Showing 43 changed files with 834 additions and 647 deletions.
1 change: 1 addition & 0 deletions addons/gut/fonts/AnonymousPro-Bold.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/AnonymousPro-Bold.ttf-9d8fef4d357af5b52cd60af
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/AnonymousPro-BoldItalic.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/AnonymousPro-BoldItalic.ttf-4274bf704d3d6b9cd
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/AnonymousPro-Italic.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/AnonymousPro-Italic.ttf-9989590b02137b799e13d
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/AnonymousPro-Regular.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/AnonymousPro-Regular.ttf-856c843fd6f89964d2ca
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/CourierPrime-Bold.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/CourierPrime-Bold.ttf-1f003c66d63ebed70964e77
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/CourierPrime-BoldItalic.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/CourierPrime-BoldItalic.ttf-65ebcc61dd5e1dfa8
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/CourierPrime-Italic.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/CourierPrime-Italic.ttf-baa9156a73770735a0f72
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/CourierPrime-Regular.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/CourierPrime-Regular.ttf-3babe7e4a7a588dfc9a8
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/LobsterTwo-Bold.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/LobsterTwo-Bold.ttf-7c7f734103b58a32491a47881
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/LobsterTwo-BoldItalic.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/LobsterTwo-BoldItalic.ttf-227406a33e84448e6aa
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/LobsterTwo-Italic.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/LobsterTwo-Italic.ttf-f93abf6c25390c85ad5fb6c
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 1 addition & 0 deletions addons/gut/fonts/LobsterTwo-Regular.ttf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/LobsterTwo-Regular.ttf-f3fcfa01cd671c8da433dd
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 0 additions & 1 deletion addons/gut/script_parser.gd
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,3 @@ func parse(thing, inner_thing=null):
scripts[key] = parsed

return parsed

1 change: 0 additions & 1 deletion addons/gut/test_collector.gd
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,3 @@ func get_pending_count():
for s in scripts:
count += s.get_pending_count()
return count

3 changes: 1 addition & 2 deletions addons/rmsmartshape/actions/action_add_collision_nodes.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extends SS2D_Action

## ActionAddCollisionNodes
class_name SS2D_ActionAddCollisionNodes

var _shape: SS2D_Shape

Expand Down
26 changes: 13 additions & 13 deletions addons/rmsmartshape/actions/action_add_point.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
extends SS2D_Action
class_name SS2D_ActionAddPoint

## ActionAddPoint

const ActionInvertOrientation := preload("res://addons/rmsmartshape/actions/action_invert_orientation.gd")
var _invert_orientation: ActionInvertOrientation
var _invert_orientation: SS2D_ActionInvertOrientation

var _commit_update: bool
var _shape: SS2D_Shape
Expand All @@ -16,28 +14,30 @@ func _init(shape: SS2D_Shape, position: Vector2, idx: int = -1, commit_update: b
_shape = shape
_position = position
_commit_update = commit_update
_idx = _shape.adjust_add_point_index(idx)
_key = _shape.reserve_key()
_invert_orientation = ActionInvertOrientation.new(shape)
_idx = idx
_key = _shape.get_point_array().reserve_key()
_invert_orientation = SS2D_ActionInvertOrientation.new(shape)


func get_name() -> String:
return "Add Point at (%d, %d)" % [_position.x, _position.y]


func do() -> void:
_shape.begin_update()
_key = _shape.add_point(_position, _idx, _key)
var pa := _shape.get_point_array()
pa.begin_update()
_key = pa.add_point(_position, _idx, _key)
_invert_orientation.do()
if _commit_update:
_shape.end_update()
pa.end_update()


func undo() -> void:
_shape.begin_update()
var pa := _shape.get_point_array()
pa.begin_update()
_invert_orientation.undo()
_shape.remove_point(_key)
_shape.end_update()
pa.remove_point(_key)
pa.end_update()


func get_key() -> int:
Expand Down
24 changes: 12 additions & 12 deletions addons/rmsmartshape/actions/action_close_shape.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
extends SS2D_Action
class_name SS2D_ActionCloseShape

## ActionCloseShape

const ActionInvertOrientation := preload("res://addons/rmsmartshape/actions/action_invert_orientation.gd")
var _invert_orientation: ActionInvertOrientation
var _invert_orientation: SS2D_ActionInvertOrientation

var _shape: SS2D_Shape
var _key: int
Expand All @@ -12,28 +10,30 @@ var _performed: bool

func _init(shape: SS2D_Shape) -> void:
_shape = shape
_invert_orientation = ActionInvertOrientation.new(shape)
_invert_orientation = SS2D_ActionInvertOrientation.new(shape)


func get_name() -> String:
return "Close Shape"


func do() -> void:
_performed = _shape.can_close()
var pa := _shape.get_point_array()
_performed = pa.can_close()
if _performed:
_shape.begin_update()
_key = _shape.close_shape(_key)
pa.begin_update()
_key = pa.close_shape(_key)
_invert_orientation.do()
_shape.end_update()
pa.end_update()


func undo() -> void:
if _performed:
_shape.begin_update()
var pa := _shape.get_point_array()
pa.begin_update()
_invert_orientation.undo()
_shape.remove_point(_key)
_shape.end_update()
pa.remove_point(_key)
pa.end_update()


func get_key() -> int:
Expand Down
23 changes: 10 additions & 13 deletions addons/rmsmartshape/actions/action_cut_edge.gd
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
extends SS2D_Action
class_name SS2D_ActionCutEdge


## ActionCutEdge
##
## A delegate action that selects an action to perform based on the edge
## location and shape state.

var ActionOpenShape := preload("res://addons/rmsmartshape/actions/action_open_shape.gd")
var ActionDeletePoint := preload("res://addons/rmsmartshape/actions/action_delete_point.gd")
var ActionSplitShape := preload("res://addons/rmsmartshape/actions/action_split_shape.gd")

var _shape: SS2D_Shape
var _action: SS2D_Action


func _init(shape: SS2D_Shape, key_edge_start: int, key_edge_end: int) -> void:
_shape = shape
var pa := _shape.get_point_array()

var key_first: int = shape.get_point_key_at_index(0)
var key_last: int = shape.get_point_key_at_index(shape.get_point_count()-1)
if _shape.is_shape_closed():
_action = ActionOpenShape.new(shape, key_edge_start)
var key_first: int = pa.get_point_key_at_index(0)
var key_last: int = pa.get_point_key_at_index(pa.get_point_count()-1)
if pa.is_shape_closed():
_action = SS2D_ActionOpenShape.new(shape, key_edge_start)
elif key_edge_start == key_first:
_action = ActionDeletePoint.new(shape, key_edge_start)
_action = SS2D_ActionDeletePoint.new(shape, key_edge_start)
elif key_edge_end == key_last:
_action = ActionDeletePoint.new(shape, key_edge_end)
_action = SS2D_ActionDeletePoint.new(shape, key_edge_end)
else:
_action = ActionSplitShape.new(shape, key_edge_start)
_action = SS2D_ActionSplitShape.new(shape, key_edge_start)


func get_name() -> String:
Expand Down
29 changes: 15 additions & 14 deletions addons/rmsmartshape/actions/action_delete_control_point.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
extends SS2D_Action

## ActionDeleteControlPoint
class_name SS2D_ActionDeleteControlPoint

enum PointType {POINT_IN, POINT_OUT}

const ActionInvertOrientation := preload("res://addons/rmsmartshape/actions/action_invert_orientation.gd")
var _invert_orientation: ActionInvertOrientation
var _invert_orientation: SS2D_ActionInvertOrientation

var _shape: SS2D_Shape
var _key: int
Expand All @@ -17,29 +15,32 @@ func _init(shape: SS2D_Shape, key: int, point_type: PointType) -> void:
_shape = shape
_key = key
_point_type = point_type
_old_value = shape.get_point_in(key) if _point_type == PointType.POINT_IN else shape.get_point_out(key)
_invert_orientation = ActionInvertOrientation.new(shape)
var pa := _shape.get_point_array()
_old_value = pa.get_point_in(key) if _point_type == PointType.POINT_IN else pa.get_point_out(key)
_invert_orientation = SS2D_ActionInvertOrientation.new(shape)


func get_name() -> String:
return "Delete Control Point " + ("In" if _point_type == PointType.POINT_IN else "Out")


func do() -> void:
_shape.begin_update()
var pa := _shape.get_point_array()
pa.begin_update()
if _point_type == PointType.POINT_IN:
_shape.set_point_in(_key, Vector2.ZERO)
pa.set_point_in(_key, Vector2.ZERO)
else:
_shape.set_point_out(_key, Vector2.ZERO)
pa.set_point_out(_key, Vector2.ZERO)
_invert_orientation.do()
_shape.end_update()
pa.end_update()


func undo() -> void:
_shape.begin_update()
var pa := _shape.get_point_array()
pa.begin_update()
_invert_orientation.undo()
if _point_type == PointType.POINT_IN:
_shape.set_point_in(_key, _old_value)
pa.set_point_in(_key, _old_value)
else:
_shape.set_point_out(_key, _old_value)
_shape.end_update()
pa.set_point_out(_key, _old_value)
pa.end_update()
7 changes: 3 additions & 4 deletions addons/rmsmartshape/actions/action_delete_point.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extends "res://addons/rmsmartshape/actions/action_delete_points.gd"

## ActionDeletePoint
extends SS2D_ActionDeletePoints
class_name SS2D_ActionDeletePoint


func _init(shape: SS2D_Shape, key: int, commit_update: bool = true) -> void:
Expand All @@ -9,5 +8,5 @@ func _init(shape: SS2D_Shape, key: int, commit_update: bool = true) -> void:


func get_name() -> String:
var pos := _shape.get_point_position(_keys[0])
var pos := _shape.get_point_array().get_point_position(_keys[0])
return "Delete Point at (%d, %d)" % [pos.x, pos.y]
Loading

0 comments on commit 148f3ee

Please sign in to comment.