« 2009年9月 | メイン | 2010年1月 »

●LWOエクスポート/インポートスクリプト バージョンアップです

2009年12月29日    

Shadeで.lwo(LightWave3D object file)をインポート/エクスポートするスクリプトをアップデートしました
Shade11への対応とUVの入出力に対応しました
通常Professionalでしか扱うことのできないlwoの形状データを扱うことができるようになります

Shade10/11のWidget形式となります
Shade10とShade11では別バイナリとなっています

ダウンロードしたファイルを解凍してできる
お使いのバージョンに合ったフォルダを開き
中にあるLWO_toolsフォルダごとShadeのWidgetsフォルダにコピーして
Shadeを再起動すれば利用可能になるかと思います
(詳しいインストール方法はShadeのマニュアルを参照してください)

http://artistside.com/?m=pc&a=page_fh_content&target_c_diary_id=15359

インポートは指定した形状のレイヤを一つのポリゴンメッシュとして作成
エクスポートはブラウザ上で選択した形状を選択形状毎に
ポリゴンメッシュに変換後それぞれをlwoとして出力します(複数形状可)

UVの入出力 テクスチャーの出力に対応しました
出力では距離UVのUV値と レイヤ1のテクスチャーデータをLWOに設定した状態で出力します
入力ではパラメタUVと距離UVの両方に同じUV値を設定します

テクスチャ出力の確認には(株)セルシスが販売しているComicStudioを利用しました
UV設定がされたポリゴンメッシュならばテクスチャー込みでコミスタ等に受け渡すことができるかと思います

●書き捨てスクリプト メモ

shadeの自作スクリプトのバグチェックのための書き捨てスクリプトをメモ

ポリゴンメッシュのuv値を(面id,頂点id):uv値 と出力するスクリプト


shd_shape = xshade.scene().active_shape()
for i in range(shd_shape.number_of_faces):
vertex_id_list =shd_shape.face(i) .vertex_indices#面を構成する頂点のid
uv_list = shd_shape.face(i).parameter_uv#パラメターUVの値を距離UVに
for j in xrange(len(uv_list)):
print "(" + str(i) + "," + str(vertex_id_list[j])+ ")" + str(uv_list[j])

●ShadeのUVをフォトショップの選択範囲に

2009年12月 1日    

書捨て状態だったスクリプトを公開
MacOSXのShadeとPhotoshop環境以外では使いようがないけれど
何かの参考に


import sys
import commands

##ApleScript部分ここから##
AppleScript_="""
on run argv
set argv_ to item 1 of argv
set point_list to {}
tell application "Adobe Photoshop CS3"
--activate
set width_ to width of current document as pixels
set Height_ to height of current document as pixels
if ((count word of argv_) mod 2) = 1 then
return
else
repeat with i from 1 to (count word of argv_) div 2
set a1 to (word (i * 2 - 1) in argv_ as number) * width_
set a2 to (word (i * 2) in argv_ as number) * Height_
set end of point_list to {a1, a2}
end repeat
end if
--選択範囲を追加
select current document region point_list combination type extended
end tell
end run
"""
##AppleScript部分ここまで##

##選択されている面のUVを取得
shd_shape = xshade.scene().active_shape()
f=commands.getoutput('osascript -e \'tell application \"Adobe Photoshop CS3\" to deselect selection of current document\'')
for i in range(shd_shape.number_of_faces):
if (shd_shape.face(i).active):
UV_list = shd_shape.face(i).distance_uv #距離UV
#UV_list = shd_shape.face(i).parameter_uv #パラメータUV値
argv_ = ""
for j in range(len(UV_list)):
(u,v) = UV_list[j]
argv_ = argv_ + str(u) + " " +str(v) + " "
(u,v) = UV_list[0]
argv_ = argv_ + str(u) + " " +str(v)
#print argv_
f=commands.getoutput('osascript -e \'' + AppleScript_ + '\' \''+ argv_ +'\'')
#print f
f=commands.getoutput('osascript -e \'tell application \"Adobe Photoshop CS3\" to activate\'')