1
$\begingroup$

For example, I have Leg.R and Leg.CTRL.R bones. I want to set such a search so that it removes the word "CTRL". But the invert button won't help here because I want it to be in common search bar. For example, I want to find only the hands or fingers of the right hand, but without the word "CTRL", and the invert button will not help here.

$\endgroup$
3
  • $\begingroup$ what object type do you want to search by name? Could you up load a image to let us more easy to understand $\endgroup$
    – X Y
    Commented Apr 7, 2022 at 8:51
  • 1
    $\begingroup$ @XY The example he gives in the question says it's bones. I think it's quite easy to understand. Let's say his model has an armature with lots of bones. The ones on the right have a suffix '.R' and the ones on the left have '.L' and some seem to be controller bones which also have a secondary suffix '.CTRL' before the '.R' and '.L'. Now if the right hand has bone names like 'hand.finger1.R', 'hand.finger1.CTRL.R' 'hand.finger2.R', 'hand.finger2.CTRL.R' etc. he wants to filter for something like 'finger*.R', but he doesn't want those bones which have a '.CTRL' inbetween. $\endgroup$ Commented Apr 7, 2022 at 10:34
  • $\begingroup$ Gordon Brinkmann, yes, that's exactly what I mean! Thank you. $\endgroup$
    – Tim Pro
    Commented Apr 8, 2022 at 9:14

2 Answers 2

0
$\begingroup$

Do you want to select them or rename them?

1) Make sure you are in Object mode and select the armature object.
2) Go to Text Editor paste the text:

import bpy

oj = bpy.context.object
bones = oj.data.bones

for bo in bones:
    bo.select = True  if bo.name.find("CTRL") == -1 else False

3) Run the script, the bone will select if name not include "CTRL"

enter image description here enter image description here

$\endgroup$
0
$\begingroup$

Blender has a batch rename function that takes wildcard format called regular expressions. Regular expressions can be very flexible and have form that says must have this part but not that. you just have to find the right wildcard for your search.

$\endgroup$
2
  • $\begingroup$ That's the thing, it doesn't exist. I tested different characters before posting this question. I know for sure that ?, * and [] work. For example, in the link you gave, they write: "[^b]at matches all strings matched by .at except "bat"." Ok. But it doesn't work in Blender. $\endgroup$
    – Tim Pro
    Commented Apr 8, 2022 at 9:25
  • $\begingroup$ Can the built-in Batch Rename feature grab let's say Object Name and use that as a prefix for Object Data such as Mesh Name? $\endgroup$
    – Henrik
    Commented Nov 20, 2023 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .