Skip to content

Commit ba94914

Browse files
committed
contrib/auto_snapshot - added Lua option to create always create a snapshot
when opening an image in darkroom, even if it is altered
1 parent 3bb4e9c commit ba94914

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

contrib/auto_snapshot.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
local dt = require "darktable"
3939
local du = require "lib/dtutils"
40+
local log = require "lib/dtutils.log"
4041

4142
-- - - - - - - - - - - - - - - - - - - - - - - -
4243
-- C O N S T A N T S
@@ -96,6 +97,13 @@ log.log_level(DEFAULT_LOG_LEVEL)
9697

9798
local auto_snapshot = {}
9899

100+
-- - - - - - - - - - - - - - - - - - - - - - - -
101+
-- P R E F E R E N C E S
102+
-- - - - - - - - - - - - - - - - - - - - - - - -
103+
104+
dt.preferences.register(MODULE, "always_create_snapshot", "bool", "always automatically create_snapshot",
105+
"auto_snapshot - create a snapshot even if the image is altered", false)
106+
99107
-- - - - - - - - - - - - - - - - - - - - - - - -
100108
-- D A R K T A B L E I N T E G R A T I O N
101109
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -112,7 +120,10 @@ script_data.destroy = destroy
112120

113121
dt.register_event(MODULE, "darkroom-image-loaded",
114122
function(event, clean, image)
115-
if clean then
123+
local always = dt.preferences.read(MODULE, "always_create_snapshot", "bool")
124+
if clean and always then
125+
dt.gui.libs.snapshots.take_snapshot()
126+
elseif clean and not image.is_altered then
116127
dt.gui.libs.snapshots.take_snapshot()
117128
end
118129

0 commit comments

Comments
 (0)