lib/dtutils/string - fixed ROLL.NAME to support the original and
the ROLL.NAME[n] variant in the same variable
string
This commit is contained in:
@@ -672,22 +672,21 @@ local function build_rollname_substitution_list(image, variable_string)
|
||||
local var = string.match(match, "%$%((.-%)?)%)") -- strip of the leading $( and trailing )
|
||||
log.msg(log.info, "var is " .. var)
|
||||
|
||||
if string.match(var, "ROLL.NAME") then
|
||||
local element = "1"
|
||||
local element = nil
|
||||
|
||||
if string.match(var, "ROLL.NAME%[") then
|
||||
element = string.match(var, "%[(%d)%]")
|
||||
end
|
||||
if string.match(var, "ROLL.NAME%[") then
|
||||
element = string.match(var, "%[(%d)%]")
|
||||
|
||||
local path = du.split(image.film.path, dt.configuration.running_os ~= "windows" and "/" or "\\")
|
||||
|
||||
element = tonumber(element) + 1 -- add one because c arrays are 0 based and lua are 1 based
|
||||
|
||||
if tonumber(element) > #path then
|
||||
substitutes["ROLL.NAME"] = ""
|
||||
if element > #path then
|
||||
log.msg(log.warn, "ROLL.NAME element requested was more than number of elements in film roll")
|
||||
substitutes[var] = ""
|
||||
else
|
||||
substitutes["ROLL.NAME"] = path[(#path + 1) - tonumber(element)]
|
||||
substitutes[var] = path[(#path + 1) - element]
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1067,6 +1066,11 @@ local function treat(var_string)
|
||||
if not ret_val then ret_val = "" end
|
||||
log.msg(log.info, "ret_val is " .. ret_val)
|
||||
|
||||
elseif string.match(var_string, "ROLL.NAME%[") then
|
||||
ret_val = substitutes[var_string]
|
||||
if not ret_val then ret_val = "" end
|
||||
log.msg(log.info, "ret_val is " .. ret_val)
|
||||
|
||||
elseif string.match(var_string, "SEQUENCE%[") then
|
||||
local width, start = string.match(var_string, "(%d+),(%d+)")
|
||||
local seq_val = tonumber(substitutes[var])
|
||||
|
||||
Reference in New Issue
Block a user