How can I use python to delete channels? I looked through the documentation but didn't find a command. Thanks!
(Reason: I want to make a script that will loop through all the parameters of a node and delete all the channels. I know how to do the looping part now, but I don't know the command to delete the channels )
delete channels with python (HOM)
17530 7 0- josh3light
- Member
- 120 posts
- Joined: Feb. 2008
- Offline
- graham
- Member
- 1906 posts
- Joined: Nov. 2006
- Online
- josh3light
- Member
- 120 posts
- Joined: Feb. 2008
- Offline
- josh3light
- Member
- 120 posts
- Joined: Feb. 2008
- Offline
I'm a little confused about the usage… create a default box and write an expression sin($FF) in tx…
I ran this from the python shell:
>>>hou.parm.deleteAllKeyframes('/obj/box_object1/tx')
or this:
>>>hou.parm.deleteAllKeyframes(hou.node('/obj/box_object1/tx'))
and got this:
Traceback (most recent call last):
File “<console>”, line 1, in <module>
AttributeError: ‘function’ object has no attribute ‘deleteAllKeyframes’
I ran this from the python shell:
>>>hou.parm.deleteAllKeyframes('/obj/box_object1/tx')
or this:
>>>hou.parm.deleteAllKeyframes(hou.node('/obj/box_object1/tx'))
and got this:
Traceback (most recent call last):
File “<console>”, line 1, in <module>
AttributeError: ‘function’ object has no attribute ‘deleteAllKeyframes’
- graham
- Member
- 1906 posts
- Joined: Nov. 2006
- Online
- josh3light
- Member
- 120 posts
- Joined: Feb. 2008
- Offline
- josh3light
- Member
- 120 posts
- Joined: Feb. 2008
- Offline
In appreciation of the help, here are three functions for any others that are starting python, that can be added to hou.session.module. I just started using python (not being a programmer or scripter before) and it took me a couple of days to figure it out…
It would be nice if there was a place that users could easily contribute things like this for houdini (like scriptspot.com etc)…. oh maybe the exchange.. but there's no python section yet.
———————
copyVals: copies values from one node's parameters to another.
copyParms: channel references one node with another identical node.
delParms: deletes all channels of a node.
def copyVals(sourcebox, targetbox):
mytargettuple =
for row in mytargettuple:
targetbox.parm(row).set(sourcebox.parm(row).eval())
def copyParms(sourcebox, targetbox):
mytargettuple =
for row in mytargettuple:
targetbox.parm(row).set(sourcebox.parm(row))
def delParms(targetbox):
for theparm in targetbox.parms():
theparm.deleteAllKeyframes()
It would be nice if there was a place that users could easily contribute things like this for houdini (like scriptspot.com etc)…. oh maybe the exchange.. but there's no python section yet.
———————
copyVals: copies values from one node's parameters to another.
copyParms: channel references one node with another identical node.
delParms: deletes all channels of a node.
def copyVals(sourcebox, targetbox):
mytargettuple =
for row in mytargettuple:
targetbox.parm(row).set(sourcebox.parm(row).eval())
def copyParms(sourcebox, targetbox):
mytargettuple =
for row in mytargettuple:
targetbox.parm(row).set(sourcebox.parm(row))
def delParms(targetbox):
for theparm in targetbox.parms():
theparm.deleteAllKeyframes()
- windwolfx23
- Member
- 11 posts
- Joined: July 2017
- Offline
import toolutils
def clearAnimation(nodes):
“”“
clear all animation
”“”
for node in nodes:
if not isinstance(node, hou.NetworkBox):
for parm in node.parms():
parm.deleteAllKeyframes()
nodes = hou.selectedItems()
clearAnimation(nodes)
##paste this to a new shelf tool, it delete all selected nodes channels.
def clearAnimation(nodes):
“”“
clear all animation
”“”
for node in nodes:
if not isinstance(node, hou.NetworkBox):
for parm in node.parms():
parm.deleteAllKeyframes()
nodes = hou.selectedItems()
clearAnimation(nodes)
##paste this to a new shelf tool, it delete all selected nodes channels.
-
- Quick Links