diff options
author | Bastien Montagne <bastien@blender.org> | 2021-05-19 18:45:47 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-05-19 18:50:22 +0300 |
commit | ca74ebc96e134f361b842a6b338774a24d327c2b (patch) | |
tree | ca85d43b73fdfa7c602a7abd43edf098177fe1af | |
parent | 3620dbbe97e649742cb7cc0eb69d3b1ee1e70390 (diff) |
IDManagement: Do not prevent sorting of linked IDs in `BKE_id_new_name_validate`.
While this function should (currently) not be called on linked ID, there
is no reason to treat those differently than local IDs, for the part
that they have in common: needs to be properly sorted.
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 62d7c6a2d4c..c2e5006cbc1 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1366,8 +1366,7 @@ void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint) ID *id_sorting_hint_next = id_sorting_hint->next; if (BLI_strcasecmp(id_sorting_hint->name, id->name) < 0 && - (id_sorting_hint_next == NULL || - id_sorting_hint_next->lib != id->lib || + (id_sorting_hint_next == NULL || id_sorting_hint_next->lib != id->lib || BLI_strcasecmp(id_sorting_hint_next->name, id->name) > 0)) { BLI_insertlinkafter(lb, id_sorting_hint, id); return; @@ -1375,8 +1374,7 @@ void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint) ID *id_sorting_hint_prev = id_sorting_hint->prev; if (BLI_strcasecmp(id_sorting_hint->name, id->name) > 0 && - (id_sorting_hint_prev == NULL || - id_sorting_hint_prev->lib != id->lib || + (id_sorting_hint_prev == NULL || id_sorting_hint_prev->lib != id->lib || BLI_strcasecmp(id_sorting_hint_prev->name, id->name) < 0)) { BLI_insertlinkbefore(lb, id_sorting_hint, id); return; @@ -1716,12 +1714,14 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name, ID **r_id_sorting_ */ bool BKE_id_new_name_validate(ListBase *lb, ID *id, const char *tname) { - bool result; + bool result = false; char name[MAX_ID_NAME - 2]; - /* if library, don't rename */ + /* If library, don't rename, but do ensure proper sorting. */ if (ID_IS_LINKED(id)) { - return false; + id_sort_by_name(lb, id, NULL); + + return result; } /* if no name given, use name of current ID |