Optimize loop trought layer export

A forum dedicated to George scripting questions
Post Reply
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Optimize loop trought layer export

Post by jeremyb »

Hi,

I try to optimize part of code, that currently export frame by frame on each visible layer. But i've got some trouble with loop 'FOR image = 1 TO 50'

Code: Select all

// COLLECT DATA FROM ARGS 
tv_ReadUserString VfxConfig ExportPath
exportPath = '"'result'"'

tv_ReadUserString VfxConfig PlayblastPath
playblastPath = '"'result'"'

tv_ReadUserString VfxConfig Episode
episodeNum = result

tv_ReadUserString VfxConfig Sequence
sequenceNum = result

tv_ReadUserString VfxConfig Shot
shotNum = result

tv_ReadUserString VfxConfig Version
versionNum = result

// COLLECT DATA FROM TVPAINT FILE
tv_FirstImage
startingFrame = result
tv_LastImage
LastImage = result

tv_Background "NONE"
tv_SaveMode "PNG" "b32"
tv_AlphaSaveMode NoPreMultiply

layerRun = 1
layerCount = 0
WHILE layerRun == 1
    tv_LayerGetID layerCount
    layerID = result
    IF (CMP(layerID,"NONE") != 0)
        layerRun = 0
    ELSE
        tv_LayerSet layerID
        tv_LayerInfo
        PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable
        IF (CMP(layerDisplay,"OFF") == 0) && (CMP(layerName,"playblast") == 0)
            tv_layerpostbehavior layerID
            endBehavior=result
            IF (CMP(endBehavior, "NONE") == 1)
                endingFrame=imageEnd
            ELSE
                endingFrame=LastImage
            END
            lyrExportPath = CONCAT(exportPath,layerName)
            lyrExportPathFormat = '"'lyrExportPath'"'
            tv_WriteTextFile "mkdir" lyrExportPathFormat
            FOR CurrentImage = startingFrame TO endingFrame
                currentReelImage = CurrentImage+1000
                tv_layerImage CurrentImage
                layerFileName = episodeNum"_"sequenceNum"_"shotNum"-"layerName"_"currentReelImage".png"
                exportFullPath = CONCAT(lyrExportPathFormat,layerFileName)
                exportFullPathFormat = '"'exportFullPath'"'
                tv_LockDisplay "Exporting... (layer "layerName", image "currentReelImage" )"
                tv_saveimage exportFullPathFormat
                tv_UnLockDisplay
            END
        END
        layerCount = layerCount + 1
    END
END

This line make some error, script dosen't do anything and i don't know if is the good syntax ?

Code: Select all

FOR CurrentImage = startingFrame TO endingFrame
By the way, on which language GEORGE is based ?

regards
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
Xavier
Posts: 1855
Joined: 01 Oct 2019, 11:08

Re: Optimize loop trought layer export

Post by Xavier »

George is not a language. George is just a set of commands, that the current version of TVPaint can understand.
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Optimize loop trought layer export

Post by Svengali »

try using another variable name in the FOR/NEXT loop, like CurImage. The interpreter might be getting confused.

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
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

yep, i've allready change some 'Common' var...but still here
Capture.PNG
Capture.PNG (2.23 KiB) Viewed 16744 times
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Optimize loop trought layer export

Post by Svengali »

j.

tested your code (without any changes except commented out "// tv_saveimage exportFullPathFormat line") by putting a tv_warn message inside FOR/NEXT loop... and the loop works for me...

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
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

hum, yes !
that's a problem

Code: Select all

CONCAT(exportPath,layerName)
should be the same as : ? right ?

Code: Select all

lyrExportPath = exportPath"\"layerName"\"

so, why is blocking when i want create directory with that path ?

Code: Select all

tv_WriteTextFile "mkdir" '"'lyrExportPath'"'
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

So, to rebuild filepath i need to remove ' " ' from result

Code: Select all

tv_ReadUserString VfxConfig ExportPath
exportPath = result
note:
cmd line output from ExportPath : \\server\project\version\

So after, i can re-create path

Code: Select all

layerPathCreate = exportLayerPath'\'layerName'\'
but, tv_Warn doesn't catch layerPathCreate if i wan't to print path, to see if iam correct...
any idea ?
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

Ok, after testing all formatting string, i think there is an issue with UNC path...

if my exportLayerPath result is UNC, i've got error with : tv_WriteTextFile "mkdir"
if i change UNC with a mapper drive, all working good.

Code: Select all

layerPathCreate = '"'exportLayerPath'\'layerName'"'
tv_WriteTextFile "mkdir" layerPathCreate
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Optimize loop trought layer export

Post by Svengali »

:D
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
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

Apart from that, I don't see where I could have made a mistake
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

After checking, everything, really everything...it was the installation of TVpaint that was not good.
Our sys admin, has overridden the installation since 10.0.3.

With a fresh install, it's good !
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

i'm back again :D

I thought they was a problem with tv_lockdisplay, so i remove tv_lockdisplay and tv_unlockdisplay.
The issue, came back !

And if i re-write tv_lockdisplay and tv_unlockdisplay the issue still !

I'm really stuck, and I don't understand why...

Find if we are a tvpaint support on our contract, then i call later.
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

can there be problems if ffmpeg is already installed on the machine?
or LVA filter
https://github.com/Nevcairiel/LAVFilters/releases

I'm trying to find out, because apparently...I'm the only one with this problem
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
User avatar
Thierry
Site Admin
Posts: 2780
Joined: 07 Jan 2013, 08:28

Re: Optimize loop trought layer export

Post by Thierry »

jeremyb wrote: 28 Jan 2022, 23:59can there be problems if ffmpeg is already installed on the machine?
or LVA filter
https://github.com/Nevcairiel/LAVFilters/releases
Hmm, TVPaint uses FFmpeg to read and export mp4/mov/mkv, so there's a chance that a conflict can happen when trying to export files.
However the dll/dilyb/so used by TVPaint are in the software's folder, so I don't know if having another version of FFmpeg is the culprit here.
Have you tried on a computer without FFmpeg?
jeremyb
Posts: 31
Joined: 31 Jul 2020, 08:52

Re: Optimize loop trought layer export

Post by jeremyb »

Yes I had also tried without ffmpeg, the problem remains the same.
After trying everything, and I spent a while there. I decided to switch part of the workflow to Blender.
WINDOWS 10 : 10.0.19044 Build 19044
TVPAINT : 11.5.3-64bit dec 3 2021
CPU : i9-9900
RAM : 64Go
CG: RTX 2080 SUPER 8go
Post Reply