diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-02-21 16:47:49 +0300 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-02-21 16:47:49 +0300 |
commit | 1c7a422f78805a0533d9623c3f11f682f0c98083 (patch) | |
tree | 196f722f1446e1bfd262f63b50e95b6a389a2656 /source/blender/blenloader | |
parent | 9ef0eed4b64325092dc90bf2db0ca9825fd94f83 (diff) |
Big node groups improvement patch. Node group trees now have their own lists of input/output sockets. Those can be linked to internal nodes just like links between regular nodes. In addition group sockets can be renamed and have a defined order, which can be modified, and they can be removed again.
More details can be found in the patch tracker description (#24883) and on the code.blender.org development blog.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 28 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 6 |
2 files changed, 28 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c8ab53da177..3f722cc8cf3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2046,8 +2046,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) /* now create the own typeinfo structs an verify nodes */ /* here we still assume no groups in groups */ for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) { - ntreeVerifyTypes(ntree); /* internal nodes, no groups! */ - ntreeMakeOwnType(ntree); /* for group usage */ + ntreeVerifyTypes(ntree); /* internal nodes, no groups! */ } /* now verify all types in material trees, groups are set OK now */ @@ -2078,7 +2077,6 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) bNodeLink *link; ntree->init= 0; /* to set callbacks and force setting types */ - ntree->owntype= NULL; ntree->progress= NULL; ntree->adt= newdataadr(fd, ntree->adt); @@ -2116,6 +2114,10 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) } link_list(fd, &ntree->links); + /* external sockets */ + link_list(fd, &ntree->inputs); + link_list(fd, &ntree->outputs); + /* and we connect the rest */ for(node= ntree->nodes.first; node; node= node->next) { node->preview= newimaadr(fd, node->preview); @@ -2125,13 +2127,16 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) for(sock= node->outputs.first; sock; sock= sock->next) sock->ns.data= NULL; } + for(sock= ntree->outputs.first; sock; sock= sock->next) + sock->link= newdataadr(fd, sock->link); + for(link= ntree->links.first; link; link= link->next) { link->fromnode= newdataadr(fd, link->fromnode); link->tonode= newdataadr(fd, link->tonode); link->fromsock= newdataadr(fd, link->fromsock); link->tosock= newdataadr(fd, link->tosock); } - + /* type verification is in lib-link */ } @@ -11363,8 +11368,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) { + bNodeTree *ntree; + + /* node sockets are not exposed automatically any more, + * this mimics the old behaviour by adding all unlinked sockets to groups. + */ + for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) { + nodeAddAllGroupSockets(ntree); + } + } + /* put compatibility code here until next subversion bump */ - + { bScreen *sc; @@ -11377,7 +11393,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } - + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e8275dde2af..8d0656e45e1 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -670,6 +670,12 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree) for(link= ntree->links.first; link; link= link->next) writestruct(wd, DATA, "bNodeLink", 1, link); + + /* external sockets */ + for(sock= ntree->inputs.first; sock; sock= sock->next) + writestruct(wd, DATA, "bNodeSocket", 1, sock); + for(sock= ntree->outputs.first; sock; sock= sock->next) + writestruct(wd, DATA, "bNodeSocket", 1, sock); } static void current_screen_compat(Main *mainvar, bScreen **screen) |