Merge with trunk r41625
[blender.git] / source / blender / nodes / shader / nodes / node_shader_geom.c
index 1b073f6415bd4c1ac9746118e9ce1c2a7c5bdf23..6547194b33ab957c90d12ab43f41bf321ab2680b 100644 (file)
@@ -45,6 +45,7 @@ static bNodeSocketTemplate sh_node_geom_out[]= {
        {       SOCK_VECTOR, 0, "UV"},
        {       SOCK_VECTOR, 0, "Normal"},
        {       SOCK_RGBA,   0, "Vertex Color"},
+       {       SOCK_FLOAT,   0, "Vertex Alpha"},
        {       SOCK_FLOAT,   0, "Front/Back"},
        {       -1, 0, ""       }
 };
@@ -90,11 +91,14 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
                                }
                        }
 
-                       VECCOPY(out[GEOM_OUT_VCOL]->vec, scol->col);
-                       out[GEOM_OUT_VCOL]->vec[3]= 1.0f;
+                       copy_v3_v3(out[GEOM_OUT_VCOL]->vec, scol->col);
+                       out[GEOM_OUT_VCOL]->vec[3]= scol->col[3];
+                       out[GEOM_OUT_VCOL_ALPHA]->vec[0]= scol->col[3];
                }
-               else
+               else  {
                        memcpy(out[GEOM_OUT_VCOL]->vec, defaultvcol, sizeof(defaultvcol));
+                       out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f;
+               }
                
                if(shi->osatex) {
                        out[GEOM_OUT_GLOB]->data= shi->dxgl;
@@ -139,6 +143,7 @@ void register_node_type_sh_geom(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, NULL, sh_node_geom_out);
        node_type_size(&ntype, 120, 80, 160);
        node_type_init(&ntype, node_shader_init_geometry);