* 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
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Modifier.c 12840 2007-12-11 01:58:22Z khughes $
|
* $Id$
|
||||||
*
|
*
|
||||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
*
|
*
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "BLI_blenlib.h"
|
#include "BLI_blenlib.h"
|
||||||
#include "BLI_arithb.h"
|
#include "BLI_arithb.h"
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
#include "BDR_editobject.h"
|
||||||
#include "butspace.h"
|
#include "butspace.h"
|
||||||
#include "blendef.h"
|
#include "blendef.h"
|
||||||
#include "mydevice.h"
|
#include "mydevice.h"
|
||||||
@@ -1352,6 +1353,18 @@ static PyObject *ModSeq_moveDown( BPy_ModSeq * self, BPy_Modifier *value )
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* quick hack for ZanQdo: add new hook modifier for selected verts */
|
||||||
|
static PyObject *ModSeq_ZanQdoHack(BPy_ModSeq *self)
|
||||||
|
{
|
||||||
|
/* this should add the hook (assumes that modifier stack is on same ob!) */
|
||||||
|
if ((self) && (G.obedit) && (self->object==G.obedit)) {
|
||||||
|
add_hook(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python BPy_ModSeq methods table: */
|
/* Python BPy_ModSeq methods table: */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -1365,6 +1378,8 @@ static PyMethodDef BPy_ModSeq_methods[] = {
|
|||||||
"(modifier) - Move a modifier up in stack"},
|
"(modifier) - Move a modifier up in stack"},
|
||||||
{"moveDown", ( PyCFunction ) ModSeq_moveDown, METH_O,
|
{"moveDown", ( PyCFunction ) ModSeq_moveDown, METH_O,
|
||||||
"(modifier) - Move a modifier down in stack"},
|
"(modifier) - Move a modifier down in stack"},
|
||||||
|
{"ZanQdoHack", (PyCFunction)ModSeq_ZanQdoHack, METH_NOARGS,
|
||||||
|
"while in editmode, adds a hook for the selected verts (adds new modifier, and deselects object)"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ struct View3D;
|
|||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
#include "DNA_userdef_types.h" /* U.userdefs */
|
#include "DNA_userdef_types.h" /* U.userdefs */
|
||||||
#include "DNA_object_types.h" /* SceneObSeq_new */
|
#include "DNA_object_types.h" /* SceneObSeq_new */
|
||||||
|
#include "BKE_armature.h"
|
||||||
#include "BKE_depsgraph.h"
|
#include "BKE_depsgraph.h"
|
||||||
#include "BKE_library.h"
|
#include "BKE_library.h"
|
||||||
#include "BKE_object.h"
|
#include "BKE_object.h"
|
||||||
|
|||||||
@@ -634,17 +634,33 @@ int hook_getIndexArray(int *tot, int **indexar, char *name, float *cent_r)
|
|||||||
|
|
||||||
void add_hook_menu(void)
|
void add_hook_menu(void)
|
||||||
{
|
{
|
||||||
ModifierData *md = NULL;
|
|
||||||
HookModifierData *hmd = NULL;
|
|
||||||
Object *ob=NULL;
|
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
|
if(G.obedit==NULL) return;
|
||||||
|
|
||||||
if(modifiers_findByType(G.obedit, eModifierType_Hook))
|
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");
|
mode= pupmenu("Hooks %t|Add, To New Empty %x1|Add, To Selected Object %x2|Remove... %x3|Reassign... %x4|Select... %x5|Clear Offset...%x6");
|
||||||
else
|
else
|
||||||
mode= pupmenu("Hooks %t|Add, New Empty %x1|Add, To Selected Object %x2");
|
mode= pupmenu("Hooks %t|Add, New Empty %x1|Add, To Selected Object %x2");
|
||||||
|
|
||||||
if(mode<1) return;
|
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 */
|
/* preconditions */
|
||||||
if(mode==2) { /* selected object */
|
if(mode==2) { /* selected object */
|
||||||
@@ -708,23 +724,6 @@ void add_hook_menu(void)
|
|||||||
ob= hmd->object;
|
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 */
|
/* do it, new hooks or reassign */
|
||||||
if(mode==1 || mode==2 || mode==4) {
|
if(mode==1 || mode==2 || mode==4) {
|
||||||
float cent[3];
|
float cent[3];
|
||||||
|
|||||||
Reference in New Issue
Block a user