SCRIPTING: How To Return Parameter's Original Value

   942   2   0
User Avatar
Member
4 posts
Joined: 12月 2014
Offline
My setup is very simple, I have a custom float parameter with a custom toggle. I want the user to be able to enter a value in the float parameter. But when the user hits the toggle button, I want the float parameter to be set to 0. That works. But when they uncheck the toggle, I want to the float value to return to the original value.

This is the code I am working with, I will give you python and hscript:

PYTHON:
if ch("../null1/cy") == 1:
    return 0
return ???ORIGINAL VALUE???

HSCRIPT
if(ch("../null1/cy") == 1, 0, ???ORIGINAL VALUE???)

How can I return the original value of the parameter?

Thank you
Edited by Guy Micciche - 2023年1月10日 18:05:32
User Avatar
Member
4 posts
Joined: 12月 2014
Offline
I think this is right. Is it? Seems to work at the base level, but is $IV the correct answer or is there something else? Also, out of curiosity, what is $IV equivalent using python? Hoping somebody can confirm this is correct or if there is a standard way. Thanks!

HSCRIPT:
{
    if(ch("../null1/cy") == 1)
    {
        return 0;
    }
    else
    {
        return $IV;
    }
}
Edited by Guy Micciche - 2023年1月10日 18:46:03
User Avatar
Member
51 posts
Joined: 6月 2020
Offline
You can write hou.lvar("IV") in python
  • Quick Links