Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Picard <pioverfour>2022-07-15 14:30:57 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-15 14:40:04 +0300
commit2e70d5cb980ef2fda6d3bd7e89ed942f3f4b9c59 (patch)
treec4d2b144123d26b7eb202c9d9489e99a2f0f9eaa /source/blender/blenkernel/intern/camera.c
parent5ddbc14bb240a206ed38d5fd994db2a5ac2c4d3d (diff)
Render: camera depth of field support for armature bone targets
This is useful when using an armature as a camera rig, to avoid creating and targetting an empty object. Differential Revision: https://developer.blender.org/D7012
Diffstat (limited to 'source/blender/blenkernel/intern/camera.c')
-rw-r--r--source/blender/blenkernel/intern/camera.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 7cfac0cb75a..2e6439f7e1a 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -26,6 +26,7 @@
#include "BLI_utildefines.h"
#include "BKE_anim_data.h"
+#include "BKE_action.h"
#include "BKE_camera.h"
#include "BKE_idtype.h"
#include "BKE_layer.h"
@@ -221,7 +222,15 @@ float BKE_camera_object_dof_distance(const Object *ob)
if (cam->dof.focus_object) {
float view_dir[3], dof_dir[3];
normalize_v3_v3(view_dir, ob->obmat[2]);
- sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof.focus_object->obmat[3]);
+ bPoseChannel *pchan = BKE_pose_channel_find_name(cam->dof.focus_object->pose, cam->dof.focus_subtarget);
+ if (pchan) {
+ float posemat[4][4];
+ mul_m4_m4m4(posemat, cam->dof.focus_object->obmat, pchan->pose_mat);
+ sub_v3_v3v3(dof_dir, ob->obmat[3], posemat[3]);
+ }
+ else {
+ sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof.focus_object->obmat[3]);
+ }
return fabsf(dot_v3v3(view_dir, dof_dir));
}
return cam->dof.focus_distance;