Reputation: 11
I have a custom MATLAB script that I use to analyze 3D data. I recently started using a new piece of software to export about 150 3D points over time as an .fbx file. These points (imported as individual objects into Blender) have clunky names and I want to rename about 20 of these using bpy in order to fit what my MATLAB script is expecting.
For example, I want an object called "BottomNoseBottom_99" to be called "NT" for Nose Tip. I know I can do this individually within Blender by right-clicking, but I will be doing this very often and want to create a script.
I have found a lot of references to the following piece of code, but I think (I'm new to bpy) that it only applies to an object that is currently selected:
import bpy
for obj in bpy.context.selected_objects:
obj.name = "newName"
What I can't figure out is how to rename only particular objects, like this:
BottomNoseBottom_99 = "NT"
UpperLipTopCenter_65 = "CUL"
etc.
I've searched for an answer with no luck.
Thanks in advance -
Upvotes: 1
Views: 3362
Reputation: 316
Objects in Blender Python console are accessible via bpy.data.objects
which has a dict
interface.
Try this:
bpy.data.objects["BottomNoseBottom_99"].name = "NT"
Upvotes: 1