次の項目は別ページに分割しました。
関連ページ:
Blender におけるスクリプトの使い方一般については次のページにまとめています。
Blender Python API
公式サイト:
Blender Python API Documentation [Official]
目次
アプリケーションモジュール
- Context Access (bpy.context):現在の UI のコンテキストに応じたアクセスを提供する
- Data Access (bpy.data):Blender 上のデータへのアクセスを提供する
- Operators (bpy.ops):Blender 上での操作を実装したオペレーターを提供する
- Types (bpy.types):Blender API で使用される型を提供する
- Utilities (bpy.utils):ユーティリティを提供する
- Path Utilities (bpy.path):パスを取り扱うユーティリティを提供する
- Application Data (bpy.app):ランタイムに固有のデータを保持する
オペレーター (Operators)
- Collection Operators (bpy.ops.collection)
- Constraint Operators (bpy.ops.constraint)
- Graph Operators (bpy.ops.graph)
- Image Operators (bpy.ops.image)
- Render Operators (bpy.ops.render)
- UV Operators (bpy.ops.uv)
- View3D Operators (bpy.ops.view3d)
- Wm Operators (bpy.ops.wm)
- Object Operators (bpy.ops.object)
- Pose Operators (bpy.ops.pose)
- Preferences Operators (bpy.ops.preferences)
- Rigidbody Operators (bpy.ops.rigidbody)
参考:
Operators (bpy.ops) | Blender Python API [Official]
型 (Types)
参考:
Types (bpy.types) | Blender Python API [Official]
bpy_struct
bpy.types
で定義される全クラスの大元となる基底クラス
参考:
bpy_struct | Blender Python API [Official]
What is bpy_struct for? – Blender Stack Exchange
ユーティリティ (bpy.utils)
アドオンフォルダ
アドオンインストール先フォルダのパスを取得する。
bpy.utils.user_resource('SCRIPTS', path="addons")
Code language: Python (python)
参考:
Utilities (bpy.utils) | Blender Python API [Official]
How to automatically get a Add-on folder’s path regardless of OS? – Blender Stack Exchange
positional argument error in 3.0 – Blender Stack Exchange
アプリケーションデータ (Application Data)
参考:
Application Data (bpy.app) | Blender Python API [Official]
エクストラユーティリティ (Extra Utilities / bpy_extras)
参考:
Extra Utilities (bpy_extras) | Blender Python API [Official]
数学ユーティリティ (Math Types & Utilities / mathutils)
参考:
Math Types & Utilities (mathutils) | Blender Python API [Official]
コンテキストアクセス (bpy.context)
コンテキストに応じたデータや UI、操作を提供するインスタンス。
グローバルコンテキスト (Global Context)
- area
- blend_data
- collection
- engine
- gizmo_group
- layer_collection
- mode
- preferences
- region
- region_data
- scene
- screen
- space_data
- tool_settings
- view_layer
- window
- window_manager
- workspace
スクリーンコンテキスト (Screen Context)
- scene
- view_layer
- visible_objects
- selectable_objects
- selected_objects
- editable_objects
- selected_editable_objects
- objects_in_mode
- objects_in_mode_unique_data
- visible_bones
- editable_bones
- selected_bones
- selected_editable_bones
- visible_pose_bones
- selected_pose_bones
- selected_pose_bones_from_active_object
- active_bone
- active_pose_bone
- active_object
- object
- edit_object
- sculpt_object
- vertex_paint_object
- weight_paint_object
- image_paint_object
- particle_edit_object
- pose_object
- sequences
- selected_sequences
- selected_editable_sequences
- gpencil_data
- gpencil_data_owner
- annotation_data
- annotation_data_owner
- visible_gpencil_layers
- editable_gpencil_layers
- editable_gpencil_strokes
- active_gpencil_layer
- active_gpencil_frame
- active_annotation_layer
- active_operator
- visible_fcurves
- editable_fcurves
- selected_visible_fcurves
- selected_editable_fcurves
- active_editable_fcurves
3D ビューコンテキスト (View3D Context)
- active_base
- active_object
ボタンコンテキスト (Buttons Context)
- texture_slot
- scene
- world
- object
- mesh
- armature
- lattice
- curve
- meta_ball
- light
- speaker
- lightprobe
- camera
- material
- material_slot
- texture
- texture_user
- texture_user_property
- bone
- edit_bone
- pose_bone
- particle_system
- particle_system_editable
- particle_settings
- cloth
- soft_body
- fluid
- collision
- brush
- dynamic_paint
- line_style
- collection
- gpencil
イメージコンテキスト (Image Context)
- edit_image
- edit_mask
ノードコンテキスト (Node Context)
- selected_nodes
- active_node
- light
- material
- world
テキストコンテキスト (Text Context)
- edit_text
クリップコンテキスト (Clip Context)
- edit_movieclip
- edit_mask
シーケンサーコンテキスト (Sequencer Context)
- edit_mask
参考:
Context Access (bpy.context) | Blender Python API [Official]
プロパティ (Property)
- BoolProperty
- CollectionProperty
- EnumProperty
- FloatProperty
- IntProperty
- PointerProperty
- StringProperty
参考:
bpy.types.Property | Blender Python API [Official]
スタートアップ
Scripts which are automatically imported on startup.
./scripts/startup/*.py
起動時に読み込まれるモジュール/ファイル
- bl_app_templates_system:テンプレート
- bl_operators:オペレーター
- bl_ui:ユーザーインターフェイス
- keyingsets_builtins.py:標準キーイングセット
- nodeitems_builtins.py:組み込みノード
参考:
Blender’s Directory Layout | Blender Manual [Official]
blender/blender/release/scripts/startup – GitHub
How could a single Python script run when Blender is started? – Blender Stack Exchange
How to execute custom Python code on startup? – Blender Stack Exchange
仕組み
- Python/C API
リポジトリ:
source/blender/python – GitHub
参考:
Quickstart Introduction | Blender Python API [Official]
Python/C API Reference Manual | Python 3.x Documentation [Official]
Python and C/C++ Relationship – Blender Stack Exchange
Creating a Blender python module – Blender Developer Talk
更新履歴
最新の情報を確認する → Release Notes
参考:
Release Notes 3.0: Python API | Blender Developer Wiki [Official]
Release Notes 2.93: Python API | wiki.blender.jp
Release Notes 2.93: Python API | Blender Developer Wiki [Official]
Release Notes 2.80: Python API | Blender Developer Wiki [Official]
Release Notes | Blender Developer Wiki [Official]
API Changes | Blender Wiki (archive)
How to check the last changes in the Blender Python API | Interplanety
Change Log
参考:
Change Log | Blender Python API [Official]
Change Log (2.79 to 2.80) | Blender Python API [Official]
Change Log (2.83 to 2.90) | Blender Python API [Official]
ドキュメント
Blender Python API Documentation [Official]
Cython
参考: