• 追加された行はこの色です。
  • 削除された行はこの色です。
* SprBlender [#j24b9d76]
//※開発中につき仕様は予告なく変わります~
//※画像は更新されていないかもしれません
- Springhead2をBlender上で動かすことができるpythonモジュールです
- Blenderの編集画面上でリアルタイム物理シミュレーションできます
//- Blender自体については[[コチラ>Blender]]へ

//* 構成検討 [#pb0b1631]
//- SprBlender紹介(このページ)
//- デモ
//- マニュアル
//- ダウンロード

#contents

* 導入方法 [#ac182abd]
** 必要なもの [#fc15097a]
- 以下を32bit版または64bit版'''どちらかに統一して'''揃える
- Blender 2.5以降(最新版) 32bit or 64bit
-- インストーラ版だとうまく動作しないようなのでzip版をダウンロードしてください
-- 現在は最新2.62版にて動作確認を行なっています
- springhead2のpythonDLL: Spr.pyd 32bit or 64bit
-- \Springhead2\bin\win32 or win64
-- http://springhead.info/spr2/Springhead2/trunk/bin/win32/Spr.pyd
-- or http://springhead.info/spr2/Springhead2/trunk/bin/win64/Spr.pyd
-- 最新バージョンのビルドは\Springhead2\src\EmbPython\SprPythonDLL.sln
- Blender用pythonスクリプト
-- \Experiments\SprPyBlender\scripts
-- http://springhead.info/lab/Experiments/trunk/SprPyBlender/scripts
-- SVNレポジトリになっています.
- Springhead2の動作に必要なライブラリ 32bit or 64bit
-- \Springhead2\lib
-- http://springhead.info/spr2/Springhead2/trunk/bin/win32
-- or http://springhead.info/spr2/Springhead2/trunk/bin/win64

** 導入 [#j347a24c]
+ Blenderをインストール
-- インストール先パスに日本語が含まれないよう注意
+ Blender用モジュールスクリプト(\Experiments\SprPyBlender\scripts)の"scripts"をBlender本体のフォルダ内の"(バージョン番号)\scripts"に上書き
-- 今のところファイルの上書きにはなりません
-- 今のところ必要なのはscripts\module\spr_opだけです
-- scriptsフォルダでチェックアウトすると楽にupdateできます
+ Spr.pydをBlender本体フォルダ内の"(バージョン番号)\scripts\modules"に入れる
+ Springhead2のライブラリ(lib\win32かlib\win64)にPathを通す

** 常に最新のspr_opを使いたい場合 [#c330a0d2]
- シンボリックリンクを使うと便利です
*** Windows7 [#c0eb9ba8]
- 管理者権限でコマンドプロンプト起動
 mklink /J "D:\Program Files (x86)\Blender Foundation\blender-2.61-release-windows64\2.61\scripts\modules\spr_op" "D:\project\Experiments\SprPyBlender\scripts\modules\spr_op"
*** windows XP [#r228fd1c]
- Link Creation Shell Extension[[(SourceForge.net):http://sourceforge.jp/projects/sfnet_lnhdr/]]をダウンロード、インストール
- 右クリックドラッグ&ドロップ→「リンクを作る」


* とりあえず使ってみる [#u7582805]
+ Blenderを起動する
+ \Experiments\SprPyBlender\demo\test.blendを読み込む
-- 環境によってGLSLがうまく描画されない場合はひとまず3D Viewの"Viewport Shading"から"Solid"を選択
-- &ref(01_open.png,zoom,320x240);
+ 右下のpythonコンソールで"import spr_op"と入力してEnter
-- &ref(02_import.png,320x240,02_import.png);
-- BlenderにSpringhead2用のOperatorが登録される
-- Springhead2用のパネルを表示
--- 3DView: Spr Operator Panel、Spr Info Panel
--- Scene: Spr Scene panel
--- Object: Spr Object Panel
--- &ref(SprOperatorPanel.png,zoom,320x240);
&ref(SprScenePanel.png,zoom,320x240);
&ref(SprObjectPanel.png,zoom,320x240);
-- Springhead2の初期化、Operatorメインループ始動
+ "Set Scene"を押すとSpringhead2のシーンを初期化
-- &ref(OperatorSetScene.png,zoom,320x240);
+ "Physics Step Enable"をチェックするとStepが有効になり動き出す
-- &ref(PhysicsStepEnable.png,zoom,320x240);
+ オブジェクトを移動したり回転するとリアルタイムに影響
-- オブジェクトの移動:選択(右クリック)→G(または右ドラッグ)→マウス移動→左クリックで決定(右クリックキャンセル)
-- オブジェクトの回転:選択(右クリック)→R→マウス移動→左クリックで決定(右クリックキャンセル)
-- "Enable Throw"を押すとオブジェクトに初速を与えられるようになる
-- &ref(04_move.png,zoom,320x240);
+ "Restore Scene"を押すと初期姿勢に戻る(変位、回転)
-- &ref(OperatorRestoreScene.png,zoom,320x240);
+ コピーしたオブジェクトや追加したオブジェクトに物理を適用したい場合は、対象を選択(右クリック、shiftを押しながらで複数選択可)、"Set Objects"を押す
-- オブジェクトのコピー:選択(右クリック)→shift+D→マウス移動→左クリックで決定
-- 追加時に物理法則に従うかどうか、BoxかSphereかの設定が適用される
-- &ref(OperatorSetObjects.png,zoom,320x240);
+ "Set Scene"を押すとその場でSpringhead2のシーン全体を初期化する
-- &ref(OperatorSetScene.png,zoom,320x240);

**memo [#u6918ad9]
- 現状では"import spr_op"後にblendファイルをロードすると動かなくなります
-- "ReRegister"を'''1度'''押すと再び動くようになります
---"ReRegister"を複数回押すとStepが重複して呼ばれるようになるので注意してください


* 詳しい使い方 [#c7bba44f]


* Blender操作に関するメモ [#p3454853]
** 描画関連 [#p5652c12]
** Blenderの基本操作 [#q2bdaec6]
- [[CGrad Project チュートリアル:http://www.cgradproject.com/Blender_Tutorial/tutorial_Blender_tute_menu.html]]
**その他操作 [#w02a5ead]
- PythonコンソールでCtrl+Shitを押すと補完を利用できる


* 中身・仕組みに関するメモ [#me489625]
- 引継ぎ120312
-- doc
- spr_op.physicsがphSdkやその他必要なオブジェクトを持っている
- Blender Pythonのドキュメント
-- [[Blender2.62Python API>http://www.blender.org/documentation/blender_python_api_2_62_1/]]
-- [[Blender Pythonスクリプトサンプルコード集(pdf)>http://blenderartists.org/forum/showthread.php?193908-Code-snippets.-Introduction-to-Python-scripting-in-Blender-2.5x]]