diff --git a/src/functionObjects/graphics/runTimePostProcessing/scene.C b/src/functionObjects/graphics/runTimePostProcessing/scene.C index 4af8b0d0e83f119a19afdc3ac68df3a1546c6209..d282d640810ed7c2b2ea4665234180fb74446f17 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/scene.C +++ b/src/functionObjects/graphics/runTimePostProcessing/scene.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -131,6 +131,21 @@ void Foam::functionObjects::runTimePostPro::scene::readColours } +void Foam::functionObjects::runTimePostPro::scene::setActorVisibility +( + vtkRenderer* renderer, + const bool visible +) const +{ + vtkActorCollection *actors = renderer->GetActors(); + for (int i = 0; i < actors->GetNumberOfItems(); ++i) + { + vtkActor *actor = vtkActor::SafeDownCast(actors->GetItemAsObject(i)); + actor->SetVisibility(visible); + } +} + + void Foam::functionObjects::runTimePostPro::scene::initialise ( vtkRenderer* renderer, @@ -239,9 +254,13 @@ void Foam::functionObjects::runTimePostPro::scene::setCamera // to be done once on initialisation if (clipBox_ != boundBox::greatBox) { - // Call ResetCamera() to fit clip box in view + setActorVisibility(renderer, false); clipBoxActor_->VisibilityOn(); + + // Call ResetCamera() to fit clip box in view renderer->ResetCamera(); + + setActorVisibility(renderer, true); clipBoxActor_->VisibilityOff(); } diff --git a/src/functionObjects/graphics/runTimePostProcessing/scene.H b/src/functionObjects/graphics/runTimePostProcessing/scene.H index 549b430e397f76cf5af6de9b6b382736fdda6150..127fcb6db6909bd0e94645efae5f1d2cc95bb05a 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/scene.H +++ b/src/functionObjects/graphics/runTimePostProcessing/scene.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -105,6 +105,13 @@ class scene //- Read colour properties void readColours(const dictionary& dict); + //- Set visibility of all actors on/off + void setActorVisibility + ( + vtkRenderer* renderer, + const bool visible + ) const; + //- Disallow default bitwise copy construct scene(const scene&);