diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2011-09-07 09:40:12 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2011-09-07 09:40:12 +0400 |
commit | bac64b39e91f9da10f2b79db8fafecaf9c45a4e7 (patch) | |
tree | 58e40312855dfaf9d367ec6e23a9e1faed968426 /source/blender/blenloader | |
parent | c64336390569a344f972ce41d8a1fb96d3c9c38f (diff) | |
parent | 9161d3ce4bdd7c838751462b47eb045ea33a686e (diff) |
Merging r39948 through r39988 from trunk into vgroup_modifiers.vgroup_modifiers
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_sys_types.h | 9 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 33 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 33 |
3 files changed, 73 insertions, 2 deletions
diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h index 2114fc34bf1..4b3902dca43 100644 --- a/source/blender/blenloader/BLO_sys_types.h +++ b/source/blender/blenloader/BLO_sys_types.h @@ -93,7 +93,8 @@ typedef unsigned long uintptr_t; #include <inttypes.h> #elif defined(FREE_WINDOWS) - +/* define htoln here, there must be a syntax error in winsock2.h in MinGW */ +unsigned long __attribute__((__stdcall__)) htonl(unsigned long); #include <stdint.h> #else @@ -105,8 +106,14 @@ typedef unsigned long uintptr_t; #ifdef _WIN32 +#ifndef FREE_WINDOWS +#ifndef htonl #define htonl(x) correctByteOrder(x) +#endif +#ifndef ntohl #define ntohl(x) correctByteOrder(x) +#endif +#endif #elif defined (__FreeBSD__) || defined (__OpenBSD__) #include <sys/param.h> #elif defined (__APPLE__) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5518e133daf..eb5d6a6fbcb 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); @@ -7022,6 +7023,15 @@ static void do_versions_nodetree_default_value(bNodeTree *ntree) do_versions_socket_default_value(sock); } +static void do_versions_nodetree_dynamic_sockets(bNodeTree *ntree) +{ + bNodeSocket *sock; + for (sock=ntree->inputs.first; sock; sock=sock->next) + sock->flag |= SOCK_DYNAMIC; + for (sock=ntree->outputs.first; sock; sock=sock->next) + sock->flag |= SOCK_DYNAMIC; +} + static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ @@ -11979,6 +11989,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main) tex->nodetree->update |= NTREE_UPDATE; } } + + /* add SOCK_DYNAMIC flag to existing group sockets */ + { + bNodeTree *ntree; + /* only need to do this for trees in main, local trees are not used as groups */ + for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) { + do_versions_nodetree_dynamic_sockets(ntree); + 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 c3f51dc6ce4..3b736e8aeae 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); |