-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalidate hierarchy cache? #26
Comments
Hi @csaez, It's a little hard to guess at whether this may be an issue with the The The brute-force method of getting a fresh hierarchy cache would be to call: model.ResetStage(None)
model.ResetStage(theRealStage) While that obviously isn't the best long-term solution, it may at least help you determine the source of the inconsistency you're seeing. You may be able to get some more information about what the cache is doing by enabling the Tf debug code |
Thanks @nrusch, I can confirm that our issues are gone by invalidating the cache. def invalidateCache(self):
model = self.model()
if not model:
return False
expandedState = [index.data(QtCore.Qt.DisplayRole)
for index in model.persistentIndexList()
if self.isExpanded(index)]
model.beginResetModel()
model._index = _HierarchyCache(self.stage.GetPrimAtPath('/'), model._predicate)
model.endResetModel(model.index(0, 0))
self._restoreExpandedState(expandedState, model.index(0, 0))
return True
def _restoreExpandedState(self, state, index)
for each in expandedState:
for index in model.match(index, QtCore.Qt.DisplayRole, each):
if not index:
continue
control.setExpanded(model.index(0, 0, index), True)
self._restoreExpandedState(expandedState, index) Does this looks reasonable to you? Thanks! |
Hi there,
I'm trying to debug/isolate an issue on a stage modified procedurally by an internal tool (think of a graph with nodes applying edits on the stage, the user can step through nodes seeing the chain of changes applied till that point).
Unfortunatelly I don't have a simple repro, but I'm seeing something like this before/after the modification and I suspect the cache might be associating the wrong QModelIndex to the new prims.
Is there a relatively simple way to invalidate the hierarchy cache on the model?
I tried by overriding the
model._index
with a fresh instance (similar toResetStage
), but the view loses its state (i.e. selection, expanded items, scroll) and was wondering if there's already a more straight forward way to do this.usd-qt/pxr/usdQt/hierarchyModel.py
Lines 113 to 114 in eae0a95
Thanks!
The text was updated successfully, but these errors were encountered: