Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/properties_object.py7
-rw-r--r--source/blender/editors/io/io_cache_library.c10
-rw-r--r--source/blender/makesdna/DNA_cache_library_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_cache_library.c5
-rw-r--r--source/blender/pointcache/PTC_api.cpp8
-rw-r--r--source/blender/pointcache/PTC_api.h5
-rw-r--r--source/blender/pointcache/alembic/abc_writer.cpp33
-rw-r--r--source/blender/pointcache/alembic/abc_writer.h5
-rw-r--r--source/blender/pointcache/alembic/alembic.cpp5
-rw-r--r--source/blender/pointcache/intern/ptc_types.h3
10 files changed, 64 insertions, 18 deletions
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 63161bc66ce..4523d0da091 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -449,9 +449,9 @@ class CacheArchiveInfoPanel():
def draw_info(self, context, layout, info):
layout.prop(info, "filepath", text="File")
row = layout.row(align=True)
- row.prop(info, "app_name", text="Created by")
- row.prop(info, "date_written", text="")
- layout.prop(info, "description", text="")
+ row.label("Created by: {} | {}".format(info.app_name if info.app_name else "-", info.date_written if info.date_written else "-"))
+ if info.description:
+ layout.label(info.description)
if info.root_node:
row = layout.row()
@@ -526,6 +526,7 @@ class OBJECT_PT_cache_library(CacheArchiveInfoPanel, ObjectButtonsPanel, Panel):
row2.alignment = 'LEFT'
row2.prop(cachelib, "data_types", icon_only=True, toggle=True)
row2.template_ID(cachelib, "filter_group")
+ col.prop(cachelib, "description")
col = row.column()
props = col.operator("cachelibrary.bake", text="Bake Preview", icon='RESTRICT_VIEW_OFF')
props.eval_mode = {'PREVIEW'}
diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index e2a19ebe776..def99d0a175 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -49,6 +49,7 @@
#include "DNA_particle_types.h"
#include "BKE_anim.h"
+#include "BKE_blender.h"
#include "BKE_depsgraph.h"
#include "BKE_cache_library.h"
#include "BKE_context.h"
@@ -366,6 +367,7 @@ static void cache_library_bake_start(void *customdata, short *stop, short *do_up
const PTCArchiveResolution archive_res = (do_preview ? PTC_RESOLUTION_PREVIEW : 0) | (do_render ? PTC_RESOLUTION_RENDER : 0);
Scene *scene = data->scene;
char filename[FILE_MAX];
+ char app_name[MAX_NAME];
data->stop = stop;
data->do_update = do_update;
@@ -376,7 +378,8 @@ static void cache_library_bake_start(void *customdata, short *stop, short *do_up
scene->r.framelen = 1.0f;
BKE_cache_archive_output_path(data->cachelib, filename, sizeof(filename));
- data->archive = PTC_open_writer_archive(FPS, data->start_frame, filename, archive_res);
+ BLI_snprintf(app_name, sizeof(app_name), "Blender %s", versionstr);
+ data->archive = PTC_open_writer_archive(FPS, data->start_frame, filename, archive_res, app_name, data->cachelib->description, NULL);
if (data->archive) {
@@ -625,6 +628,7 @@ static int cache_library_archive_slice_exec(bContext *C, wmOperator *op)
struct PTCReaderArchive *input_archive;
struct PTCWriterArchive *output_archive;
PTCArchiveResolution archive_res;
+ CacheArchiveInfo info;
RNA_string_get(op->ptr, "input_filepath", input_filepath);
if (input_filepath[0] == '\0')
@@ -646,7 +650,9 @@ static int cache_library_archive_slice_exec(bContext *C, wmOperator *op)
}
archive_res = PTC_reader_archive_get_resolutions(input_archive);
- output_archive = PTC_open_writer_archive(FPS, start_frame, output_filename, archive_res);
+ PTC_get_archive_info(input_archive, &info);
+
+ output_archive = PTC_open_writer_archive(FPS, start_frame, output_filename, archive_res, info.app_name, info.description, NULL);
if (!output_archive) {
BKE_reportf(op->reports, RPT_ERROR, "Cannot write to cache file at '%s'", output_filepath);
return OPERATOR_CANCELLED;
diff --git a/source/blender/makesdna/DNA_cache_library_types.h b/source/blender/makesdna/DNA_cache_library_types.h
index 5a003680b64..0def355e7d5 100644
--- a/source/blender/makesdna/DNA_cache_library_types.h
+++ b/source/blender/makesdna/DNA_cache_library_types.h
@@ -88,6 +88,7 @@ typedef struct CacheLibrary {
int render_flag DNA_DEPRECATED;
int data_types;
struct Group *filter_group;
+ char description[256];
char input_filepath[1024]; /* 1024 = FILE_MAX */
char output_filepath[1024]; /* 1024 = FILE_MAX */
diff --git a/source/blender/makesrna/intern/rna_cache_library.c b/source/blender/makesrna/intern/rna_cache_library.c
index 41424c80502..4c8b8835491 100644
--- a/source/blender/makesrna/intern/rna_cache_library.c
+++ b/source/blender/makesrna/intern/rna_cache_library.c
@@ -925,13 +925,14 @@ static void rna_def_cache_library(BlenderRNA *brna)
RNA_def_property_enum_items(prop, cache_library_data_type_items);
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
RNA_def_property_ui_text(prop, "Data Types", "Types of data to store in the cache");
- RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
prop = RNA_def_property(srna, "filter_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "filter_group");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Filter Group", "If set, only objects in this group will be cached");
- RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
+
+ prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Description", "Description of the output archive");
/* modifiers */
prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/pointcache/PTC_api.cpp b/source/blender/pointcache/PTC_api.cpp
index e248e9aff38..4aecf557b34 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -51,7 +51,8 @@ using namespace PTC;
class StubFactory : public Factory {
const std::string &get_default_extension() { static std::string ext = ""; return ext; }
- WriterArchive *open_writer_archive(double /*fps*/, float /*start_frame*/, const std::string &/*name*/, PTCArchiveResolution /*resolutions*/, ErrorHandler */*error_handler*/) { return NULL; }
+ WriterArchive *open_writer_archive(double /*fps*/, float /*start_frame*/, const std::string &/*name*/, PTCArchiveResolution /*resolutions*/,
+ const char */*app_name*/, const char */*description*/, const struct tm */*t*/, ErrorHandler */*error_handler*/) { return NULL; }
ReaderArchive *open_reader_archive(double /*fps*/, float /*start_frame*/, const std::string &/*name*/, ErrorHandler * /*error_handler*/) { return NULL; }
void slice(ReaderArchive * /*in*/, WriterArchive * /*out*/, float /*start_frame*/, float /*end_frame*/) {}
Writer *create_writer_object(const std::string &/*name*/, Scene */*scene*/, Object */*ob*/) { return NULL; }
@@ -129,9 +130,10 @@ const char *PTC_get_default_archive_extension(void)
return PTC::Factory::alembic->get_default_extension().c_str();
}
-PTCWriterArchive *PTC_open_writer_archive(double fps, float start_frame, const char *path, PTCArchiveResolution resolutions)
+PTCWriterArchive *PTC_open_writer_archive(double fps, float start_frame, const char *path, PTCArchiveResolution resolutions,
+ const char *app_name, const char *description, const struct tm *time)
{
- return (PTCWriterArchive *)PTC::Factory::alembic->open_writer_archive(fps, start_frame, path, resolutions, NULL);
+ return (PTCWriterArchive *)PTC::Factory::alembic->open_writer_archive(fps, start_frame, path, resolutions, app_name, description, time, NULL);
}
void PTC_close_writer_archive(PTCWriterArchive *_archive)
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.h
index 6c9ad08d6ec..e00739e58c9 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.h
@@ -25,6 +25,8 @@
extern "C" {
#endif
+struct tm;
+
struct Main;
struct Scene;
struct EvaluationContext;
@@ -59,7 +61,8 @@ void PTC_error_handler_modifier(struct ModifierData *md);
const char *PTC_get_default_archive_extension(void);
-struct PTCWriterArchive *PTC_open_writer_archive(double fps, float start_frame, const char *path, PTCArchiveResolution resolutions);
+struct PTCWriterArchive *PTC_open_writer_archive(double fps, float start_frame, const char *path, PTCArchiveResolution resolutions,
+ const char *app_name, const char *description, const struct tm *time);
void PTC_close_writer_archive(struct PTCWriterArchive *archive);
void PTC_writer_archive_use_render(struct PTCWriterArchive *archive, bool enable);
diff --git a/source/blender/pointcache/alembic/abc_writer.cpp b/source/blender/pointcache/alembic/abc_writer.cpp
index 88b10487c44..79514831c2b 100644
--- a/source/blender/pointcache/alembic/abc_writer.cpp
+++ b/source/blender/pointcache/alembic/abc_writer.cpp
@@ -19,12 +19,15 @@
//#include <Alembic/AbcCoreHDF5/ReadWrite.h>
#include <Alembic/AbcCoreOgawa/ReadWrite.h>
#include <Alembic/Abc/OObject.h>
+#include <Alembic/Abc/ArchiveInfo.h>
#include "abc_writer.h"
#include "util_error_handler.h"
extern "C" {
+#include <ctime>
+
#include "BLI_fileops.h"
#include "BLI_path_util.h"
}
@@ -41,14 +44,38 @@ static void ensure_directory(const char *filename)
BLI_dir_create_recursive(dir);
}
-AbcWriterArchive *AbcWriterArchive::open(double fps, float start_frame, const std::string &filename, PTCArchiveResolution resolutions, ErrorHandler *error_handler)
+static MetaData create_archive_info(const char *app_name, const char *description, const struct tm *t)
+{
+ MetaData md;
+
+ md.set(kApplicationNameKey, app_name);
+ md.set(kUserDescriptionKey, description);
+
+ if (!t) {
+ time_t curtime = time(NULL);
+ t = localtime(&curtime);
+ }
+
+ if (t) {
+ char buf[256];
+ strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", t);
+ md.set(kDateWrittenKey, buf);
+ }
+
+ return md;
+}
+
+AbcWriterArchive *AbcWriterArchive::open(double fps, float start_frame, const std::string &filename, PTCArchiveResolution resolutions,
+ const char *app_name, const char *description, const struct tm *time, ErrorHandler *error_handler)
{
ensure_directory(filename.c_str());
+ MetaData md = create_archive_info(app_name, description, time);
+
OArchive abc_archive;
PTC_SAFE_CALL_BEGIN
-// abc_archive = OArchive(AbcCoreHDF5::WriteArchive(), filename, Abc::ErrorHandler::kThrowPolicy);
- abc_archive = OArchive(AbcCoreOgawa::WriteArchive(), filename, Abc::ErrorHandler::kThrowPolicy);
+// abc_archive = OArchive(AbcCoreHDF5::WriteArchive(), filename, md, Abc::ErrorHandler::kThrowPolicy);
+ abc_archive = OArchive(AbcCoreOgawa::WriteArchive(), filename, md, Abc::ErrorHandler::kThrowPolicy);
PTC_SAFE_CALL_END_HANDLER(error_handler)
if (abc_archive)
diff --git a/source/blender/pointcache/alembic/abc_writer.h b/source/blender/pointcache/alembic/abc_writer.h
index 6914b7ef971..50b46164444 100644
--- a/source/blender/pointcache/alembic/abc_writer.h
+++ b/source/blender/pointcache/alembic/abc_writer.h
@@ -37,6 +37,8 @@ extern "C" {
#include "DNA_ID.h"
}
+struct tm;
+
namespace PTC {
using namespace Alembic;
@@ -45,7 +47,8 @@ class AbcWriterArchive : public WriterArchive, public FrameMapper {
public:
virtual ~AbcWriterArchive();
- static AbcWriterArchive *open(double fps, float start_frame, const std::string &filename, PTCArchiveResolution resolutions, ErrorHandler *error_handler);
+ static AbcWriterArchive *open(double fps, float start_frame, const std::string &filename, PTCArchiveResolution resolutions,
+ const char *app_name, const char *description, const struct tm *time, ErrorHandler *error_handler);
bool use_render() const { return m_use_render; }
void use_render(bool enable) { m_use_render = enable; }
diff --git a/source/blender/pointcache/alembic/alembic.cpp b/source/blender/pointcache/alembic/alembic.cpp
index 782ce79a787..5b986519356 100644
--- a/source/blender/pointcache/alembic/alembic.cpp
+++ b/source/blender/pointcache/alembic/alembic.cpp
@@ -39,9 +39,10 @@ class AbcFactory : public Factory {
return ext;
}
- WriterArchive *open_writer_archive(double fps, float start_frame, const std::string &name, PTCArchiveResolution resolutions, ErrorHandler *error_handler)
+ WriterArchive *open_writer_archive(double fps, float start_frame, const std::string &name, PTCArchiveResolution resolutions,
+ const char *app_name, const char *description, const struct tm *time, ErrorHandler *error_handler)
{
- return AbcWriterArchive::open(fps, start_frame, name, resolutions, error_handler);
+ return AbcWriterArchive::open(fps, start_frame, name, resolutions, app_name, description, time, error_handler);
}
ReaderArchive *open_reader_archive(double fps, float start_frame, const std::string &name, ErrorHandler *error_handler)
diff --git a/source/blender/pointcache/intern/ptc_types.h b/source/blender/pointcache/intern/ptc_types.h
index b389dd19dca..0c2be73a110 100644
--- a/source/blender/pointcache/intern/ptc_types.h
+++ b/source/blender/pointcache/intern/ptc_types.h
@@ -198,7 +198,8 @@ protected:
struct Factory {
virtual const std::string &get_default_extension() = 0;
- virtual WriterArchive *open_writer_archive(double fps, float start_frame, const std::string &name, PTCArchiveResolution resolutions, ErrorHandler *error_handler) = 0;
+ virtual WriterArchive *open_writer_archive(double fps, float start_frame, const std::string &name, PTCArchiveResolution resolutions,
+ const char *app_name, const char *description, const struct tm *time, ErrorHandler *error_handler) = 0;
virtual ReaderArchive *open_reader_archive(double fps, float start_frame, const std::string &name, ErrorHandler *error_handler) = 0;
virtual void slice(ReaderArchive *in, WriterArchive *out, float start_frame, float end_frame) = 0;