Skip to content

Commit

Permalink
Merge pull request #1904 from mwestphal/fix_armature
Browse files Browse the repository at this point in the history
 - Fix an issue with armature showing up outside of model
 - Fix an issue with armature not visible with opacity
 - Change default config for better armature rendering
 - Add tests
  • Loading branch information
mwestphal authored Jan 11, 2025
2 parents a79a648 + 8d04b92 commit deac8e0
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/baselines/install_example_plugin_output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ if(NOT F3D_MACOS_BUNDLE)
f3d_test(NAME TestDefaultConfigFileAndCommand DATA suzanne.stl ARGS --up=-Y --camera-direction=-1,0.5,-1 CONFIG config_build LONG_TIMEOUT TONE_MAPPING UI)
f3d_test(NAME TestDefaultConfigTranslucent DATA red_translucent_monkey.gltf CONFIG config_build LONG_TIMEOUT TONE_MAPPING UI)

if(VTK_VERSION VERSION_GREATER_EQUAL 9.4.20241219)
f3d_test(NAME TestDefaultConfigFileArmature DATA RiggedFigure.glb ARGS --animation-time=1 --armature CONFIG config_build LONG_TIMEOUT TONE_MAPPING UI)
endif()

file(COPY "${F3D_SOURCE_DIR}/resources/configs/thumbnail.d/" "${F3D_SOURCE_DIR}/plugins/native/configs/thumbnail.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/thumbnail_build.d")
f3d_test(NAME TestThumbnailConfigFileVTU DATA dragon.vtu CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING)
f3d_test(NAME TestThumbnailConfigFileVTI DATA vase_4comp.vti CONFIG thumbnail_build LONG_TIMEOUT TONE_MAPPING)
Expand Down Expand Up @@ -417,9 +421,10 @@ f3d_test(NAME TestVerboseAnimationWrongAnimationTimeHigh DATA BoxAnimated.gltf A
f3d_test(NAME TestVerboseAnimationWrongAnimationTimeLow DATA BoxAnimated.gltf ARGS --animation-time=-5 --verbose REGEXP "Animation time -5 is outside of range \\[0, 3\\.70833\\], using 0" NO_BASELINE)

# Armature test
f3d_test(NAME TestGLTFRigNoArmature DATA RiggedFigure.glb ARGS --animation-time=1)
f3d_test(NAME TestGLTFRigArmatureNoArmature DATA RiggedFigure.glb ARGS --animation-time=1 --opacity=0.5 -p)
if(VTK_VERSION VERSION_GREATER_EQUAL 9.4.20241219)
f3d_test(NAME TestGLTFRigArmature DATA RiggedFigure.glb ARGS --animation-time=1 --armature)
f3d_test(NAME TestGLTFRigArmatureWithOpacity DATA RiggedFigure.glb ARGS --animation-time=1 --armature --opacity=0.5 -p)
f3d_test(NAME TestGLTFRigArmatureSphereTube DATA RiggedFigure.glb ARGS --animation-time=1 --armature --point-size=20 --line-width=5)
endif()

Expand Down
2 changes: 1 addition & 1 deletion doc/user/QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ For **default scene** formats, certain default values are set automatically:
- roughness: 0.3
- camera-orthographic: false

They will be overridden when using corresponding [options](OPTIONS.md).
They will be overridden when using corresponding [options](OPTIONS.md), either from command line or [configuration file](CONFIGURATION_FILE.md).

## Interacting with your scene

Expand Down
4 changes: 3 additions & 1 deletion resources/configs/config.d/05_all.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"camera-direction": "-1,-0.5,-1",
"hdri-ambient": true,
"translucency-support": true,
"animation-progress": true
"animation-progress": true,
"point-size": 5,
"line-width": 2
}
}
]
3 changes: 3 additions & 0 deletions testing/baselines/TestDefaultConfigFileArmature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/baselines/TestGLTFRigArmatureNoArmature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/baselines/TestGLTFRigArmatureWithOpacity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions testing/baselines/TestGLTFRigNoArmature.png

This file was deleted.

7 changes: 5 additions & 2 deletions vtkext/private/module/vtkF3DRenderPass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ void vtkF3DRenderPass::Initialize(const vtkRenderState* s)
{
// armature
vtkInformation* info = prop->GetPropertyKeys();
if (this->ArmatureVisible && info && info->Has(vtkF3DImporter::ACTOR_IS_ARMATURE()))
if (info && info->Has(vtkF3DImporter::ACTOR_IS_ARMATURE()))
{
this->MainOnTopProps.push_back(prop);
if (this->ArmatureVisible)
{
this->MainOnTopProps.push_back(prop);
}
}
else
{
Expand Down
8 changes: 6 additions & 2 deletions vtkext/private/module/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1840,8 +1840,12 @@ void vtkF3DRenderer::ConfigureActorsProperties()

if (this->Opacity.has_value())
{
actor->GetProperty()->SetOpacity(this->Opacity.value());
originalActor->GetProperty()->SetOpacity(this->Opacity.value());
vtkInformation* info = originalActor->GetPropertyKeys();
if (!info || !info->Has(vtkF3DImporter::ACTOR_IS_ARMATURE()))
{
actor->GetProperty()->SetOpacity(this->Opacity.value());
originalActor->GetProperty()->SetOpacity(this->Opacity.value());
}
}

if (this->Roughness.has_value())
Expand Down

0 comments on commit deac8e0

Please sign in to comment.