Blender Python 開発メモ〜パネル表示〜
アドオン写経2
https://docs.blender.org/manual/en/dev/advanced/scripting/addon_tutorial.html#your-second-add-on
単発アドオンを作成してGITにアップ
1.写経してアドオンの作成パターンを理解する
2.ファイル分割、パッケージ化は二の次
3.アドオンの構成を理解する
・単発ファイルでオペレータとパネルの関連を理解
・コンポーネント作成とアクション
メートル法設定
https://wiki.blender.org/index.php/User:Rayek/Doc:2.6/Manual/Interface/Units
実寸設定
https://dskjal.com/blender/set-units.html
https://docs.blender.org/api/blender_python_api_2_63_release/bpy.app.handlers.html
import bpy
#パネルの左にチェックボックス
def my_handler(scene):
print("Frame Change", scene.frame_current)
bpy.app.handlers.frame_change_pre.append(my_handler)
初めに設計をちゃんとやらないとわけがわからなくなるので以下に注意
1.作成する入力コンポーネントを何個使うのか?
2. どのように使うのか?
3.Operatorで各コンポーネントを定義するのでここを工夫して(Codeで)
なんとかする
4.Panel側は、使用するコンポーネントの登録で終わらせる(そういう仕様だと思う)
Operatorクラスで bl_idnameで指定したIDをパネルで表示できることを確認
< in Panel#draw()>
print("Drawing")
layout = self.layout
layout.label(text="Hello World")
col = layout.column(align=True)
row = col.row(align = True)
row.operator("object.root_operator", text = "RootOperator")
< in Operatorフィールド>
bl_idname = "object.root_operator"
<Git>パターン1
https://gist.github.com/p2or/a00bdde9f2751940717a404cf977dd01
パネルに表示するものはオペレーターで定義する
オペレーターで定義したIDを読み込む
https://docs.blender.org/api/blender_python_api_current/bpy.types.Operator.html
bl_idnameがこの部分に対応し
「bpy.ops.この部分」の様に使用すると思われる
import bpy
class HelloWorldOperator(bpy.types.Operator):
bl_idname = "wm.hello_world"
bl_label = "Minimal Operator"
def execute(self, context):
print("Hello World")
return {'FINISHED'}
bpy.utils.register_class(HelloWorldOperator)
# test call to the newly defined operator
bpy.ops.wm.hello_world()
Eclipse セットアップ
- Java Install Eclipse〜開発ツールのインストール〜
- TensorFlow C++環境〜EclipseにCDTをインストール〜
- Setup OpenGL with Java〜JOGLを使う準備 for Eclipse〜
- Eclipse Meven 開発手順〜プロジェクトの作成〜
- Java OpenCV 環境セットアップ(on Mac)
- Java Basic
- Java Basic Level 1 〜Hello Java〜
- Java Basic Level2 〜Arithmetic Calculate〜
- Java Basic Level3 〜About String class〜
- Java Basic Level 4〜Boolean〜
- Java Basic Level 5〜If Statement〜
- Java Basic Summary from Level1 to 5
- Java Basic Level 6 〜Traning of If statement〜
- Java Basic Level8 〜How to use for statement〜
- Java Basic Level 8.5 〜Array〜
- Java Basic Level 9〜Training of for statement〜
- Java Basic Level 10 〜While statement 〜
- Java Basic Swing〜オブジェクト指向〜
- Java Basic Swing Level 2〜オブジェクト指向2〜
- サンプル実装〜コンソールゲーム〜
- Java Basic インターフェース・抽象クラスの作り方
- Java Basic クラスとは〜Step2_1〜
- Java Basic JUnit 〜テストスイートの作り方〜