![見出し画像](https://assets.st-note.com/production/uploads/images/147599128/rectangle_large_type_2_f32cf6edc8dadc5f5a252db6e07cc109.png?width=1200)
[Blender][スクリプト]カメラ外枠の透明度スライダーを3Dビュー上に表示させる
これを表示させるスクリプト(chatGPT産)
![](https://assets.st-note.com/img/1721212473196-7gCtLvC51u.png?width=1200)
import bpy
def draw_camera_opacity(self, context):
layout = self.layout
camera = context.scene.camera
if camera and camera.type == 'CAMERA':
row = layout.row(align=True)
sub = row.row(align=True)
sub.scale_x = 0.9 # スライダーの幅を調整
sub.prop(camera.data, "passepartout_alpha", text="Cam", slider=True)
def register():
bpy.types.VIEW3D_HT_header.append(draw_camera_opacity)
def unregister():
bpy.types.VIEW3D_HT_header.remove(draw_camera_opacity)
if __name__ == "__main__":
register()
スライダーの名前を外に出したい場合は下記
import bpy
def draw_camera_opacity(self, context):
layout = self.layout
camera = context.scene.camera
if camera and camera.type == 'CAMERA':
row = layout.row(align=True)
row.label(text="Cam:")
sub = row.row(align=True)
sub.scale_x = 0.9 # スライダーの幅を調整
sub.prop(camera.data, "passepartout_alpha", text="")
def register():
bpy.types.VIEW3D_HT_header.append(draw_camera_opacity)
def unregister():
bpy.types.VIEW3D_HT_header.remove(draw_camera_opacity)
if __name__ == "__main__":
register()
![](https://assets.st-note.com/img/1721213670498-njwA8BiETv.png)
この記事が気に入ったらサポートをしてみませんか?