I want to set all the values of all parameters of all nodes in all contexts to the current value (at a specific frame). So, everything that is time dependent is effectively frozen or locked in at a certain value.
Sounds simple but there are a lot of edge cases like expressions evaluating scripts, referencing other nodes from perhaps other networks, hidden parms, unusual types, animated channels, etc.
Is there a beautiful and simple way that I'm missing?
How do I hard-set all parameters to the current value?
1761 3 2-
- Soothsayer
- Member
- 875 posts
- Joined: Oct. 2008
- Offline
-
- shadesoforange
- Member
- 203 posts
- Joined: July 2015
- Offline
Essentially you want to call hou.Parm.deleteAllKeyframes() [www.sidefx.com] (this includes hscript expressions, hscript, python parms) etc and you'll be left with the current value.
Pseudo python code incoming:
Hope that helps
Edit: If you want to do it at a specific frame, you can set the current frame to a specific value first.
Pseudo python code incoming:
for network in network: for node in network.nodes(): # there might be a function to get all node instances of all networks right away for parm in node.parms() parm.deleteAllKeyframes()
Hope that helps
Edit: If you want to do it at a specific frame, you can set the current frame to a specific value first.
Edited by shadesoforange - Oct. 17, 2020 17:32:24
Manuel Köster - Senior Technical Artist @Remedy Entertainment
https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
-
- Soothsayer
- Member
- 875 posts
- Joined: Oct. 2008
- Offline
I use the deleteAllKeyframes() but it doesn't work for all parm cases. I think there are two problems with it. It doesn't deal with scripted parms well (think multiline python code) and I there seem problems with evaluating the parms in the right order, especially if there are deep dependencies.
The best I could do so far is to use deleteAllKeyframes() but copy all values first into a dictionary that I later read the values from. Second, I just ignore the parms with multiline code as they mostly seem to be irrelevant in my case. There's one parm that gets set in a script and I just sort of rewrite it a little but ideally I'd like to have a way to just freeze its current value.
The best I could do so far is to use deleteAllKeyframes() but copy all values first into a dictionary that I later read the values from. Second, I just ignore the parms with multiline code as they mostly seem to be irrelevant in my case. There's one parm that gets set in a script and I just sort of rewrite it a little but ideally I'd like to have a way to just freeze its current value.
--
Jobless
Jobless
-
- shadesoforange
- Member
- 203 posts
- Joined: July 2015
- Offline
Could you describe situations where this fails? I have couple of scripts that do shenanigans similar to this and would like to hear about potential pitfalls.
Scripted parms (python SOP/wrangle) are “just” be string parameters with language highlighting (AFAIK).
And in my head the order shouldn't matter if you don't have parameters that query if another parameter is an expression.
Scripted parms (python SOP/wrangle) are “just” be string parameters with language highlighting (AFAIK).
And in my head the order shouldn't matter if you don't have parameters that query if another parameter is an expression.
Manuel Köster - Senior Technical Artist @Remedy Entertainment
https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
-
- Quick Links