1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
20 from bpy
.types
import Panel
22 from .operators
import get_rig_and_cam
, CameraRigMixin
25 class ADD_CAMERA_RIGS_PT_camera_rig_ui(Panel
, CameraRigMixin
):
26 bl_label
= "Camera Rig"
27 bl_space_type
= 'VIEW_3D'
31 def draw(self
, context
):
32 active_object
= context
.active_object
33 rig
, cam
= get_rig_and_cam(context
.active_object
)
34 pose_bones
= rig
.pose
.bones
39 if rig
["rig_id"].lower() in ("dolly_rig", "crane_rig"):
40 layout
.prop(pose_bones
["Camera"], '["lens"]',
41 text
="Focal Length (mm)")
43 col
= layout
.column(align
=True)
44 col
.label(text
="Clipping:")
45 col
.prop(cam_data
, "clip_start", text
="Start")
46 col
.prop(cam_data
, "clip_end", text
="End")
48 layout
.prop(cam_data
, "type")
51 col
= layout
.column(align
=True)
52 col
.prop(cam_data
.dof
, "use_dof")
53 if cam_data
.dof
.use_dof
:
54 if rig
["rig_id"].lower() in ("crane_rig", "dolly_rig"):
55 if cam_data
.dof
.focus_object
is None:
56 col
.operator("add_camera_rigs.add_dof_object",
57 text
="Add DOF Empty", icon
="OUTLINER_OB_EMPTY")
59 col
.prop(cam_data
.dof
, "focus_object")
60 row
= col
.row(align
=True)
61 row
.active
= cam_data
.dof
.focus_object
is None
62 row
.prop(pose_bones
["Camera"],
63 '["focus_distance"]', text
="Focus Distance")
64 col
.prop(pose_bones
["Camera"],
65 '["aperture_fstop"]', text
="F-Stop")
68 layout
.prop(active_object
, 'show_in_front',
69 toggle
=False, text
='Show in Front')
70 layout
.prop(cam_data
, "show_limits")
71 col
= layout
.column(align
=True)
72 col
.prop(cam_data
, "show_passepartout")
73 if cam_data
.show_passepartout
:
74 col
.prop(cam_data
, "passepartout_alpha")
78 panel
="ADD_CAMERA_RIGS_PT_composition_guides",
79 text
="Composition Guides",)
82 col
= layout
.column(align
=True)
84 "hide_select", text
="Make Camera Unselectable")
85 col
.operator("add_camera_rigs.add_marker_bind",
86 text
="Add Marker and Bind", icon
="MARKER_HLT")
87 col
.operator("add_camera_rigs.set_scene_camera",
88 text
="Make Camera Active", icon
='CAMERA_DATA')
90 if rig
["rig_id"].lower() in ("dolly_rig", "crane_rig"):
92 col
= layout
.column(align
=True)
93 col
.label(text
="Tracking:")
94 col
.prop(pose_bones
["Camera"].constraints
["Track To"],
95 'influence', text
="Aim Lock", slider
=True)
98 if rig
["rig_id"].lower() == "crane_rig":
99 col
= layout
.column(align
=True)
100 col
.label(text
="Crane Arm:")
101 col
.prop(pose_bones
["Crane_height"],
102 'scale', index
=1, text
="Arm Height")
103 col
.prop(pose_bones
["Crane_arm"],
104 'scale', index
=1, text
="Arm Length")
107 elif rig
["rig_id"].lower() == "2d_rig":
108 col
= layout
.column(align
=True)
109 col
.label(text
="2D Rig:")
110 col
.prop(pose_bones
["Camera"], '["rotation_shift"]',
111 text
="Rotation/Shift")
112 if cam
.data
.sensor_width
!= 36:
113 col
.label(text
="Please set Camera Sensor Width to 36", icon
="ERROR")
117 bpy
.utils
.register_class(ADD_CAMERA_RIGS_PT_camera_rig_ui
)
121 bpy
.utils
.unregister_class(ADD_CAMERA_RIGS_PT_camera_rig_ui
)