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

Flow graph control flow nodes - 1 #14327

Merged
merged 12 commits into from Sep 25, 2023

Conversation

carolhmj
Copy link
Contributor

@carolhmj carolhmj commented Sep 20, 2023

Changes

  • Add the following Control Flow nodes (lifted from: https://docs.google.com/document/d/1MT7gL-IEn_PUw-4XGBazMxsyqsxqgAVGYcNeC4Cj_9Q/edit#heading=h.m04l33f79oe5)

  • Counter

  • DoN

  • MultiGate

  • Switch

  • Throttle

  • WaitAll

  • WhileLoop

  • Move some nodes to the Control Flow directory:

  • ForLoop

  • Timer

  • Conditional

  • To set a value on a FlowGraphDataConnection point, now you need to specify a context. This is because, if we have the same graph running with multiple contexts, the value of a data connection can be different between them. I wasn't differentiating them before, which was an oversight.

  • When a block executes, it now knows which of its input signals activated the block. This is needed for blocks that have a "reset" input, such as some of the conditional blocks added.

Example PGs

  • #RKQX23#10: DoN - Click on the sphere to log a message max 5 times, click on the box to reset the DoN counter
  • #BWRXG9#2: Throttle - Log a message every 3 seconds using onTick event and Throttle, click on the sphere to reset the throttle
  • #RKQX23#7: Multigate - without looping, click on the sphere to log the number of execution
  • #RKQX23#8: Multigate - with looping, click on the sphere to log the number of execution
  • #RKQX23#9: Multigate - with looping and randomizing, click on the sphere to log the number of execution
  • #RKQX23#6: Switch - Change the switch's value on the code
  • #J1N2GP#5: Wait all - Click on the 3 spheres to open the door, click on the box to reset the wait all count
  • #9C7VK6#1: Counter - Log the value on the counter after a delay, explore the value in two different contexts
  • #5JFH79#7: While loop - Logs from 1 to 5

@bjsplat
Copy link
Collaborator

bjsplat commented Sep 20, 2023

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@deltakosh
Copy link
Contributor

Yes I was surprised by the lack of context but now it makes total sense. Very close to NGE actually

Looks good to me

@bjsplat
Copy link
Collaborator

bjsplat commented Sep 20, 2023

Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

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

A few general comments:

  1. Codedoc is missing on different functions and classes
  2. Reusing objects and avoiding GC should be implemented wherever possible.

Otherwise - looks great!

carolhmj and others added 2 commits September 21, 2023 09:12
Copy link
Member

@RaananW RaananW left a comment

Choose a reason for hiding this comment

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

There are some conflicts to be resolved

Copy link
Member

@sebavan sebavan left a comment

Choose a reason for hiding this comment

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

A lot of the public properties/functions do not have code comments.

@carolhmj
Copy link
Contributor Author

A lot of the public properties/functions do not have code comments.

@sebavan do you mean the _updateOutputs and _execute functions? These are just overriding the existing functions in the base block, should I add this as a comment in all of them?

@carolhmj
Copy link
Contributor Author

@sebavan added some more docstrings

@sebavan
Copy link
Member

sebavan commented Sep 25, 2023

A lot of the public properties/functions do not have code comments.

@sebavan do you mean the _updateOutputs and _execute functions? These are just overriding the existing functions in the base block, should I add this as a comment in all of them?

Oh no sorry I mainly mean properties like
image

_functions being internal by conventions are a bit less important knowing they are defined in the base class.

@carolhmj
Copy link
Contributor Author

A lot of the public properties/functions do not have code comments.

@sebavan do you mean the _updateOutputs and _execute functions? These are just overriding the existing functions in the base block, should I add this as a comment in all of them?

Oh no sorry I mainly mean properties like image

_functions being internal by conventions are a bit less important knowing they are defined in the base class.

@sebavan oh that makes sense 😄 thanks for catching them, I added comments to where I found them 😸

@bjsplat
Copy link
Collaborator

bjsplat commented Sep 25, 2023

Visualization tests for webgl1 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14327/merge/testResults/webgl1/index.html

If tests were successful afterwards, this report might not be available anymore.

@bjsplat
Copy link
Collaborator

bjsplat commented Sep 25, 2023

Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14327/merge/testResults/webgl2/index.html

If tests were successful afterwards, this report might not be available anymore.

@bjsplat
Copy link
Collaborator

bjsplat commented Sep 25, 2023

Visualization tests for webgl1 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14327/merge/testResults/webgl1/index.html

If tests were successful afterwards, this report might not be available anymore.

@bjsplat
Copy link
Collaborator

bjsplat commented Sep 25, 2023

Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14327/merge/testResults/webgl2/index.html

If tests were successful afterwards, this report might not be available anymore.

@sebavan sebavan merged commit 861e1d6 into BabylonJS:master Sep 25, 2023
10 checks passed
@carolhmj carolhmj deleted the flowGraphControlFlowNodes branch October 3, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants