Jump to content

Update parameters


csp

Recommended Posts

Is it possible to update the default value of a parameter like an integer in order to much with the version of the current hip? So when ever you save a new version will change the default value.

AND/OR update the max value of the integer's slider to much with the current version.

I think this question has two parts:

1. Is it possible to change parameter's default, min and max values through python?

2. Is it possible to trigger a function inside your digital asset when you load or save a hip?

cheers

Link to comment
Share on other sites

It's easy enough to modify the parameter settings by using parm templates. They let you modify the default values, as well as min/max values, etc. You basically just need to get the template from the parameter (hou.Parm.parmTemplate()) and make any modifications to it. You then should replace it back to your node/asset definition using either parm template groups, or replacing the tuple directly using the appropriate method depending if your parm is a spare parm or asset parameter.

As for running something on load/save, that is more difficult. You can do things on load in the 456.py file, however I don't think there is anything that gets run whenever you save the hip file. You would have to write your own function that would save your file and then run your updating code.

What is it you are trying to do exactly?

Link to comment
Share on other sites

The DA I am building is able to cache a simulation which gets the version of the shot but I want for the use to be able to change version of the shot but use a past version of sim, I have this implemented already but I would like the "Past Version" integer slider to update both the default value and max value to match with the version of the shot. With (hou.Parm.parmTemplate()) as you said I can do that, but I am thinking that if the user save a new version of the shot, I have somehow trigger the function which will update slider to use the current version as default and max.

Link to comment
Share on other sites

Personally I feel like this is trying to make things too complex. With this setup I'd probably just use an env var that corresponds to the shot version as the default value so it would update automatically when the version changes. As for the slider, I would just leave it unbounded and clamped internally.

Ideally though, I'd have a menu that would list all the available versions (as well as a Latest option) and just use that. That way you don't have to worry about ranges and stuff since it only shows you versions up to whatever you are at now.

  • Like 1
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...