diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-20 16:02:33 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-20 16:02:33 +0300 |
commit | 6b1258f5b899d9aa0ad4e0c995dd637801b44aba (patch) | |
tree | c98e33576461d52270737b4ac8dda74f0d61fee4 /source/blender/editors/render | |
parent | 88b2955564c42359d4367a4da52596c30dda3cd1 (diff) |
Bugfix #25301
Material Node trees:
SSS wasn't displaying in Nodes.
Implementation notes:
- Currently copying local data for preview render, only copies
the base material. Node materials are re-used.
- This causes data to be in 2 "main" databases... complex.
- To make it work for preview, I had to add another loop in the
SSS code that checks the original Main dbase. That's marked
as warning in code to be fixed up.
Another bug:
- Material properties "SSS presets" copied settings to the
active material, not to the displayed one. Added RNA call
to retrieve this from Objects.
(Next commit will fix preset scripts)
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_preview.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index f8c8faffc88..2eac7c20350 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -49,6 +49,7 @@ #include "DNA_world_types.h" #include "DNA_camera_types.h" #include "DNA_material_types.h" +#include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_lamp_types.h" #include "DNA_space_types.h" @@ -309,6 +310,32 @@ static Object *find_object(ListBase *lb, const char *name) return ob; } +static int preview_mat_has_sss(Material *mat, bNodeTree *ntree) +{ + if(mat) { + if(mat->sss_flag & MA_DIFF_SSS) + return 1; + if(mat->nodetree) + if( preview_mat_has_sss(NULL, mat->nodetree)) + return 1; + } + else if(ntree) { + bNode *node; + for(node= ntree->nodes.first; node; node= node->next) { + if(node->type==NODE_GROUP && node->id) { + if( preview_mat_has_sss(NULL, (bNodeTree *)node->id)) + return 1; + } + else if(node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) { + mat= (Material *)node->id; + if(mat->sss_flag & MA_DIFF_SSS) + return 1; + } + } + } + return 0; +} + /* call this with a pointer to initialize preview scene */ /* call this with NULL to restore assigned ID pointers in preview scene */ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPreview *sp) @@ -361,7 +388,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sce->r.mode |= R_RAYTRACE; if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP)) sce->r.mode |= R_RAYTRACE; - if(mat->sss_flag & MA_DIFF_SSS) + if(preview_mat_has_sss(mat, NULL)) sce->r.mode |= R_SSS; /* turn off fake shadows if needed */ |