Move the storage for deprecated lines in show_depreciation_warnings().

This commit is contained in:
Mikaël Capelle
2020-08-30 10:25:11 +02:00
parent 7a9cd34878
commit 3780f157e4
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -7,12 +7,12 @@
#include "log.h"
// Contains the list of filename / line number for which a depreciation warning has already been shown.
static std::set<std::pair<std::string, int>> g_DeprecatedLines;
namespace utils {
void show_depreciation_warning(std::string_view name, std::string_view message, bool show_once) {
// Contains the list of filename / line number for which a depreciation warning has already been shown.
static std::set<std::pair<std::string, int>> DeprecatedLines;
// Find the caller:
auto inspect = bpy::import("inspect");
@@ -23,12 +23,12 @@ namespace utils {
auto lineno = bpy::extract<int>(callable_frame[-1].attr("lineno"));
// Only show once if requested:
if (show_once && g_DeprecatedLines.contains({ filename, lineno })) {
if (show_once && DeprecatedLines.contains({ filename, lineno })) {
return;
}
// Register the depreciation:
g_DeprecatedLines.emplace(filename, lineno);
DeprecatedLines.emplace(filename, lineno);
auto path = relative(std::filesystem::path(filename), QCoreApplication::applicationDirPath().toStdWString());