Skip to content

Conversation

@manuq
Copy link
Contributor

@manuq manuq commented Jun 25, 2024

No description provided.

Copy link
Contributor

@wnbaum wnbaum left a comment

Choose a reason for hiding this comment

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

Nice! Looks a lot cleaner! I suppose we don't even need SignalManager anymore... I made that more complicated than I needed to hah.

See comments for small changes.

b.block_format = "Send signal {signal: STRING} to node {node: NODE_PATH}"
b.statement = 'if get_tree().root.has_node("SignalManager"):\n' + '\tget_tree().root.get_node_or_null("SignalManager").send_signal_to_node({node}, {signal})'
b.block_format = "Call method {method_name: STRING} in node {node_path: NODE_PATH}"
b.statement = (
Copy link
Contributor

Choose a reason for hiding this comment

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

This generates code that looks like this:

func _on_body_entered(_body: Node2D):
	var body: NodePath = _body.get_path()

	var node = get_node(body)
	if node:
		node.call('test')

We should probably have both the signal and the "call method in node" block work with TYPE_OBJECT instead of TYPE_NODE_PATH. We can do this in another PR.

Copy link
Contributor Author

@manuq manuq Jun 25, 2024

Choose a reason for hiding this comment

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

Yeah. After all the type discussions I realize that we should have 2 types of Value blocks:

  • Variant block
  • Node block

The Value node blocks can have a hint like "Node2D" for parameters. Basically the PROPERTY_HINT_NODE_TYPE in global scope. But yes let's think about this as a group after the MVP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This generates code that looks like this:

func _on_body_entered(_body: Node2D):
	var body: NodePath = _body.get_path()

	var node = get_node(body)
	if node:
		node.call('test')

We should probably have both the signal and the "call method in node" block work with TYPE_OBJECT instead of TYPE_NODE_PATH. We can do this in another PR.

By the way is this something that have regressed? I think it was like this before the multi-line change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aha, yes, that would be good. Maybe we don't have to make a new block since a node block is really a value too? We could just add a new property to value block or extend it.

We'll discuss!

await get_tree().root.ready
"""
. dedent()
)
Copy link
Contributor

Choose a reason for hiding this comment

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

dedent() is nice! Didn't know about it but would have done it this way if I had :)

)
% [verb]
)
b.signal_name = "body_%s"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
b.signal_name = "body_%s"
b.signal_name = "body_%s" % [verb]

Don't forget the string replacement here!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good catch!

manuq added 3 commits June 25, 2024 15:14
This is more readable. Even with the extra parenthesis added by the
gdformat formatter.
The rest of the blocks match the GDScript nomenclature. Except for a few
"simple" or higher level abstractions.

This also removes the signal manager. Keep the await for scene ready in
a separate block so it can be used explicitly when needed. Add it to the
Lifecycle category.

Keep the category "Signal" for now as they need overhaul in ordering and
colors.
This is not needed anymore. This breaks the Pong demo, but it will be
redone soon when things stabilize.
@manuq manuq force-pushed the multiline-and-renaming branch from 69a745e to 124a7cf Compare June 25, 2024 18:18
@manuq
Copy link
Contributor Author

manuq commented Jun 25, 2024

I suppose we don't even need SignalManager anymore

Yes, the only reason I left it was to avoid breaking the Pong demo. But it has to be redone anyways as the blocks changed, categories changed, etc.

@wnbaum wnbaum self-requested a review June 25, 2024 18:25
Copy link
Contributor

@wnbaum wnbaum 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 to me now!

@manuq manuq merged commit 794a015 into main Jun 25, 2024
@manuq manuq deleted the multiline-and-renaming branch June 25, 2024 18:29
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.

3 participants