diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-23 22:27:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-23 22:27:01 +0400 |
commit | 0096d180b924c1f1187d723a8e79ddc1b4c83586 (patch) | |
tree | 80aca065e503ae70b15c50c5d003e4d11246b521 /source/blender/blenkernel | |
parent | ba6a09f31d3fff40d316d856795345d085d79a0f (diff) |
Dof Object - set the depth of field to an object - set in the camera edit panel but the distance is calculated on the camera object only so linked cameras work.
Alt+Period - sets active pivot
some tooltips didnt make much sense, edited a few.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 28 |
3 files changed, 36 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 9022e07ebac..b834116f11d 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -63,6 +63,7 @@ int exist_object(struct Object *obtest); void *add_camera(char *name); struct Camera *copy_camera(struct Camera *cam); void make_local_camera(struct Camera *cam); +float dof_camera(struct Object *ob); void *add_lamp(char *name); struct Lamp *copy_lamp(struct Lamp *la); void make_local_lamp(struct Lamp *la); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 8e2feba1e2f..7b869f8b0e8 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -44,6 +44,7 @@ #include "DNA_action_types.h" #include "DNA_armature_types.h" #include "DNA_curve_types.h" +#include "DNA_camera_types.h" #include "DNA_ID.h" #include "DNA_effect_types.h" #include "DNA_group_types.h" @@ -479,7 +480,13 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB); /* inverted relation, so addtoroot shouldn't be set to zero */ } - + if (ob->type==OB_CAMERA) { + Camera *cam = (Camera *)ob->data; + if (cam->dof_ob) { + node2 = dag_get_node(dag, cam->dof_ob); + dag_add_relation(dag,node2,node,DAG_RL_OB_OB); + } + } if (ob->transflag & OB_DUPLI) { if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { GroupObject *go; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 751887b9f42..ba8d047644b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -260,6 +260,7 @@ void unlink_object(Object *ob) Tex *tex; Ipo *ipo; Group *group; + Camera *camera; bConstraint *con; bActionStrip *strip; int a; @@ -473,6 +474,15 @@ void unlink_object(Object *ob) rem_from_group(group, ob); group= group->id.next; } + + /* cameras */ + camera= G.main->camera.first; + while(camera) { + if (camera->dof_ob==ob) { + camera->dof_ob = NULL; + } + camera= camera->id.next; + } } int exist_object(Object *obtest) @@ -573,7 +583,23 @@ void make_local_camera(Camera *cam) } } - +/* get the camera's dof value, takes the dof object into account */ +float dof_camera(Object *ob) +{ + Camera *cam = (Camera *)ob->data; + if (ob->type != OB_CAMERA) + return 0.0; + if (cam->dof_ob) { + /* too simple, better to return the distance on the view axis only + * return VecLenf(ob->obmat[3], cam->dof_ob->obmat[3]); */ + + float mat[4][4]; + Mat4Invert(ob->imat, ob->obmat); + Mat4MulMat4(mat, cam->dof_ob->obmat, ob->imat); + return fabs(mat[3][2]); + } + return cam->YF_dofdist; +} void *add_lamp(char *name) { |