[Bf-blender-cvs] [47e2f7c] alembic_pointcache: Make the archive file name construction based on PointCache settings internal to the path utility function.

Lukas Tönne noreply at git.blender.org
Thu Oct 16 16:53:57 CEST 2014


Commit: 47e2f7cf99283e8845cba44153df4f207bfb91a8
Author: Lukas Tönne
Date:   Thu Dec 5 11:07:04 2013 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB47e2f7cf99283e8845cba44153df4f207bfb91a8

Make the archive file name construction based on PointCache settings
internal to the path utility function.

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

M	source/blender/pointcache/PTC_api.cpp
M	source/blender/pointcache/PTC_api.h
M	source/blender/pointcache/util/util_path.cpp
M	source/blender/pointcache/util/util_path.h

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

diff --git a/source/blender/pointcache/PTC_api.cpp b/source/blender/pointcache/PTC_api.cpp
index c1efd65..46cfa76 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -126,10 +126,7 @@ PTCWriter *PTC_writer_particles(Scene *scene, Object *ob, ParticleSystem *psys)
 	PointCache *cache = psys->pointcache;
 	if (!cache)
 		return NULL;
-	std::string filename = ptc_archive_path(cache->name, cache->index, cache->path, &ob->id,
-	                                        true, true,
-	                                        cache->flag & PTC_EXTERNAL,
-	                                        cache->flag & PTC_IGNORE_LIBPATH);
+	std::string filename = ptc_archive_path(cache, &ob->id);
 	
 	PTC::ParticlesWriter *writer = new PTC::ParticlesWriter(filename, scene, ob, psys);
 	return (PTCWriter *)writer;
@@ -140,10 +137,7 @@ PTCReader *PTC_reader_particles(Scene *scene, Object *ob, ParticleSystem *psys)
 	PointCache *cache = psys->pointcache;
 	if (!cache)
 		return NULL;
-	std::string filename = ptc_archive_path(cache->name, cache->index, cache->path, &ob->id,
-	                                        true, true,
-	                                        cache->flag & PTC_EXTERNAL,
-	                                        cache->flag & PTC_IGNORE_LIBPATH);
+	std::string filename = ptc_archive_path(cache, &ob->id);
 
 	PTC::ParticlesReader *reader = new PTC::ParticlesReader(filename, scene, ob, psys);
 	return (PTCReader *)reader;
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.h
index 3aa4aa7..6edb3a6 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.h
@@ -42,6 +42,8 @@ void PTC_bake(struct Main *bmain, struct Scene *scene, struct PTCWriter *writer,
               short *stop, short *do_update, float *progress);
 
 
+/*** Reader/Writer Interface ***/
+
 void PTC_writer_free(struct PTCWriter *writer);
 void PTC_write_sample(struct PTCWriter *writer);
 
diff --git a/source/blender/pointcache/util/util_path.cpp b/source/blender/pointcache/util/util_path.cpp
index 7fec1ab..e45f552 100644
--- a/source/blender/pointcache/util/util_path.cpp
+++ b/source/blender/pointcache/util/util_path.cpp
@@ -25,8 +25,7 @@ extern "C" {
 #include "BLI_string.h"
 
 #include "DNA_ID.h"
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
+#include "DNA_pointcache_types.h"
 
 #include "BKE_global.h"
 #include "BKE_main.h"
@@ -109,11 +108,10 @@ static int ptc_filename(char *filename, const char *name, int index, const char
 	return len;
 }
 
-std::string ptc_archive_path(const std::string &name, int index, const std::string &path, ID *id,
-                             bool do_path, bool do_ext, bool is_external, bool ignore_libpath)
+std::string ptc_archive_path(PointCache *cache, ID *id)
 {
 	char filename[FILE_MAX];
-	ptc_filename(filename, name.c_str(), index, path.c_str(), id, do_path, do_ext, is_external, ignore_libpath);
+	ptc_filename(filename, cache->name, cache->index, cache->path, id, true, true, cache->flag & PTC_EXTERNAL, cache->flag & PTC_IGNORE_LIBPATH);
 	return std::string(filename);
 }
 
diff --git a/source/blender/pointcache/util/util_path.h b/source/blender/pointcache/util/util_path.h
index 63c3c2d..5cff2f7 100644
--- a/source/blender/pointcache/util/util_path.h
+++ b/source/blender/pointcache/util/util_path.h
@@ -22,6 +22,7 @@
 #include <string>
 
 struct ID;
+struct PointCache;
 
 namespace PTC {
 
@@ -29,8 +30,7 @@ namespace PTC {
 #define PTC_EXTENSION ".abc"
 #define PTC_DIRECTORY "blendcache_"
 
-std::string ptc_archive_path(const std::string &name, int index, const std::string &path, ID *id,
-                             bool do_path, bool do_ext, bool is_external, bool ignore_libpath);
+std::string ptc_archive_path(PointCache *cache, ID *id);
 
 } /* namespace PTC */




More information about the Bf-blender-cvs mailing list