TextOverlayDataset is a pip-installable package which generates text images from text and image datasets. For a simple project, it turned out to be surprisingly involved. I would mark April as largely a success, though the delivery landed after the two-week mark I set for myself. The project also bled over (or, rather, had outside involvement which led me to revisit it) into May, which is much less fortunate. Nonetheless, I’m happy with the project and will keep working on it as time allows.
I started this project a little late in the month. Initial plan was to use the Team Dogpit Jam for the February activity, but that’s been postponed because of weather troubles and power outages in Texas. My substitute project is a small scriptable text tool.
A few times a week I find myself needing to decode something in base64, wanting to pick apart a JWT token, or needing to nicely format some JSON. Sure, I can post each of these into an untrusted website or, in the base64 case, throw pbpaste | base64 --decode | pbcopy into the terminal, but I’d like something that’s fairly low resource, extensible, and serves the singular purpose of running tiny scripts on text inputs.
The proposed text tool has two fields: one for running a plugin (with autocomplete and suggestions) and another area which takes a big block of text and gets replaced with another block of text. Support for multiple scripting languages is great, but ultimately not worth it if it pushes the project past the time limit. There should be a clean, minimal UI with friendly features like autocomplete (suggest) and keyboard shortcuts for copy/paste into specific command areas.
===
Update: Despite the late start, I was able to wrap up this project. It’s not quite where I want it to be, but when is it ever? The full source is available on my GitHub page at https://github.com/JosephCatrambone/TextUtil . It needs a documentation pass and a lot of code cleanup, but it works. Here’s a demo of me invoking the base64 decode plugin, using a keyboard shortcut to jump back to the command entry, and invoking the ‘hello_world’ plugin.
I made an orbital camera controller for someone who wanted help on the Godot Discord channel. Here’s the source. When applied to a Camera Node it gives this kind of behavior:
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
var mouse_accumulator:Vector2 = Vector2() # The reason we have this instead of using the mouse.position is 'cause when we capture the camera, this will always be 0.
func _ready():
follow_target = get_node(follow_target_path)
func _process(delta):
# Looking. Rotate _this_. Tilt _camera_.
mouse_accumulator += last_mouse_delta # TODO: Cap the Y component.
last_mouse_delta = Vector2() # Reset after we process the mouse so we don't accumulate between events.
# Calculate our new position.
var look_target = follow_target.global_transform.origin + Vector3(0, follow_height, 0)
The player controller is fairly straightforward, so I’ve not included it as a separate gist. For a Kinematic Player, one can move relative to the camera direction like so:
extends KinematicBody
export var walk_speed:float = 5.0
func _process(delta):
# Walking in the direction the camera is pointing.
var camera = get_viewport().get_camera()
var dy = int(Input.is_action_pressed("move_forward")) - int(Input.is_action_pressed("move_backward"))
var dx = int(Input.is_action_pressed("move_left")) - int(Input.is_action_pressed("move_right"))
var move = (camera.global_transform.basis.x * -dx) + (camera.global_transform.basis.z * -dy)
move = Vector3(move.x, 0, move.z).normalized() # Take out the 'looking down' component.
self.move_and_slide(move*walk_speed)