diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-16 03:49:01 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-16 03:49:01 +0400 |
commit | d5b679253a09c161707437f0a86bf32d5b548a63 (patch) | |
tree | 3daf12f3074b1e4ce391ef8950dc4676ba41c79b /source/blender/blenloader/intern/readfile.c | |
parent | d293d74942a8f48d4de6c53f4300540bd0035c34 (diff) |
Cycles:
* Sun, area and point lights with size now supported
* Cast shadow option to disable shadow casting for lamps
* Emission strength of materials tweaked such that setting strength to 1.0
basically makes the material "shadeless" in that the value of the color
input will be the resulting color in the image.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1ed23361581..fb1beec1cbf 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2057,6 +2057,30 @@ static void lib_link_nodetree(FileData *fd, Main *main) } } +static void ntree_tmp_cycles_emission_version_patch(FileData *fd, Library *lib, bNodeTree *ntree) +{ + bNode *node; + bNodeSocket *sock; + bNodeSocketValueFloat *valfloat; + + for(node=ntree->nodes.first; node; node=node->next) { + if(node->type == SH_NODE_EMISSION) { + for(sock=node->inputs.first; sock; sock=sock->next) { + if(strcmp(sock->name, "Strength") == 0) { + valfloat= sock->default_value; + valfloat->value /= M_PI; + } + } + } + else if(node->type == NODE_GROUP) { + bNodeTree *ntree= newlibadr(fd, lib, node->id); + + if(ntree) + ntree_tmp_cycles_emission_version_patch(fd, lib, ntree); + } + } +} + static void ntree_tmp_cycles_version_patch(bNodeTree *ntree) { bNode *node; @@ -12296,6 +12320,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } + if(main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 5)) { + Scene *sce; + Base *base; + Material *ma; + + /* compatibility tweak */ + for(sce = main->scene.first; sce; sce = sce->id.next) { + if(strcmp(sce->r.engine, "CYCLES") == 0) { + for(base = sce->base.first; base; base=base->next) { + Object *ob= newlibadr(fd, lib, base->object); + + if(ob && ob->type == OB_LAMP) { + Lamp *la= newlibadr(fd, lib, ob->data); + if(la) + la->area_size= 0.0f; + } + } + } + } + + for(ma = main->mat.first; ma; ma= ma->id.next) + if(ma->nodetree) + ntree_tmp_cycles_emission_version_patch(fd, lib, ma->nodetree); + } + /* put compatibility code here until next subversion bump */ { } |