Bugfix #26221
authorTon Roosendaal <ton@blender.org>
Sat, 26 Feb 2011 13:53:15 +0000 (13:53 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 26 Feb 2011 13:53:15 +0000 (13:53 +0000)
Two bugs in one:

- Lukas commit monday for new group/socket handling accidentally removed
  to set socketype in stacks, which as used by (texture) nodes to detect
  whether value, color or vector had to be read.
  Result was that all texture nodes were rendering as B&W

- Old 2.5 bug: preview renders for texture nodes didn't call a
  NodeEndExec function, which gave crashes on deleting nodes.

The change in interface_hanlers.c is only a comment to explain
how keymaps are being found.

source/blender/blenkernel/intern/node.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/render/render_preview.c

index 15ad3a7809a45069eb2437a1e69c44fc23327876..320bead1c6145b4cd99684044cba6fb4e1cddd4c 100644 (file)
@@ -2318,8 +2318,15 @@ void ntreeBeginExecTree(bNodeTree *ntree)
 
                        for(sock= node->inputs.first; sock; sock= sock->next) {
                                ns = get_socket_stack(ntree->stack, sock, NULL);
-                               if (ns)
+                               if (ns) {
                                        ns->hasoutput = 1;
+                                       
+                                       /* sock type is needed to detect rgba or value or vector types */
+                                       if(sock->link)
+                                               ns->sockettype= sock->link->fromsock->type;
+                                       else
+                                               sock->ns.sockettype= sock->type;
+                               }
                                
                                if(sock->link) {
                                        bNodeLink *link= sock->link;
index e8d2771e257b509ffef927cdda3f91b2fa8c8328..acc806555ce5300ac09ad549ac71332c5e0e227a 100644 (file)
@@ -4042,6 +4042,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
        uiStyle *style= U.uistyles.first;
        IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
        
+       /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
        km = WM_keymap_guess_opname(C, but->optype->idname);            
        kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
 
index 95a5220d5620d1f22575add3ceae7ab73586ebaa..67a0773199fe180bf82cd6d5c92b32678e0a0142 100644 (file)
@@ -1055,6 +1055,14 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
 
        /* unassign the pointers, reset vars */
        preview_prepare_scene(sp->scene, NULL, GS(id->name), sp);
+       
+       /* XXX bad exception, end-exec is not being called in render, because it uses local main */
+       if(idtype == ID_TE) {
+               Tex *tex= (Tex *)id;
+               if(tex->use_nodes && tex->nodetree)
+                       ntreeEndExecTree(tex->nodetree);
+       }
+
 }
 
 /* runs inside thread for material and icons */