[Bf-blender-cvs] [2aa75bb] alembic: Simplified render/preview settings for cache baking.

Lukas Tönne noreply at git.blender.org
Wed May 27 15:22:17 CEST 2015


Commit: 2aa75bb1061d9c7327f219396efd01aea1bdedae
Author: Lukas Tönne
Date:   Wed May 27 15:16:40 2015 +0200
Branches: alembic
https://developer.blender.org/rB2aa75bb1061d9c7327f219396efd01aea1bdedae

Simplified render/preview settings for cache baking.

The previous way of selecting preview ("realtime") and render settings
on the cache library level was complicated and confusing. Now there are
just 2 buttons for baking either the preview or render level.
Technically the cache still works the same way, so a 3rd button could be
added for baking both passes into the same cache, should the need arise.

The preview cache now also uses the preview frame range, which should
help in quick testing of hair simulation settings. Render always uses
the scene frame range, like render buttons do.

For display in the viewport and rendering the cache will now use
whatever data is available in the archive. If the cache contains only
render data, the viewport will also draw full render data. Vice versa,
if the cache contains only preview data, this will also be used for
rendering.

Hair toggles for children and motion now are only used for the viewport
display. This simplifies the settings a lot and removes one potential
button to be overlooked.

===================================================================

M	intern/cycles/blender/blender_mesh.cpp
M	release/scripts/startup/bl_ui/properties_object.py
M	source/blender/blenkernel/BKE_cache_library.h
M	source/blender/blenkernel/intern/cache_library.c
M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/editors/io/io_cache_library.c
M	source/blender/makesdna/DNA_cache_library_types.h
M	source/blender/makesrna/intern/rna_cache_library.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/pointcache/PTC_api.cpp
M	source/blender/pointcache/PTC_api.h
M	source/blender/pointcache/alembic/abc_reader.cpp
M	source/blender/pointcache/alembic/abc_reader.h
M	source/blender/pointcache/alembic/abc_writer.cpp
M	source/blender/pointcache/alembic/abc_writer.h
M	source/blender/pointcache/alembic/alembic.cpp
M	source/blender/pointcache/intern/ptc_types.h
M	source/blender/pointcache/intern/reader.h
M	source/blender/pointcache/util/util_types.h

===================================================================

diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index 7f13559..76af193 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -633,11 +633,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_parent, bool object_updated, bool hide
 
 	bool need_update;
 	BL::CacheLibrary b_cachelib = b_parent.cache_library();
-	const BL::CacheLibrary::eval_mode_enum dupli_eval_mode =
-	        preview ? BL::CacheLibrary::eval_mode_REALTIME
-	                : BL::CacheLibrary::eval_mode_RENDER;
 	bool use_dupli_override = b_dupli_ob && b_cachelib &&
