[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18421] branches/blender2.5/blender/source /blender/editors: 2.5
Martin Poirier
theeth at yahoo.com
Thu Jan 8 18:12:55 CET 2009
Revision: 18421
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18421
Author: theeth
Date: 2009-01-08 18:12:50 +0100 (Thu, 08 Jan 2009)
Log Message:
-----------
2.5
Transform editbones
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
Modified: branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/editarmature.c 2009-01-08 16:52:30 UTC (rev 18420)
+++ branches/blender2.5/blender/source/blender/editors/armature/editarmature.c 2009-01-08 17:12:50 UTC (rev 18421)
@@ -1830,7 +1830,7 @@
/* adjust bone roll to align Z axis with vector
* vec is in local space and is normalized
*/
-float rollBoneToVector(EditBone *bone, float new_up_axis[3])
+float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3])
{
float mat[3][3], nor[3], up_axis[3], vec[3];
float roll;
Modified: branches/blender2.5/blender/source/blender/editors/include/ED_armature.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_armature.h 2009-01-08 16:52:30 UTC (rev 18420)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_armature.h 2009-01-08 17:12:50 UTC (rev 18421)
@@ -92,7 +92,10 @@
short hits, short extend);
void mouse_armature(struct bContext *C, short mval[2], int extend);
+float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3]);
+void transform_armature_mirror_update(struct Object *obedit);
+
/* poseobject.c */
void ED_armature_exit_posemode(struct Base *base);
void ED_armature_enter_posemode(struct Base *base);
Modified: branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c 2009-01-08 16:52:30 UTC (rev 18420)
+++ branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c 2009-01-08 17:12:50 UTC (rev 18421)
@@ -1021,25 +1021,29 @@
static void createTransArmatureVerts(bContext *C, TransInfo *t)
{
- // TRANSFORM_FIX_ME
-#if 0
EditBone *ebo;
bArmature *arm= t->obedit->data;
+ ListBase *edbo = arm->edbo;
TransData *td;
float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3];
t->total = 0;
- for (ebo=G.edbo.first;ebo;ebo=ebo->next) {
- if(ebo->layer & arm->layer) {
- if (t->mode==TFM_BONESIZE) {
+ for (ebo = edbo->first; ebo; ebo = ebo->next)
+ {
+ if(ebo->layer & arm->layer)
+ {
+ if (t->mode==TFM_BONESIZE)
+ {
if (ebo->flag & BONE_SELECTED)
t->total++;
}
- else if (t->mode==TFM_BONE_ROLL) {
+ else if (t->mode==TFM_BONE_ROLL)
+ {
if (ebo->flag & BONE_SELECTED)
t->total++;
}
- else {
+ else
+ {
if (ebo->flag & BONE_TIPSEL)
t->total++;
if (ebo->flag & BONE_ROOTSEL)
@@ -1055,13 +1059,15 @@
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone");
- for (ebo=G.edbo.first;ebo;ebo=ebo->next){
- ebo->oldlength= ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
+ for (ebo = edbo->first; ebo; ebo = ebo->next)
+ {
+ ebo->oldlength = ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
if(ebo->layer & arm->layer) {
- if (t->mode==TFM_BONE_ENVELOPE) {
-
- if (ebo->flag & BONE_ROOTSEL){
+ if (t->mode==TFM_BONE_ENVELOPE)
+ {
+ if (ebo->flag & BONE_ROOTSEL)
+ {
td->val= &ebo->rad_head;
td->ival= *td->val;
@@ -1077,7 +1083,8 @@
td++;
}
- if (ebo->flag & BONE_TIPSEL){
+ if (ebo->flag & BONE_TIPSEL)
+ {
td->val= &ebo->rad_tail;
td->ival= *td->val;
VECCOPY (td->center, ebo->tail);
@@ -1094,14 +1101,17 @@
}
}
- else if (t->mode==TFM_BONESIZE) {
+ else if (t->mode==TFM_BONESIZE)
+ {
if (ebo->flag & BONE_SELECTED) {
- if(arm->drawtype==ARM_ENVELOPE) {
+ if(arm->drawtype==ARM_ENVELOPE)
+ {
td->loc= NULL;
td->val= &ebo->dist;
td->ival= ebo->dist;
}
- else {
+ else
+ {
// abusive storage of scale in the loc pointer :)
td->loc= &ebo->xwidth;
VECCOPY (td->iloc, td->loc);
@@ -1125,8 +1135,10 @@
td++;
}
}
- else if (t->mode==TFM_BONE_ROLL) {
- if (ebo->flag & BONE_SELECTED) {
+ else if (t->mode==TFM_BONE_ROLL)
+ {
+ if (ebo->flag & BONE_SELECTED)
+ {
td->loc= NULL;
td->val= &(ebo->roll);
td->ival= ebo->roll;
@@ -1140,8 +1152,10 @@
td++;
}
}
- else {
- if (ebo->flag & BONE_TIPSEL){
+ else
+ {
+ if (ebo->flag & BONE_TIPSEL)
+ {
VECCOPY (td->iloc, ebo->tail);
VECCOPY (td->center, td->iloc);
td->loc= ebo->tail;
@@ -1166,7 +1180,8 @@
td++;
}
- if (ebo->flag & BONE_ROOTSEL){
+ if (ebo->flag & BONE_ROOTSEL)
+ {
VECCOPY (td->iloc, ebo->head);
VECCOPY (td->center, td->iloc);
td->loc= ebo->head;
@@ -1191,7 +1206,6 @@
}
}
}
-#endif
}
/* ********************* meta elements ********* */
Modified: branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c 2009-01-08 16:52:30 UTC (rev 18420)
+++ branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c 2009-01-08 17:12:50 UTC (rev 18421)
@@ -421,30 +421,7 @@
}
}
else if (t->obedit) {
- if (t->obedit->type == OB_MESH) {
- if(t->spacetype==SPACE_IMAGE) {
- flushTransUVs(t);
- if (G.sima->flag & SI_LIVE_UNWRAP)
- unwrap_lscm_live_re_solve();
- } else {
- EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh
- /* mirror modifier clipping? */
- if(t->state != TRANS_CANCEL) {
- if ((G.qual & LR_CTRLKEY)==0) {
- /* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
- retopo_do_all();
- }
- clipMirrorModifier(t, t->obedit);
- }
- if((t->options & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
- editmesh_apply_to_mirror(t);
-
- DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
-
- recalc_editnormals(em);
- }
- }
- else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
+ if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Nurb *nu= editNurb.first;
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
@@ -463,14 +440,68 @@
retopo_do_all();
}
}
- else if(t->obedit->type==OB_ARMATURE){ /* no recalc flag, does pose */
+ else if(t->obedit->type==OB_LATTICE) {
+ DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
+
+ if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
+ }
+ else {
+ DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
+ }
+ }
+ else if( (t->flag & T_POSE) && t->poseobj) {
+ Object *ob= t->poseobj;
+ bArmature *arm= ob->data;
+
+ /* old optimize trick... this enforces to bypass the depgraph */
+ if (!(arm->flag & ARM_DELAYDEFORM)) {
+ DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); /* sets recalc flags */
+ }
+ else
+ where_is_pose(ob);
+ }
+ else if(G.f & G_PARTICLEEDIT) {
+ flushTransParticles(t);
+ }
+#endif
+ if (t->spacetype==SPACE_NODE) {
+ flushTransNodes(t);
+ }
+ else if (t->obedit) {
+ if (t->obedit->type == OB_MESH) {
+ if(t->spacetype==SPACE_IMAGE) {
+ flushTransUVs(t);
+ /* TRANSFORM_FIX_ME */
+// if (G.sima->flag & SI_LIVE_UNWRAP)
+// unwrap_lscm_live_re_solve();
+ } else {
+ EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
+ /* mirror modifier clipping? */
+ if(t->state != TRANS_CANCEL) {
+ /* TRANSFORM_FIX_ME */
+// if ((G.qual & LR_CTRLKEY)==0) {
+// /* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
+// retopo_do_all();
+// }
+ clipMirrorModifier(t, t->obedit);
+ }
+ if((t->options & CTX_NO_MIRROR) == 0 && (t->scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
+ editmesh_apply_to_mirror(t);
+
+ DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
+
+ recalc_editnormals(em);
+ }
+ }
+ else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
bArmature *arm= t->obedit->data;
+ ListBase *edbo = arm->edbo;
EditBone *ebo;
TransData *td = t->data;
int i;
/* Ensure all bones are correctly adjusted */
- for (ebo=G.edbo.first; ebo; ebo=ebo->next){
+ for (ebo = edbo->first; ebo; ebo = ebo->next){
if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
/* If this bone has a parent tip that has been moved */
@@ -531,69 +562,16 @@
Mat3MulVecfl(t->mat, up_axis);
}
- ebo->roll = rollBoneToVector(ebo, up_axis);
+ ebo->roll = ED_rollBoneToVector(ebo, up_axis);
}
}
}
if(arm->flag & ARM_MIRROR_EDIT)
- transform_armature_mirror_update();
+ transform_armature_mirror_update(t->obedit);
}
- else if(t->obedit->type==OB_LATTICE) {
- DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
-
- if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
- }
- else {
- DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
- }
}
- else if( (t->flag & T_POSE) && t->poseobj) {
- Object *ob= t->poseobj;
- bArmature *arm= ob->data;
-
- /* old optimize trick... this enforces to bypass the depgraph */
- if (!(arm->flag & ARM_DELAYDEFORM)) {
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); /* sets recalc flags */
- }
- else
- where_is_pose(ob);
- }
- else if(G.f & G_PARTICLEEDIT) {
- flushTransParticles(t);
- }
-#endif
- if (t->spacetype==SPACE_NODE) {
- flushTransNodes(t);
- }
- else if (t->obedit) {
- if (t->obedit->type == OB_MESH) {
- if(t->spacetype==SPACE_IMAGE) {
- flushTransUVs(t);
- /* TRANSFORM_FIX_ME */
-// if (G.sima->flag & SI_LIVE_UNWRAP)
-// unwrap_lscm_live_re_solve();
- } else {
- EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
- /* mirror modifier clipping? */
- if(t->state != TRANS_CANCEL) {
- /* TRANSFORM_FIX_ME */
-// if ((G.qual & LR_CTRLKEY)==0) {
-// /* Only retopo if not snapping, Note, this is the only case of G.qual being used, but we have no T_SHIFT_MOD - Campbell */
-// retopo_do_all();
-// }
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list