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
Expression parser improvements #7663
Expression parser improvements #7663
Conversation
0aed2d4
to
0a3f023
Compare
7063eae
to
e0ac877
Compare
d58fb6d
to
3e11b4c
Compare
6a06f9b
to
b51642b
Compare
08f4e43
to
35d02f8
Compare
Source/Core/InputCommon/ControlReference/FunctionExpression.cpp
Outdated
Show resolved
Hide resolved
Source/Core/InputCommon/ControlReference/FunctionExpression.cpp
Outdated
Show resolved
Hide resolved
848ed64
to
dbfeada
Compare
Source/Core/InputCommon/ControlReference/FunctionExpression.cpp
Outdated
Show resolved
Hide resolved
|
|
||
| connect(m_expression_text, &QPlainTextEdit::textChanged, [this] { | ||
| m_apply_button->setText(m_apply_button->text().remove(QStringLiteral("*"))); | ||
| m_apply_button->setText(m_apply_button->text() + QStringLiteral("*")); |
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.
This looks...weird. Why does it have to be done this way (not to mention: why at all?)
Is this trying to add an asterisk as "hey, something changed!" indicator at the end of the apply text?
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.
Yes. That is what it's doing. :)
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.
Kinda gets the job done, but feels a little roundabout...but I cannot really think of a better way to do this though other than moving it to a method (or providing a shown/hidden text instead of changing the button text)
15d1ff9
to
f9a4ddd
Compare
d6d6e83
to
87f8166
Compare
0e89e2b
to
4dc4bab
Compare
|
The |
| } | ||
|
|
||
| m_functions_combo = new QComboBox(); | ||
| m_functions_combo->addItem(tr("Functions")); |
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.
Not needed in this PR but even with documentation available it might be helpful to have some sort of description box. Many of these are self explanatory but a couple aren't as obvious.
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.
We could have a wiki page with documentation on the functions.
…ld for N seconds.
… to 2) taps within Y seconds.
…onds for each press.
…unctions so people are semi-aware of them. Fixed the "Apply" button. Display an error message on expression parse error.
…sed serialization functions.
… Hotplug would make that problematic.
d586213
to
b4e2b3c
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.
Code seems good, untested.
|
I've tested this a bit and it seems to work. I'm nervous about how it'll end up with people who do more complex things than I do, but it's the middle of the month and if there are any major issues, they should be sorted out before the monthly build. |
|
It would be wise having a wiki page or something detailing everything the Expression Parser supports now before the next Progress Report. Also, does it break anything configured on the "older" syntax? |
|
Trial by fire I guess? We do need a wiki page (and maybe a help page somewhere in the controller configuration that links to that wiki page?) Dolphin's controller configuration is awesome, but it's really complicated to use some of these features. It took me a long time. |
|
@mbc07 The only thing that should be broken is that a typical order of operations is now obeyed. |
Demonstrations (note: syntax has changed. function names used to be prefixed with !)
https://i.imgur.com/9wCT3sH.gif
https://i.imgur.com/codD9p2.gif
https://i.imgur.com/PbeGoKl.gif
Added syntax highlighting and parse result display:
https://giant.gfycat.com/GlaringOddballGenet.webm
https://giant.gfycat.com/BasicScaredBarracuda.webm
When a function is inserted with the improper number of arguments the expected arguments are shown in the parse-result textbox.
Literals are now supported, e.g.
`Trigger R`+0.25This is useful for:
Additional binary and unary operators have been added for advanced configurations:
, * - / % < > sin ifetc.Added a
togglefunction whose state toggles on/off when its inner expression is activated.This allows for any mapped input in Dolphin to be toggled on and off rather than held without needing separate "toggle" settings.
Added special function named
timerwhich increases from 0.0 to 1.0 every N seconds.timer(1/2)for a 2Hz timer.Added named variables and assignment operator, e.g.
$my_var=`Button 1`Outputs and Inputs can now be used in the same expression.
`Motor R`=`Button 1`will set rumble motor on when pressing a button.Added comma operator which behaves like it does in c++ to string together expressions.
C++-style operator precedence is now followed.
FYI, multi-line expressions fail to save because of our ini-file code.
This will fix (or at least alleviate) these issues:
https://bugs.dolphin-emu.org/issues/5531
https://bugs.dolphin-emu.org/issues/6513
https://bugs.dolphin-emu.org/issues/6827
https://bugs.dolphin-emu.org/issues/7636
https://bugs.dolphin-emu.org/issues/11187