Unfortunately not. This was just an example. I'm writing a script which should merge two layers, but keep the image marks (something like your suggestion
here). And it would work without checking if a variable is set, but it would be a bit more scripting, but a lot more to do for the script.
Code: Select all
//======= TOP LAYER GET INFOS =======//
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
TLnum = layerPosition
TLfirst = layerStart
TLlast = layerEnd
tv_LayerGetID TLnum
TLid = Result
//======= TOP LAYER SAVE MARKS TO ARRAY =======//
Cpos = TLfirst
DO
tv_LayerMarkGet 0 CPos
CColor = Result
TLarray[Cpos] = CColor //------ Save marks to array TLarray
Cpos = CPos +1
UNTIL (Cpos == TLlast)
//======= BOTTOM LAYER GET ID AND SELECT =======//
BLnum = TLnum + 1
tv_LayerGetID BLnum
BLid = result
tv_LayerSet BLid
//======= BOTTOM LAYER GET INFOS =======//
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
BLfirst = layerStart
BLlast = layerEnd
//======= BOTTOM LAYER SAVE MARKS TO ARRAY =======//
Cpos = BLfirst
DO
tv_LayerMarkGet 0 CPos
CColor = Result
BLarray[Cpos] = CColor //------ Save marks to array BLarray
Cpos = CPos +1
UNTIL (Cpos == BLlast)
//======= MERGE LAYERS ======
tv_LayerMerge TLid STAMP
tv_LayerKill TLid
//======= MERGE LAYER GET INFOS =======//
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable layerSelection
MLfirst = layerStart
MLlast = layerEnd
//======= MERGE LAYER SET COLORS =======//
Cpos = MLfirst
DO
IF (TLarray[CPos] != 0) //------ if Top Layer mark isn't 0 choose Top Layer mark
ColorSet = TLarray[CPos]
ELSE //------ else choose Bottom Layer mark
ColorSet = BLarray[CPos]
END
tv_LayerMarkSet 0 Cpos ColorSet //------ set Color
Cpos = Cpos+1
UNTIL (Cpos == MLlast)
This works if both layers share the same length, BUT if one of them is longer or shorter it fails, cause then I'm asking here for something in the array I never defined.
I could fill both arrays with empty numbers, but seems ridiculous to me.