loopier / animatron

Animatron for Godot 4.x <
15 stars 1 forks source link

Using `/color` crashes the app #13

Closed loopier closed 9 months ago

loopier commented 9 months ago

When I run

/load mama
/create ma mama
/color ma 1 0 0

It crashes

Invalid get index 'type' (on base: 'Nil').
res://CommandInterface.gd:181 - at function: parseCommand
// etc ...

Aparently result is null.

totalgee commented 9 months ago

This happens for commands (like /color) that are executed from the code editor, where the arguments are all strings. When executed from OSC (e.g. from SC), they typically come in with the correct type (e.g. float), so the call succeeds. This is related (due) to this issue, since these coreCommands are called using Callable.callv().

Unfortunately, the workaround for now (I guess) is to have functions such as colorActor() not use static typing for their (e.g. float) arguments, but leave arguments untyped. Then, in the function, use var r := red as float (or similar) to convert the untyped argument (which may be strings, integers) to the desired "compatible" type (float, in this case).

I'll make a fix/workaround for this.

totalgee commented 9 months ago

Fixed in main and develop.