Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

category_factory: Add another Sounds blocks for GDScript flavor #174

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

starnight
Copy link
Contributor

@starnight starnight commented Jul 30, 2024

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 starnight force-pushed the T35582-refactor-sounds branch from e29c594 to 3508c2a Compare July 30, 2024 06:43
@starnight starnight requested review from manuq and wnbaum July 30, 2024 06:44
@starnight
Copy link
Contributor Author

starnight commented Jul 30, 2024

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
Copy link
Contributor

manuq commented Jul 30, 2024

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 #172

@starnight starnight force-pushed the T35582-refactor-sounds branch from 3508c2a to 7919803 Compare July 31, 2024 03:58
@starnight
Copy link
Contributor Author

starnight commented Jul 31, 2024

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 #174 (comment).

@starnight
Copy link
Contributor Author

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

@starnight starnight force-pushed the T35582-refactor-sounds branch from 7919803 to e31dc69 Compare August 1, 2024 03:51
starnight added a commit that referenced this pull request Aug 1, 2024
Preloading a scene may be failed, because Godot engine has not prepared
the resource ready. And, shows "Parse Error: [ext_resource] referenced
non-existent" error [1]:

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()

So, use load() to replace preload() the scene.

[1]: #174 (comment)
starnight added a commit that referenced this pull request Aug 1, 2024
Preloading a scene may be failed, because Godot engine has not prepared
the resource ready. And, shows "Parse Error: [ext_resource] referenced
non-existent" error [1]:

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()

So, use load() to replace preload() the scene.

[1]: #174 (comment)
@manuq
Copy link
Contributor

manuq commented Aug 1, 2024

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 starnight force-pushed the T35582-refactor-sounds branch from e31dc69 to c9f659a Compare August 2, 2024 03:10
@starnight
Copy link
Contributor Author

Rebase on main branch again.

@starnight starnight force-pushed the T35582-refactor-sounds branch 3 times, most recently from 7ee8eb4 to bc29651 Compare August 9, 2024 04:23
@starnight
Copy link
Contributor Author

starnight commented Aug 9, 2024

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 starnight force-pushed the T35582-refactor-sounds branch 3 times, most recently from 621fe34 to 6b6adb9 Compare August 13, 2024 03:50
@starnight starnight changed the title category_factory: Refactor the Sounds blocks for GDScript flavor category_factory: Add another Sounds blocks for GDScript flavor Aug 13, 2024
@starnight
Copy link
Contributor Author

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

@starnight starnight force-pushed the T35582-refactor-sounds branch from 6b6adb9 to 50e9215 Compare August 13, 2024 03:55
Copy link
Contributor

@manuq manuq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Please squash the commits before merging. One commit is undoing a previous commit.

@starnight starnight force-pushed the T35582-refactor-sounds branch from 50e9215 to a7ff0c5 Compare August 14, 2024 03:06
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.

[1]: #161 (comment)

https://phabricator.endlessm.com/T35609
@starnight starnight force-pushed the T35582-refactor-sounds branch from a7ff0c5 to dbdaca8 Compare August 14, 2024 03:21
@starnight
Copy link
Contributor Author

Tweaked the commits and merge it.

@starnight starnight merged commit 3ba53f5 into main Aug 14, 2024
2 checks passed
@starnight starnight deleted the T35582-refactor-sounds branch August 14, 2024 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants