Blender > ActionScript Exporter

やられたー、まだ詳細見てないけど、完成度高いみたい。
GameBlenderの機能は移植されてないようだけど。

でも、やっぱりみんなこう考えるよね。
そしてほんとに実現しちゃう人がいるのがBlenderコミュニティの厚さなんだよなあ。
勉強させていただきます・・・が、ちと悔しい。

追伸。
よく調べるとAS3のオブジェクトとして出力するようです。
確かにこっちの方が賢いよなあ。

FlashCS3で読み込めるか確認してみるか。

メモ:EclipseでBlenderAPIをコード補完する

*必要なもの
Blenderソース
Eclipse
PyDev

*手順
1、Blenderソースを適当なディレクトリに展開(ここでは「d:\pub\src」)
2、PyDevの設定で[Interpreter – Python]の[System PYTHONPATH]に以下の2つのディレクトリ追加。これによってBlenderAPIとGameEngineAPIのpyファイルが走査されるようになる。

D:\pub\src\blender-2.45\source\blender\python\api2_2x\doc
D:\pub\src\blender-2.45\source\gameengine\PyDoc

bleclipse.jpg

※pyファイルが不完全なのか、ごく一部のAPIが補完されない(GameEngineAPIに顕著)

メモ:Blender起動オプション

blender –helpを記載。

Blender 2.45 (sub 0) Build
Usage: blender [options ...] [file]

Render options:
  -b 	Render  in background
    -S 	Set scene 
    -f 	Render frame  and save it
    -s 	Set start to frame  (use with -a)
    -e 	Set end to frame (use with -a)
    -o
	Set the render path and file name.
      Use // at the start of the path to
        render relative to the blend file.
      The frame number will be added at the end of the filename.
      eg: blender -b foobar.blend -o //render_ -F PNG -x 1
    -F
	Set the render format, Valid options are..
    	TGA IRIS HAMX FTYPE JPEG MOVIE IRIZ RAWTGA
    	AVIRAW AVIJPEG PNG BMP FRAMESERVER
    (formats that can be compiled into blender, not available on all systems)
    	HDR TIFF EXR MPEG AVICODEC QUICKTIME CINEON DPX
    -x 	Set option to add the file extension to the end of the file.
    -t
Use amount of 
for rendering

Animation options:
  -a 	Playback 
    -p  	Open with lower left corner at , 
    -m		Read from disk (Don't buffer)

Window options:
  -w		Force opening with borders (default)
  -W		Force opening without borders
  -p    	Open with lower left corner at , 
                      	and width and height , 

Game Engine specific options:
  -g fixedtime		Run on 50 hertz without dropping frames
  -g vertexarrays	Use Vertex Arrays for rendering (usually faster)
  -g noaudio		No audio in Game Engine
  -g nomipmap		No Texture Mipmapping
  -g linearmipmap	Linear Texture Mipmapping instead of Nearest (default)

Misc options:
  -d		Turn debugging on
  -noaudio	Disable audio on systems that support audio
  -h		Print this help text
  -y		Disable script links, use -Y to find out why its -y
  -P 	Run the given Python script (filename or Blender Text)
  -R		Register .blend extension
  -v		Print Blender version and exit

ていうか、ウィンドウサイズを指定して起動ってないのかorz
GameBlenderを配布するとしたら、環境ごとに画面サイズ違うのをどうやって統一するんだ・・・。

GameBlenderでTkinter

単にテキストボックスを表示するだけのコードです。

Tkinterを使う目的は主にゲームの日本語チャットウィンドウを想定。
気になる問題はTkinterにスレッド使っていいのか、最前面化が常に可能か、GameBlender終了時に後処理としてデストラクタできるか等。

※検証コードです、きちんと終了処理してません。

import Tkinter as tk
import ScrolledText as st
import Rasterizer as r

r.showMouse(True)

if not hasattr(GameLogic, 'tk'):
	GameLogic.tk = tk.Tk()
	GameLogic.st = st.ScrolledText(GameLogic.tk)
	GameLogic.st.pack()

if hasattr(GameLogic, 'tk'):
	GameLogic.tk.update()