Fix cycles backwards compatibility for specular_toon shader this actually needs
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 10 Jun 2013 20:10:03 +0000 (20:10 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 10 Jun 2013 20:10:03 +0000 (20:10 +0000)
to be done in cycles itself to keep compatibility for bytecode too.

Also fix broken button to compile OSL from the text editors, this got broken after
recent change to disable editing of library linked nodes.

intern/cycles/kernel/osl/osl_closures.cpp
intern/cycles/kernel/shaders/stdosl.h
source/blender/editors/space_node/node_edit.c

index 8473f800d398e079a806f4b83ae145f4762bc6e4..b1549e95920e8f281b6f39534c8d7c8759cf6b7d 100644 (file)
@@ -198,6 +198,8 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
                bsdf_diffuse_toon_params(), bsdf_diffuse_toon_prepare);
        register_closure(ss, "glossy_toon", id++,
                bsdf_glossy_toon_params(), bsdf_glossy_toon_prepare);
+       register_closure(ss, "specular_toon", id++,
+               bsdf_glossy_toon_params(), bsdf_glossy_toon_prepare);
        register_closure(ss, "westin_backscatter", id++,
                bsdf_westin_backscatter_params(), bsdf_westin_backscatter_prepare);
        register_closure(ss, "westin_sheen", id++,
index 09217e52b556ae6ca7812ed7dedb89070604c771..24c3e187783a4c4cbfdc27109a04e9286e17e7e0 100644 (file)
@@ -467,10 +467,7 @@ closure color bssrdf_cubic(normal N, vector radius) BUILTIN;
 
 // Backwards compatibility
 
-closure color specular_toon(normal N, float size, float smooth)
-{
-       return glossy_toon(N, size, smooth);
-}
+closure color specular_toon(normal N, float size, float smooth) BUILTIN;
 
 // Renderer state
 int raytype (string typename) BUILTIN;
index 8ee09101cdf56ae31bc6695e02065b2598b9eef1..89fa58cd75041e482e9bc2f64a3894627ed10153 100644 (file)
@@ -2315,9 +2315,6 @@ static int node_shader_script_update_poll(bContext *C)
        bNode *node;
        Text *text;
 
-       if (!ED_operator_node_editable(C))
-               return 0;
-
        /* test if we have a render engine that supports shaders scripts */
        if (!(type && type->update_script_node))
                return 0;
@@ -2325,14 +2322,14 @@ static int node_shader_script_update_poll(bContext *C)
        /* see if we have a shader script node in context */
        node = CTX_data_pointer_get_type(C, "node", &RNA_ShaderNodeScript).data;
 
-       if (!node)
+       if (!node && snode && snode->edittree)
                node = nodeGetActive(snode->edittree);
 
        if (node && node->type == SH_NODE_SCRIPT) {
                NodeShaderScript *nss = node->storage;
 
                if (node->id || nss->filepath[0]) {
-                       return 1;
+                       return ED_operator_node_editable(C);
                }
        }