diff options
author | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:43 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:43 +0300 |
commit | e83f88c951e26b01893acee4f24b40a46062a41c (patch) | |
tree | 09f60bf7d4fc2ae1ef50668823e416fc675b252e /add_camera_rigs/operators.py | |
parent | ec84e3294593e2e26475f18c81e847bf00dc201e (diff) | |
parent | 0cd92169d40ae1c7e103ff269e850eaf1b901646 (diff) |
Merge branch 'master' into xr-devxr-dev
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, ) |