Skip to content

Commit f8d49cc

Browse files
committed
Modified apply_camera_style script so that the application of a camera style does not mark the image as changed
1 parent 62e9329 commit f8d49cc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

official/apply_camera_style.lua

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ local PS <const> = dt.configuration.running_os == "windows" and "\\" or "/"
6060
-- command separator
6161
local CS <const> = dt.configuration.running_os == "windows" and "&" or ";"
6262

63+
-- tag name for changed images
64+
local changed_tag_name = "darktable|changed"
65+
6366
-- - - - - - - - - - - - - - - - - - - - - - - -
6467
-- A P I C H E C K
6568
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -313,7 +316,7 @@ local function normalize_maker(maker)
313316
return maker
314317
end
315318

316-
local function has_style_tag(image, tag_name)
319+
local function has_tag(image, tag_name)
317320

318321
local log_level = set_log_level(acs.log_level)
319322

@@ -387,11 +390,19 @@ local function apply_style_to_images(images)
387390
for i, pattern in ipairs(acs.styles[maker].patterns) do
388391
if string.match(model, pattern) or
389392
(i == #acs.styles[maker].patterns and string.match(pattern, "generic")) then
390-
local tag_name = "darktable|style|" .. acs.styles[maker].styles[i].name
391-
if not has_style_tag(image, tag_name) then
393+
local style_tag_name = "darktable|style|" .. acs.styles[maker].styles[i].name
394+
if not has_tag(image, style_tag_name) then
395+
local already_changed = has_tag(image, changed_tag_name)
392396
image:apply_style(acs.styles[maker].styles[i])
393397
no_match = false
394398
log.msg(log.info, "applied style " .. acs.styles[maker].styles[i].name .. " to " .. image.filename)
399+
if not already_changed then
400+
local ct = dt.tags.find(changed_tag_name)
401+
if ct then
402+
log.msg(log.debug, "detaching tag " .. changed_tag_name .. " from image " .. image.filename)
403+
image:detach_tag(ct)
404+
end
405+
end
395406
end
396407
log.log_level(loglevel)
397408
break

0 commit comments

Comments
 (0)