Reading if an Attribute has been accessed by a node

   1054   6   0
User Avatar
Member
9 posts
Joined: Dec. 2018
Offline
Hi folks!

Lately I have been dabbling with the idea of creating an Attribute Checker in Python (within a python panel), giving me insights, where and how attributes are accessed upstream. I have found that with hou.AttribDataId I can check for changes in attributes.
However, is there a python method of some sorts that gives info about Accessed attributes not Changed?
I.e. if I have this snippet somewhere in my stream:
vector test = v@rest;
v@test = test
Then the v@rest has been accessed and is crucial to the node tree, but it has not been changed.
This would help me greatly figuring out what attributes can be discarded in huge node trees.
Thanks in advance!
User Avatar
Member
9 posts
Joined: Dec. 2018
Offline
Or maybe there is a method or list per node on which attributes are accessed?
User Avatar
Member
152 posts
Joined: Jan. 2013
Online
The most suitable class for this https://www.sidefx.com/docs/houdini/hom/hou/NodeInfoTree.html [www.sidefx.com]
You can also find the corresponding showDiffsClicked function in the $HFS/houdini/python3.9libs/nodegraphui.py module.
User Avatar
Member
9 posts
Joined: Dec. 2018
Offline
alexwheezy
The most suitable class for this https://www.sidefx.com/docs/houdini/hom/hou/NodeInfoTree.html [www.sidefx.com]
You can also find the corresponding showDiffsClicked function in the $HFS/houdini/python3.9libs/nodegraphui.py module.
Oh that definitly helps basically giving me the info that is displayed in the NodeInfo UI with more options / Debug enabled.
Although I had a look into the python files and it seems all info I can get with this is "Deleted", "New" and "Changed" Attributes, not somehow "Accessed".
Another option, although super cumbersome would be that I check all text inputs on each node (even the code in a wrangle) and search for a specific attribute like if I want to see which nodes accesses rest e.g I would search for string matches like "rest" "v@rest" "@rest" etc.
User Avatar
Member
8025 posts
Joined: July 2007
Offline
I don't think it's easy for node to know which attributes it will access during runtime without cooking in all possible code paths on all frames, etc.
So for the ultimate goal of knowing which upstream attributes will most likely never be accessed (or at least we're not accessed by the node during within the shot length) it would be pretty tricky but most likely impossible to tell 100% without cooking

The node can also access attributes of geo from any of it's inputs including spare inputs and also from arbitrary nodes by direct op: reference

Parameters can be overriden by expressions or through spare input dictionary parm attribute, can be different for each take etc..
Node and attribute names can also be generated by internal logic at runtime so scanning for text may not always help

The most straightforward way would be to submit an RFE and see what SESI will come up with, maybe they can add a function that would from a single node cook at least return a list of directly referenced nodes and which attributes were read from them at that time
Edited by tamte - Jan. 21, 2023 12:13:41
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
9 posts
Joined: Dec. 2018
Offline
Ah, dang it :/. But thanks so much for your explanation! Now it makes it quite a bit more logical why it's a a lot trickier than it seems. I'll check out submitting an RFE, maybe this is a handy feature for more people.
Thanks again!
User Avatar
Member
9 posts
Joined: Dec. 2018
Offline
tamte
So for the ultimate goal of knowing which upstream attributes will most likely never be accessed (or at least we're not accessed by the node during within the shot length) it would be pretty tricky but most likely impossible to tell 100% without cooking

The node can also access attributes of geo from any of it's inputs including spare inputs and also from arbitrary nodes by direct op: reference

Parameters can be overriden by expressions or through spare input dictionary parm attribute, can be different for each take etc..
Node and attribute names can also be generated by internal logic at runtime so scanning for text may not always help

But as you said, maybe as a first step (for an RFE) it could compute the access only on the current frame and only for the main stream only taking the first inputs geo into account. Thinking in terms of my use case, I would essentially select a bunch of nodes (preferably all connected upstream) and then check for Access of a certain attribute only on those. That could limit complexity and maybe live somewhere in hou.NodeInfoTree.
Edited by JoshRizzo - Jan. 22, 2023 04:30:29
  • Quick Links