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

UI: Improve block shapes #325

Merged
merged 5 commits into from
Dec 5, 2024
Merged

UI: Improve block shapes #325

merged 5 commits into from
Dec 5, 2024

Conversation

manuq
Copy link
Contributor

@manuq manuq commented Dec 2, 2024

  • Make entry blocks more distinguishable from the parameter blocks.
  • Change boolean blocks to be pointy.

Contribution from @DoomTas3r #273 so I marked the 2 relevant commits as authored by them, although I changed things aggressively. In particular:

  • The contributor kept the Panel in parameter block and parameter input, and toggled visibility with the added background. Instead I replaced the Panel by the background shape.
  • The pointy shape in this PR ensures 45 degrees.

Since I was there I also fixed the drag preview which was showing the statement block shape for all blocks. It now looks like this:
Grabación de pantalla desde 2024-12-04 17-54-01.webm

Note that sometimes the parameter block won't resize when inner blocks are moved out. But this is not a problem introduced by this PR. It happens in main too:
Grabación de pantalla desde 2024-12-04 18-01-14.webm

Fix #278
Fix #279

@manuq manuq force-pushed the new-shapes branch 2 times, most recently from 64fe001 to 609d19e Compare December 4, 2024 20:19
@manuq manuq marked this pull request as ready for review December 4, 2024 21:07
Copy link
Contributor

@starnight starnight left a comment

Choose a reason for hiding this comment

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

Thanks arrange this improvement. It makes more like logic flowchart!
However, I notice a bug and place suggestion.


func _on_definition_changed():
super()
_update_block_shape()
Copy link
Contributor

Choose a reason for hiding this comment

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

The _background accessed in _update_block_shape() is only available when the node has been ready. However, seems like _on_definition_changed() will be invoked by some where before this node becomes ready and shows error:

res://addons/block_code/ui/blocks/parameter_block/parameter_block.gd:29 - Invalid assignment of property or key 'is_pointy_value' with value of type 'bool' on a base object of type 'Nil'.

I think that here should add a if condition checking is_node_ready() before _update_block_shape().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch @starnight ! I appended a fixup commit. Adding await ready did the trick.

DoomTas3r and others added 5 commits December 5, 2024 11:30
To make entry blocks more distinguishable from the parameter blocks.

Add another drag area, a rectangle that approximates the added ellipsis
part. So the block can also be dragged from it. This drag area has a
fixed size and doesn't expand.

#278
Previously the parameter block and parameter input had a Panel node.
Unlike the other blocks which had a custom shape, provided by the
background control. But in the next commit we want to have different
shapes for value blocks.

So remove the panels and add background control nodes intead.
Mainly to test the background in isolation in a new Control scene.
Use a custom background drawing for parameter blocks and input that are
of type boolean.

#279
Previously all blocks had a statement shape as drag preview. Now that we
have a good mapping of blocks / shapes, use the corresponding shape.

A especial case is the control block which uses the background twice,
one for the top part and one for the bottom part. For simplicity, use
the statement shape in this case.

Also, move drag colors to constants.
@manuq manuq merged commit 493caa1 into main Dec 5, 2024
3 checks passed
@manuq manuq deleted the new-shapes branch December 5, 2024 14:31
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.

Change shape of booleans to be hexagonal Change shape of entry blocks to make them unique
3 participants