fix for [#8236] Lens Change by driver won't update in 3d View
authorCampbell Barton <ideasman42@gmail.com>
Sat, 19 Apr 2008 02:19:46 +0000 (02:19 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 19 Apr 2008 02:19:46 +0000 (02:19 +0000)
Lamps would not update either.

source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/object.c
source/blender/render/intern/source/initrender.c

index eb59ed885a959d04a1bbbbe5709432deafb69774..5b84617f8d5ae6b51b323ce194e8d088406e9543 100644 (file)
@@ -46,6 +46,7 @@
 #include "DNA_effect_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_lamp_types.h"
 #include "DNA_key_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_modifier_types.h"
@@ -494,11 +495,20 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int
        }
        if (ob->type==OB_CAMERA) {
                Camera *cam = (Camera *)ob->data;
+               if (cam->ipo) {
+                       dag_add_driver_relation(cam->ipo, dag, node, 1);
+               }
                if (cam->dof_ob) {
                        node2 = dag_get_node(dag, cam->dof_ob);
                        dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Camera DoF");
                }
        }
+       if (ob->type==OB_LAMP) {
+               Lamp *la = (Lamp *)ob->data;
+               if (la->ipo) {
+                       dag_add_driver_relation(la->ipo, dag, node, 1);
+               }
+       }
        if (ob->transflag & OB_DUPLI) {
                if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
                        GroupObject *go;
index a5243b3f55dad26caaf27f5aca5c973b2b88110b..5029ac458ab1ba93b32f307705569e21aa1c0652 100644 (file)
@@ -2224,6 +2224,16 @@ void object_handle_update(Object *ob)
                        else if(ob->type==OB_LATTICE) {
                                lattice_calc_modifiers(ob);
                        }
+                       else if(ob->type==OB_CAMERA) {
+                               Camera *cam = (Camera *)ob->data;
+                               calc_ipo(cam->ipo, frame_to_float(G.scene->r.cfra));
+                               execute_ipo(&cam->id, cam->ipo);
+                       }
+                       else if(ob->type==OB_LAMP) {
+                               Lamp *la = (Lamp *)ob->data;
+                               calc_ipo(la->ipo, frame_to_float(G.scene->r.cfra));
+                               execute_ipo(&la->id, la->ipo);
+                       }
                        else if(ob->type==OB_ARMATURE) {
                                /* this happens for reading old files and to match library armatures with poses */
                                if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
index add89d6249f2bc40d9aecfe12a72bb9810a8462b..ba971d2852499bd0ef0b13b33a445dc540bdc1a5 100644 (file)
@@ -459,11 +459,7 @@ void RE_SetCamera(Render *re, Object *camera)
                
                if(cam->type==CAM_ORTHO) re->r.mode |= R_ORTHO;
                
-               /* solve this too... all time depending stuff is in convertblender.c? */
-               if(cam->ipo) {
-                       calc_ipo(cam->ipo, frame_to_float(re->r.cfra));
-                       execute_ipo(&cam->id, cam->ipo);
-               }
+               /* updating these values from ipo's/drivers is handeled by the depgraph */
                lens= cam->lens;
                shiftx=cam->shiftx;
                shifty=cam->shifty;