itch.io is community of indie game creators and players

Devlogs

New Year Progress

Node2D Gizmo
A downloadable plugin

Here are some updates on my progress. I have been fiddling with my workflow; now I have the project nicely split up into different repositories: one for the plugin, one for tests, one for documentation, for marketing, etc. There's promise in the use of submodules to manage dependencies during development (there are no dependencies for this, but for another plugin there may be), but one must note that the submodules cannot be used in the distribution repo, if you're publishing through the Asset Library: the contents of the submodules are not included in git archives. I haven't worked this out yet, but it's turned out to be unnecessary to use submodules at all for now.

The interface is changing slightly after all; here's what add_handle() looks like right now:

add_handle(
    "vec",
    HandleInfo.ConversionType.CONVERSION_POSITION, # default? !
    Color.GREEN, # default!
    HandleInfo.DrawFlag.DRAW_KNOB,
    HandleInfo.OptionFlag.OPT_DEFAULT, # default !
    HandleInfo.KeyFlag.KEY_DEFAULT, # default !!
    Vector2.UP, # default
)

No one has purchased or downloaded this anyway, so it's not a big deal. It will change further; since I'm the only one testing it right now, the "default" comments are there to inform which of these parameters gets shoved to the back for the final version. Speaking of testing, I've discovered GUT, a plugin implementing a unit test framework for GDscript. Incredibly useful, I would highly-recommend it to anyone.

There's a bug in draw_knob_label() as-is, interferes with the Handle's transform. The bug didn't present itself until I fully-decoupled the Handle class from the resource it now uses to store data, but it had to have been there all along. My unit tests were all passing, so I had to track down the responsible section with print() and print_stack() -- unpleasant. Now that I've found it, of course I'll write a new test.

What was happening is this: In order to get the strings to be displayed correctly, you have to actually call draw_set_transform_matrix before drawing them at all. This is semi-tricky... look how the labels are supposed to be placed:

You have to rotate, translate, and scale the transform passed into draw_set_transform_matrix(), and then you have to change it back -- I also for some reason am setting the handle's transform as part of the process, if it's to the left of its node... it made no sense as I was writing it, and it makes no sense now. It worked well enough, but I knew that section was a mess.

Anyway, once I fix this, the next thing on my list is adding an interface to create handles on the fly from the editor, without having to subclass the plugin. That'd be better, right?

Download Node2D Gizmo
Leave a comment