スクリプトを使ってレンダリング画像をファイル保存

スクリプトを使用して、レンダリング画像を保存します。


scene = xshade.scene()

if scene.rendering.image != None:
  dialog = xshade.create_dialog_with_uuid()
  file_path = dialog.ask_path(False, '*.png|png')
  if file_path != '':
    scene.rendering.image.save(file_path)

「scene.rendering.image」がNone以外の場合は、レンダリングイメージが存在します。
「dialog = xshade.create_dialog_with_uuid()」「dialog.ask_path」でファイルダイアログボックスを表示します。
「ask_path」の第一引数がTrueの場合はファイルオープン、Falseの場合はファイル保存になります。
第二引数にファイルの種類を列挙します。
‘*.png|png’の場合はpngのみ。
‘Jpeg(*.jpg, *.jpeg)|jpg;jpeg|*.png|png’とすると、jpg/pngを選択できます。

「dialog.ask_path」の戻り値が空文字(”)以外の場合は、絶対パスが取得できたことになります。
「scene.rendering.image.save(file_path)」を使用すると、
第一引数に指定したパスでレンダリング画像がファイル保存されます。

この記事のURLとタイトルをコピーする
Translate »