Jump to content
agelosc

parameter value relative offset

Recommended Posts

Hi, 

Is there a way to set a parameter value to the result of an math operation using the current value. In maya for example, in the channel editor you can set the value to "+=10" or "*=2". This will add 10 or multiple by 2 the current value. This makes sense when multiple objects are selected and you want a common relative offset and not an absolute value or an expression. 

Thanks in advance

Share this post


Link to post
Share on other sites

For addition/subtraction parameter ladder will work. For more complex expressions you can type in Python Shell pane:

for node in hou.selectedNodes():
    node.parm('tx').set(node.evalParm('tx') * 2)

Or type that in Python Source Editor window and press Apply. In that case you need to remove the code after execution, so it won't run again on file reload.

  • Like 1

Share this post


Link to post
Share on other sites

Something like this?

multi_edit_values.gif.9b91c9d4f1f4af11d187790119152c64.gif

You can have it by installing simple script below:

<?xml version="1.0" encoding="UTF-8"?>

<menuDocument>
    <menu>
    <subMenu id="expression_menu">
        <scriptItem id="multi_edit_values">
            <label>Multi-Edit Values</label>
            <scriptCode>
                <![CDATA[

import hou

choice, expression = hou.ui.readInput(
    'Multi-Edit Values',
    initial_contents='$SELF',
    help='Use $SELF to reference current value.',
    buttons=('Accept', 'Cancel'), close_choice=1
)

if choice != 1:
    with hou.undos.group('Multi-Edit Values'):
        for p in kwargs['parms']:
            p.setExpression(expression.replace('$SELF', p.evalAsString()))
            p.deleteAllKeyframes()

                ]]>
            </scriptCode>
        </scriptItem>
    </subMenu>
    </menu>
</menuDocument>

Save this to a file called PARMmenu.xml  (Windows example: C:\Users\user\Documents\houdini16.5\PARMmenu.xml).

If the file exist, then merge contents under nearest common tag.

  • Like 2

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

×