Here is a rather serious kind of "Gotcha" bug (and a work-around) that I recently ran into and had to solve.
I was writing a utility that works with CLIPS and found a "parsing problem" in the tv_ClipInfo command, ONE THAT HAPPENS IF THE CLIP NAME CONTAINS ONE OR MORE SPACES.
Spoiler : :
This probably will result in an error message for that line in the script that uses tv_ClipInfo.
My work-around works like this:
First a temporary, one-word name (temp) replaces the ORIGINAL CLIP NAME which we put into a temporary variable (whether the original clip name includes spaces or not) where it is enclosed in double quotes.
The "temp" CLIP NAME makes it safe to use the tv_ClipInfo command so the resulting values are assigned to the proper variables. Except the CLIP NAME is now temp, so you need to substitute CLIP NAME variable created as part of the tv_ClipInfo command with the ORIGINAL CLIP NAME ENCLOSED IN QUOTES. Then you should finally replace the Original Clip Name (now enclosed with double quotes) back into to the clip.
Note to TVPaint Programmers:
I really think the tv_ClipInfo command should automatically allow for Clip Names that contain spaces. The bug should be taken care of, internally, by fixing the tv_ClipInfo GEORGE command so it automatically encloses the clip title in double quotes.
Here is a script and FUNCTION that properly parses the variables, matching them to their expected values, whether the CLIP NAME contains spaces or not.
Code: Select all
// ClipInfoBugTest.grg
ClipNameBugFix()
tv_warn "CName = " CName " IsCurrent = " CCurrent " isHidden = " CHidden " IsSelected = " CSelected " StoryboardStart = " CSBStartFrame " FirstFrame = " CFirstFrame " LastFrame = " CLastframe " FrameCount = " CFrameCount " MarkIn = " CMarkIn " MarkOut = " CMarkOut " Coloridx = " CColorIdx
FUNCTION ClipNameBugFix() // traps bug for clip names which include spaces which ruins parsing for tv_ClipInfo command
tv_ClipCurrentID // get current CLIP's ID
ClipID = result
tv_ClipName ClipID "temp" // rename current CLIP to one word "temp"
OriginalClipName = result // save original CLIP name (which might include one or more spaces)
OriginalClipName = '"' OriginalClipName '"' // enclose original name in double quotes
tv_ClipInfo
parse result Name CName IsCurrent CCurrent IsHidden CHidden IsSelected CSelected StoryboardStartFrame CSBStartFrame FirstFrame CFirstFrame LastFrame CLastFrame FrameCount CFrameCount MarkIn CMarkIn MarkOut CMarkOut ColorIdx CColorIdx
CName = OriginalClipName
tv_ClipName ClipID OriginalClipName
END