-
Notifications
You must be signed in to change notification settings - Fork 205
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
Shader browser search #5352
Shader browser search #5352
Conversation
afb5c1c
to
bfc3632
Compare
I pushed an update that tweaks some of the early-out checks in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Eric - comments inline as usual.
This is a pre-existing problem, but I'm finding the generic Filter...
label to be a bit nonspecific, with the state about what we're filtering on being hidden inside an unlabelled dropdown menu. Any thoughts on ways of making that more obvious? Perhaps we could change the placeholder text to be Filter by <Name>...
so it shows the state from the dropdown menu?
It would also be great if you could include (#5293)
in the Changes.md comment, and Fixes #5293
in the commit message so that we're linking and auto-closing the associated ticket.
Cheers...
John
python/GafferSceneUI/ShaderUI.py
Outdated
def collectPaths( parentPath ) : | ||
result = [] | ||
for p in parentPath.children() : | ||
result.append( p ) | ||
result += collectPaths( p ) | ||
|
||
return result | ||
|
||
self.__filter.setPaths( collectPaths( rootPath ) ) | ||
|
||
self.setPath( rootPath ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might improve the separation of responsibilities if the filter had a setRootPath()
method instead of a setPaths()
method, and it did the iteration over paths itself in __updatePathMatcher()
. This would also allow the filter to connect to rootPath.changedSignal()
to dirty the pathmatcher. Wouldn't make a visible difference in this use case, but gives us a better chance of reusing _PathMatcherPathFilter
at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does set us up nicely to factor this out to a reusable _PathMatcherPathFilter
some day. That's changed in 02de60f where I think I got the signalling and dirty handling correct...
aff1cd4
to
4721cad
Compare
Thanks John! I have the comments addressed, and the change in the placeholder text is in 705fbd0. I believe the only other place where the The last four commits are fixes the I'm not sure why I'm getting the message on Github about the commit not being part of the repository, it's probably related to the rebase I did to insert the Read for a new look |
4721cad
to
74e9063
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Eric - please could you squash everything down while taking care of the final couple of comments?
python/GafferSceneUI/ShaderUI.py
Outdated
|
||
def __rootPathChanged( self, path ) : | ||
|
||
self.__updatePaths() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to rebuild the paths immediately any time pathChanged()
is signalled. Why don't we just set __pathMatcherDirty
and iterate the paths lazily in __updatePathMatcher
? In other words, why do we even need self.__paths
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think __pathMatcherDirty
will be true quite often - with every change to the filter - but the paths will be changed much less often. In the specific case of the shader browser, paths will only be set once and then left alone.
That suggests to me to keep the self.__paths
so they can be updated only as needed, and adding a new self.__pathsDirty
flag, and call updatePaths()
before __updatePathMatcher()
in the _filter()
method.
How does that sound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a reasonable argument for sure. I guess maybe I'd counter by saying that storing all the Path objects could be quite expensive in the general case, vs just storing the matches in a PathMatcher. And I quite liked the simplicity of removing the additional state. All a bit hypothetical given the current use case, I know. I'll defer to your judgment - certainly if it makes a tangible performance difference to the current use case, then storing __paths
is worthwhile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give both a try and see if I can pick up on a performance difference.
python/GafferSceneUI/ShaderUI.py
Outdated
|
||
def __updatePathMatcher( self ) : | ||
|
||
if not self.__pathMatcherDirty or len( self.__patterns ) == 0 or self.__propertyName == "" : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't a call to setPropertyName( "" )
or setMatchPatterns( [] )
fail to update the path matcher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! Fixed in 100525f
74e9063
to
a974d53
Compare
I squashed down, but still have a WIP commit where I'm trying to update the paths lazily. What I have in a974d53 is what I thought should work, but when I enter something valid in the filter all of the paths are removed. It seems like I'll look into it more on Monday... |
a974d53
to
9e2bb14
Compare
John and I sorted out the filter problem offline and it's implemented in 9e2bb14 along with some other cleanups. The issue was giving the same path to the filter and the path widget. In The solution is to give the filter a copy of the root path so it's not affected by filtering and always has access to the full tree of shader paths. |
9e2bb14
to
3ba7aa3
Compare
Thanks Eric - I've squashed the fixup in and merged. |
This adds a search / filter input to the shader browser, used by the
ShaderTweaks
andShaderQuery
nodes.Checklist