Batch Rename: Numbering support #69479

Open
opened 2019-09-04 10:05:31 +02:00 by Campbell Barton · 5 comments

Currently batch renaming relies on Blender to number duplicates.

Numbering could be supported:

Example: a chain of finger bones. These would usually be named Index.01.L, Index.02.L, Index.03.L and so forth.

For numbering to work usefully we would want a way to sort items before they're numbered (by their current alphabetical order, hierarchy, location... possibly others).

This needs some design to think of how to expose this to users usefully, see suggestion: a5b1231de7#244815

Currently batch renaming relies on Blender to number duplicates. Numbering could be supported: Example: a chain of finger bones. These would usually be named `Index.01.L`, `Index.02.L`, `Index.03.L` and so forth. For numbering to work usefully we would want a way to sort items before they're numbered (by their current alphabetical order, hierarchy, location... possibly others). This needs some design to think of how to expose this to users usefully, see suggestion: a5b1231de7#244815
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Added subscriber: @Josephbburg

Added subscriber: @Josephbburg

I think there should be support for incrementing, decrementing, and re-setting numbers, and using an arbitrary start value. So, for example, a user could rename a chain of bones "foo.004.L" "foo.003.L" "foo.002.L" if they wanted to.
It's also a good idea to think about using nested numbers. A Spider, for example, has eight legs and many segments per leg. The fifth bone on the third leg may be called Leg.002.004.L. Using this naming convention is easy for scripting, in my experience. Perhaps the batch rename operator could have a feature for renaming multiple bone chains at a time? Finally, it should be possible to keep number/left/right as is. Some users may wish for the option to start with 1 instead of 0, some users may wish to use zero padding, others will not ( 002 vs 2).

Additionally, it may be useful to automatically find the other bones in the chain, so that the user doesn't have to select each one. For disconnected bone chains, you could compare the location and direction of each head/tail within the current bone layer. This would fail if bones are in the same layer and location, so some additional testing logic may become necessary here. Bone chains also have to manage branches. The rename script I use just selects the first bone in the branch and keeps going when finding branches in chains of bones- following the behavior of the L key in armature edit mode. Alternatively, it treats branch in a chain as a separate chain altogether. For rigs that are heavily branches, such as rigs for trees, it may be convenient to have an automatic tool for creating names like "trunk.000.branch.003.twig.004.leaf.002". If you choose to have a feature to extend the batch rename feature to bone chains, it may be useful to select bones based on a similar parent structure, too: for example, each bone is parented to another sequence of bones- child.000 is child of parent.000, child.001 of parent.001 etc. In this situation, the rigger probably wants to rename all of the child bones, and needs the tool to select and rename them even if they or their parents are named badly to begin with. Another useful feature would be to automatically rename bones that are symmetrical. The difficulty of this sort of tool is that you have to work from the assumption that things are named badly to begin with if you want an operator that handles the edge cases.

I have a Python Script that handles some of this, which I'd be happy to share if it's helpful. I'm working on it, and the above is essentially my to-do list for the tool. I plan on separating these into a few different operators, and I think implementing all of those behaviors will be a little heavy for a single operator. But this should help identify some of the use cases for renaming bones in particular. And of course, if you'd like me to elaborate about the specific use-case for these ideas, I'd be happy to do so.

I think there should be support for incrementing, decrementing, and re-setting numbers, and using an arbitrary start value. So, for example, a user could rename a chain of bones "foo.004.L" "foo.003.L" "foo.002.L" if they wanted to. It's also a good idea to think about using nested numbers. A Spider, for example, has eight legs and many segments per leg. The fifth bone on the third leg may be called Leg.002.004.L. Using this naming convention is easy for scripting, in my experience. Perhaps the batch rename operator could have a feature for renaming multiple bone chains at a time? Finally, it should be possible to keep number/left/right as is. Some users may wish for the option to start with 1 instead of 0, some users may wish to use zero padding, others will not ( 002 vs 2). Additionally, it may be useful to automatically find the other bones in the chain, so that the user doesn't have to select each one. For disconnected bone chains, you could compare the location and direction of each head/tail within the current bone layer. This would fail if bones are in the same layer and location, so some additional testing logic may become necessary here. Bone chains also have to manage branches. The rename script I use just selects the first bone in the branch and keeps going when finding branches in chains of bones- following the behavior of the L key in armature edit mode. Alternatively, it treats branch in a chain as a separate chain altogether. For rigs that are heavily branches, such as rigs for trees, it may be convenient to have an automatic tool for creating names like "trunk.000.branch.003.twig.004.leaf.002". If you choose to have a feature to extend the batch rename feature to bone chains, it may be useful to select bones based on a similar parent structure, too: for example, each bone is parented to another sequence of bones- child.000 is child of parent.000, child.001 of parent.001 etc. In this situation, the rigger probably wants to rename all of the child bones, and needs the tool to select and rename them even if they or their parents are named badly to begin with. Another useful feature would be to automatically rename bones that are symmetrical. The difficulty of this sort of tool is that you have to work from the assumption that things are named badly to begin with if you want an operator that handles the edge cases. I have a Python Script that handles some of this, which I'd be happy to share if it's helpful. I'm working on it, and the above is essentially my to-do list for the tool. I plan on separating these into a few different operators, and I think implementing all of those behaviors will be a little heavy for a single operator. But this should help identify some of the use cases for renaming bones in particular. And of course, if you'd like me to elaborate about the specific use-case for these ideas, I'd be happy to do so.
Member

Added subscriber: @Calra

Added subscriber: @Calra
Member

Hi with respect to description mentioned in #69478 -
Numbering based on their Z location, I have a few questions : how should the tie be broken if say 2 cubes at the same height (Z direction) ?
This is a stupid one but I still don't get it Numbering should be done on homogeneous objects ( all Cubes, all bones ) or can be done on heterogeneous objects( Cube,sphere,planes etc) ?

Hi with respect to description mentioned in #69478 - Numbering based on their Z location, I have a few questions : how should the tie be broken if say 2 cubes at the same height (Z direction) ? This is a stupid one but I still don't get it Numbering should be done on homogeneous objects ( all Cubes, all bones ) or can be done on heterogeneous objects( Cube,sphere,planes etc) ?
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:43:17 +01:00
Sign in to join this conversation.
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
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#69479
No description provided.