Batch rename of label of node & material names

Anyone can help me to batch rename the label of a node with specific string?

Or it is if reset the label of all materials in the scene…

2nd one can we batch rename one material name with specific string…

Pls help, thanks in advance…:blush:

Actually I need a python script to change node label of materials, objects & material name with some string replaced one new one… e.g. floor_base_1, floor_base_2 floor_base_3 etc with name floor_mat_1, floor_mat_2 floor_mat_3 etc. I need this renaming system for all objects, materials & node labels of scene

Pls help to sort out my problem…

Hmm did you saw this BDocs Batch Rename ??

Made a script that checks:

  1. If a material has any material nodes (to avoid breaking if none are found).
  2. Checks if any of the valid materials have any labels that match a certain string in the list OLD_LABELS.
  3. If a string matches the node label, the label name is replaced by a corresponding string via list index from the NEW_LABELS list.
import bpy

OLD_LABELS = ["Red", "Green", "Blue"]
NEW_LABELS = ["abc", "123", "hello_world"]

for m in bpy.data.materials:
    if m.node_tree != None:
        for n in m.node_tree.nodes:
            for l in OLD_LABELS:
                if n.label == l:
                    n.label = str(NEW_LABELS[int(OLD_LABELS.index(l))])