diff --git a/src/houdini/lib/H_USD/HUSD/HUSD_Scene.C b/src/houdini/lib/H_USD/HUSD/HUSD_Scene.C index f665af83..205aefad 100644 --- a/src/houdini/lib/H_USD/HUSD/HUSD_Scene.C +++ b/src/houdini/lib/H_USD/HUSD/HUSD_Scene.C @@ -112,6 +112,7 @@ HUSD_Scene::HUSD_Scene() myModSerial(0), myCamSerial(0), myLightSerial(0), + mySelectionResolveSerial(0), mySelectionArrayID(0), myDeferUpdate(false), myRenderIndex(nullptr), @@ -682,7 +683,9 @@ HUSD_Scene::setSelection(const UT_StringArray &paths, selectionModified(id); } - if(no_path_id) + // Prim isn't missing if it's a render setting prim, otherwise we + // need to resolve later when more prims are processed. + if(no_path_id && !selpath.startsWith("/Render/")) missing = true; mySelection[id] = PATH_HIGHLIGHT; @@ -695,13 +698,25 @@ HUSD_Scene::setSelection(const UT_StringArray &paths, // If some ids failed to resolve, we may need to try again after the // scene is updated. mySelectionArrayNeedsUpdate = missing; + if(missing) + { + // Don't attempt to resolve unless something changes. + mySelectionResolveSerial = myGeoSerial + myLightSerial + myCamSerial; + } } void HUSD_Scene::redoSelectionList() { if(mySelectionArrayNeedsUpdate) - setSelection(mySelectionArray); + { + int64 serial = myGeoSerial + myLightSerial + myCamSerial; + + // Don't attempt to resolve missing selection paths unless + // something actually changed (geometry, camera, or lights added). + if(serial != mySelectionResolveSerial) + setSelection(mySelectionArray); + } } const UT_StringArray & @@ -1181,7 +1196,6 @@ HUSD_Scene::intersectHighlightWithSelection() if(to_remove.entries()) mySelectionID++; - } void diff --git a/src/houdini/lib/H_USD/HUSD/HUSD_Scene.h b/src/houdini/lib/H_USD/HUSD/HUSD_Scene.h index f8e801e3..30bd4ce3 100644 --- a/src/houdini/lib/H_USD/HUSD/HUSD_Scene.h +++ b/src/houdini/lib/H_USD/HUSD/HUSD_Scene.h @@ -254,6 +254,7 @@ class HUSD_API HUSD_Scene : public UT_NonCopyable int64 myModSerial; int64 myCamSerial; int64 myLightSerial; + int64 mySelectionResolveSerial; bool myDeferUpdate; UT_Vector2I myRenderPrimRes;