You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Houdini lsattrs logic does a search for nodes based on a parameter name and value which is used for host.ls() in Houdini.
I just heard of nodesearch that comes with Houdini out of the box. It might be worth actually relying on that logic instead.
It could make lsattrs basically like this:
# pseudocode match any of {attr: value} in attrsimporthouimportnodesearchdeflsattrs(attrs):
root=hou.node("/obj")
forattr, valueinattrs.items():
matcher=nodesearch.RawParm(attr, value, exact=True)
fornodeinmatcher.nodes(root, recursive=True)
yieldnode
And I noticed the current logic in Houdini doesn't actually ensure all input values of the attrs dict get matched but if we do actually want that:
# pseudocode match all of {attr: value} in attrsimporthouimportnodesearchdeflsattrs(attrs):
root=hou.node("/obj")
matchers= []
forattr, valueinattrs.items():
matchers.append(nodesearch.RawParm(attr, value, exact=True))
fornodeinnodesearch.Group(matchers, intersect=True):
yieldnode
It could be worth investigating whether the logic used by nodesearch is faster or not.
Additional Context
This could be a micro-optimization so might only really be worth if host.ls() really becomes problematic. But leaving it here for future reference.
The text was updated successfully, but these errors were encountered:
What happened?
The Houdini
lsattrs
logic does a search for nodes based on a parameter name and value which is used forhost.ls()
in Houdini.I just heard of
nodesearch
that comes with Houdini out of the box. It might be worth actually relying on that logic instead.It could make
lsattrs
basically like this:And I noticed the current logic in Houdini doesn't actually ensure all input values of the
attrs
dict get matched but if we do actually want that:It could be worth investigating whether the logic used by
nodesearch
is faster or not.Additional Context
This could be a micro-optimization so might only really be worth if
host.ls()
really becomes problematic. But leaving it here for future reference.The text was updated successfully, but these errors were encountered: