diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-03-03 06:21:25 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-03-03 06:21:25 +0300 |
commit | 7af9e824bfc3a2ad10843e451a1cb15a266164ca (patch) | |
tree | 04e29a0d347bff269c1d3cff6be3f81e3f6d9d4a /source/blender/src/editobject.c | |
parent | 5b54b519c0719f0598532e80a3ffe671c90e04cd (diff) |
* Bugfix #8426: certain hooks options segfaulted
This was caused by my previous commit for add_hook.
* Also, removed a compiler warning in the Python code
Diffstat (limited to 'source/blender/src/editobject.c')
-rw-r--r-- | source/blender/src/editobject.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index a98020aea35..821be0b07e4 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -634,17 +634,33 @@ int hook_getIndexArray(int *tot, int **indexar, char *name, float *cent_r) void add_hook_menu(void) { - ModifierData *md = NULL; - HookModifierData *hmd = NULL; - Object *ob=NULL; int mode; + if(G.obedit==NULL) return; + if(modifiers_findByType(G.obedit, eModifierType_Hook)) mode= pupmenu("Hooks %t|Add, To New Empty %x1|Add, To Selected Object %x2|Remove... %x3|Reassign... %x4|Select... %x5|Clear Offset...%x6"); else mode= pupmenu("Hooks %t|Add, New Empty %x1|Add, To Selected Object %x2"); if(mode<1) return; + + /* do operations */ + add_hook(mode); + + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWBUTSOBJECT, 0); + + BIF_undo_push("Add hook"); +} + +void add_hook(int mode) +{ + ModifierData *md = NULL; + HookModifierData *hmd = NULL; + Object *ob=NULL; + + if(G.obedit==NULL) return; /* preconditions */ if(mode==2) { /* selected object */ @@ -708,23 +724,6 @@ void add_hook_menu(void) ob= hmd->object; } - /* do operations */ - add_hook(mode); - - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSOBJECT, 0); - - BIF_undo_push("Add hook"); -} - -void add_hook(int mode) -{ - ModifierData *md = NULL; - HookModifierData *hmd = NULL; - Object *ob=NULL; - - if(G.obedit==NULL) return; - /* do it, new hooks or reassign */ if(mode==1 || mode==2 || mode==4) { float cent[3]; |