-	       ((b_cachelib.eval_mode() & dupli_eval_mode) != 0) &&
 	        (b_cachelib.source_mode() == BL::CacheLibrary::source_mode_CACHE ||
 	         b_cachelib.display_mode() == BL::CacheLibrary::display_mode_RESULT);
 	if (use_dupli_override) {
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 3e771e4..55eefad 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -429,11 +429,6 @@ class OBJECT_PT_cache_library(ObjectButtonsPanel, Panel):
         col.label("Display:")
         col.prop(cachelib, "display_motion", text="Motion")
         col.prop(cachelib, "display_children", text="Children")
-        split = row.split()
-        col = split.column()
-        col.label("Render:")
-        col.prop(cachelib, "render_motion", text="Motion")
-        col.prop(cachelib, "render_children", text="Children")
 
         layout.separator()
 
@@ -451,12 +446,22 @@ class OBJECT_PT_cache_library(ObjectButtonsPanel, Panel):
         
         col = row.column()
         row2 = col.row()
-        row2.prop(cachelib, "eval_mode", toggle=True, expand=True)
-        row2 = col.row()
         row2.alignment = 'LEFT'
         row2.prop(cachelib, "data_types", icon_only=True, toggle=True)
         row2.template_ID(cachelib, "filter_group")
-        row.operator("cachelibrary.bake")
+        col = row.column()
+        props = col.operator("cachelibrary.bake", text="Bake Preview", icon='RESTRICT_VIEW_OFF')
+        props.eval_mode = {'PREVIEW'}
+        if context.scene.use_preview_range:
+            props.start_frame = context.scene.frame_preview_start
+            props.end_frame = context.scene.frame_preview_end
+        else:
+            props.start_frame = context.scene.frame_start
+            props.end_frame = context.scene.frame_end
+        props = col.operator("cachelibrary.bake", text="Bake Render", icon='RESTRICT_RENDER_OFF')
+        props.eval_mode = {'RENDER'}
+        props.start_frame = context.scene.frame_start
+        props.end_frame = context.scene.frame_end
 
         '''
         row = layout.row(align=True)
diff --git a/source/blender/blenkernel/BKE_cache_library.h b/source/blender/blenkernel/BKE_cache_library.h
index beb8e81..3fcd48a 100644
--- a/source/blender/blenkernel/BKE_cache_library.h
+++ b/source/blender/blenkernel/BKE_cache_library.h
@@ -71,8 +71,7 @@ bool BKE_cache_library_validate_item(struct CacheLibrary *cachelib, struct Objec
 
 /* ========================================================================= */
 
-void BKE_cache_library_get_read_flags(struct CacheLibrary *cachelib, eCacheLibrary_EvalMode eval_mode, bool for_display,
-                                      bool *read_strands_motion, bool *read_strands_children);
+void BKE_cache_library_get_read_flags(struct CacheLibrary *cachelib, bool use_render, bool for_display, bool *read_strands_motion, bool *read_strands_children);
 
 bool BKE_cache_archive_path_test(struct CacheLibrary *cachelib, const char *path);
 void BKE_cache_archive_path_ex(const char *path, struct Library *lib, const char *default_filename, char *result, int max);
@@ -85,12 +84,12 @@ void BKE_cache_library_dag_recalc_tag(struct EvaluationContext *eval_ctx, struct
 void BKE_cache_library_tag_used_objects(CacheLibrary *cachelib);
 
 bool BKE_cache_read_dupli_cache(struct CacheLibrary *cachelib, struct DupliCache *dupcache,
-                                struct Scene *scene, struct Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display);
+                                struct Scene *scene, struct Group *dupgroup, float frame, bool use_render, bool for_display);
 bool BKE_cache_read_dupli_object(struct CacheLibrary *cachelib, struct DupliObjectData *data,
-                                 struct Scene *scene, struct Object *ob, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display);
+                                 struct Scene *scene, struct Object *ob, float frame, bool use_render, bool for_display);
 
 void BKE_cache_process_dupli_cache(struct CacheLibrary *cachelib, struct CacheProcessData *data,
-                                   struct Scene *scene, struct Group *dupgroup, float frame_prev, float frame, eCacheLibrary_EvalMode eval_mode);
+                                   struct Scene *scene, struct Group *dupgroup, float frame_prev, float frame);
 
 /* ========================================================================= */
 
@@ -115,7 +114,7 @@ typedef void (*CacheModifier_CopyFunc)(struct CacheModifier *md, struct CacheMod
 typedef void (*CacheModifier_ForeachIDLinkFunc)(struct CacheModifier *md, struct CacheLibrary *cachelib,
                                                 CacheModifier_IDWalkFunc walk, void *userData);
 typedef void (*CacheModifier_ProcessFunc)(struct CacheModifier *md, struct CacheProcessContext *ctx, struct CacheProcessData *data,
-                                          int frame, int frame_prev, eCacheLibrary_EvalMode eval_mode);
+                                          int frame, int frame_prev);
 
 typedef struct CacheModifierTypeInfo {
 	/* The user visible name for this modifier */
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 2188023..46cc2aa 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -89,8 +89,6 @@ CacheLibrary *BKE_cache_library_add(Main *bmain, const char *name)
 	cachelib->source_mode = CACHE_LIBRARY_SOURCE_SCENE;
 	cachelib->display_mode = CACHE_LIBRARY_DISPLAY_MODIFIERS;
 	cachelib->display_flag = CACHE_LIBRARY_DISPLAY_MOTION | CACHE_LIBRARY_DISPLAY_CHILDREN;
-	cachelib->render_flag = CACHE_LIBRARY_RENDER_MOTION | CACHE_LIBRARY_RENDER_CHILDREN;
-	cachelib->eval_mode = CACHE_LIBRARY_EVAL_REALTIME | CACHE_LIBRARY_EVAL_RENDER;
 
 	/* cache everything by default */
 	cachelib->data_types = CACHE_TYPE_ALL;
@@ -376,24 +374,11 @@ static struct PTCReaderArchive *find_active_cache(Scene *scene, CacheLibrary *ca
 	return archive;
 }
 
-void BKE_cache_library_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_EvalMode eval_mode, bool for_display,
-                                      bool *read_strands_motion, bool *read_strands_children)
+void BKE_cache_library_get_read_flags(CacheLibrary *cachelib, bool use_render, bool for_display, bool *read_strands_motion, bool *read_strands_children)
 {
-	if (for_display) {
-		switch (eval_mode) {
-			case CACHE_LIBRARY_EVAL_REALTIME:
-				*read_strands_motion = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_MOTION;
-				*read_strands_children = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_CHILDREN;
-				break;
-			case CACHE_LIBRARY_EVAL_RENDER:
-				*read_strands_motion = cachelib->render_flag & CACHE_LIBRARY_RENDER_MOTION;
-				*read_strands_children = cachelib->render_flag & CACHE_LIBRARY_RENDER_CHILDREN;
-				break;
-			default:
-				*read_strands_motion = false;
-				*read_strands_children = false;
-				break;
-		}
+	if (!use_render && for_display) {
+		*read_strands_motion = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_MOTION;
+		*read_strands_children = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_CHILDREN;
 	}
 	else {
 		*read_strands_motion = true;
@@ -402,7 +387,7 @@ void BKE_cache_library_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_Eval
 }
 
 bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
-                                Scene *scene, Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display)
+                                Scene *scene, Group *dupgroup, float frame, bool use_render, bool for_display)
 {
 	bool read_strands_motion, read_strands_children, read_simdebug = G.debug & G_DEBUG_SIMDATA;
 	struct PTCReaderArchive *archive;
@@ -415,16 +400,14 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
 	
 	if (!dupgroup || !cachelib)
 		return false;
-	if (!(cachelib->eval_mode & eval_mode))
-		return false;
 	
 	archive = find_active_cache(scene, cachelib);
 	if (!archive)
 		return false;
 	
-	PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
+	PTC_reader_archive_use_render(archive, use_render);
 	
-	BKE_cache_library_get_read_flags(cachelib, eval_mode, for_display, &read_strands_motion, &read_strands_children);
+	BKE_cache_library_get_read_flags(cachelib, use_render, for_display, &read_strands_motion, &read_strands_children);
 	// TODO duplicache reader should only overwrite data that is not sequentially generated by modifiers (simulations) ...
 	reader = PTC_reader_duplicache(dupgroup->id.name, dupgroup, dupcache,
 	                               read_strands_motion, read_strands_children, read_simdebug);
@@ -439,7 +422,7 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
 }
 
 bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
-                                 Scene *scene, Object *ob, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display)
+                                 Scene *scene, Object *ob, float frame, bool use_render, bool for_display)
 {
 	bool read_strands_motion, read_strands_children;
 	struct PTCReaderArchive *archive;
@@ -448,16 +431,14 @@ bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
 	
 	if (!data || !ob || !cachelib)
 		return false;
-	if (!(cachelib->eval_mode & eval_mode))
-		return false;
 	
 	archive = find_activ

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list