Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/camera.c
| Show All 20 Lines | |||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_rect.h" | #include "BLI_rect.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_anim_data.h" | #include "BKE_anim_data.h" | ||||
| #include "BKE_action.h" | |||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_lib_query.h" | #include "BKE_lib_query.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| ▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Camera *cam = (Camera *)ob->data; | Camera *cam = (Camera *)ob->data; | ||||
| if (ob->type != OB_CAMERA) { | if (ob->type != OB_CAMERA) { | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| if (cam->dof.focus_object) { | if (cam->dof.focus_object) { | ||||
| float view_dir[3], dof_dir[3]; | float view_dir[3], dof_dir[3]; | ||||
| normalize_v3_v3(view_dir, ob->obmat[2]); | normalize_v3_v3(view_dir, ob->obmat[2]); | ||||
| 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]); | sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof.focus_object->obmat[3]); | ||||
| } | |||||
| return fabsf(dot_v3v3(view_dir, dof_dir)); | return fabsf(dot_v3v3(view_dir, dof_dir)); | ||||
| } | } | ||||
| return cam->dof.focus_distance; | return cam->dof.focus_distance; | ||||
| } | } | ||||
| float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y) | float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y) | ||||
| { | { | ||||
| /* sensor size used to fit to. for auto, sensor_x is both x and y. */ | /* sensor size used to fit to. for auto, sensor_x is both x and y. */ | ||||
| ▲ Show 20 Lines • Show All 954 Lines • Show Last 20 Lines | |||||