Skip to content

Commit

Permalink
Add option to hide animation progress bar (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
spevnev authored Jun 21, 2024
1 parent 3fc57b2 commit 185e095
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion application/F3DOptionsParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o
#ifndef F3D_NO_DEPRECATED
this->DeclareOption(grp1, "quiet", "", "Enable quiet mode, which supersede any verbose options and prevent any console output to be generated at all (deprecated, using `--verbose=quiet` instead)", deprecatedQuiet, HasDefault::YES, MayHaveConfig::YES );
#endif
this->DeclareOption(grp1, "progress", "", "Show progress bar", options.getAsBoolRef("ui.loader-progress"), HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp1, "progress", "", "Show loading progress bar", options.getAsBoolRef("ui.loader-progress"), HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp1, "animation-progress", "", "Show animation progress bar", options.getAsBoolRef("ui.animation-progress"), HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp1, "geometry-only", "", "Do not read materials, cameras and lights from file", appOptions.GeometryOnly, HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp1, "group-geometries", "", "When opening multiple files, show them all in the same scene. Force geometry-only. The configuration file for the first file will be loaded.", appOptions.GroupGeometries, HasDefault::YES, MayHaveConfig::NO);
this->DeclareOption(grp1, "up", "", "Up direction", options.getAsStringRef("scene.up-direction"), HasDefault::YES, MayHaveConfig::YES, "{-X, +X, -Y, +Y, -Z, +Z}");
Expand Down
30 changes: 15 additions & 15 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ f3d_test(NAME TestScalarsCell DATA f3d.vtp ARGS --scalars --cells --comp=-2 --up
f3d_test(NAME TestScalarsRange DATA suzanne.ply ARGS --scalars=Normals --comp=1 --range=0,1 DEFAULT_LIGHTS)
f3d_test(NAME TestScalarsWithBar DATA suzanne.ply ARGS -b --scalars=Normals --comp=0 DEFAULT_LIGHTS)
f3d_test(NAME TestGLTFImporter DATA WaterBottle.glb DEFAULT_LIGHTS) # Using default lights because of ResetCamera
f3d_test(NAME TestGLTFImporterWithAnimation DATA BoxAnimated.gltf ARGS --animation-time=2 DEFAULT_LIGHTS) # Technically not a default lights tests, but fails for some reason on vtk 9.0.0
f3d_test(NAME TestGLTFImporterWithAnimation DATA BoxAnimated.gltf ARGS --animation-time=2 --animation-progress DEFAULT_LIGHTS) # Technically not a default lights tests, but fails for some reason on vtk 9.0.0
f3d_test(NAME TestGLTFSkin DATA SimpleSkin.gltf DEFAULT_LIGHTS) # Using default lights because of ResetCamera
f3d_test(NAME TestGLTFReaderWithAnimation DATA BoxAnimated.gltf ARGS --geometry-only --animation-time=2 DEFAULT_LIGHTS)
f3d_test(NAME TestGLTFReaderWithAnimation DATA BoxAnimated.gltf ARGS --geometry-only --animation-time=2 --animation-progress DEFAULT_LIGHTS)
f3d_test(NAME TestDicom DATA IM-0001-1983.dcm ARGS --scalars --roughness=1 DEFAULT_LIGHTS)
f3d_test(NAME TestMHD DATA HeadMRVolume.mhd ARGS --scalars --roughness=1 DEFAULT_LIGHTS)
f3d_test(NAME TestVTICell DATA waveletMaterial.vti ARGS --scalars=Material -c --roughness=1 DEFAULT_LIGHTS)
Expand Down Expand Up @@ -184,7 +184,7 @@ f3d_test(NAME TestLightIntensityDarkerFullScene DATA WaterBottle.glb ARGS --ligh
f3d_test(NAME TestUTF8 DATA "(ノಠ益ಠ )ノ.vtp" DEFAULT_LIGHTS)
f3d_test(NAME TestFilenameCommasSpaces DATA "tetrahedron, with commas & spaces.stl" DEFAULT_LIGHTS)
f3d_test(NAME TestFont DATA suzanne.ply ARGS -n --font-file=${F3D_SOURCE_DIR}/testing/data/Crosterian.ttf DEFAULT_LIGHTS)
f3d_test(NAME TestAnimationIndex DATA InterpolationTest.glb ARGS --animation-index=7 --animation-time=0.5 DEFAULT_LIGHTS)
f3d_test(NAME TestAnimationIndex DATA InterpolationTest.glb ARGS --animation-index=7 --animation-time=0.5 --animation-progress DEFAULT_LIGHTS)
f3d_test(NAME TestAnimationAutoplay DATA InterpolationTest.glb ARGS --animation-autoplay DEFAULT_LIGHTS)
f3d_test(NAME TestMaxSizeBelow DATA suzanne.stl ARGS --max-size=1 DEFAULT_LIGHTS)
f3d_test(NAME TestMaxSizeAbove DATA WaterBottle.glb ARGS --max-size=0.2 REGEXP "No file loaded, file is bigger than max size" NO_BASELINE)
Expand Down Expand Up @@ -333,7 +333,7 @@ if(VTK_VERSION VERSION_GREATER 9.0.1)
f3d_test(NAME TestTextureMatCapWithEdges DATA suzanne.ply ARGS -e --texture-matcap=${F3D_SOURCE_DIR}/testing/data/skin.png DEFAULT_LIGHTS)

# Test enabling all animations
f3d_test(NAME TestAnimationAllAnimations DATA InterpolationTest.glb ARGS --animation-index=-1 --animation-time=1)
f3d_test(NAME TestAnimationAllAnimations DATA InterpolationTest.glb ARGS --animation-index=-1 --animation-time=1 --animation-progress)

# Test Verbose animation, no baseline needed
f3d_test(NAME TestVerboseAnimation DATA InterpolationTest.glb ARGS --verbose NO_BASELINE REGEXP "7: CubicSpline Translation")
Expand All @@ -344,7 +344,7 @@ if(VTK_VERSION VERSION_GREATER 9.0.1)
# Test interactive animation and speed factor
f3d_test(NAME TestInteractionAnimationFast DATA InterpolationTest.glb ARGS --animation-speed-factor=1000 --animation-index=-1 INTERACTION NO_BASELINE)#Space;Space;
f3d_test(NAME TestInteractionAnimationSlow DATA InterpolationTest.glb ARGS --animation-speed-factor=0.01 --animation-index=-1 INTERACTION)#Space;Wait;Space;
f3d_test(NAME TestInteractionAnimationCameraMovement DATA CameraAnimated.glb ARGS --camera-index=0 --animation-speed-factor=1000 INTERACTION)#Space;MouseMovement;Space;
f3d_test(NAME TestInteractionAnimationCameraMovement DATA CameraAnimated.glb ARGS --camera-index=0 --animation-speed-factor=1000 --animation-progress INTERACTION)#Space;MouseMovement;Space;

# Framerate test is a smoke test as event playing seems to break VTK timers
f3d_test(NAME TestInteractionAnimationFrameRate DATA InterpolationTest.glb ARGS --animation-frame-rate=2 --animation-index=-1 INTERACTION NO_BASELINE)#Space;Wait;Space;
Expand Down Expand Up @@ -500,7 +500,7 @@ endif()
if(F3D_PLUGIN_BUILD_ALEMBIC)
f3d_test(NAME TestABC DATA suzanne.abc ARGS -s --load-plugins=alembic DEFAULT_LIGHTS) # Using default lights because of ResetCamera
f3d_test(NAME TestABCNonFaceVarying DATA tetrahedron_non_facevarying_uv.abc ARGS -s --load-plugins=alembic DEFAULT_LIGHTS) # Using default lights because of ResetCamera
f3d_test(NAME TestABCAnimation DATA drop.abc ARGS --animation-time=2 --load-plugins=alembic DEFAULT_LIGHTS) # Using default lights because of ResetCamera
f3d_test(NAME TestABCAnimation DATA drop.abc ARGS --animation-time=2 --load-plugins=alembic --animation-progress DEFAULT_LIGHTS) # Using default lights because of ResetCamera

if(NOT F3D_MACOS_BUNDLE)
file(COPY "${F3D_SOURCE_DIR}/plugins/alembic/configs/config.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/config_build.d")
Expand Down Expand Up @@ -528,7 +528,7 @@ if(F3D_PLUGIN_BUILD_ASSIMP)
# TGA Reader needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8224
if(VTK_VERSION VERSION_GREATER_EQUAL 9.0.20210805) # for TGA support and embedded textures
f3d_test(NAME TestFBXBone DATA animation_with_skeleton.fbx ARGS --load-plugins=assimp --camera-position=1.90735e-06,0,11007.8 --camera-focal-point=1.90735e-06,0,-8.9407e-08)
f3d_test(NAME TestFBXBoneAnimation DATA animation_with_skeleton.fbx ARGS --load-plugins=assimp --camera-position=1.90735e-06,0,11007.8 --camera-focal-point=1.90735e-06,0,-8.9407e-08 --animation-time=0.5)
f3d_test(NAME TestFBXBoneAnimation DATA animation_with_skeleton.fbx ARGS --load-plugins=assimp --camera-position=1.90735e-06,0,11007.8 --camera-focal-point=1.90735e-06,0,-8.9407e-08 --animation-time=0.5 --animation-progress)
f3d_test(NAME TestVerboseAssimp DATA duck.fbx ARGS --verbose --load-plugins=assimp NO_BASELINE REGEXP "LOD3sp")
f3d_test(NAME TestTGATextureFBX DATA duck.fbx ARGS --load-plugins=assimp)
f3d_test(NAME TestDAE DATA duck.dae ARGS --load-plugins=assimp)
Expand All @@ -544,10 +544,10 @@ if(F3D_PLUGIN_BUILD_ASSIMP)
# Embedded texture are only working with assimp 5.1.X
if("${F3D_ASSIMP_VERSION}" VERSION_GREATER_EQUAL "5.1.0")
f3d_test(NAME TestEmbeddedTextureFBX DATA texturedCube.fbx ARGS --load-plugins=assimp)
f3d_test(NAME TestFBXAnimation DATA animatedWorld.fbx ARGS --load-plugins=assimp --animation-time=2)
f3d_test(NAME TestFBXAnimationLights DATA animatedLights.fbx ARGS --load-plugins=assimp --animation-time=1.8)
f3d_test(NAME TestFBXAnimationCamera DATA animatedCamera.fbx ARGS --load-plugins=assimp --camera-index=0 --animation-index=0 --animation-time=3)
f3d_test(NAME TestDAEAnimationLights DATA animatedLights.dae ARGS --load-plugins=assimp --animation-time=1.8)
f3d_test(NAME TestFBXAnimation DATA animatedWorld.fbx ARGS --load-plugins=assimp --animation-time=2 --animation-progress)
f3d_test(NAME TestFBXAnimationLights DATA animatedLights.fbx ARGS --load-plugins=assimp --animation-time=1.8 --animation-progress)
f3d_test(NAME TestFBXAnimationCamera DATA animatedCamera.fbx ARGS --load-plugins=assimp --camera-index=0 --animation-index=0 --animation-time=3 --animation-progress)
f3d_test(NAME TestDAEAnimationLights DATA animatedLights.dae ARGS --load-plugins=assimp --animation-time=1.8 --animation-progress)
endif()
endif()

Expand Down Expand Up @@ -577,7 +577,7 @@ if(F3D_PLUGIN_BUILD_DRACO)
if(VTK_VERSION VERSION_GREATER_EQUAL 9.3.20240214)
f3d_test(NAME TestGLTFDracoImporter DATA Box_draco.gltf ARGS --load-plugins=draco --camera-position=-1.6,1.3,2.7)
f3d_test(NAME TestGLTFDracoReader DATA Box_draco.gltf ARGS --load-plugins=draco --geometry-only --camera-position=-1.6,1.3,2.7)
f3d_test(NAME TestGLTFDracoReaderWithoutCompression DATA BoxAnimated.gltf ARGS --load-plugins=draco --geometry-only --animation-time=2 DEFAULT_LIGHTS)
f3d_test(NAME TestGLTFDracoReaderWithoutCompression DATA BoxAnimated.gltf ARGS --load-plugins=draco --geometry-only --animation-time=2 --animation-progress DEFAULT_LIGHTS)
endif()

if(NOT F3D_MACOS_BUNDLE)
Expand All @@ -601,10 +601,10 @@ if(F3D_PLUGIN_BUILD_EXODUS)
f3d_test(NAME TestVerboseGenericImporterAnimation DATA small.ex2 ARGS --load-plugins=exodus --verbose NO_BASELINE REGEXP "0, 0.00429999")

# Test animation with generic importer and coloring
f3d_test(NAME TestAnimationGenericImporter DATA small.ex2 ARGS -sb --load-plugins=exodus --animation-time=0.003 DEFAULT_LIGHTS)
f3d_test(NAME TestAnimationGenericImporter DATA small.ex2 ARGS -sb --load-plugins=exodus --animation-time=0.003 --animation-progress DEFAULT_LIGHTS)

# Test animation with inverted speed factor
f3d_test(NAME TestInteractionAnimationInvert DATA small.ex2 ARGS -sb --load-plugins=exodus --animation-speed-factor=-0.0000001 --animation-time=0.00429998 INTERACTION DEFAULT_LIGHTS)#Space;Space;
f3d_test(NAME TestInteractionAnimationInvert DATA small.ex2 ARGS -sb --load-plugins=exodus --animation-speed-factor=-0.0000001 --animation-time=0.00429998 --animation-progress INTERACTION DEFAULT_LIGHTS)#Space;Space;

# Test Generic Importer Verbose animation. Regex contains the time range.
f3d_test(NAME TestVerboseAnimationSingleTimestep DATA single_timestep.e ARGS --load-plugins=exodus --verbose NO_BASELINE REGEXP "time range delta is invalid")
Expand Down Expand Up @@ -678,7 +678,7 @@ if(F3D_PLUGIN_BUILD_USD)

# https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8224
if(VTK_VERSION VERSION_GREATER_EQUAL 9.0.20210805) # for embedded material support
f3d_test(NAME TestUSDZAnimated DATA AnimatedCube.usdz ARGS --load-plugins=usd --animation-time=0.3)
f3d_test(NAME TestUSDZAnimated DATA AnimatedCube.usdz ARGS --load-plugins=usd --animation-time=0.3 --animation-progress)
f3d_test(NAME TestUSDZRigged DATA RiggedSimple.usdz ARGS --load-plugins=usd --animation-time=0.3)

# The threshold is quite high because of macos
Expand Down
1 change: 1 addition & 0 deletions doc/libf3d/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ ui.filename-info|string<br>-<br>render|Content of *filename info* to display.
ui.font-file|string<br>-<br>render|Use the provided FreeType compatible font file to display text.<br>Can be useful to display non-ASCII filenames.|\-\-font-file
ui.fps|bool<br>false<br>render|Display a *frame per second counter*.|\-\-fps
ui.loader-progress|bool<br>false<br>load|Show a *progress bar* when loading the file.|\-\-progress
ui.animation-progress|bool<br>false<br>load|Show a *progress bar* when playing the animation.|\-\-animation-progress
ui.metadata|bool<br>false<br>render|Display the *metadata*.|\-\-metadata
ui.dropzone|bool<br>false<br>render|Show a drop zone.
ui.dropzone-info|string<br>-<br>render|Content of the drop zone text to display.
1 change: 1 addition & 0 deletions doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Options|Default|Description
------|------|------
\-\-verbose=\<[debug\|info\|warning\|error\|quiet]\>|info| Set *verbose* level, in order to provide more information about the loaded data in the console output. If no level is providen, assume `debug`. Option parsing may ignore this flag.
\-\-progress||Show a *progress bar* when loading the file.
\-\-animation-progress||Show a *progress bar* when playing the animation.
\-\-geometry-only||For certain **full scene** file formats (gltf/glb and obj),<br>reads *only the geometry* from the file and use default scene construction instead.
\-\-group-geometries||When opening multiple files, show them all in the same scene.<br>Force geometry-only. The configuration file for the first file will be loaded.
\-\-up=\<[+\|-][X\|Y\|Z]\>|+Y|Define the Up direction.
Expand Down
1 change: 1 addition & 0 deletions library/src/animationManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ bool animationManager::Initialize(
progressRep->DrawFrameOff();
progressRep->SetPadding(0.0, 0.0);
#endif
progressRep->SetVisibility(options->getAsBool("ui.animation-progress"));

this->ProgressWidget->On();
}
Expand Down
1 change: 1 addition & 0 deletions library/src/options.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ options::options()
this->Internals->init("ui.metadata", false);
this->Internals->init("ui.font-file", std::string());
this->Internals->init("ui.loader-progress", false);
this->Internals->init("ui.animation-progress", false);

// Model
this->Internals->init("model.matcap.texture", std::string());
Expand Down
3 changes: 2 additions & 1 deletion resources/configs/config.d/10_global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scalars": "",
"camera-direction": "-1,-0.5,-1",
"hdri-ambient": true,
"translucency-support": true
"translucency-support": true,
"animation-progress": true
}
}

0 comments on commit 185e095

Please sign in to comment.