------------------------------------------------------------------------------------------------ Apply post-processing to the currently bound scene
| 788 | // ------------------------------------------------------------------------------------------------ |
| 789 | // Apply post-processing to the currently bound scene |
| 790 | const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags) { |
| 791 | ai_assert(nullptr != pimpl); |
| 792 | |
| 793 | ASSIMP_BEGIN_EXCEPTION_REGION(); |
| 794 | // Return immediately if no scene is active |
| 795 | if (!pimpl->mScene) { |
| 796 | return nullptr; |
| 797 | } |
| 798 | |
| 799 | // If no flags are given, return the current scene with no further action |
| 800 | if (!pFlags) { |
| 801 | return pimpl->mScene; |
| 802 | } |
| 803 | |
| 804 | // In debug builds: run basic flag validation |
| 805 | ai_assert(_ValidateFlags(pFlags)); |
| 806 | ASSIMP_LOG_INFO("Entering post processing pipeline"); |
| 807 | |
| 808 | #ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS |
| 809 | // The ValidateDS process plays an exceptional role. It isn't contained in the global |
| 810 | // list of post-processing steps, so we need to call it manually. |
| 811 | if (pFlags & aiProcess_ValidateDataStructure) { |
| 812 | ValidateDSProcess ds; |
| 813 | ds.ExecuteOnScene (this); |
| 814 | if (!pimpl->mScene) { |
| 815 | return nullptr; |
| 816 | } |
| 817 | } |
| 818 | #endif // no validation |
| 819 | #ifdef ASSIMP_BUILD_DEBUG |
| 820 | if (pimpl->bExtraVerbose) |
| 821 | { |
| 822 | #ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS |
| 823 | ASSIMP_LOG_ERROR("Verbose Import is not available due to build settings"); |
| 824 | #endif // no validation |
| 825 | pFlags |= aiProcess_ValidateDataStructure; |
| 826 | } |
| 827 | #else |
| 828 | if (pimpl->bExtraVerbose) { |
| 829 | ASSIMP_LOG_WARN("Not a debug build, ignoring extra verbose setting"); |
| 830 | } |
| 831 | #endif // ! DEBUG |
| 832 | |
| 833 | std::unique_ptr<Profiler> profiler(GetPropertyInteger(AI_CONFIG_GLOB_MEASURE_TIME, 0) ? new Profiler() : nullptr); |
| 834 | for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) { |
| 835 | BaseProcess* process = pimpl->mPostProcessingSteps[a]; |
| 836 | pimpl->mProgressHandler->UpdatePostProcess(static_cast<int>(a), static_cast<int>(pimpl->mPostProcessingSteps.size()) ); |
| 837 | if( process->IsActive( pFlags)) { |
| 838 | if (profiler) { |
| 839 | profiler->BeginRegion("postprocess"); |
| 840 | } |
| 841 | |
| 842 | process->ExecuteOnScene ( this ); |
| 843 | |
| 844 | if (profiler) { |
| 845 | profiler->EndRegion("postprocess"); |
| 846 | } |
| 847 | } |
no test coverage detected