diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2011-09-09 16:21:41 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2011-09-09 16:21:41 +0400 |
commit | c1c4743696c67f562eda31e90d03c72eaec04567 (patch) | |
tree | 12c992e4160d7ff878f05f33549ff24b0ae3faa1 /source/blender/blenloader | |
parent | dbd6658d737b1592a633ddf6397be14e50e434d9 (diff) | |
parent | 01744abd8187d1566b336bf38033673aa05b6786 (diff) |
svn merge -r 39975:40061 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 21 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 39 |
2 files changed, 59 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f15d7a7b772..316999df6f6 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2217,8 +2217,9 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) if(node->type == NODE_DYNAMIC) { node->custom1= 0; node->custom1= BSET(node->custom1, NODE_DYNAMIC_LOADED); - node->typeinfo= NULL; } + + node->typeinfo= NULL; link_list(fd, &node->inputs); link_list(fd, &node->outputs); @@ -4190,6 +4191,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) if(tmd->curfalloff) direct_link_curvemapping(fd, tmd->curfalloff); } + else if (md->type==eModifierType_WeightVGEdit) { + WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md; + + wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve); + if(wmd->cmap_curve) + direct_link_curvemapping(fd, wmd->cmap_curve); + } } } @@ -12013,6 +12021,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ntree->update |= NTREE_UPDATE; } } + + { + /* Initialize group tree nodetypes. + * These are used to distinguish tree types and + * associate them with specific node types for polling. + */ + bNodeTree *ntree; + /* all node trees in main->nodetree are considered groups */ + for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) + ntree->nodetype = NODE_GROUP; + } } /* put compatibility code here until next subversion bump */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 9275852d424..e92ec5dbe6e 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -135,6 +135,7 @@ Any case: direct data is ALWAYS after the lib block #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_bpath.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "BKE_action.h" @@ -645,6 +646,38 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap) static void write_node_socket(WriteData *wd, bNodeSocket *sock) { bNodeSocketType *stype= ntreeGetSocketType(sock->type); + + /* forward compatibility code, so older blenders still open */ + sock->stack_type = 1; + + if(sock->default_value) { + bNodeSocketValueFloat *valfloat; + bNodeSocketValueVector *valvector; + bNodeSocketValueRGBA *valrgba; + + switch (sock->type) { + case SOCK_FLOAT: + valfloat = sock->default_value; + sock->ns.vec[0] = valfloat->value; + sock->ns.min = valfloat->min; + sock->ns.max = valfloat->max; + break; + case SOCK_VECTOR: + valvector = sock->default_value; + copy_v3_v3(sock->ns.vec, valvector->value); + sock->ns.min = valvector->min; + sock->ns.max = valvector->max; + break; + case SOCK_RGBA: + valrgba = sock->default_value; + copy_v4_v4(sock->ns.vec, valrgba->value); + sock->ns.min = 0.0f; + sock->ns.max = 1.0f; + break; + } + } + + /* actual socket writing */ writestruct(wd, DATA, "bNodeSocket", 1, sock); if (sock->default_value) writestruct(wd, DATA, stype->value_structname, 1, sock->default_value); @@ -1322,6 +1355,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase) write_curvemapping(wd, tmd->curfalloff); } } + else if (md->type==eModifierType_WeightVGEdit) { + WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md; + + if (wmd->cmap_curve) + write_curvemapping(wd, wmd->cmap_curve); + } } } |