0
$\begingroup$

Only just started playing with Python and have managed to work out how to change all objects names after a ton of google searches.

for o in bpy.context.scene.objects: o.name = o.name.replace("grau", "Grey")

Seems to do what I want, but I can't find a way to rename materials for all objects in the same fashion.

Any help would be appreciated, thank you in advance.

$\endgroup$

1 Answer 1

0
$\begingroup$
for mat in bpy.data.materials:
    mat.name = mat.name.replace("grau", "Grey")
  • this will change all materials in the Blendfile, not just the ones occuring in the current scene.
$\endgroup$
3
  • $\begingroup$ Thank you Frederik, better than Google ! Regards. $\endgroup$ Commented Oct 22, 2022 at 13:04
  • $\begingroup$ np, could you upvote and accept the answer, so others won't have to check whether it's already solved? $\endgroup$ Commented Oct 22, 2022 at 13:04
  • $\begingroup$ Done. thank you again. $\endgroup$ Commented Oct 22, 2022 at 13:05

You must log in to answer this question.

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