[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29604] trunk/blender: Timeline addition: Display cached frames

Matt Ebb matt at mke3.net
Tue Jun 22 04:29:57 CEST 2010


Revision: 29604
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29604
Author:   broken
Date:     2010-06-22 04:29:52 +0200 (Tue, 22 Jun 2010)

Log Message:
-----------
Timeline addition: Display cached frames

This started off doing pointcache debugging but it's also very useful for users too.
Previously it was very hard to see the state of the system when you're working caches
such as physics point cache - is it baked? which frames are cached? is it out of date?

Now, for better feedback, cached frames are drawn for the active object at the bottom 
of the timeline - a semitransparent area shows the entire cache extents, and more 
solid blocks on top show the frames that are cached. Darker versions indicate it's 
using a disk cache.

It can be disabled in general in the timeline View -> Caches menu, or by each individual
system that can be shown.

There's still a bit to do on this, behaviour needs to be clarified still eg. deciding what
shows when it's out of date, or when it's been played back but not cached, etc. etc. 
Part of this is due to a lack of definition in the point cache system itself, so we should
try and clean up/clarify this behaviour and what it means to users, at the same time.

Also would be interested in extending this to other caches such as fluid cache, 
sequencer memory cache etc. in the future, too.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_time.py
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/include/ED_screen.h
    trunk/blender/source/blender/editors/include/ED_screen_types.h
    trunk/blender/source/blender/editors/physics/particle_object.c
    trunk/blender/source/blender/editors/physics/physics_pointcache.c
    trunk/blender/source/blender/editors/screen/screen_edit.c
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/space_time/space_time.c
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/makesrna/intern/rna_space.c
    trunk/blender/source/blender/windowmanager/WM_types.h

Modified: trunk/blender/release/scripts/ui/space_time.py
===================================================================
--- trunk/blender/release/scripts/ui/space_time.py	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/release/scripts/ui/space_time.py	2010-06-22 02:29:52 UTC (rev 29604)
@@ -99,10 +99,32 @@
         layout.prop(st, "only_selected")
 
         layout.separator()
+        
+        layout.menu("TIME_MT_cache")
+        
+        layout.separator()
 
         layout.operator("marker.camera_bind")
+        
+class TIME_MT_cache(bpy.types.Menu):
+    bl_label = "Cache"
 
+    def draw(self, context):
+        layout = self.layout
 
+        st = context.space_data
+
+        layout.prop(st, "show_cache")
+
+        layout.separator()
+
+        col = layout.column()
+        col.enabled = st.show_cache
+        col.prop(st, "cache_softbody")
+        col.prop(st, "cache_particles")
+        col.prop(st, "cache_cloth")
+        col.prop(st, "cache_smoke")
+
 class TIME_MT_frame(bpy.types.Menu):
     bl_label = "Frame"
 
@@ -171,6 +193,7 @@
 classes = [
     TIME_HT_header,
     TIME_MT_view,
+    TIME_MT_cache,
     TIME_MT_frame,
     TIME_MT_autokey,
     TIME_MT_playback]

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-06-22 02:29:52 UTC (rev 29604)
@@ -10857,14 +10857,21 @@
 				SpaceLink *sl;
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
 					if (sl->spacetype == SPACE_NODE) {
-						SpaceNode *snode;
-
-						snode= (SpaceNode *)sl;
+						SpaceNode *snode= (SpaceNode *)sl;
+						
 						if (snode->v2d.minzoom > 0.09f)
 							snode->v2d.minzoom= 0.09f;
 						if (snode->v2d.maxzoom < 2.31f)
 							snode->v2d.maxzoom= 2.31f;
 					}
+					else if (sl->spacetype == SPACE_TIME) {
+						SpaceTime *stime= (SpaceTime *)sl;
+						
+						/* enable all cache display */
+						stime->cache_display |= TIME_CACHE_DISPLAY;
+						stime->cache_display |= (TIME_CACHE_SOFTBODY|TIME_CACHE_PARTICLES);
+						stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE);
+					}
 				}
 			}
 		}

Modified: trunk/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen.h	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/source/blender/editors/include/ED_screen.h	2010-06-22 02:29:52 UTC (rev 29604)
@@ -97,8 +97,8 @@
 void	ED_screen_delete_scene(struct bContext *C, struct Scene *scene);
 void	ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event);
 void	ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
-void	ED_screen_animation_timer(struct bContext *C, int redraws, int sync, int enable);
-void	ED_screen_animation_timer_update(struct bScreen *screen, int redraws);
+void	ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable);
+void	ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh);
 int		ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
 void	ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
 void	ED_screen_full_restore(struct bContext *C, ScrArea *sa);

Modified: trunk/blender/source/blender/editors/include/ED_screen_types.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen_types.h	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/source/blender/editors/include/ED_screen_types.h	2010-06-22 02:29:52 UTC (rev 29604)
@@ -35,6 +35,7 @@
 typedef struct ScreenAnimData {
 	ARegion *ar;		/* do not read from this, only for comparing if region exists */
 	short redraws;
+	short refresh;
 	short flag;			/* flags for playback */
 	int sfra;			/* frame that playback was started from */
 } ScreenAnimData;

