-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
opacity binding #1972
base: master
Are you sure you want to change the base?
opacity binding #1972
Conversation
…isplayed on the cheatsheet, it only updates when another binding is called
I don't think it's your code, the cheat sheet is only updated if it has been invalidated, and it doesn't look like it is (yet) when changing the opacity, see f3d/vtkext/private/module/vtkF3DRenderer.cxx Lines 1154 to 1162 in dc202ae
f3d/vtkext/private/module/vtkF3DRenderer.cxx Lines 1678 to 1685 in dc202ae
@mwestphal this f3d/library/src/interactor_impl.cxx Line 890 in dc202ae
should it go just before all the this->addBinding s instead?
also should the bindings added by this PR go on the |
library/src/interactor_impl.cxx
Outdated
std::stringstream valStream; | ||
valStream.precision(2); | ||
valStream << std::fixed; | ||
val.has_value() ? (valStream << val.value()) : (valStream << 1.0); |
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.
ternary operator as a replacement for if else
without assigning the value looks confusing, would be clearer as:
val.has_value() ? (valStream << val.value()) : (valStream << 1.0); | |
valStream << (val.has_value() ? val.value() : 1.0); |
and then std::optional
already has a shortcut for this pattern
val.has_value() ? (valStream << val.value()) : (valStream << 1.0); | |
valStream << val.value_or(1.0); |
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.
fixed, though I just realized I can do the same in IncreaseOpacity(). I will address it in the next commit.
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.
Actually, I am also now realizing that it may not be best to default to 1 automatically, in case docDblOpt needs to be used for a different binding in the future. Should I pass the default value as a parameter to the lambda instead?
@snoyer is right, please add |
Agreed |
Good point
I think that make sense but I would like @Meakk input on this |
…w invalidates the cheat sheet in order to allow the binding to properly update the number displayed on the cheat sheet
The bug appears to be fixed after doing the cheat sheet invalidation thing, and I have switched the binding to P. It seems like all that should be left is:
Am I missing anything? Here is the original issue |
std::stringstream valStream; | ||
valStream.precision(2); | ||
valStream << std::fixed; | ||
valStream << val.value_or(1.0); |
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.
Hum, I dont think thats correct, it should default to "N/A" to be coherent with docTglOpt
imo.
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.
Is that not misleading? The user may think that the opacity binding is incompatible with their model if they see that, and you said it can be forced to 1 if it is not set. In fact, I think using "N/A" for docTglOpt might also be a bit misleading, since when I initially saw the values displayed as "N/A" I assumed that I would be unable to change those values even though that is not the case.
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.
"1" is incorrect, but maybe N/A is not the right choice. The idea to convey is that it is not defined. I dont have a better idea than N/A.
In any case, lets be coherent at least :)
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.
Maybe one of these: [*]
, [_]
, [—]
, [?]
could be used instead? Or if you are okay with being a bit more verbose, [Unset]
might be a bit more descriptive.
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.
Lets discuss that on discord
The binding works, but the value displayed in the cheat sheet does not update until some other binding has been called by the user. I suspect the issue lies in docDblOpt, but I cannot figure it out and would like someone to review the problem.