LoginSignup
0
1

More than 5 years have passed since last update.

直前に生成したプリミティブ等の名称を取得するには

Last updated at Posted at 2014-07-19

はじめに

最近Blenderを使えると色々おもしろいことが出来そうなので、Pythonであれこれ出来ないか調査中。

今回は、BlenderをPythonから操る場合、追加したプリミティブなどを指定する際に名称を指定して後続の処理を行うことが多いように思えたので、この名称の取得方法を調べてみた。

プリミティブ追加時に名称を指定する方法が分からなかったので、調べたら、今回の方法に辿り着いた。

直前に生成したプリミティブの名称を取得するには

bpy.context.object.name

使い方

bpy.ops.mesh.primitive_uv_sphere_add(location=(0, 0, 0.5))
# ↑で追加したプリミティブ名は
bpy.context.object.name

関連投稿

関連記事

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1