Fix T40436: No preview in Brush with Cycles

More like a feature request, but after i've implemented preview for
icons it was rather simple to support nodes previews.
This commit is contained in:
2014-06-05 13:15:01 +06:00
parent 650f1d0a6f
commit ee5f43247b

View File

@@ -299,10 +299,10 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.cfra = scene->r.cfra; sce->r.cfra = scene->r.cfra;
if (id_type == ID_TE && sp->pr_method == PR_ICON_RENDER) { if (id_type == ID_TE && ELEM(sp->pr_method, PR_ICON_RENDER, PR_NODE_RENDER)) {
/* force blender internal for texture icons render, /* Force blender internal for texture icons and nodes render,
* seems commonly used render engines does not support * seems commonly used render engines does not support
* such kind of rendering * such kind of rendering.
*/ */
BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine)); BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));
} }
@@ -1138,10 +1138,6 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
ShaderPreview *sp; ShaderPreview *sp;
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
/* node previews not supported for cycles */
if (BKE_scene_use_new_shading_nodes(scene) && method == PR_NODE_RENDER)
return;
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW); WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
sp = MEM_callocN(sizeof(ShaderPreview), "shader preview"); sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
@@ -1158,7 +1154,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
/* hardcoded preview .blend for cycles/internal, this should be solved /* hardcoded preview .blend for cycles/internal, this should be solved
* once with custom preview .blend path for external engines */ * once with custom preview .blend path for external engines */
if (BKE_scene_use_new_shading_nodes(scene)) if (BKE_scene_use_new_shading_nodes(scene) && method != PR_NODE_RENDER)
sp->pr_main = G_pr_main_cycles; sp->pr_main = G_pr_main_cycles;
else else
sp->pr_main = G_pr_main; sp->pr_main = G_pr_main;