[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31938] trunk/blender/source/blender: - rna properties for bones, select_head, select_tail
Campbell Barton
ideasman42 at gmail.com
Wed Sep 15 10:03:33 CEST 2010
Revision: 31938
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31938
Author: campbellbarton
Date: 2010-09-15 10:03:33 +0200 (Wed, 15 Sep 2010)
Log Message:
-----------
- rna properties for bones, select_head, select_tail
- fix for minor inconsistency in armature selection, entering editmode and selecting a bone would move the manipulator because the selected bones, childs root wasnt selected on entering editmode.
- use copy_v3_v3 rather then VECCOPY in editarmature.c
Modified Paths:
--------------
trunk/blender/source/blender/editors/armature/editarmature.c
trunk/blender/source/blender/makesrna/intern/rna_armature.c
Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c 2010-09-15 08:00:19 UTC (rev 31937)
+++ trunk/blender/source/blender/editors/armature/editarmature.c 2010-09-15 08:03:33 UTC (rev 31938)
@@ -185,12 +185,17 @@
else
eBone->flag |= BONE_ROOTSEL;
}
- else
- eBone->flag &= ~BONE_ROOTSEL;
+ else {
+ /* selecting with the mouse gives this behavior */
+ if(eBone->parent && (eBone->flag & BONE_CONNECTED) && (eBone->parent->flag & BONE_SELECTED))
+ eBone->flag |= BONE_ROOTSEL;
+ else
+ eBone->flag &= ~BONE_ROOTSEL;
+ }
+
+ copy_v3_v3(eBone->head, curBone->arm_head);
+ copy_v3_v3(eBone->tail, curBone->arm_tail);
- VECCOPY(eBone->head, curBone->arm_head);
- VECCOPY(eBone->tail, curBone->arm_tail);
-
eBone->roll= 0.0f;
/* roll fixing */
@@ -570,8 +575,8 @@
curbone= editbone_name_exists(arm->edbo, pchan->name);
/* simply copy the head/tail values from pchan over to curbone */
- VECCOPY(curbone->head, pchan->pose_head);
- VECCOPY(curbone->tail, pchan->pose_tail);
+ copy_v3_v3(curbone->head, pchan->pose_head);
+ copy_v3_v3(curbone->tail, pchan->pose_tail);
/* fix roll:
* 1. find auto-calculated roll value for this bone now
@@ -2056,7 +2061,7 @@
sub_v3_v3v3(nor, bone->tail, bone->head);
vec_roll_to_mat3(nor, 0, mat);
- VECCOPY(up_axis, mat[2]);
+ copy_v3_v3(up_axis, mat[2]);
roll = angle_normalized_v3v3(new_up_axis, up_axis);
@@ -2083,12 +2088,12 @@
vec_roll_to_mat3(delta, 0.0f, curmat);
/* Make new matrix based on y axis & z-up */
- VECCOPY(yaxis, curmat[1]);
+ copy_v3_v3(yaxis, curmat[1]);
unit_m3(targetmat);
- VECCOPY(targetmat[0], xaxis);
- VECCOPY(targetmat[1], yaxis);
- VECCOPY(targetmat[2], zaxis);
+ copy_v3_v3(targetmat[0], xaxis);
+ copy_v3_v3(targetmat[1], yaxis);
+ copy_v3_v3(targetmat[2], zaxis);
normalize_m3(targetmat);
/* Find the difference between the two matrices */
@@ -2111,7 +2116,7 @@
sub_v3_v3v3(delta, ebone->tail, ebone->head);
vec_roll_to_mat3(delta, ebone->roll, curmat);
copy_m4_m3(mat, curmat);
- VECCOPY(mat[3], ebone->head);
+ copy_v3_v3(mat[3], ebone->head);
/* multiply bone-matrix by object matrix (so that bone-matrix is in WorldSpace) */
invert_m4_m4(imat, mat);
@@ -2416,19 +2421,19 @@
arm->act_edbone= newbone;
if (to_root) {
- VECCOPY(newbone->head, ebone->head);
+ copy_v3_v3(newbone->head, ebone->head);
newbone->rad_head= ebone->rad_tail;
newbone->parent= ebone->parent;
}
else {
- VECCOPY(newbone->head, ebone->tail);
+ copy_v3_v3(newbone->head, ebone->tail);
newbone->rad_head= ebone->rad_tail;
newbone->parent= ebone;
newbone->flag |= BONE_CONNECTED;
}
curs= give_cursor(scene, v3d);
- VECCOPY(newbone->tail, curs);
+ copy_v3_v3(newbone->tail, curs);
sub_v3_v3v3(newbone->tail, newbone->tail, obedit->obmat[3]);
if (a==1)
@@ -2472,7 +2477,7 @@
fp= give_cursor(scene, v3d);
- VECCOPY(oldcurs, fp);
+ copy_v3_v3(oldcurs, fp);
mx= event->x - ar->winrct.xmin;
my= event->y - ar->winrct.ymin;
@@ -2502,7 +2507,7 @@
retv= armature_click_extrude_exec(C, op);
/* restore previous 3d cursor position */
- VECCOPY(fp, oldcurs);
+ copy_v3_v3(fp, oldcurs);
return retv;
}
@@ -2531,8 +2536,8 @@
ebo= ED_armature_edit_bone_add(obedit->data, "Bone");
- VECCOPY(ebo->head, head);
- VECCOPY(ebo->tail, tail);
+ copy_v3_v3(ebo->head, head);
+ copy_v3_v3(ebo->tail, tail);
return ebo;
}
@@ -2859,10 +2864,10 @@
short found= 0;
if (eb_tail) {
- VECCOPY(vec, ebo->tail);
+ copy_v3_v3(vec, ebo->tail);
}
else {
- VECCOPY(vec, ebo->head);
+ copy_v3_v3(vec, ebo->head);
}
for (ebp= points->first; ebp; ebp= ebp->next) {
@@ -2891,11 +2896,11 @@
ebp= MEM_callocN(sizeof(EditBonePoint), "EditBonePoint");
if (eb_tail) {
- VECCOPY(ebp->vec, ebo->tail);
+ copy_v3_v3(ebp->vec, ebo->tail);
ebp->tail_owner= ebo;
}
else {
- VECCOPY(ebp->vec, ebo->head);
+ copy_v3_v3(ebp->vec, ebo->head);
ebp->head_owner= ebo;
}
@@ -5694,7 +5699,7 @@
/* Also move connected children, in case children's name aren't mirrored properly */
for (children=arm->edbo->first; children; children=children->next) {
if (children->parent == eboflip && children->flag & BONE_CONNECTED) {
- VECCOPY(children->head, eboflip->tail);
+ copy_v3_v3(children->head, eboflip->tail);
children->rad_head = ebo->rad_tail;
}
}
@@ -5709,7 +5714,7 @@
if (eboflip->parent && eboflip->flag & BONE_CONNECTED)
{
EditBone *parent = eboflip->parent;
- VECCOPY(parent->tail, eboflip->head);
+ copy_v3_v3(parent->tail, eboflip->head);
parent->rad_tail = ebo->rad_head;
}
}
@@ -5750,7 +5755,7 @@
parent = ED_armature_edit_bone_add(arm, "Bone");
parent->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- VECCOPY(parent->head, head->p);
+ copy_v3_v3(parent->head, head->p);
root = parent;
@@ -5775,17 +5780,17 @@
if (len1 > 0.0f && len2 > 0.0f && dot_v3v3(vec1, vec2) < angleLimit)
{
- VECCOPY(parent->tail, previous);
+ copy_v3_v3(parent->tail, previous);
child = ED_armature_edit_bone_add(arm, "Bone");
- VECCOPY(child->head, parent->tail);
+ copy_v3_v3(child->head, parent->tail);
child->parent = parent;
child->flag |= BONE_CONNECTED|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
parent = child; /* new child is next parent */
}
}
- VECCOPY(parent->tail, tail->p);
+ copy_v3_v3(parent->tail, tail->p);
/* If the bone wasn't subdivided, delete it and return NULL
* to let subsequent subdivision methods do their thing.
@@ -5904,7 +5909,7 @@
obedit= scene->basact->object;
/* Copy orientation from source */
- VECCOPY(dst->loc, src->obmat[3]);
+ copy_v3_v3(dst->loc, src->obmat[3]);
mat4_to_eul( dst->rot,src->obmat);
mat4_to_size( dst->size,src->obmat);
@@ -5986,8 +5991,8 @@
bone = ED_armature_edit_bone_add(obedit->data, "Bone");
bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
- VECCOPY(bone->head, head->p);
- VECCOPY(bone->tail, tail->p);
+ copy_v3_v3(bone->head, head->p);
+ copy_v3_v3(bone->tail, tail->p);
/* set first and last bone, since there's only one */
lastBone = bone;
Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c 2010-09-15 08:00:19 UTC (rev 31937)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c 2010-09-15 08:03:33 UTC (rev 31938)
@@ -538,6 +538,16 @@
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
RNA_def_property_ui_text(prop, "Select", "");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop= RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
+ RNA_def_property_ui_text(prop, "Select Head", "");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop= RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
+ RNA_def_property_ui_text(prop, "Select Tail", "");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
/* XXX better matrix descriptions possible (Arystan) */
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
More information about the Bf-blender-cvs
mailing list