Blender V4.5
ed_id_management.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2004 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "CLG_log.h"
10
11#include "DNA_ID.h"
12
13#include "BKE_lib_id.hh"
14#include "BKE_library.hh"
15#include "BKE_main.hh"
16
17#include "WM_api.hh"
18
19#include "ED_id_management.hh"
20
22static CLG_LogRef LOG = {"ed.id_management"};
23
25{
27
30
31 switch (result.action) {
33 CLOG_INFO(&LOG, 4, "ID '%s' not renamed, already using the requested name", id.name + 2);
34 return false;
37 4,
38 "ID '%s' not renamed, requested new name '%s' would collide with an existing one",
39 id.name + 2,
40 name.c_str());
41 return false;
43 CLOG_INFO(&LOG, 4, "ID '%s' renamed without any collision", id.name + 2);
45 return true;
48 4,
49 "ID '%s' renamed with adjustment from requested name '%s', to avoid name "
50 "collision with another ID",
51 id.name + 2,
52 name.c_str());
54 "Data-block renamed to '%s', try again to force renaming it to '%s'",
55 id.name + 2,
56 name.c_str());
58 return true;
61 &LOG,
62 4,
63 "ID '%s' forcefully renamed, another ID had to also be renamed to avoid name collision",
64 id.name + 2);
66 "Name in use. The other data-block was renamed to ā€˜%s’",
67 result.other_id->name + 2);
70 return true;
71 }
72
73 return false;
74}
IDNewNameResult BKE_id_rename(Main &bmain, ID &id, blender::StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
Definition lib_id.cc:2372
#define BLI_assert(a)
Definition BLI_assert.h:46
#define CLOG_INFO(clg_ref, level,...)
Definition CLG_log.h:179
ID and Library types, which are fundamental for SDNA.
#define NC_ID
Definition WM_types.hh:392
#define NA_RENAME
Definition WM_types.hh:585
constexpr const char * c_str() const
bool ED_id_rename(Main &bmain, ID &id, blender::StringRefNull name)
#define ID_IS_EDITABLE(_id)
#define LOG(severity)
Definition log.h:32
Definition DNA_ID.h:404
void WM_main_add_notifier(uint type, void *reference)
void WM_global_reportf(eReportType type, const char *format,...)