Page 3 of 3

Re: Standard layer attenuation percentage

Posted: 23 May 2014, 10:14
by Lukas
I also did an attempt to get the way I like it;

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
//}
I replaced my 'Display all layers or just the current layer' shortcut with this one.

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. :)

Re: Standard layer attenuation percentage

Posted: 23 May 2014, 12:07
by Svengali
Lukas wrote: But if someone knows how to fix it, please let me know. :)
tv_ReadUserString

tv_ReadUserString section line default

Reads a character string in the current configuration file. The section argument is the name of the section, and the line argument is the name of the line containing the string to be read. The default argument may be used to specify the string to be returned by default if the search line does not exist. All these arguments must be enclosed in double quotes. The character string is stored in the Result variable. This command may be used to read data stored using tv_WriteUserString in the current configuration file.

The first time you run the script, no attenuation value has been stored yet so you should include a DEFAULT attenuation value to be returned. After that, when you run the script it will read whatever has been stored from the previous tv_WriteUserString and the DEFAULT attenuation value will be always be ignored.

Sven

Re: Standard layer attenuation percentage

Posted: 23 May 2014, 12:34
by Lukas
Thanks for the help Svengali! I misread that part :) It works exactly like intended now.

- Click the button to hide/show other layers (with layer attenuation value, which will be remembered forever).
- Shift click the button to change layer attenuation percentage.

Re: Standard layer attenuation percentage

Posted: 24 May 2014, 22:41
by schwarzgrau
Thank you Lukas.
Maybe something for the contents sharing section.

Re: Standard layer attenuation percentage

Posted: 24 Jun 2014, 12:29
by Lukas
schwarzgrau wrote:Thank you Lukas.
Maybe something for the contents sharing section.
Sure, I'll post it there.

edit: Here http://forum.tvpaint.com/viewtopic.php?f=11&t=8330" onclick="window.open(this.href);return false;

Re: Standard layer attenuation percentage

Posted: 07 Jul 2014, 22:47
by CartoonMonkey
Thank you Lukas for this panel! It really should be built into TVPaint by default!
Essential!