Closed manuq closed 2 months ago
Here is more porting to the new block definitions. Compared with @wnbaum PR, this is using resource files, not through code like in https://github.com/endlessm/godot-block-coding/pull/147/commits/f390ae83057e050084dcd5b580c4934a21a4e015#diff-d355da8c634915f2c506c52aaf96eba422696b3c4b7cf0362804bd673b3a4767R431-R438
Should we transform the data type of raw_input, before assign to _line_edit.text
? It shows error with Godot 4.3:
res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd:65 - Invalid assignment of property or key 'text' with value of type 'float' on a base object of type 'LineEdit'.
Should we transform the data type of raw_input, before assign to
_line_edit.text
? It shows error with Godot 4.3:res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd:65 - Invalid assignment of property or key 'text' with value of type 'float' on a base object of type 'LineEdit'.
Yes, thanks for pointing @starnight. I'll do it. The original PR has this in https://github.com/endlessm/godot-block-coding/pull/147/commits/0946f373d56fe69547fe80f4c1d84824f762f270 but that commit doesn't work well in isolation.
I migrated the property blocks and the custom blocks. But now I have to change the tests.
I read through all this and it looks good to me! It would be nice to make the InputMap stuff happen without the hack in
blocks_catalog
, but I don't feel like we need to do that here. (And I was going to mess around with that type of thing in #191). This already lands us a significant upgrade from the previous setup :)
Thanks for taking a deep look @dylanmccall . Now it should also work and tests are passing again. This is because the last commit which is basically @wnbaum 0946f373 plus some of 073eddda (the raw_input_to_code_string(input)
).
Should we transform the data type of raw_input, before assign to
_line_edit.text
? It shows error with Godot 4.3:res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd:65 - Invalid assignment of property or key 'text' with value of type 'float' on a base object of type 'LineEdit'.
Adressed in commit 8d18e338
@starnight @dylanmccall @dbnicholson I think this is ready for a final review. Compared with the original PR #147:
@export var target_node_class: String
was added to the BlockDefinition.Thank you @manuq! It is a big code refactoring.
However, I notice if I add BlockCode under SimpleCharater and SimpleScoring node, it shows error:
Cannot get class 'SimpleCharacter'.
Cannot get class 'SimpleScoring'.
Thank you @manuq! It is a big code refactoring.
However, I notice if I add BlockCode under SimpleCharater and SimpleScoring node, it shows error:
Cannot get class 'SimpleCharacter'. Cannot get class 'SimpleScoring'.
I see it now, thanks. It seems that the block catalog is trying to add their blocks too early. If I switch to another BlockCode and then back to the SimpleCharacter one, I see the custom blocks.
Thank you @manuq! It is a big code refactoring. However, I notice if I add BlockCode under SimpleCharater and SimpleScoring node, it shows error:
Cannot get class 'SimpleCharacter'. Cannot get class 'SimpleScoring'.
I see it now, thanks. It seems that the block catalog is trying to add their blocks too early. If I switch to another BlockCode and then back to the SimpleCharacter one, I see the custom blocks.
This is now fixed with the 2 last fixups. And the picker logic for custom blocks is much cleaner now! Because the _get_subclasses(_class_name)
utility now handles custom classes. For example for SimpleCharacter it will get:
["SimpleCharacter", "CharacterBody2D", "PhysicsBody2D", "CollisionObject2D", "Node2D", "CanvasItem", "Node", "Object"]
This would welcome a unit test.
I just redid the Pong example with the new blocks in the PR. While doing it, I've found that there is a hack adding suffix "__nil__"
in some parameter inputs in the original PR. I don't quite understand why that was needed in the original PR, but removing it makes things work again. So I appended another fixup.
https://phabricator.endlessm.com/T35591