csp Posted December 4, 2013 Share Posted December 4, 2013 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 Quote Link to comment Share on other sites More sharing options...
graham Posted December 4, 2013 Share Posted December 4, 2013 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? Quote Link to comment Share on other sites More sharing options...
csp Posted December 4, 2013 Author Share Posted December 4, 2013 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. Quote Link to comment Share on other sites More sharing options...
csp Posted December 4, 2013 Author Share Posted December 4, 2013 Never mind, I will trigger it at moment a new version is sent to the farm. But thanks for the tips. Quote Link to comment Share on other sites More sharing options...
graham Posted December 4, 2013 Share Posted December 4, 2013 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. 1 Quote Link to comment Share on other sites More sharing options...
csp Posted December 4, 2013 Author Share Posted December 4, 2013 Good point, by just in case how I can use the hou.Parm.parmTemplate() to change max value of a numeric parameter? I cant find much on documentation (parmTemplate -> Returns the template for this parameter.) Quote Link to comment Share on other sites More sharing options...
graham Posted December 4, 2013 Share Posted December 4, 2013 Since your parameter is an integer parameter, take a look at the help for hou.IntParmTemplate. It has functions to set the min/max/default values. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.