Modified: trunk/blender/source/blender/editors/physics/particle_object.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_object.c	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/source/blender/editors/physics/particle_object.c	2010-06-22 02:29:52 UTC (rev 29604)
@@ -69,8 +69,10 @@
 		return OPERATOR_CANCELLED;
 
 	object_add_particle_system(scene, ob, NULL);
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 	
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
+	
 	return OPERATOR_FINISHED;
 }
 
@@ -107,7 +109,8 @@
 			if(scene->basact && scene->basact->object==ob)
 				WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -166,7 +169,7 @@
 	DAG_scene_sort(scene);
 	DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -214,7 +217,7 @@
 	DAG_scene_sort(scene);
 	DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -262,7 +265,7 @@
 	DAG_scene_sort(scene);
 	DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -300,7 +303,7 @@
 			BLI_insertlink(&psys->targets, pt->prev->prev, pt);
 
 			DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 			break;
 		}
 	}
@@ -338,7 +341,7 @@
 			BLI_insertlink(&psys->targets, pt->next, pt);
 
 			DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
-			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 			break;
 		}
 	}
@@ -376,7 +379,7 @@
 			BLI_remlink(&part->dupliweights, dw);
 			BLI_insertlink(&part->dupliweights, dw->prev->prev, dw);
 
-			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
 			break;
 		}
 	}
@@ -415,7 +418,7 @@
 			dw->flag |= PART_DUPLIW_CURRENT;
 			BLI_addhead(&part->dupliweights, dw);
 
-			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
 			break;
 		}
 	}
@@ -461,7 +464,7 @@
 	if(dw)
 		dw->flag |= PART_DUPLIW_CURRENT;
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
 	
 	return OPERATOR_FINISHED;
 }
@@ -498,7 +501,7 @@
 			BLI_remlink(&part->dupliweights, dw);
 			BLI_insertlink(&part->dupliweights, dw->next, dw);
 
-			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
 			break;
 		}
 	}
@@ -590,7 +593,7 @@
 		disconnect_hair(scene, ob, psys);
 	}
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 
 	return OPERATOR_FINISHED;
 }
@@ -729,7 +732,7 @@
 		connect_hair(scene, ob, psys);
 	}
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
 
 	return OPERATOR_FINISHED;
 }

Modified: trunk/blender/source/blender/editors/physics/physics_pointcache.c
===================================================================
--- trunk/blender/source/blender/editors/physics/physics_pointcache.c	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/source/blender/editors/physics/physics_pointcache.c	2010-06-22 02:29:52 UTC (rev 29604)
@@ -115,6 +115,7 @@
 	BKE_ptcache_make_cache(&baker);
 
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, NULL);
 
 	return OPERATOR_FINISHED;
 }
@@ -133,6 +134,8 @@
 		}
 		
 		BLI_freelistN(&pidlist);
+		
+		WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, base->object);
 	}
 
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -211,6 +214,7 @@
 	BLI_freelistN(&pidlist);
 
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
 
 	return OPERATOR_FINISHED;
 }
@@ -218,6 +222,7 @@
 {
 	PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
 	PointCache *cache= ptr.data;
+	Object *ob= ptr.id.data;
 
 	if(cache->edit) {
 		if(!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) {
@@ -228,6 +233,8 @@
 	}
 	else
 		cache->flag &= ~PTCACHE_BAKED;
+	
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
 
 	return OPERATOR_FINISHED;
 }
@@ -235,8 +242,11 @@
 {
 	PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
 	PointCache *cache= ptr.data;
+	Object *ob= ptr.id.data;
 	
 	cache->flag |= PTCACHE_BAKED;
+	
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
 
 	return OPERATOR_FINISHED;
 }
@@ -303,6 +313,7 @@
 	BLI_freelistN(&pidlist);
 
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
 
 	return OPERATOR_FINISHED;
 }
@@ -331,6 +342,8 @@
 	}
 
 	BLI_freelistN(&pidlist);
+	
+	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
 
 	return OPERATOR_FINISHED;
 }

Modified: trunk/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_edit.c	2010-06-22 00:08:05 UTC (rev 29603)
+++ trunk/blender/source/blender/editors/screen/screen_edit.c	2010-06-22 02:29:52 UTC (rev 29604)
@@ -1651,7 +1651,7 @@
 /* redraws: uses defines from stime->redraws 
  * enable: 1 - forward on, -1 - backwards on, 0 - off
  */
-void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable)
+void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync, int enable)
 {
 	bScreen *screen= CTX_wm_screen(C);
 	wmWindowManager *wm= CTX_wm_manager(C);
@@ -1669,6 +1669,7 @@
 		sad->ar= CTX_wm_region(C);
 		sad->sfra = scene->r.cfra;
 		sad->redraws= redraws;
+		sad->refresh= refresh;
 		sad->flag |= (enable < 0)? ANIMPLAY_FLAG_REVERSE: 0;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list