[Sidefx-houdini-list] setting default values of HDA

Sandy Sutherland sandy.maillists at gmail.com
Wed Nov 9 09:26:58 EST 2016


Just had to set this up myself for a tool I am creating here - the function
snippet is -

    @staticmethod
    def _set_defaults(node, p, value):
        """
        Function to set Parm defaults in an HDA
        :param node: The node to set it on
        :param p: The Parm in question
        :param value: The Value to set the default to
        :return:
        """
        deff = node.type().definition()
        parm_group = deff.parmTemplateGroup()
        parm_template = parm_group.find(p)
        parm_template.setDefaultValue(value)
        parm_group.replace(parm_template.name(), parm_template)
        deff.setParmTemplateGroup(parm_group)

On Wed, Nov 9, 2016 at 2:15 PM, Martijn Grootendorst <martinuz at gmail.com>
wrote:

> found it:
>
> in Type properties/ the little gear top right in existing parameters
> column: "copy defaults from node"
>
> sweet! :)
>
>
>
> On Wed, Nov 9, 2016 at 3:07 PM, Edward Lam <edward at sidefx.com> wrote:
>
> > I think the only alternative is to only use _all_ the parameter values of
> > your HDA node that you opened the Type Properties from. To do this for
> your
> > HDA in the Type Properties dialog, go to the Save tab. Turn off Save
> > Defaults as Initial Parameters.
> >
> > Turning this off is a bit dangerous though as the setting lives with the
> > HDA and you have to be careful about keeping the parameter values of your
> > HDA "clean" whenever you save or else you inadvertently change the
> initial
> > parameter values whenever creating a new node of your HDA type.
> >
> > Cheers,
> > -Edward
> >
> >
> > On 09/11/2016 8:46 AM, Martijn Grootendorst wrote:
> >
> >> Hi,
> >>
> >> I'm having some fun with creating my own HDA and I was wondering if
> there
> >> is an easier way to set default values of the asset.
> >> Ideally I would like a shelf button or maybe even in a right-click menu
> to
> >> create/set the default values from the current values.
> >> This is already possible for 1 parameter at a time (right-click in a
> value
> >> field/ Make Current Value Default), but with an increasing amount of
> >> parameters this becomes more difficult to manage.
> >>
> >> I know python (but I've only had to use it in maya :)  so any guidance
> in
> >> this direction would be great!
> >>
> >> thanks,
> >> Martijn
> >> _______________________________________________
> >> Sidefx-houdini-list mailing list
> >> Sidefx-houdini-list at sidefx.com
> >> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >>
> >>
> > _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list