Fix #115192: Inconsistent behavior renaming data-blocks #116246
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116246
Loading…
Reference in New Issue
No description provided.
Delete Branch "PratikPB2123/blender:115192-id-naming"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is due to
BLI_findstring
returning wrong id from passed name.Two IDs can have same name before making them unique so it can return
wrong id. To fix this, pass id argument instead of id_name to
BLI_libblock_ensure_unique_name
and skip the use ofBLI_findstring
A difference is that
is_memfile_undo_written
will now be set regardless if the name is actually changed.I think we can now check the return value of
BKE_id_new_name_validate
for that, same asBKE_libblock_rename
does just below.However looking at the implementation of
BKE_id_new_name_validate
, it doesn't seem to account for name changes to due e.g. invalid characters. Which I think could be fixed as follows:Looks good to me, but since @mont29 is owner of this code would wait for review from him too.
@brecht as noticed in the report (#115192), this was already reported long time ago as #71244.
Back then, there were some unclear/inconclusive discussions about whether we always want to modify the 'current' ID's name, or whether in some cases (e.g. when renaming from the UI), we'd rather change the other ID's name.
I would rather have the consistent behavior proposed by this PR as a starting point, and then evaluate whether we really need some tweaks to it (or additional operators) later, but would love to hear @ideasman42 here as well?
I think it makes sense to allow taking the name of other datablocks from the UI. But this should then have a confirmation popup, or at least a warning in the status bar so the user can undo it. Both for individual and batch renames.
This seems much better than the current behavior (how it should have worked all along).
The only other comment is the doc-strings in this area should be improved/clarified however that can be done as part of a separate change as they're not made invalid by this commit.
Fix #115192: Inconsistancy renaming datablock behaviourto Fix #115192: Inconsist behavior renaming data-blocksFix #115192: Inconsist behavior renaming data-blocksto Fix #115192: Inconsistent behavior renaming data-blocksThere is also a terrible name prefix usage here for
BLI_libblock_ensure_unique_name
(should beBKE_ prefix
, comes from original cleanup renames641d4e2b7f
). ;)Will fix as soon as this PR is merged.
Merged, thanks for reviewing :)