++リンク
【Blender 2.8 アドオン開発】002 Blender API を調べて使ってみよう - めもてう
https://firemiller.net/2019/06/control-blender-camera/
++APIリファレンス
Blender 2.81a Python API Documentation — Blender Python API
++その他
ここの情報ウィンドウで、実行したコマンドのAPIを確認出来る。
---
クラス名をXXX_OT_YYYみたいな形式にするのだが、このXXXが同じアドオンを複数入れても、どれか一つしか表示されない。
++++HowTo
++オブジェクト名、メッシュ名の変更
for obj in bpy.context.selected_objects:
obj.name = "newName"
obj.data.name = "kkk"
++FBXインポートしたメッシュで編集モードに移動出来ない場合
bpy.ops.import_scene.fbx(filepath=path)
でインポートした場合、そのままだとなぜか編集モードに移動出来ない。
bpy.ops.mesh.primitive_plane_add()
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.delete(type='VERT')
空のオブジェクトを作成
bpy.ops.object.select_by_type(type="MESH")
bpy.ops.object.join()
空のオブジェクトとインポートしたオブジェクトをジョイン
bpy.ops.object.mode_set(mode="EDIT")
これでEditモードに行ける
++++Error
RuntimeError: Operator bpy.ops.object.select_by_type.poll() failed, context is incorrect
=>select_by_typeはオブジェクトモードで実行されるがEditモードで実行した場合等に発生する。
bpy.ops.object.mode_set(mode="OBJECT")
でオブジェクトモードに切り替える。