From 185e0954551ef19599f2575d8d1b489a813a4d5d Mon Sep 17 00:00:00 2001 From: Serhii Pievniev <52126367+spevnev@users.noreply.github.com> Date: Fri, 21 Jun 2024 23:23:33 +0300 Subject: [PATCH] Add option to hide animation progress bar (#1478) --- application/F3DOptionsParser.cxx | 3 ++- application/testing/CMakeLists.txt | 30 +++++++++++------------ doc/libf3d/OPTIONS.md | 1 + doc/user/OPTIONS.md | 1 + library/src/animationManager.cxx | 1 + library/src/options.cxx | 1 + resources/configs/config.d/10_global.json | 3 ++- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/application/F3DOptionsParser.cxx b/application/F3DOptionsParser.cxx index 6ed47d0fc0..dd5f5d4605 100644 --- a/application/F3DOptionsParser.cxx +++ b/application/F3DOptionsParser.cxx @@ -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}"); diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index 9a3daf4365..78f066332e 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -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) @@ -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) @@ -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") @@ -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; @@ -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") @@ -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) @@ -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() @@ -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) @@ -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") @@ -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 diff --git a/doc/libf3d/OPTIONS.md b/doc/libf3d/OPTIONS.md index 576802f301..7d9a3e34c6 100644 --- a/doc/libf3d/OPTIONS.md +++ b/doc/libf3d/OPTIONS.md @@ -95,6 +95,7 @@ ui.filename-info|string
-
render|Content of *filename info* to display. ui.font-file|string
-
render|Use the provided FreeType compatible font file to display text.
Can be useful to display non-ASCII filenames.|\-\-font-file ui.fps|bool
false
render|Display a *frame per second counter*.|\-\-fps ui.loader-progress|bool
false
load|Show a *progress bar* when loading the file.|\-\-progress +ui.animation-progress|bool
false
load|Show a *progress bar* when playing the animation.|\-\-animation-progress ui.metadata|bool
false
render|Display the *metadata*.|\-\-metadata ui.dropzone|bool
false
render|Show a drop zone. ui.dropzone-info|string
-
render|Content of the drop zone text to display. diff --git a/doc/user/OPTIONS.md b/doc/user/OPTIONS.md index 05f2ec6669..876c85ad46 100644 --- a/doc/user/OPTIONS.md +++ b/doc/user/OPTIONS.md @@ -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),
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.
Force geometry-only. The configuration file for the first file will be loaded. \-\-up=\<[+\|-][X\|Y\|Z]\>|+Y|Define the Up direction. diff --git a/library/src/animationManager.cxx b/library/src/animationManager.cxx index 0d57050694..9b0ad6aab5 100644 --- a/library/src/animationManager.cxx +++ b/library/src/animationManager.cxx @@ -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(); } diff --git a/library/src/options.cxx b/library/src/options.cxx index 0f988625c2..93884cdfc4 100644 --- a/library/src/options.cxx +++ b/library/src/options.cxx @@ -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()); diff --git a/resources/configs/config.d/10_global.json b/resources/configs/config.d/10_global.json index 26d15076a3..b579820c98 100644 --- a/resources/configs/config.d/10_global.json +++ b/resources/configs/config.d/10_global.json @@ -10,6 +10,7 @@ "scalars": "", "camera-direction": "-1,-0.5,-1", "hdri-ambient": true, - "translucency-support": true + "translucency-support": true, + "animation-progress": true } }