@@ -63,13 +63,12 @@ ObjectsChanged& ObjectsChanged::operator=(const ObjectsChanged& other)
6363
6464void ObjectsChanged::Merge (ObjectsChanged&& notice)
6565{
66- SdfPathSet resyncSet (_resyncChanges.begin (), _resyncChanges.end ());
67-
6866 // Update resyncChanges if necessary.
69- for (const auto & path : notice._resyncChanges ) {
70- if (resyncSet.find (path) == resyncSet.end ()) {
71- resyncSet.insert (path);
72- _resyncChanges.push_back (std::move (path));
67+ for (auto & path : notice._resyncChanges ) {
68+ const auto iter = std::find (_resyncChanges.begin (), _resyncChanges.end (), path);
69+ if (iter == _resyncChanges.end ())
70+ {
71+ _resyncChanges.emplace_back (std::move (path));
7372 }
7473 }
7574
@@ -78,31 +77,37 @@ void ObjectsChanged::Merge(ObjectsChanged&& notice)
7877 const SdfPath& primPath = path.GetPrimPath ();
7978
8079 // Skip if the path is already in resyncedPaths.
81- if (resyncSet.find (primPath) != resyncSet.end ()) {
82- continue ;
80+ {
81+ const auto it = std::find (
82+ _resyncChanges.begin (), _resyncChanges.end (), primPath);
83+ if (it != _resyncChanges.end ())
84+ continue ;
8385 }
8486
8587 // Skip if an ancestor of the path is already in resyncedPaths.
8688 bool ancestorResynced = false ;
8789 for (const auto & ancestor : primPath.GetPrefixes ()) {
88- if (resyncSet.find (ancestor) != resyncSet.end ()) {
89- ancestorResynced = true ;
90- break ;
90+ const auto it = std::find (
91+ _resyncChanges.begin (), _resyncChanges.end (), ancestor);
92+ if (it != _resyncChanges.end ()) {
93+ goto continue_ancestorResynced;
9194 }
9295 }
93- if (ancestorResynced) {
94- continue ;
95- }
9696
97- auto it = std::find (_infoChanges.begin (), _infoChanges.end (), path);
98- if (it == _infoChanges.end ()) {
99- _infoChanges.push_back (std::move (path));
97+ // Add infoChanges, when not already available
98+ {
99+ const auto it = std::find (
100+ _infoChanges.begin (), _infoChanges.end (), path);
101+ if (it == _infoChanges.end ()) {
102+ _infoChanges.push_back (std::move (path));
103+ }
100104 }
105+ continue_ancestorResynced:;
101106 }
102107
103108 // Update changeFields.
104109 for (auto const & entry : notice._changedFields ) {
105- auto const path = entry.first ;
110+ auto const & path = entry.first ;
106111
107112 if (_changedFields.find (path) == _changedFields.end ()) {
108113 _changedFields[path] = std::move (notice._changedFields [path]);
0 commit comments