Fix [#21521] Displacement modifier does not update when modifing texture
authorMatt Ebb <matt@mke3.net>
Mon, 24 May 2010 07:30:50 +0000 (07:30 +0000)
committerMatt Ebb <matt@mke3.net>
Mon, 24 May 2010 07:30:50 +0000 (07:30 +0000)
Depgraph now handles texture dependencies - textures can affect objects/data via modifiers.

source/blender/blenkernel/intern/depsgraph.c
source/blender/editors/space_view3d/space_view3d.c

index 1e5f276ba95d5e242b85c0e67b8959c6a015b63c..0568050950f4052cbec7555395f4c7e3e80dfc0e 100644 (file)
@@ -2250,6 +2250,16 @@ void DAG_on_load_update(void)
        }
 }
 
+static void dag_id_flush_update__isDependentTexture(void *userData, Object *ob, ID **idpoin)
+{
+       struct { ID *id; int is_dependent; } *data = userData;
+       
+       if(*idpoin && GS((*idpoin)->name)==ID_TE) {
+               if (data->id == (*idpoin))
+                       data->is_dependent = 1;
+       }
+}
+
 void DAG_id_flush_update(ID *id, short flag)
 {
        Main *bmain= G.main;
@@ -2304,6 +2314,17 @@ void DAG_id_flush_update(ID *id, short flag)
                        }
                }
                
+               /* set flags based on textures - can influence depgraph via modifiers */
+               if(idtype == ID_TE) {
+                       for(obt=bmain->object.first; obt; obt= obt->id.next) {
+                               struct { ID *id; int is_dependent; } data = {id, 0};
+                               
+                               modifiers_foreachIDLink(obt, dag_id_flush_update__isDependentTexture, &data);
+                               if (data.is_dependent)
+                                       obt->recalc |= OB_RECALC_DATA;
+                       }
+               }
+               
                /* set flags based on ShapeKey */
                if(idtype == ID_KE) {
                        for(obt=bmain->object.first; obt; obt= obt->id.next) {
index e78618f4627a0af668e4854c6e8b97b05d93dafb..78ae13d255e42f644e7e0b91ae6546b8e7b27ac5 100644 (file)
@@ -610,6 +610,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
                         * more context than just the region */
                        ED_region_tag_redraw(ar);
                        break;
+               case NC_TEXTURE:        
+                       /* same as above */
+                       ED_region_tag_redraw(ar);
+                       break;
                case NC_SPACE:
                        if(wmn->data == ND_SPACE_VIEW3D) {
                                if (wmn->subtype == NS_VIEW3D_GPU) {