Jump to content
gerardocastellanos

python code in a shelf buttom

Recommended Posts

Hi, I am new scripting for Houdini

I made an script in python, I tested on "python source editor" window... it works

So I decide to make a shelf buttom in order to store it and apply it later on.

I put my code into the script tab and field, define python as my language.

but when I click in my buttom, it says this error message:

Quote

Traceback (most recent call last):
  File "tool_1", line 7, in <module>
  File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.499/houdini/python2.7libs\hou.py", line 50447, in keyframes
    return _hou.Parm_keyframes(*args)
ObjectWasDeleted: Attempt to access an object that no longer exists in Houdini.

 

this is my code
 

import hou

for n in hou.selectedNodes():

    for p in n.parms():

        if len(p.keyframes()) > 0:
        
            exp = p.expression()
            exp = exp.replace("L_", "R_")
            p.setExpression(exp)

 

what I did wrong?

 

thanks you

 

 

Share this post


Link to post
Share on other sites

It works for me, but the error tells you what is wrong. A node in the selection was removed somewhere during the process. Try testing to make sure p is not None before trying to fetch the keyframes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×