fix: recompute axes grid bounds when switching files#2988
fix: recompute axes grid bounds when switching files#2988soumyasavarn wants to merge 12 commits into
Conversation
GridAxesConfigured was not being reset when the importer changed (i.e. on file switch), so ConfigureGridAxesUsingCurrentActors() was never re-called. Add GridAxesConfigured = false alongside the existing GridConfigured = false in UpdateActors(). Fixes f3d-app#2963
|
\ci fast |
removed unnecessary comment Co-authored-by: Mathieu Westphal <mwestphal.f3d@protonmail.com>
Co-authored-by: Mathieu Westphal <mwestphal.f3d@protonmail.com>
mwestphal
left a comment
There was a problem hiding this comment.
the feature doesnt seem to work yet.
|
@mwestphal I tested with the "F3D-3.4.1-147-g30c7f045-Windows-x86_64-raytracing":
My fix makes the grid reappear on switch, but the bounds show -58 to 100 |
It looks like the bounds computation is not correct for some reason, so you need to dig into that. |
Please do not merge with master, but use rebase instead, and only when needed. |
4398688 to
d3e2e36
Compare
|
Hi @soumyasavarn , do you need help moving forward ? |
Yes, a little guidance is needed. As of now only that one line fix is what I figured out is necessary "this->GridAxesConfigured = false;" in the updateActors(). Like, what amount of fix would be there as I am new to this codebase. Meanwhile, I will be unavailable for a week. If someone else wants to work on this you can let him. |
Resetting GridAxesConfigured alone left coloring/visibility/mapper state from the previous file, so ComputeVisiblePropOrientedBounds reported a clipped bbox for the new file (dragon.vtu after cow.vtp showed Z bounds of -58..100 instead of -100..100). Reset all derived *Configured flags when the importer changes, request whole-extent before alg->Update so streaming readers like vtkXMLUnstructuredGridReader report full bounds rather than piece 0, and reset the missing flags in Initialize() for symmetry. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
c96b6e4 to
c24ded7
Compare
deleting earlier baseline
I'm afraid this would require some investigation to figure out. Do your one line fix work as expected ?
No worries, it can wait. |
The previous attempt called vtkStreamingDemandDrivenPipeline::SetUpdateExtentToWholeExtent on an instance with an int argument; that overload does not exist (it is a static method taking vtkInformation*) and broke the build. vtkAlgorithm::UpdateWholeExtent does the equivalent in one call and works for both extent- and piece-based pipelines. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ComputeVisiblePropOrientedBounds iterates renderer Props whose visibility and mapper inputs depend on per-file-switch state, so it returned a clipped bbox after the cow.vtp -> dragon.vtu switch. Use vtkF3DMetaImporter::GetGeometryBoundingBox instead - the importer maintains the union of imported surface bounds and is authoritative regardless of prop visibility ordering. Transform the 8 corners through the env-up matrix to support non-axis-aligned up directions. Also revert the speculative UpdateWholeExtent call in ComputeVisiblePropOrientedBounds (that path is now only used by the floor grid, which was unaffected). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Yes, without that the axes didn't appear. |
|
Style Checks CI failed: diff --git a/vtkext/private/module/vtkF3DRenderer.cxx b/vtkext/private/module/vtkF3DRenderer.cxx
index a98fe9f..b334ca8 100644
--- a/vtkext/private/module/vtkF3DRenderer.cxx
+++ b/vtkext/private/module/vtkF3DRenderer.cxx
@@ -978,12 +978,10 @@ void vtkF3DRenderer::ConfigureGridAxesUsingCurrentActors()
{
double bnds[6];
importerBbox.GetBounds(bnds);
- const double corners[8][3] = {
- { bnds[0], bnds[2], bnds[4] }, { bnds[1], bnds[2], bnds[4] },
- { bnds[0], bnds[3], bnds[4] }, { bnds[1], bnds[3], bnds[4] },
- { bnds[0], bnds[2], bnds[5] }, { bnds[1], bnds[2], bnds[5] },
- { bnds[0], bnds[3], bnds[5] }, { bnds[1], bnds[3], bnds[5] }
- };
+ const double corners[8][3] = { { bnds[0], bnds[2], bnds[4] }, { bnds[1], bnds[2], bnds[4] },
+ { bnds[0], bnds[3], bnds[4] }, { bnds[1], bnds[3], bnds[4] }, { bnds[0], bnds[2], bnds[5] },
+ { bnds[1], bnds[2], bnds[5] }, { bnds[0], bnds[3], bnds[5] },
+ { bnds[1], bnds[3], bnds[5] } };
for (int i = 0; i < 8; ++i)
{
double p[4] = { corners[i][0], corners[i][1], corners[i][2], 1.0 }; |
|
It looks lke you are using Generative AI for coding, please note in the MR description how it was used and which model in compliance with our AI policy: https://f3d.app/dev/AI_POLICY |
Describe your changes
GridAxesConfiguredwas not being reset when the importer changed on file switch, soConfigureGridAxesUsingCurrentActors()was never re-called with the new file's bounds. Addedthis->GridAxesConfigured = false;alongside the existingthis->GridConfigured = false;inUpdateActors()invtkext/private/module/vtkF3DRenderer.cxx.Issue ticket number and link if any
Fixes #2963
Checklist for finalizing the PR
.github/workflows/versions.json, I have updateddocker_timestampAI Disclosure
Continuous integration
Please write a comment to run CI, eg:
\ci fast.See here for more info.