-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
Can now add default values to parameter inputs. Will be helpful for dropdown. |
Added dropdowns, condensing some of the logic blocks for example. |
addons/block_code/types/types.gd
Outdated
@@ -12,14 +12,16 @@ enum BlockType { | |||
VECTOR2, | |||
BOOL, | |||
COLOR, | |||
NODE | |||
NODE, | |||
OPTION |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
This is looking great! |
945cade
to
8d7e49f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
if option: | ||
_panel.visible = false |
There was a problem hiding this comment.
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
(...)
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
Dropdown still has to be fixed/reimplemented with new type system
84635e7
to
1470758
Compare
Had to rebase again, should be good now. |
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