Jump to content

parameter value relative offset


agelosc

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

Link to comment
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
Link to comment
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 5
Link to comment
Share on other sites

  • 1 year later...
On 21/12/2017 at 2:12 PM, f1480187 said:

 

 

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.

 

THIS.... is fantastic! Many thanks, as an ex Softie it's super helpful to be able to do this (easily) again.

Rich.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...