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:
Diffstat (limited to 'source/blender/blenloader/intern/writefile.c')
-rw-r--r--source/blender/blenloader/intern/writefile.c117
1 files changed, 99 insertions, 18 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index aa44b484f03..88757e497c3 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -97,6 +97,7 @@
#include "DNA_armature_types.h"
#include "DNA_actuator_types.h"
#include "DNA_brush_types.h"
+#include "DNA_cache_library_types.h"
#include "DNA_camera_types.h"
#include "DNA_cloth_types.h"
#include "DNA_constraint_types.h"
@@ -147,6 +148,7 @@
#include "BKE_action.h"
#include "BKE_blender.h"
#include "BKE_bpath.h"
+#include "BKE_cache_library.h"
#include "BKE_curve.h"
#include "BKE_constraint.h"
#include "BKE_global.h" // for G
@@ -869,23 +871,38 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
writestruct(wd, DATA, "bNodeLink", 1, link);
if (node->storage) {
/* could be handlerized at some point, now only 1 exception still */
- if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
- write_curvemapping(wd, node->storage);
- else if (ntree->type==NTREE_SHADER && node->type==SH_NODE_SCRIPT) {
- NodeShaderScript *nss = (NodeShaderScript *)node->storage;
- if (nss->bytecode)
- writedata(wd, DATA, strlen(nss->bytecode)+1, nss->bytecode);
- writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
- }
- else if (ntree->type==NTREE_COMPOSIT && ELEM(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
- write_curvemapping(wd, node->storage);
- else if (ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
- write_curvemapping(wd, node->storage);
- else if (ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION) {
- /* pass */
- }
- else
- writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+ if (ntree->type==NTREE_SHADER) {
+ if (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB)
+ write_curvemapping(wd, node->storage);
+ else if (node->type==SH_NODE_SCRIPT) {
+ NodeShaderScript *nss = (NodeShaderScript *)node->storage;
+ if (nss->bytecode)
+ writedata(wd, DATA, strlen(nss->bytecode)+1, nss->bytecode);
+ writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+ }
+ else if (node->type==SH_NODE_OPENVDB) {
+ NodeShaderOpenVDB *vdb = (NodeShaderOpenVDB *)node->storage;
+ writelist(wd, DATA, "OpenVDBGridInfo", &vdb->grid_info);
+ writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+ }
+ else
+ writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+ }
+ else if (ntree->type==NTREE_COMPOSIT) {
+ if (ELEM(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+ write_curvemapping(wd, node->storage);
+ else if (node->type==CMP_NODE_MOVIEDISTORTION) {
+ /* pass */
+ }
+ else
+ writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+ }
+ else if (ntree->type==NTREE_TEXTURE) {
+ if (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME)
+ write_curvemapping(wd, node->storage);
+ else
+ writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
+ }
}
if (node->type==CMP_NODE_OUTPUT_FILE) {
@@ -1494,6 +1511,14 @@ static void write_defgroups(WriteData *wd, ListBase *defbase)
writestruct(wd, DATA, "bDeformGroup", 1, defgroup);
}
+static void write_fmaps(WriteData *wd, ListBase *fbase)
+{
+ bFaceMap *fmap;
+
+ for (fmap=fbase->first; fmap; fmap=fmap->next)
+ writestruct(wd, DATA, "bFaceMap", 1, fmap);
+}
+
static void write_modifiers(WriteData *wd, ListBase *modbase)
{
ModifierData *md;
@@ -1524,6 +1549,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
}
else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md;
+ OpenVDBCache *cache;
if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
if (smd->domain) {
@@ -1546,6 +1572,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, smd->domain->effector_weights);
}
+
+ cache = smd->domain->vdb_caches.first;
+ for (; cache; cache = cache->next) {
+ writestruct(wd, DATA, "OpenVDBCache", 1, cache);
+ }
+
}
else if (smd->type & MOD_SMOKE_TYPE_FLOW)
writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow);
@@ -1664,6 +1696,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
write_pose(wd, ob->pose);
write_defgroups(wd, &ob->defbase);
+ write_fmaps(wd, &ob->fmaps);
write_constraints(wd, &ob->constraints);
write_motionpath(wd, ob->mpath);
@@ -1949,6 +1982,10 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
else if (layer->type == CD_GRID_PAINT_MASK) {
write_grid_paint_mask(wd, count, layer->data);
}
+ else if (layer->type == CD_FACEMAP) {
+ const int *layer_data = layer->data;
+ writedata(wd, DATA, sizeof(*layer_data) * count, layer_data);
+ }
else {
CustomData_file_write_info(layer->type, &structname, &structnum);
if (structnum) {
@@ -2768,7 +2805,10 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
writestruct(wd, DATA, "SpaceIpo", 1, sl);
if (sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
-
+
+ if (sipo->backdrop_camera)
+ writestruct(wd, DATA, "Object", 1, sipo->backdrop_camera);
+
/* reenable ghost curves */
sipo->ghostCurves= tmpGhosts;
}
@@ -3544,6 +3584,46 @@ static void write_linestyles(WriteData *wd, ListBase *idbase)
}
}
+static void write_cache_modifiers(WriteData *wd, CacheLibrary *cachelib)
+{
+ CacheModifier *md;
+ for (md = cachelib->modifiers.first; md; md = md->next) {
+ const char *struct_name = BKE_cache_modifier_type_struct_name(md->type);
+ if (!struct_name || struct_name[0] == '\0')
+ continue;
+
+ writestruct(wd, DATA, struct_name, 1, md);
+
+ switch (md->type) {
+ case eCacheModifierType_HairSimulation: {
+ HairSimCacheModifier *hsmd = (HairSimCacheModifier *)md;
+ writestruct(wd, DATA, "EffectorWeights", 1, hsmd->sim_params.effector_weights);
+ if (hsmd->sim_params.goal_stiffness_mapping)
+ write_curvemapping(wd, hsmd->sim_params.goal_stiffness_mapping);
+ if (hsmd->sim_params.bend_stiffness_mapping)
+ write_curvemapping(wd, hsmd->sim_params.bend_stiffness_mapping);
+ break;
+ }
+ }
+ }
+}
+
+static void write_cachelibraries(WriteData *wd, ListBase *idbase)
+{
+ CacheLibrary *cachelib;
+
+ for (cachelib = idbase->first; cachelib; cachelib = cachelib->id.next) {
+ if (cachelib->id.us > 0 || wd->current) {
+
+ writestruct(wd, ID_CL, "CacheLibrary", 1, cachelib);
+ if (cachelib->id.properties)
+ IDP_WriteProperty(cachelib->id.properties, wd);
+
+ write_cache_modifiers(wd, cachelib);
+ }
+ }
+}
+
/* context is usually defined by WM, two cases where no WM is available:
* - for forward compatibility, curscreen has to be saved
* - for undofile, curscene needs to be saved */
@@ -3672,6 +3752,7 @@ static int write_file_handle(
write_scripts (wd, &mainvar->script);
write_gpencils (wd, &mainvar->gpencil);
write_linestyles(wd, &mainvar->linestyle);
+ write_cachelibraries(wd, &mainvar->cache_library);
write_libraries(wd, mainvar->next);
if (write_user_block) {