Page MenuHome

my-patch_IKsysb.diff

my-patch_IKsysb.diff

Index: source/blender/python/api2_2x/Bone.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Bone.c,v
retrieving revision 1.27
diff -u -r1.27 Bone.c
--- source/blender/python/api2_2x/Bone.c 22 May 2005 17:40:00 -0000 1.27
+++ source/blender/python/api2_2x/Bone.c 15 Jun 2005 02:24:56 -0000
@@ -1,4 +1,4 @@
-/*
+/*
* $Id: Bone.c,v 1.27 2005/05/22 17:40:00 stiv Exp $
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
@@ -46,6 +46,7 @@
#include <BSE_editaction.h>
#include <BKE_constraint.h>
#include <MEM_guardedalloc.h>
+#include <mydevice.h>
#include "constant.h"
#include "gen_utils.h"
#include "NLA.h"
@@ -87,6 +88,7 @@
static PyObject *Bone_clearChildren( BPy_Bone * self );
static PyObject *Bone_hide( BPy_Bone * self );
static PyObject *Bone_unhide( BPy_Bone * self );
+static PyObject *Bone_setIK( BPy_Bone * self, PyObject * args ); // Quick hack to set the bone ik via declaration.
static PyObject *Bone_setName( BPy_Bone * self, PyObject * args );
static PyObject *Bone_setRoll( BPy_Bone * self, PyObject * args );
static PyObject *Bone_setHead( BPy_Bone * self, PyObject * args );
@@ -140,6 +142,8 @@
"() - remove the children associated with this bone"},
{"setName", ( PyCFunction ) Bone_setName, METH_VARARGS,
"(str) - rename Bone"},
+ {"setIK", ( PyCFunction ) Bone_setIK, METH_VARARGS,
+ "() - set the Bone IKToParent flag."},
{"setRoll", ( PyCFunction ) Bone_setRoll, METH_VARARGS,
"(float) - set Bone roll"},
{"setHead", ( PyCFunction ) Bone_setHead, METH_VARARGS,
@@ -174,7 +178,7 @@
//--------------- Python TypeBone structure definition-------------
PyTypeObject Bone_Type = {
- PyObject_HEAD_INIT( NULL )
+ PyObject_HEAD_INIT( NULL )
0, /* ob_size */
"Blender Bone", /* tp_name */
sizeof( BPy_Bone ), /* tp_basicsize */
@@ -1666,6 +1670,33 @@
"couldn't get Bone.Boneclass attribute" ) );
}
+
+//--------------- BPy_Bone.setIK()-------------------------------
+static PyObject *Bone_setIK( BPy_Bone * self, PyObject * args )
+{
+ // here is all the code to make the ik setting system... i hope.
+ int toggle;
+ char *parent_str = "";
+
+ if( !self->bone ) { //test to see if linked to armature
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "link bone to armature before attempting to set IK." ); }
+ else {
+
+ if( BLI_streq( self->parent, parent_str ) ) {
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "set bone to have a parent before attempting to set IK." );
+ }
+ // the positioning of the head for the bone bein changed is off... somewhere around here it need to be fixed.
+ if( toggle ){
+ //VECCOPY (self->bone->head,self->bone->parent->tail); // update head position of bone.
+ self->bone->flag |= BONE_IK_TOPARENT;}
+ else
+ self->bone->flag &= ~BONE_IK_TOPARENT;
+ }
+ return EXPP_incr_ret( Py_None ); // call update.
+ }
+
//--------------- BPy_Bone.getRestMatrix()-------------------------
static PyObject *Bone_getRestMatrix( BPy_Bone * self, PyObject * args )
{
@@ -1721,3 +1752,4 @@
return matrix;
}
+
Index: source/blender/src/editarmature.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editarmature.c,v
retrieving revision 1.50
diff -u -r1.50 editarmature.c
--- source/blender/src/editarmature.c 10 May 2005 04:21:11 -0000 1.50
+++ source/blender/src/editarmature.c 15 Jun 2005 02:10:34 -0000
@@ -1747,7 +1747,7 @@
void attach_bone_to_parent_cb(void *bonev, void *arg2_unused)
{
EditBone *curBone= bonev;
- attach_bone_to_parent(curBone);
+ attach_bone_to_parent(curBone); // this is the line that does the bones pannel on the armature settings.
}
void attach_bone_to_parent(EditBone *bone)
@@ -1756,22 +1756,24 @@
if (bone->flag & BONE_IK_TOPARENT) {
- /* See if there are any other bones that refer to the same
- * parent and disconnect them
+ /* See if there are any other bones that refer to the same
+ * parent and disconnect them
*/
- for (curbone = G.edbo.first; curbone; curbone=curbone->next){
+ // this next if statement is useless, when what you want
+ // is to allow for the multiple attachment to a single parent.
+ /*for (curbone = G.edbo.first; curbone; curbone=curbone->next){
if (curbone!=bone){
- if (curbone->parent &&
- (curbone->parent == bone->parent) &&
+ if (curbone->parent &&
+ (curbone->parent == bone->parent) &&
(curbone->flag & BONE_IK_TOPARENT))
curbone->flag &= ~BONE_IK_TOPARENT;
}
}
-
+ */
/* Attach this bone to its parent */
VECCOPY(bone->head, bone->parent->tail);
+ }
}
-}
void deselectall_armature(void)
/* Actually, it toggles selection, deselecting
@@ -1948,61 +1950,57 @@
void extrude_armature(void)
{
EditBone *newbone, *curbone, *first=NULL, *partest;
-
+ short nr;
+
TEST_EDITARMATURE;
-
-
+
+
if(okee("Extrude bone segments")==0) return;
-
+
/* Duplicate the necessary bones */
for (curbone = G.edbo.first; ((curbone) && (curbone!=first)); curbone=curbone->next){
if (curbone->flag & (BONE_TIPSEL|BONE_SELECTED)){
- newbone = MEM_callocN(sizeof(EditBone), "extrudebone");
-
-
- VECCOPY (newbone->head, curbone->tail);
- VECCOPY (newbone->tail, newbone->head);
- newbone->parent = curbone;
- newbone->flag = BONE_TIPSEL;
- newbone->flag |= BONE_QUATROT;
- newbone->weight= curbone->weight;
- newbone->dist= curbone->dist;
- newbone->boneclass= curbone->boneclass;
-
- Mat4One(newbone->obmat);
-
- /* See if there are any ik children of the parent */
- for (partest = G.edbo.first; partest; partest=partest->next){
- if ((partest->parent == curbone) && (partest->flag & BONE_IK_TOPARENT))
- break;
+ nr = pupmenu("Extrude %t||Link to Parent %x1||Unliked to Parent %x2");
+ if (nr == (1 || 2))
+ {
+ newbone = MEM_callocN(sizeof(EditBone), "extrudebone");
+
+ VECCOPY (newbone->head, curbone->tail);
+ VECCOPY (newbone->tail, newbone->head);
+ newbone->parent = curbone;
+ newbone->flag = BONE_TIPSEL;
+ newbone->flag |= BONE_QUATROT;
+ newbone->weight= curbone->weight;
+ newbone->dist= curbone->dist;
+ newbone->boneclass= curbone->boneclass;
+
+ Mat4One(newbone->obmat);
+
+
+ if (nr == 1)
+ newbone->flag |= BONE_IK_TOPARENT;
+
+ strcpy (newbone->name, curbone->name);
+ unique_editbone_name(newbone->name);
+
+ /* Add the new bone to the list */
+ BLI_addtail(&G.edbo, newbone);
+ if (!first)
+ first = newbone;
+ /* Deselect the old bone */
+ curbone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
+ /* Transform the endpoints */
+ countall();
+ BIF_TransformSetUndo("Extrude");
+ initTransform(TFM_TRANSLATION, CTX_NO_PET);
+ Transform();
+ allqueue(REDRAWBUTSEDIT, 0);
+ allqueue(REDRAWBUTSOBJECT, 0);
+ allqueue(REDRAWOOPS, 0);
}
-
- if (!partest)
- newbone->flag |= BONE_IK_TOPARENT;
-
- strcpy (newbone->name, curbone->name);
- unique_editbone_name(newbone->name);
-
- /* Add the new bone to the list */
- BLI_addtail(&G.edbo, newbone);
- if (!first)
- first = newbone;
}
-
- /* Deselect the old bone */
- curbone->flag &= ~(BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
-
}
-
- /* Transform the endpoints */
- countall();
- BIF_TransformSetUndo("Extrude");
- initTransform(TFM_TRANSLATION, CTX_NO_PET);
- Transform();
- allqueue(REDRAWBUTSEDIT, 0);
- allqueue(REDRAWBUTSOBJECT, 0);
- allqueue(REDRAWOOPS, 0);
-}
+ }
void addvert_armature(void)
{
@@ -2521,7 +2519,7 @@
* bDeformGroup pointer -- the
* bDeformGroup pointer is set to point
* to the deform group with the bone's
- * name, and the pointer the handle
+ * name, and the pointer the handle
* points to is incremented to point to the
* next member of an array of pointers
* to bDeformGroups. This way we can loop using

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6b/33/4cceeaed42fc404714595dd3b65f

Event Timeline