|
| 1 | +--[[ |
| 2 | + Hugin storage for darktable |
| 3 | +
|
| 4 | + copyright (c) 2014 Wolfgang Goetz |
| 5 | + copyright (c) 2015 Christian Kanzian |
| 6 | + |
| 7 | + darktable is free software: you can redistribute it and/or modify |
| 8 | + it under the terms of the GNU General Public License as published by |
| 9 | + the Free Software Foundation, either version 3 of the License, or |
| 10 | + (at your option) any later version. |
| 11 | + |
| 12 | + darktable is distributed in the hope that it will be useful, |
| 13 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + GNU General Public License for more details. |
| 16 | + |
| 17 | + You should have received a copy of the GNU General Public License |
| 18 | + along with darktable. If not, see <http://www.gnu.org/licenses/>. |
| 19 | +]] |
| 20 | + |
| 21 | +--[[ |
| 22 | +HUGIN |
| 23 | +Add a new storage option to send images to hugin. |
| 24 | +Images are exported to darktable tmp dir first. |
| 25 | +
|
| 26 | +ADDITIANAL SOFTWARE NEEDED FOR THIS SCRIPT |
| 27 | +* hugin |
| 28 | +
|
| 29 | +USAGE |
| 30 | +* require this file from your main luarc config file. |
| 31 | +
|
| 32 | +This plugin will add a new storage option and calls hugin after export. |
| 33 | +]] |
| 34 | + |
| 35 | +dt = require "darktable" |
| 36 | + |
| 37 | +-- should work with darktable API version 2.0.0 |
| 38 | +dt.configuration.check_version(...,{2,0,0}) |
| 39 | + |
| 40 | +dt.register_storage("module_hugin","Hugin panorama", |
| 41 | + function(storage, image, format, filename, |
| 42 | + number,total,high_quality,extra_data) |
| 43 | + dt.print("Export to hugin " .. tostring(number).."/"..tostring(total)) |
| 44 | + end, |
| 45 | + function(storage,image_table,extra_data) --finalize |
| 46 | + -- list of exported images |
| 47 | + local img_list |
| 48 | + |
| 49 | + -- reset and create image list |
| 50 | + img_list = "" |
| 51 | + |
| 52 | + for _,v in pairs(image_table) do |
| 53 | + img_list = img_list ..v.. " " |
| 54 | + end |
| 55 | + |
| 56 | + dt.print("Will try to stitch now") |
| 57 | + |
| 58 | + if coroutine.yield("RUN_COMMAND","hugin "..img_list) |
| 59 | + then |
| 60 | + dt.print("Command hugin failed ...") |
| 61 | + end |
| 62 | + |
| 63 | + end, |
| 64 | + nil, |
| 65 | + nil |
| 66 | +) |
| 67 | + |
| 68 | +-- |
| 69 | +-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua |
0 commit comments