Finding the UserString in a file
Finding the UserString in a file
I'm looking into getting TVPaint to write out some information, in the interest of automation.
eg. A George script that could open a file, check the name of all the layers in it and then write all their names to a file.
There is file writing in TVPaint, but it requires a user to manually say that it's ok to write files, which is not really suitable for what I want to do. I did also see that there was the tv_WriteUserString command, which might work. It references a configuration file where I presume the information is stored but I couldn't see where that file might be (assuming it even exists).
Is this a file on the drive that I could have an external script read or is it somehow just contained within TVPaint for different TVP files to use?
eg. A George script that could open a file, check the name of all the layers in it and then write all their names to a file.
There is file writing in TVPaint, but it requires a user to manually say that it's ok to write files, which is not really suitable for what I want to do. I did also see that there was the tv_WriteUserString command, which might work. It references a configuration file where I presume the information is stored but I couldn't see where that file might be (assuming it even exists).
Is this a file on the drive that I could have an external script read or is it somehow just contained within TVPaint for different TVP files to use?
Re: Finding the UserString in a file
The config file exists in the user/appdata/roaming/tvp animation 11 pro folder on windows 7, not sure where it would be on other operating systems. Writing into and reading from the config is simple enough with george. I haven't seen a way to remove entries from the config so you could potentially end up with a lot of garbage if you're not careful. It's not an easy to read file so manually pruning garbage entries might be tedious but I'm sure a simple python script or something could help with that sort of thing.
Re: Finding the UserString in a file
The "Write File ? Yes No" question when reading/writing a file only needs to be answered once per TVPaint session. You could (I think) write a little George script to just ask the user the "Write File" question once, at the start of each TVPaint session instructing the user to always answer "yes". For the rest of that session, you could trigger any other George script to write out data at any time to a file or files without any confirmation.
Also, if you look in the Config.ini file, you will clearly see how the information is organized in Sections so you could easily Categorize data that could be read in the Config.ini file under some unique Custom Section name. Note however, that the info you insert in the current Config.ini file during the current session only exists in memory until you quit TVPaint at which point it is written/updated in a new version of the Config.ini file.
I think this info is correct, but you need to test it. Also, if you develop an easy, practical method for passing info into and out of TVPaint via written files, please share what you learn with the rest of the forum. Thanks!
Sven
Also, if you look in the Config.ini file, you will clearly see how the information is organized in Sections so you could easily Categorize data that could be read in the Config.ini file under some unique Custom Section name. Note however, that the info you insert in the current Config.ini file during the current session only exists in memory until you quit TVPaint at which point it is written/updated in a new version of the Config.ini file.
I think this info is correct, but you need to test it. Also, if you develop an easy, practical method for passing info into and out of TVPaint via written files, please share what you learn with the rest of the forum. Thanks!
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Re: Finding the UserString in a file
Aha! I was foolish not to check there thoroughly. I did indeed find the config.ini file in the AppData\Roaming folder for me. Thanks! Just a note that I did find out you only need to answer the file prompt once, but I was trying to set up an automated process where there's no user at all interacting so I was trying to bypass that part.
To share some of what I've figured out, you actually can remove data from the config file using TVPaint commands. If you use the same section and keyword but give no value to be stored. For example:
That will store "teststring", but that can be removed like this:
Then the "Test" key wont be in the document any more. Though "Sect" would still persist as a section, just without any data in it. And Sven is entirely correct, the data is only written once TVPaint quits, before then the file on the disk isn't touched. This does allow me to be able to possibly read info out of TVPaint with a script, in practice it might be cumbersome since the file contains so much other data that the program itself uses but it's good to know.
The more practical solution I have been using was mostly to get info into TVPaint, and the tv_writeuserstring command was most helpful. What I basically have is a Python script that runs a command to the commandline. The main thing it needs to do is call a George script, but I first call some tv_writeuserstring commands to set up things, like this:
So this can set the render settings based on parameters figured out in the Python script itself, then the George script can use tv_ReadUserString to get these values that have been set. Obviously this doesn't make it easy to get information from TVPaint files, but to do that I could use a George script to call tv_WriteUserString and then read the config file directly with Python. It's not the cleanest solution but it definitely makes it possible.
To share some of what I've figured out, you actually can remove data from the config file using TVPaint commands. If you use the same section and keyword but give no value to be stored. For example:
Code: Select all
tvpaint.exe "cmd=tv_WriteUserString Sect Test teststring"
Code: Select all
tvpaint.exe "cmd=tv_WriteUserString Sect Test"
The more practical solution I have been using was mostly to get info into TVPaint, and the tv_writeuserstring command was most helpful. What I basically have is a Python script that runs a command to the commandline. The main thing it needs to do is call a George script, but I first call some tv_writeuserstring commands to set up things, like this:
Code: Select all
tvpaint.exe "cmd=tv_WriteUserString Render Output Path/to/Export" "cmd=tv_WriteUserString Render Start 12" "cmd=tv_WriteUserString Render End 85" "script=Path/to/George.grg"
Re: Finding the UserString in a file
Gary,
Good info, thanks. My guess is the requirement for per session confirmation by the user (for file read/write activity) discourages mischief or accidental/unintended overwriting of data?
Sven
Good info, thanks. My guess is the requirement for per session confirmation by the user (for file read/write activity) discourages mischief or accidental/unintended overwriting of data?
Sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Re: Finding the UserString in a file
Yeah I've seen responses somewhere to that effect. You could theoretically point them to critical system files and overwrite those, so they want to make sure that it's always human validated so there's no automated script that accidentally runs amok like that.
Re: Finding the UserString in a file
I actually never was so happy about this. I think it is a little confusing/annoying that I have to click yes every time I start TVPaint.Svengali wrote: requirement for per session confirmation by the user (for file read/write activity)
And I was once working on an animation production with 12 people working in TVPaint where I sat up the pipeline. And I remeber people was confused about this popups, and never understod them.
If I remember correct in Adobe after effects there is a checkbox in the preferences that enables scripts to access read/Write of file systems.
I would prefer this. A checkbox in the TVPaint Preferences that allows scripts to read write files in the file system, and once I have checked this George is able to read write Filesystem without any warnings/popup.It should also be checked the next time I open TVPaint.
And if I was running a pipeline in a studio It would be nice if I only wpold have to click these settings one time, so I didn't have to answer questions about the popup.
-Mads
Re: Finding the UserString in a file
hmmm ... good time to ask as we prepare the 11.0.3 currently.
Will talk about it tomorrow with Mike.
Will talk about it tomorrow with Mike.
Fabrice Debarge
Re: Finding the UserString in a file
OkFabrice wrote:hmmm ... good time to ask as we prepare the 11.0.3 currently.
Will talk about it tomorrow with Mike.
![Smile :)](./images/smilies/icon_smile.gif)