From ffb4397238344bd3d4844c11ce520b98e95d4ed9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 7 Apr 2021 12:57:24 -0300 Subject: [PATCH] Reset tool preferences just once when running from CLI --- LICENSE.txt | 2 +- scripts/app_preferences.lua | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 73cdac56d..a1db71aea 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2018-2020 Igara Studio S.A. +Copyright (c) 2018-2021 Igara Studio S.A. Copyright (c) 2018 David Capello Permission is hereby granted, free of charge, to any person obtaining diff --git a/scripts/app_preferences.lua b/scripts/app_preferences.lua index 9c2a96c4f..82cbe4286 100644 --- a/scripts/app_preferences.lua +++ b/scripts/app_preferences.lua @@ -1,10 +1,13 @@ --- Copyright (C) 2019 Igara Studio S.A. +-- Copyright (C) 2019-2021 Igara Studio S.A. -- -- This file is released under the terms of the MIT license. -- Read LICENSE.txt for more information. -- Preferences for tools do + -- The first time we get the tool preferences in CLI mode, we get + -- the default options for this tool (in GUI, we get the current + -- user-defined options). local t = app.preferences.tool('pencil') assert(t.opacity == 255) assert(t.tolerance == 0) @@ -14,10 +17,10 @@ do t.brush.size = 2 assert(t.brush.size == 2) - -- Getting the tool again will give us the default configuration - -- again in batch mode + -- Getting the tool again must give us the configuration that was + -- set inside the script t = app.preferences.tool('pencil') - assert(t.brush.size == 1) + assert(t.brush.size == 2) end -- Preferences for documents