Where is the "home" folder for george include function

Please use this part to report bugs & errors, ask questions & "How to..."
Post Reply
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Where is the "home" folder for george include function

Post by NathanOtano »

Hey! :)

In this part of the tvpaint george wiki :
When George command interpreter meets a line containing this command, it replaces it by the contents of the specified file. This allows you to create function libraries and include them in your George script. To access the specified file, George gives priority to tow search directories :

The TVPaint home directory (mentioned in the HomeDir line in the TVPaint.ini file)
The directory containing the George script in which the INCLUDE instruction was given.

From these base directories you can specify an access path for the file to be included (for example, #INCLUDE "library\strfunc\strlib.grg"). If the file to be included contains procedures, you must place the INCLUDE line after the end of the main program. You will find two examples of function libraries for the processing of character strings ("basic.grg" and "Advanced.grg") in the "George\Include" directory of TVPaint.
Is the following line still true? I assume it's for mac users, I tried to find the equivalent for PC.
The TVPaint home directory (mentioned in the HomeDir line in the TVPaint.ini file)
I think that I someday moved my scripts away from the folder... but maybe it's just that I never used the files I included in my scripts in another location than the one of my scripts.

I can't find the folder on windows, I tried everywhere (tvpaint george directories in program files, roaming, my cloud config folder...) but nothing works.
I want to put my libraries of functions somewhere to be able to call them with the include function when I set an embedded script or when I reference a script file that is not in the same folder as my library.

In which cases the included scripts exports with the panels?

Nathan
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

No clue on this one? It's really important to me
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
User avatar
neonnoodle
Posts: 240
Joined: 22 Dec 2010, 14:17
Location: Boston, MA
Contact:

Re: Where is the "home" folder for george include function

Post by neonnoodle »

Have you tried C:\Users\(Your Username)\AppData\Roaming\tvp animation 11 pro\default
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

Yes I tried :( I guess the problem is related to the "include" function that does'nt like when the library is not just next to the script? The problem is I can't find a way to put my library of functions is a "home directory" and call it from somewhere else.
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Where is the "home" folder for george include function

Post by Svengali »

Nathan,

Here is a REALLY simple TVPX file with two buttons that demonstrate two things...
Path&IncludeTests.jpg
Path&IncludeTests.jpg (3.76 KiB) Viewed 30516 times
1. tv_Path Test Button which simply shows what the results of each tv_Path parameter option would be. Just click the button.
It uses a simple concatenation trick to build a msg (message) which can then be shown as a "list" using the tv_ListRequest command.
Note that tv_GetPath and tv_GetPath HOST results in the same "root' path.
The other tv_GetPath parameter results are shown as well ( TEMP : CONFIG : PLUGIN : GEORGE).
You can concatenate the results of tv_GetPath with the name of any folder in your script to generate any useful path
As an example, in the PathTest, I create the complete path to the FxBin folder...

2. Include Test Button demonstrates that you can "nest" include files. The main script contains "#Include IncludeHello.grg"
Then, the IncludeHello.grg script contains the line "#Include IncludeGoodBye.grg"
The Main Include Test script calls both the Hello() function in IncludeHello.grg and the GoodBye() function in IncludeGoodBye.grg

The important information here is:
A. Both include files IncludeHello.grg and IncludeGoodbye.grg are deliberately stored in the George subfolder.
B. When the Path&IncludeTest.tvpx file was generated, it correctly and separately "included" the main script and both include files.
C. When the Path&IncludeTest.tvpx is installed, the main script and both include files are correctly installed in the George subfolder.

Here is the tv_Path Test script:

Code: Select all

// PathTest.grg
// Svengali © 2016
// (May) 2016 - ver .0

Param none
ScriptName = "PathTest"

// Note that tv_GetPath    and    tv_GetPath HOST  will result in the same path

tv_GetPath
RootPath = result
Msg = "RootPath = " RootPath "||"

Msg = MSG "tv_GetPath HOST : TEMP : CONFIG : PLUGIN : GEORGE  (tv_GetPath parameter options)||"

tv_GetPath HOST
HostPath = result
Msg = Msg "  HostPath = " HostPath "|"
tv_GetPath TEMP 
TempPath = result
Msg = Msg "  TempPath = " TempPath "|"
tv_GetPath CONFIG
ConfigPath = result
Msg = Msg "  ConfigPath = " ConfigPath "|"
tv_GetPath PLUGIN
PluginPath = result
tv_GetPath GEORGE
GeorgePath = result
Msg = Msg "  GeorgePath = " GeorgePath "|"

Msg = Msg "  PluginPath = " PluginPath "||"

Msg = Msg 'Create any custom path by combining RootPath concatenated to a "SubFolderName\"|'

FxBinPath = RootPath "FxBin\"
Msg = Msg "  FxBinPath = " FxBinPath ""


tv_ListRequest Msg		// show paths list




Here are listings for the main script and the two include files:

Code: Select all

// IncludeTest.grg

SayHello()
SayGoodBye()

#INCLUDE "IncludeHello.grg"

Code: Select all

// IncludeHello.grg

#INCLUDE "IncludeGoodBye.grg"

FUNCTION SayHello()
	tv_warn "Hello!"
END

Code: Select all

// IncludeGoodBye.grg

FUNCTION SayGoodBye()
	tv_warn "GoodBye!"
END
Sven
Attachments
Path&IncludeTests.tvpx
(109.5 KiB) Downloaded 1000 times
Last edited by Svengali on 07 May 2016, 23:24, edited 1 time in total.
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
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

Thanks for you help! Your script is really usefull.

I'm sorry i'm not sure that I have the answer to my question about include scripts. It works well for me to export it when the included scripts are in the same folder or in direct subfolers of the script I launch, my problem is with this line in the wiki :
George gives priority to tow search directories :
The TVPaint home directory (mentioned in the HomeDir line in the TVPaint.ini file)
I can't get it to work properly when I have for exemple an embedded script including a script in my home folder, or when I have a script in a random folder on my computer that I set on a button, that also would include a script in my home folder.
Also it seems to me that even if my include script works well in his subfolder, it does'nt export well if the script hierarchy is outside of the george home folder.

Your included script are stored is your george subfolder, but so is your pathTest script am I correct?

Does it make sense or maybe I havn't fully understood your response?
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Where is the "home" folder for george include function

Post by Svengali »

I guess I don't understand your problem.

In trying to divine the inner workings of George, I've always found it useful to create short test scripts that isolate the problem I'm having - then tweak the script until the problem is solved. Based on that I simply accept the syntactical boundaries and limits I discover and try to work within them.
NathanOtano wrote:Your included script are stored is your george subfolder, but so is your pathTest script am I correct?
Yes.

Are you creating buttons and scripts for your own use only? Or, are you designing buttons and scripts to be shared? If they are to be shared then you are obligated to follow the "path" rules pretty closely as to where you put your George files and your Include files. Experiments that test the limits of the TVPX bundling option will quickly reveal how it works... and how it breaks.

sidebar: Except for very simple operations, I tend to avoid embedding scripts in buttons because they are devilishly difficult to maintain. If you have three versions of the button in different places in your environment, then you have to edit/update all three embedded scripts. If you drop the same script in the George folder and link all three buttons to it, you need only change it once and it is instantly updated for all three buttons. Also, the embedded script editor (accessed through the button) is often just "hinky". Frankly, it never occurred to me to use an Include file in an embedded script! Does that really work?

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
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

Yes I do the same, I tested this hypothesis a lot in different folders, and while testing what I was thinking true reading the wiki isn't, so I was wondering if I was doing something wrong or if I have to give up on this wiki line :)

In fact my TVP config is on a google drive folder, this way my config in synchronized on my computer at school, my cintiq companion and my computer at home. When I tweak a script, add a button or change a shortcut I don't have to adapt or to correct it each time I change computer. So are my scripts in their own folder :)

I set scripts instead of embedding them when i'm working on the script, because it's far better to work in Notepad++ and save the script than to work the buggy TVP interface. The other option is to copy the script, open the button, open the embedded script interface, replace the script, and then validate all of this and click on the button... I really prefer to modify my script on notepad++, save it, then I just click on my buttons shortcut in TVP to test the setted updated script.
For me it's for scripting only, for now when I export panels I try to embed scripts as much as possible (not working on the interfance, just copy/pasting) to avoid exporting problems. But on my own panel I really often adapt my buttons, correct bugs etc... So I prefer that my script is somewhere in a folder where I can update it with notepad++. My problem is that my scripts are not in the TVP home directory, they are on my synced cloud to have them up to date all the time.
Frankly, it never occurred to me to use an Include file in an embedded script! Does that really work?
Haha, well I think it does'nt work. I was asking too much from TVP I guess :oops:
And sometimes I really want to use a TVP function of my library of functions for a really quick test. So I'll use my "otano_gotonext()" function for exemple in my "library_otano.grg" script, but I havn't found a way to put this library script in the right folder so that every script will search in this library, like what I understand in the wiki (it searches in the home folder). It's not only for embedded script, it also didn't work for setted scripts that are not in the home folder. So I guess it just didn't work when you library isn't in the same folder, or on a folder under, your script.

Also, when exporting, it seems to me that only the option where your library is in the same folder than your script works. When in a subfolder (or elsewhere if it's possible) the export does'nt work.

It wasn't a problem until I worked outside of my TVP home directory :) also, It means that I can't set scripts on mutiple computers using the same config because the path changes. It would be really usefull for me to be able to set scripts inside my "config folder" without losing their path from computer to computer (or simply to be able to change the george folder directory like we do with configs, or use a george config folder). TVP team if you read me <3
The solution for me is to convert every button I have to embedded scripts, but I have to search in my libraries for all my user functions and add them to the script and it's long, and if they are buggy and I correct my library I have to find all the scripts using this function and update them as well. As you said it's really not convenient, but it's the only way I have to have the scripts in my config synced on all my computers.

I think that what I'll do is moving my script folder directly in my config file, with the libraries at the same level as my scripts. I'll use set scripts only when I work on a script, then I'll export the panel to have universal buttons that does'nt have to remember a path. Then when I need to work again on my script, I'll set again the script and export again the panel. Or the other solution is to have my scripts in my home directory and update it by hand each time I change my computer, which solve some problems but creates others...
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
spyderheart
Posts: 124
Joined: 22 Jan 2013, 03:11

Re: Where is the "home" folder for george include function

Post by spyderheart »

Has anyone made any progress on this? I started a very similar thread and then found this one through google. Oh well.
Other thread: http://forum.tvpaint.com/viewtopic.php?f=34&t=11204

Much could be improved quickly if #INCLUDE could take a string variable as an argument.
David
--------------------------------------------------------
TVPaint 11.7 Standard
System: 64GB RAM // 3 TB SSD // Core i7 8700K // NVIDIA GTX 1080// Windows 10 Home
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

Still struggle with this... :(
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
spyderheart
Posts: 124
Joined: 22 Jan 2013, 03:11

Re: Where is the "home" folder for george include function

Post by spyderheart »

Still struggle with this... :(
You might be interested in picking apart my TOOLSXLAYERS panel to see how it's built:
http://forum.tvpaint.com/viewtopic.php?f=11&t=11183
It doesn't solve the #INCLUDE problem but it does use a workaround that opens up some doors that would allow you to achieve many of the same things.
David
--------------------------------------------------------
TVPaint 11.7 Standard
System: 64GB RAM // 3 TB SSD // Core i7 8700K // NVIDIA GTX 1080// Windows 10 Home
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

spyderheart wrote: 30 Jan 2018, 04:06
Still struggle with this... :(
You might be interested in picking apart my TOOLSXLAYERS panel to see how it's built:
http://forum.tvpaint.com/viewtopic.php?f=11&t=11183
It doesn't solve the #INCLUDE problem but it does use a workaround that opens up some doors that would allow you to achieve many of the same things.
The tool is great, wanted to do one really similar but havn't had the time.
But could you develop on how it could help me? Before I go into understanding your code :)
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
spyderheart
Posts: 124
Joined: 22 Jan 2013, 03:11

Re: Where is the "home" folder for george include function

Post by spyderheart »

Code: Select all

The tool is great, wanted to do one really similar but havn't had the time.
But could you develop on how it could help me? Before I go into understanding your code :)
Thanks NathanOtano. I've tried to outline it in this similar thread:
http://forum.tvpaint.com/viewtopic.php? ... ead#unread
But now that it's out in the wild let's pick it apart in public right here. Take for example, the embedded script in the button for Layers > A.

Code: Select all

1 PARAM none
2 tv_writeuserstring "toolsxlayers" "currentconnector" "A"
3 tv_getpath CONFIG
4 tv_runscript result"george/TOOLSXLAYERS/toolsxlayers_connect.grg"
5 EXIT
Let's look at it line by line:
Line 1 - Convention for any script not requiring user canvas input

Line 2 - Stores the letter "A" in under the identifier "currenconnector" the user string - this value will be retrieved using tv_readuserstring and used inside the stored script about to be called in Line 4.

Line 3 - Stores the path to the users config folder where the scripts have been installed.

Line 4 - Adds the rest of the path to the stored script and runs it using tv_runscript. If you go ahead and look at the first lines of toolsxlayers_connect.grg. You can see how it uses the "currentconnector" value to decide what to do. Each Layer button in the panel sets the "currentconnector" value to a different letter so that the script only operates on the correct Tool-Layer pair. If the value is "NONE" the script does nothing.

Line 5 - We're done.

The embedded script that you must add to the Tool button (if you select A layer button and choose "Fix Tool Connection") works in a very similar way, referencing a different stored script in the same location as the example.

The big question now is "How can you count on the script being in the location given by tv_getpath CONFIG?"
I noticed that when you use "Set Script.." inside an action, the TVPX export and install treats in seriously. It will take the script from wherever it is on your own developer machine and properly install it with it's original file name inside a unique folder which you can specify inside the George folder (which we found through tv_getPath CONFIG). But we are trying to call these scripts from inside of embedded scripts and TVPX does not see it. Let's trick it by hiding some "Set Script..." commands inside the Help (?) button (RIght click it and choose Edit to see). This way, TVPX will always grab the script and install it relative to the tv_getPath CONFIG folder of Line 3 of the code above. Remember that these scripts have an "off" switch at the beginning that causes it to EXIT immediately if the "currentconnector" user string value is set to "NONE". Thus the first command inside the help button is an embedded script that makes sure of this. This way we can be sure that pushing Help does nothing other than show you the help info. I could have placed these "Set Script..." references inside a separate functionless button but I like me some minimalism sometimes ;)

So, while this doesn't solve the #include problem it does offer a workaround that allows you to develop scripts and reference them in a way that TVPX won't destroy. It also presents a slicker looking UI to any user that pokes around and in the case of this particular tool - minimizes the amount of text to copy and paste into the Tool buttons.

Hope that makes it clearer! It has really helped me speed up the development to be able to use an external script editor and quickly export everything with TVPX without having to rebuild the panel.
David
--------------------------------------------------------
TVPaint 11.7 Standard
System: 64GB RAM // 3 TB SSD // Core i7 8700K // NVIDIA GTX 1080// Windows 10 Home
User avatar
NathanOtano
Posts: 1209
Joined: 01 Apr 2014, 07:07
Location: Biarritz, France
Contact:

Re: Where is the "home" folder for george include function

Post by NathanOtano »

NEAT! hehe, thanks for you help. Great workaround! Really clever to use "set script" and use the install path as a reference for calling scripts :)
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Post Reply