diff options
author | Damien Picard <dam.pic@free.fr> | 2022-07-28 16:32:02 +0300 |
---|---|---|
committer | Damien Picard <dam.pic@free.fr> | 2022-07-28 16:32:02 +0300 |
commit | 880284a41e843ebe751e005a046586ba6718681b (patch) | |
tree | bac7465a1a49e61b884452801cec26c6ab64e10e /add_camera_rigs/operators.py | |
parent | f2df91eae2db3a34f8b8f355d5c7a6aa1eef1437 (diff) |
Add camera rigs: use bone subtarget for DOF
We no longer need the Empty workaround since rB2e70d5cb980e
Also fix UI error when Track To constraint was renamed
Differential Revision: https://developer.blender.org/D15471
Diffstat (limited to 'add_camera_rigs/operators.py')
-rw-r--r-- | add_camera_rigs/operators.py | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/add_camera_rigs/operators.py b/add_camera_rigs/operators.py index 18300e08..29e77e3b 100644 --- a/add_camera_rigs/operators.py +++ b/add_camera_rigs/operators.py @@ -73,30 +73,16 @@ class ADD_CAMERA_RIGS_OT_add_marker_bind(Operator, CameraRigMixin): return {'FINISHED'} -class ADD_CAMERA_RIGS_OT_add_dof_object(Operator, CameraRigMixin): - bl_idname = "add_camera_rigs.add_dof_object" - bl_label = "Add DOF Object" - bl_description = "Create Empty and add as DOF Object" +class ADD_CAMERA_RIGS_OT_set_dof_bone(Operator, CameraRigMixin): + bl_idname = "add_camera_rigs.set_dof_bone" + bl_label = "Set DOF Bone" + bl_description = "Set the Aim bone as a DOF target" def execute(self, context): rig, cam = get_rig_and_cam(context.active_object) - bone = rig.data.bones['Aim_shape_rotation-MCH'] - # Add Empty - empty_obj = bpy.data.objects.new("EmptyDOF", None) - context.scene.collection.objects.link(empty_obj) - - # Parent to Aim Child bone - empty_obj.parent = rig - empty_obj.parent_type = "BONE" - empty_obj.parent_bone = "Aim_shape_rotation-MCH" - - # Move to bone head - empty_obj.location = bone.head - - # Make this new empty the dof_object - cam.data.dof.use_dof = True - cam.data.dof.focus_object = empty_obj + cam.data.dof.focus_object = rig + cam.data.dof.focus_subtarget = 'Aim_shape_rotation-MCH' return {'FINISHED'} @@ -104,7 +90,7 @@ class ADD_CAMERA_RIGS_OT_add_dof_object(Operator, CameraRigMixin): classes = ( ADD_CAMERA_RIGS_OT_set_scene_camera, ADD_CAMERA_RIGS_OT_add_marker_bind, - ADD_CAMERA_RIGS_OT_add_dof_object, + ADD_CAMERA_RIGS_OT_set_dof_bone, ) |