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

Differentiate parameter input based on type #33

Merged
merged 7 commits into from
Jun 19, 2024
Merged

Conversation

wnbaum
Copy link
Contributor

@wnbaum wnbaum commented Jun 14, 2024

The parameter input should change based on what is being inputted. For example, if we have a color input, we should show a color picker. For a Vector2 input we should have two inputs for each component ideally, though at the moment you have to input 0,0 for example.

I've implemented the color picker. We should also be able to set a default value for the parameter input. In StatementBlock where we create a parameter based on a string like {test: STRING}, we should be able to give it a default value like
{test: STRING = "Hello World!"}.

We could also have a new type called DROPDOWN that exposes text options to the user to modify the block.

https://phabricator.endlessm.com/T35505

@wnbaum
Copy link
Contributor Author

wnbaum commented Jun 17, 2024

Can now add default values to parameter inputs. Will be helpful for dropdown.

@wnbaum
Copy link
Contributor Author

wnbaum commented Jun 17, 2024

Added dropdowns, condensing some of the logic blocks for example.

@@ -12,14 +12,16 @@ enum BlockType {
VECTOR2,
BOOL,
COLOR,
NODE
NODE,
OPTION
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is still in draft, but IMO option is not a block type, it's something inside a block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I was just reusing the parameter input generation we already had, because it ties into the code generation, and it basically is just a parameter input with some default text values. I suppose I can implement another component for this and add different syntax to create them in the StatementBlock formatting code if you think that's better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do it a different way since you merged the new typing stuff, just rebased.

@manuq
Copy link
Contributor

manuq commented Jun 18, 2024

Added dropdowns, condensing some of the logic blocks for example.

This is looking great!

@wnbaum wnbaum marked this pull request as ready for review June 18, 2024 20:38
@wnbaum wnbaum requested a review from manuq June 18, 2024 20:38
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 great!

Comment on lines +40 to +41
if option:
_panel.visible = false
Copy link
Contributor

Choose a reason for hiding this comment

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

You can save some indentation by returning earlier:

	if not option:
		return

	_panel.visible = false
	(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The diff looks kind of weird, but I can't return early because if option is false I want to do the normal variant_type logic.



func get_raw_input():
if option:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here about the early return for indentation.

@wnbaum
Copy link
Contributor Author

wnbaum commented Jun 19, 2024

Had to rebase again, should be good now.

@wnbaum wnbaum merged commit a9d6a1d into main Jun 19, 2024
2 checks passed
@wnbaum wnbaum deleted the typed-parameter-input branch June 19, 2024 18:54
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