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

Add Get Property from Node expression block #34

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dylanmccall
Copy link
Contributor

@dylanmccall dylanmccall commented Jun 15, 2024

@dylanmccall dylanmccall requested review from manuq and wnbaum June 15, 2024 01:07
@dylanmccall
Copy link
Contributor Author

I did start to rebase this, but it looks like there's an unrelated issue in main blocking me from testing it (and fixing my examples), so I'll leave this with the conflicts for now. I did realize that a To String {int: INT} block was added today, so, we'll have to sort that out, but I think having an As String {value: VARIANT} makes more sense, especially if we can get those variant inputs to accept all the concrete types as well :)

@dylanmccall dylanmccall force-pushed the T35497-object-properties branch 2 times, most recently from 1b1415e to 8dfa35c Compare June 17, 2024 21:04
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.

This looks good to me. I left a comment for the Variant type and suggestions.

Ideally learners should not have to enter property names or node names by text. I remember plugins opening a node selector. Maybe we should do that for blocks with a node parameter. It seems that PROPERTY_HINT_NODE_TYPE can be useful. The alternative is to traverse the tree and create blocks like "This object".

@@ -83,6 +83,11 @@ static func get_general_categories() -> Array[BlockCategory]:
b.statement = "print({text})"
test_list.append(b)

b = BLOCKS["statement_block"].instantiate()
b.block_format = "print value {value: VARIANT}"
Copy link
Contributor

Choose a reason for hiding this comment

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

What about not passing a type at all when type is not needed? Something like "print value {value}" is assumed to have no type. So this can match #43 better.

Ultimately I think we should get rid of serialized_props and stop converting back and forth from enum types to strings. And have resources for every block, with parameters as exported properties.

addons/block_code/ui/picker/categories/category_factory.gd Outdated Show resolved Hide resolved
addons/block_code/ui/picker/categories/category_factory.gd Outdated Show resolved Hide resolved
addons/block_code/ui/picker/categories/category_factory.gd Outdated Show resolved Hide resolved
addons/block_code/ui/picker/categories/category_factory.gd Outdated Show resolved Hide resolved
addons/block_code/ui/picker/categories/category_factory.gd Outdated Show resolved Hide resolved
test_game/test_game.tscn Outdated Show resolved Hide resolved
test_game/test_game.tscn Outdated Show resolved Hide resolved
test_game/test_game.tscn Outdated Show resolved Hide resolved
test_game/test_game.tscn Outdated Show resolved Hide resolved
@dylanmccall dylanmccall marked this pull request as draft June 19, 2024 23:47
@dylanmccall dylanmccall changed the title Add Variant type, and Get Property from Node expression block Add Get Property from Node expression block Jun 19, 2024
@dylanmccall dylanmccall force-pushed the T35497-object-properties branch from 6c2ef3a to 7f9a689 Compare June 19, 2024 23:57
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