From 051616444c2f751141cde1bcb4e910d2a43bfaa5 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Thu, 29 Jun 2023 12:30:37 +0100 Subject: [PATCH] CollectScenes : Check for cancellation while building RootTree --- Changes.md | 1 + src/GafferScene/CollectScenes.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changes.md b/Changes.md index e321f86393e..a4efe389e4b 100644 --- a/Changes.md +++ b/Changes.md @@ -12,6 +12,7 @@ Improvements - MatchPatternPathFilterWidget : Added the name of the property being filtered to the placeholder text. - OpenImageIOReader : The `availableFrames` plug no longer errors for a missing file sequence - instead it outputs an empty list. - PathListingWidget : Header data is now computed asynchronously, without locking the UI. +- CollectScenes : Improved cancellation responsiveness for large lists of `rootNames`. Fixes ----- diff --git a/src/GafferScene/CollectScenes.cpp b/src/GafferScene/CollectScenes.cpp index 991025bc358..ee55d668462 100644 --- a/src/GafferScene/CollectScenes.cpp +++ b/src/GafferScene/CollectScenes.cpp @@ -95,12 +95,14 @@ class RootTree : public IECore::Data }; - RootTree( const IECore::StringVectorData *roots ) + RootTree( const IECore::StringVectorData *roots, const IECore::Canceller *canceller ) : m_treeRoot( new Location( 0 ) ) { ScenePlug::ScenePath path; for( const auto &root : roots->readable() ) { + IECore::Canceller::check( canceller ); + ScenePlug::stringToPath( root, path ); if( path.empty() ) { @@ -415,7 +417,7 @@ void CollectScenes::compute( Gaffer::ValuePlug *output, const Gaffer::Context *c { ConstStringVectorDataPtr roots = rootNamesPlug()->getValue(); static_cast( output )->setValue( - new RootTree( roots.get() ) + new RootTree( roots.get(), context->canceller() ) ); return; }