-
Notifications
You must be signed in to change notification settings - Fork 316
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
[All] Fix visualisation #5152
[All] Fix visualisation #5152
Conversation
Shouldn't we rather properly update the visualparams ? The update process is done by RealGUI while the draw is done by the Viewer (Qt or QGL):
I therefore suspect the problem to come from the inconsistent API where sofa::core::visual::VisualParams* vparams = sofa::core::visual::visualparams::defaultInstance(); To sum up, could it be possible to make sure that using the |
The IMO, VisualStyle should have a |
To be franck this is a bit confusing 🤔 it seems that there are some mixup between VisualParams & VisualStyle. It would have been great to directly quote the aforementioned code with a direct link 😅 In any case, I think this is a good idea to remove the |
No mixup here :
Those are called by the drawVisualVisitor. This is when the DefaultInstance is modified. And this is the reason why in the VisualModels, during the the call to
The drawVisual visitor called fwdDraw first, so the VisualStyle updated the DefaultInstance, then he does the draw, then the call to bwdDraw put back the old values of the flags inside DefaultInstance. Because this was not called for the updateVisual, then it wasn't working. So removing the inheritance might make sense but doesn't solve the problem. Why don't we leave the most updated values of the visual flags inside the default instance. Why do we reupload the backup values inside ? Couldn't it be constantly consistent with the actual visual flag values ? |
This is much clearer with direct quote with the code 🧑💻
A wild guess would be to manage the fact there can be other VisualStyle deeper in your scene. A node can set some flags, and its subnodes can set(or unset) other flags. |
PR updated regarding discussions. I'll add an issue regarding the testing of this feature in a unit test, I'll not have time to do it here. |
Just tested the PR, it fixes indeed the visualization problem It remains that if we want to have specific VisualStyle : it has to be defined per Node and the last one override for the rest of the graph. VisualStyle should follow the mechanism we plan to deploy on gravity with data/links and tests should be added as suggested in #5157 |
[ci-build][with-all-tests] |
[ci-build][with-all-tests][force-full-build] |
…isualStyle and instead call the fwdDraw directly in the two visualVisitor
Co-authored-by: Alex Bilger <[email protected]>
01dd45b
to
503f178
Compare
Visual models where broken since this PR #4827
Actually they were not always broken, when you started the simulation, everything was ok, but then if you unchecked visualModels in the View panel, and check it back, the visual models didn't follow the mechanical one anymore. The visual models where stuck in the position when you unchecked the VisualModel (see gif).
The problem was that the Visual params where not updated from the VisualStyle component at the right moment. It was only done in the VisualDrawVisitor, through the
fwdDraw
method. This enabled the drawing, but not the update of the visual models, because it was done before.Why was it working when the visual flags remained untouched ? I don't know.
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if