Code: Select all
//{
tv_readUserString "LayerAttenuation" "State" "NewLayerAttenuationValue"
NewLayerAttenuationValue = result
tv_display "layerattenuation" "value" NewLayerAttenuationValue
//}
//{ SHIFT change value and exit
tv_getModifiers
PARSE result shift ctrl alt
IF CMP(shift,"1")==1
tv_ReqNum NewLayerAttenuationValue 0 100 "Layer Attenuation %"
NewLayerAttenuationValue = result
IF CMP(NewLayerAttenuationValue,"Cancel")
EXIT
ELSE
tv_writeUserString "LayerAttenuation" "State" NewLayerAttenuationValue
tv_display "layerattenuation" "value" NewLayerAttenuationValue
EXIT
END
ELSE
tv_readUserString "LayerAttenuation" "State" "NewLayerAttenuationValue"
NewLayerAttenuationValue = result
END
//}
//{
tv_Display
ShowState = result
tv_Display "LayerAttenuation"
PARSE result layerattenuation LayerAttenuationState LayerAttenuationValue
//}
//{ Toggle
IF CMP(LayerAttenuationState,off) || CMP(ShowState,All)
tv_Display "LayerAttenuation" on
tv_Display current
ELSE
tv_Display "LayerAttenuation" off
tv_Display all
END
//}
It basically assumes you ALWAYS have layer attenuation enabled, and it remembers the value over ALL projects. You can change the % of it by pressing the button with SHIFT. So if you don't want attenuation, just use 0%.
For some reason there's a bug the first time you press it with shift, but after that it works fine (forever and ever, even on new projects or when you quit). It probably has something to with reading a user string before it exists... But it's only once ever, so I'm fine with it this way. But if someone knows how to fix it, please let me know.