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:
authorTon Roosendaal <ton@blender.org>2008-11-12 22:03:50 +0300
committerTon Roosendaal <ton@blender.org>2008-11-12 22:03:50 +0300
commit8030cb03fd41673b7d687128782a0e21417baaea (patch)
treeb2e25d9a91ecf3713c45a4263f88a934e973e593 /source/blender/blenloader/intern/readfile.c
parent3fd3a13efc81ce3eafadd5ab31a154bbc25d6e58 (diff)
Patch #7897 Texture Nodes!
Robin (Frrr) Allen did a decent job on this, so we can also welcome him as a member in the svn committers team to maintain it! I do the first commit with some minor fixes: - get Makefiles work - fix rounding issue with tiles on unit faces - removed UI includes from tex node A nice doc in wiki is here: http://wiki.blender.org/index.php/User:Frr/TexnodeManual On the todo for Robin is: - When using one or more Texture-input nodes, you cannot edit them by activating (as works now for Material nodes). - The new "output node" option fails on the default case, when only one output node is active. It then shows often a blank menu. Will get fixed asap. - When using a NodeTree-Texture as input node, the menu for 'active output' should not show. NodeTree should ignore other nodetrees to keep things sane for now. - On a future todo is proper usage of "Dxt" and "Dyt" texture vectors for superior antialising of checkers/bricks. General note; I know people are dying to get a full integrated shader system with nodes. In theory we could merge this with Material Nodetrees... but I rather wait for a solid and very well thought out design proposal for this, also including design ideas for unifying with a shader language (GPU, CPU). For the time being this is a nice extension of current textures. :)
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index acedf51e619..423d050c862 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1524,6 +1524,7 @@ static void lib_verify_nodetree(Main *main, int open)
{
Scene *sce;
Material *ma;
+ Tex *tx;
bNodeTree *ntree;
/* this crashes blender on undo/redo
@@ -1548,6 +1549,11 @@ static void lib_verify_nodetree(Main *main, int open)
if(sce->nodetree)
ntreeVerifyTypes(sce->nodetree);
}
+ /* and texture trees */
+ for(tx= main->tex.first; tx; tx= tx->id.next) {
+ if(tx->nodetree)
+ ntreeVerifyTypes(tx->nodetree);
+ }
}
@@ -1584,6 +1590,9 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
else if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
((ImageUser *)node->storage)->ok= 1;
}
+ else if( ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) ) {
+ direct_link_curvemapping(fd, node->storage);
+ }
}
link_list(fd, &node->inputs);
link_list(fd, &node->outputs);
@@ -2490,6 +2499,9 @@ static void lib_link_texture(FileData *fd, Main *main)
tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo);
if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
+ if(tex->nodetree)
+ lib_link_ntree(fd, &tex->id, tex->nodetree);
+
tex->id.flag -= LIB_NEEDLINK;
}
tex= tex->id.next;
@@ -2515,6 +2527,11 @@ static void direct_link_texture(FileData *fd, Tex *tex)
memset(tex->env->cube, 0, 6*sizeof(void *));
tex->env->ok= 0;
}
+
+ tex->nodetree= newdataadr(fd, tex->nodetree);
+ if(tex->nodetree)
+ direct_link_nodetree(fd, tex->nodetree);
+
tex->preview = direct_link_preview_image(fd, tex->preview);
tex->iuser.ok= 1;
@@ -8306,11 +8323,23 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key)
expand_doit(fd, mainvar, key->ipo);
}
+static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
+{
+ bNode *node;
+
+ for(node= ntree->nodes.first; node; node= node->next)
+ if(node->id && node->type!=CMP_NODE_R_LAYERS)
+ expand_doit(fd, mainvar, node->id);
+
+}
static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
{
expand_doit(fd, mainvar, tex->ima);
expand_doit(fd, mainvar, tex->ipo);
+
+ if(tex->nodetree)
+ expand_nodetree(fd, mainvar, tex->nodetree);
}
static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
@@ -8323,16 +8352,6 @@ static void expand_brush(FileData *fd, Main *mainvar, Brush *brush)
expand_doit(fd, mainvar, brush->clone.image);
}
-static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
-{
- bNode *node;
-
- for(node= ntree->nodes.first; node; node= node->next)
- if(node->id && node->type!=CMP_NODE_R_LAYERS)
- expand_doit(fd, mainvar, node->id);
-
-}
-
static void expand_material(FileData *fd, Main *mainvar, Material *ma)
{
int a;