diff options
author | Jiri Hnidek <jiri.hnidek@tul.cz> | 2006-10-30 17:59:30 +0300 |
---|---|---|
committer | Jiri Hnidek <jiri.hnidek@tul.cz> | 2006-10-30 17:59:30 +0300 |
commit | e944ed2f4a5c7a0452a7e9d431bd40ad5cbc7d9a (patch) | |
tree | 6446e3e63715c271e1f1fd93936f3473eccc8e87 /source/blender/src | |
parent | b17ce5e24a8fd099be72b753fbd98aa4448abfd0 (diff) |
- bug fix #5141, blender doesn't crash, when you try to unsubscribe twice
from verse node in outliner
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/outliner.c | 28 | ||||
-rw-r--r-- | source/blender/src/verse_object.c | 68 |
2 files changed, 55 insertions, 41 deletions
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 237c4144221..45e84c6b735 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -1656,15 +1656,25 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even } else if(te->idcode==ID_VN) { struct VNode *vnode = (VNode*)te->directdata; - event = pupmenu("VerseNode %t| Subscribe %x1| Unsubscribe %x2"); - switch(event) { - case 1: - b_verse_pop_node(vnode); - break; - case 2: - /* Global */ - b_verse_unsubscribe(vnode); - break; + if (vnode->type==V_NT_OBJECT || vnode->type==V_NT_BITMAP) { + char subscribed = 0; + if((vnode->type==V_NT_OBJECT) && (((VObjectData*)vnode->data)->object!=NULL)) + subscribed = 1; + if((vnode->type==V_NT_BITMAP) && (((VBitmapData*)vnode->data)->image!=NULL)) + subscribed = 1; + if(subscribed==1) + event = pupmenu("VerseNode %t| Unsubscribe %x2"); + else + event = pupmenu("VerseNode %t| Subscribe %x1"); + switch(event) { + case 1: + b_verse_pop_node(vnode); + break; + case 2: + /* Global */ + b_verse_unsubscribe(vnode); + break; + } } } else if(te->idcode==ID_MS) { diff --git a/source/blender/src/verse_object.c b/source/blender/src/verse_object.c index 623668b86cd..1b7e2a5157e 100644 --- a/source/blender/src/verse_object.c +++ b/source/blender/src/verse_object.c @@ -381,44 +381,48 @@ void b_verse_unsubscribe(VNode *vnode) struct VLink *vlink = ((VObjectData*)vnode->data)->links.lb.first; struct Object *ob = (Object*)((VObjectData*)vnode->data)->object; - if(vnode->type != V_NT_OBJECT) return; - - if(G.obedit && G.obedit->vnode == (void*)vnode) - exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); - - /* create mesh data */ - while(vlink){ - if(vlink->target->type == V_NT_GEOMETRY) { - struct Mesh *me; - me = ((VGeomData*)vlink->target->data)->mesh; - create_meshdata_from_geom_node(me, vlink->target); - break; + if(vnode->type==V_NT_OBJECT) { + /* exit edit mode */ + if(G.obedit && G.obedit->vnode == (void*)vnode) + exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + + /* when some geometry node is child of this object node, then create mesh data */ + while(vlink){ + if(vlink->target->type == V_NT_GEOMETRY) { + struct Mesh *me; + me = ((VGeomData*)vlink->target->data)->mesh; + create_meshdata_from_geom_node(me, vlink->target); + break; + } + vlink = vlink->next; } - vlink = vlink->next; - } - /* unsubscribe from object transformation and clear bindings between - * verse object node and object */ - unsubscribe_from_obj_node(vnode); - - /* when geometry node was shared with more object nodes, then make - * data single user */ - if(ob->type == OB_MESH) { - struct ID *id = ob->data; - if(id && id->us>1 && id->lib==0) { - ob->recalc= OB_RECALC_DATA; - ob->data = copy_mesh(ob->data); - id->us--; - id->newid= ob->data; + /* unsubscribe from object transformation and clear bindings between + * verse object node and object */ + unsubscribe_from_obj_node(vnode); + + /* when geometry node was shared with more object nodes, then make + * data single user */ + if(ob->type == OB_MESH) { + struct ID *id = ob->data; + if(id && id->us>1 && id->lib==0) { + ob->recalc= OB_RECALC_DATA; + ob->data = copy_mesh(ob->data); + id->us--; + id->newid= ob->data; + } } + + /* reinitialize object derived mesh */ + makeDispListMesh(ob); + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); + } + else if(vnode->type==V_NT_BITMAP) { + /* fake ... it isn't impelemented yet ... poke jiri, when needed */ + unsubscribe_from_bitmap_node(vnode); } - - /* reinitialize object derived mesh */ - makeDispListMesh(ob); - DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); allqueue(REDRAWVIEW3D, 1); - } /* |