Blender V5.0
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 = {"lib.id_management"};
23
25{
27
30
31 switch (result.action) {
33 CLOG_DEBUG(&LOG, "ID '%s' not renamed, already using the requested name", id.name + 2);
34 return false;
37 "ID '%s' not renamed, requested new name '%s' would collide with an existing one",
38 id.name + 2,
39 name.c_str());
40 return false;
42 CLOG_DEBUG(&LOG, "ID '%s' renamed without any collision", id.name + 2);
44 return true;
47 "ID '%s' renamed with adjustment from requested name '%s', to avoid name "
48 "collision with another ID",
49 id.name + 2,
50 name.c_str());
52 "Data-block renamed to '%s', try again to force renaming it to '%s'",
53 id.name + 2,
54 name.c_str());
56 return true;
59 &LOG,
60 "ID '%s' forcefully renamed, another ID had to also be renamed to avoid name collision",
61 id.name + 2);
63 "Name in use. The other data-block was renamed to ā€˜%s’",
64 result.other_id->name + 2);
67 return true;
68 }
69
70 return false;
71}
IDNewNameResult BKE_id_rename(Main &bmain, ID &id, blender::StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
Definition lib_id.cc:2392
@ RPT_INFO
Definition BKE_report.hh:35
#define BLI_assert(a)
Definition BLI_assert.h:46
#define CLOG_DEBUG(clg_ref,...)
Definition CLG_log.h:191
ID and Library types, which are fundamental for SDNA.
#define ID_IS_EDITABLE(_id)
Definition DNA_ID.h:705
#define NC_ID
Definition WM_types.hh:395
#define NA_RENAME
Definition WM_types.hh:588
bool ED_id_rename(Main &bmain, ID &id, blender::StringRefNull name)
#define LOG(level)
Definition log.h:97
const char * name
Definition DNA_ID.h:414
void WM_main_add_notifier(uint type, void *reference)
void WM_global_reportf(eReportType type, const char *format,...)