From bb5345614d6d4860c619e96fa174b3ffd4e8c262 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 5 Dec 2017 01:30:07 +0100 Subject: [PATCH] Allow to pre-seed Lua action script params --- libs/ardour/ardour/luascripting.h | 4 +++- libs/ardour/luascripting.cc | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/ardour/ardour/luascripting.h b/libs/ardour/ardour/luascripting.h index a184c4058b..7570ff1bc8 100644 --- a/libs/ardour/ardour/luascripting.h +++ b/libs/ardour/ardour/luascripting.h @@ -80,11 +80,12 @@ struct LIBARDOUR_API LuaScriptParam { const std::string& n, const std::string& t, const std::string& d, - bool o) + bool o, bool p) : name (n) , title (t) , dflt (d) , optional (o) + , preseeded (p) , is_set (false) , value (d) {} @@ -93,6 +94,7 @@ struct LIBARDOUR_API LuaScriptParam { std::string title; std::string dflt; bool optional; + bool preseeded; bool is_set; std::string value; }; diff --git a/libs/ardour/luascripting.cc b/libs/ardour/luascripting.cc index a3276432b2..1193e08130 100644 --- a/libs/ardour/luascripting.cc +++ b/libs/ardour/luascripting.cc @@ -410,6 +410,7 @@ LuaScriptParams::script_params (LuaState& lua, const std::string& s, const std:: std::string title = i.value ()["title"].cast (); std::string dflt; bool optional = false; + bool preseeded = false; if (i.value ()["default"].isString ()) { dflt = i.value ()["default"].cast (); @@ -417,7 +418,10 @@ LuaScriptParams::script_params (LuaState& lua, const std::string& s, const std:: if (i.value ()["optional"].isBoolean ()) { optional = i.value ()["optional"].cast (); } - LuaScriptParamPtr lsspp (new LuaScriptParam(name, title, dflt, optional)); + if (i.value ()["preseeded"].isBoolean ()) { + preseeded = i.value ()["preseeded"].cast (); + } + LuaScriptParamPtr lsspp (new LuaScriptParam(name, title, dflt, optional, preseeded)); rv.push_back (lsspp); } }