endlessm / godot-block-coding

Block-based visual programming plugin for Godot
https://godotengine.org/asset-library/asset/3095
MIT License
244 stars 16 forks source link

category_factory: Add another Sounds blocks for GDScript flavor #174

Closed starnight closed 1 month ago

starnight commented 1 month ago

According to the discussion 1, add the sound blocks into function get_built_in_blocks()'s class matching. It generates blocks belonging to AudioStreamPlayer node, including setting the property's value.

Therfore, we have sound blocks in both types of general script and GDScript flavor.

https://phabricator.endlessm.com/T35609

starnight commented 1 month ago

The Pong game plays, but the Wall hit and Score sound do not play. I found Ball's BlockCode node of Pong example hits snap_point error:

E 0:00:00:0415   _parse_ext_resource: res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn:178 - Parse Error: [ext_resource] referenced non-existent resource at: res://addons/block_code/ui/blocks/utilities/snap_point/snap_point.tscn
  <C++ Source>   scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()
E 0:00:00:0430   _parse_ext_resource: res://addons/block_code/ui/blocks/utilities/parameter_output/parameter_output.tscn:30 - Parse Error: [ext_resource] referenced non-existent resource at: res://addons/block_code/ui/blocks/utilities/snap_point/snap_point.tscn
  <C++ Source>   scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()
manuq commented 1 month ago

The Pong game plays, but the Wall hit and Score sound do not play. I found Ball's BlockCode node of Pong example hits snap_point error:

E 0:00:00:0415   _parse_ext_resource: res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn:178 - Parse Error: [ext_resource] referenced non-existent resource at: res://addons/block_code/ui/blocks/utilities/snap_point/snap_point.tscn
  <C++ Source>   scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()
E 0:00:00:0430   _parse_ext_resource: res://addons/block_code/ui/blocks/utilities/parameter_output/parameter_output.tscn:30 - Parse Error: [ext_resource] referenced non-existent resource at: res://addons/block_code/ui/blocks/utilities/snap_point/snap_point.tscn
  <C++ Source>   scene/resources/resource_format_text.cpp:163 @ _parse_ext_resource()

Yes, this is https://github.com/endlessm/godot-block-coding/issues/172

starnight commented 1 month ago

Rebase on main branch for fixed #172. Paddle & Wall hit and Score play the sounds now.

Although, there is still the error message shown in https://github.com/endlessm/godot-block-coding/pull/174#issuecomment-2258002046.

starnight commented 1 month ago

Although, there is still the error message shown in #174 (comment).

The main branch has the same Parse Error: [ext_resource] referenced non-existent resource error. Looks like relating to https://github.com/godotengine/godot/pull/71004

manuq commented 1 month ago

Although, there is still the error message shown in #174 (comment).

The main branch has the same Parse Error: [ext_resource] referenced non-existent resource error. Looks like relating to godotengine/godot#71004

Thank you for noticing the parse error and working on it!

starnight commented 1 month ago

Rebase on main branch again.

starnight commented 1 month ago

Rebase on main branch again. To avoid Pong game's conflict, I dropped the Pong example game's modification commit. We can have another Pong example game commit after the big refactor.

But, The test fails at the error, due to the nonexistent functions:

res://tests/test_category_factory.gd
* test_general_category_names
SCRIPT ERROR: Invalid call. Nonexistent function 'get_general_blocks' in base 'GDScript'.
          at: test_general_category_names (res://tests/test_category_factory.gd:29)
SCRIPT ERROR: Invalid call. Nonexistent function 'get_inherited_blocks' in base 'GDScript'.
          at: get_class_category_names (res://tests/test_category_factory.gd:22)
    [Risky]:  test_general_category_names did not assert
* test_inherited_category_names<parameterized>
    - params[0](["Node2D", ["Transform | Position", "Transform | Rotation", "Transform | Scale", "Graphics | Modulate", "Graphics | Visibility"]])
SCRIPT ERROR: Invalid call. Nonexistent function 'get_inherited_blocks' in base 'GDScript'.
          at: get_class_category_names (res://tests/test_category_factory.gd:22)
    [Failed]:  params[0] ARRAY([]) != ARRAY(["Transform | Position", "Transform | Rotation", "Transform | Scale", "Graphics | Mo...ibility"]).
    [] != ["Transform | Position", "Transform | Ro...sibility"]  5 of 5 indexes do not match.  
      at line -1
    - params[1](["Sprite2D", ["Transform | Position", "Transform | Rotation", "Transform | Scale", "Graphics | Modulate", "Graphics | Visibility"]])
SCRIPT ERROR: Invalid call. Nonexistent function 'get_inherited_blocks' in base 'GDScript'.
          at: get_class_category_names (res://tests/test_category_factory.gd:22)
SCRIPT ERROR: Invalid call. Nonexistent function 'get_inherited_blocks' in base 'GDScript'.
          at: get_class_category_names (res://tests/test_category_factory.gd:22)
    [Failed]:  params[1] ARRAY([]) != ARRAY(["Transform | Position", "Transform | Rotation", "Transform | Scale", "Graphics | Mo...ibility"]).
    [] != ["Transform | Position", "Transform | Ro...sibility"]  5 of 5 indexes do not match.  
      at line -1
    - params[2](["Node", []])
    - params[3](["Object", []])
SCRIPT ERROR: Invalid call. Nonexistent function 'get_general_blocks' in base 'GDScript'.
          at: test_unique_block_names (res://tests/test_category_factory.gd:[64](https://github.com/endlessm/godot-block-coding/actions/runs/10313448042/job/28550409459#step:5:65))
SCRIPT ERROR: Invalid call. Nonexistent function 'get_general_blocks' in base 'GDScript'.
          at: before_each (res://tests/test_instruction_tree.gd:30)
SCRIPT ERROR: Invalid call. Nonexistent function 'get_general_blocks' in base 'GDScript'.
          at: before_each (res://tests/test_instruction_tree.gd:30)
* test_unique_block_names
    [Risky]:  test_unique_block_names did not assert
starnight commented 1 month ago

After discussion, we are going to keep sound blocks in both both types of general script and GDScript flavor.

starnight commented 1 month ago

Tweaked the commits and merge it.