2
$\begingroup$

I know how to rename the transform node.

But I don't know how to access the object data node.

import bpy

obj = bpy.data.objects['Cube']
obj.name = "test"

A What should I do?

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ that one is called mesh BTW, not shape. Shape is another thing. $\endgroup$
    – HikariTW
    Commented Nov 23, 2019 at 5:53
  • 1
    $\begingroup$ It is data in a mesh object: obj.data $\endgroup$
    – HikariTW
    Commented Nov 23, 2019 at 5:56

2 Answers 2

1
$\begingroup$

Maybe you should consider to use interactive python console provided in Blender. With Ctrl+space, it will list all possible candidate complete word in current sentence. It will help you guess the desired command that you want. No need to ask at here and wait.

enter image description here

And the answer: object.data.shape_keys.key_blocks is a list of shape key for object.

$\endgroup$
3
$\begingroup$

The accepted answer is helpful, but not correct for this need. To rename the mesh for an object you need to set the .data.name. For example:

# set the name for specific mesh
bpy.data.objects['test'].data.name = 'test_mesh'

# set the name of all meshes to be the same as the object
for name, obj in bpy.data.objects.items():
   obj.data.name = name
$\endgroup$

You must log in to answer this question.

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