diff options
author | Joseph Eagar <joeedh@gmail.com> | 2011-05-09 03:43:18 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2011-05-09 03:43:18 +0400 |
commit | 6ef77cf95accc3cb914e7efd964118ce6e9521cf (patch) | |
tree | 1d8dbf95355038c93f79f9053a0bf1d55b561ec3 /source/blender/editors/armature | |
parent | 3462ddf17f38eb61fc3bb2751d55de15a47455c3 (diff) | |
parent | 770119d16f7dbee99a60d19540818892c970c4e2 (diff) |
=bmesh= merge from trunk at r36529
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 110 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_retarget.c | 6 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/meshlaplacian.c | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/poseSlide.c | 29 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 2 | ||||
-rw-r--r-- | source/blender/editors/armature/reeb.c | 2 |
8 files changed, 67 insertions, 96 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 7a6141540bd..86dc2182e03 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -206,7 +206,7 @@ void POSE_OT_propagate(struct wmOperatorType *ot); /* editarmature.c */ EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone); -void BIF_sk_selectStroke(struct bContext *C, short mval[2], short extend); +void BIF_sk_selectStroke(struct bContext *C, const short mval[2], short extend); /* duplicate method */ void preEditBoneDuplicate(struct ListBase *editbones); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 41595913c51..4c639140845 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -416,7 +416,9 @@ void ED_armature_from_edit(Object *obedit) newBone->flag= eBone->flag; if (eBone == arm->act_edbone) { - newBone->flag |= BONE_SELECTED; /* important, editbones can be active with only 1 point selected */ + /* don't change active selection, this messes up separate which uses + * editmode toggle and can separate active bone which is de-selected originally */ + /* newBone->flag |= BONE_SELECTED; */ /* important, editbones can be active with only 1 point selected */ arm->act_edbone= NULL; arm->act_bone= newBone; } @@ -504,6 +506,10 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) ebone->rad_head *= scale; ebone->rad_tail *= scale; ebone->dist *= scale; + + /* we could be smarter and scale by the matrix along the x & z axis */ + ebone->xwidth *= scale; + ebone->zwidth *= scale; } /* Turn the list into an armature */ @@ -798,7 +804,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann for (ct= targets.first; ct; ct= ct->next) { if (ct->tar == srcArm) { - if (strcmp(ct->subtarget, "")==0) { + if (ct->subtarget[0] == '\0') { ct->tar = tarArm; } else if (strcmp(ct->subtarget, pchan->name)==0) { @@ -845,7 +851,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann for (ct= targets.first; ct; ct= ct->next) { if (ct->tar == srcArm) { - if (strcmp(ct->subtarget, "")==0) { + if (ct->subtarget[0] == '\0') { ct->tar = tarArm; } else if (strcmp(ct->subtarget, pchan->name)==0) { @@ -993,7 +999,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) static void separated_armature_fix_links(Object *origArm, Object *newArm) { Object *ob; - bPoseChannel *pchan, *pcha, *pchb; + bPoseChannel *pchan; bConstraint *con; ListBase *opchans, *npchans; @@ -1020,38 +1026,23 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) * - the target isn't origArm/newArm itself * - the target is one that can be found in newArm/origArm */ - if ((ct->tar == origArm) && (ct->subtarget[0] != 0)) { - for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) { - /* check if either one matches */ - if ( (strcmp(pcha->name, ct->subtarget)==0) || - (strcmp(pchb->name, ct->subtarget)==0) ) - { + if (ct->subtarget[0] != 0) { + if (ct->tar == origArm) { + if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) { ct->tar= newArm; - break; } - - /* check if both ends have met (to stop checking) */ - if (pcha == pchb) break; - } - } - else if ((ct->tar == newArm) && (ct->subtarget[0] != 0)) { - for (pcha=opchans->first, pchb=opchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) { - /* check if either one matches */ - if ( (strcmp(pcha->name, ct->subtarget)==0) || - (strcmp(pchb->name, ct->subtarget)==0) ) - { + } + else if (ct->tar == newArm) { + if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) { ct->tar= origArm; - break; } - - /* check if both ends have met (to stop checking) */ - if (pcha == pchb) break; - } + } } } - - if (cti->flush_constraint_targets) + + if (cti->flush_constraint_targets) { cti->flush_constraint_targets(con, &targets, 0); + } } } } @@ -1073,58 +1064,33 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) * - the target isn't origArm/newArm itself * - the target is one that can be found in newArm/origArm */ - if ((ct->tar == origArm) && (ct->subtarget[0] != 0)) { - for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) { - /* check if either one matches */ - if ( (strcmp(pcha->name, ct->subtarget)==0) || - (strcmp(pchb->name, ct->subtarget)==0) ) - { + if(ct->subtarget[0] != '\0') { + if (ct->tar == origArm) { + if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) { ct->tar= newArm; - break; } - - /* check if both ends have met (to stop checking) */ - if (pcha == pchb) break; - } - } - else if ((ct->tar == newArm) && (ct->subtarget[0] != 0)) { - for (pcha=opchans->first, pchb=opchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) { - /* check if either one matches */ - if ( (strcmp(pcha->name, ct->subtarget)==0) || - (strcmp(pchb->name, ct->subtarget)==0) ) - { + } + else if (ct->tar == newArm) { + if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) { ct->tar= origArm; - break; } - - /* check if both ends have met (to stop checking) */ - if (pcha == pchb) break; - } + } } } - - if (cti->flush_constraint_targets) + + if (cti->flush_constraint_targets) { cti->flush_constraint_targets(con, &targets, 0); + } } } } /* See if an object is parented to this armature */ - if ((ob->parent) && (ob->parent == origArm)) { + if (ob->parent && (ob->parent == origArm)) { /* Is object parented to a bone of this src armature? */ - if (ob->partype==PARBONE) { - /* bone name in object */ - for (pcha=npchans->first, pchb=npchans->last; pcha && pchb; pcha=pcha->next, pchb=pchb->prev) { - /* check if either one matches */ - if ( (strcmp(pcha->name, ob->parsubstr)==0) || - (strcmp(pchb->name, ob->parsubstr)==0) ) - { - ob->parent= newArm; - break; - } - - /* check if both ends have met (to stop checking) */ - if (pcha == pchb) break; + if ((ob->partype == PARBONE) && (ob->parsubstr[0] != '\0')) { + if(BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) { + ob->parent= newArm; } } } @@ -1732,7 +1698,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot) /* does bones and points */ /* note that BONE ROOT only gets drawn for root bones (or without IK) */ -static EditBone *get_nearest_editbonepoint (ViewContext *vc, short mval[2], ListBase *edbo, int findunsel, int *selmask) +static EditBone *get_nearest_editbonepoint (ViewContext *vc, const short mval[2], ListBase *edbo, int findunsel, int *selmask) { EditBone *ebone; rcti rect; @@ -1992,7 +1958,7 @@ static int ebone_select_flag(EditBone *ebone) } /* context: editmode armature in view3d */ -int mouse_armature(bContext *C, short mval[2], int extend) +int mouse_armature(bContext *C, const short mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -2758,7 +2724,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op)) /* cancel if nothing selected */ if (CTX_DATA_COUNT(C, selected_bones) == 0) - return OPERATOR_CANCELLED; + return OPERATOR_CANCELLED; ED_armature_sync_selection(arm->edbo); // XXX why is this needed? @@ -5841,7 +5807,7 @@ EditBone * test_subdivideByCorrelation(Scene *scene, Object *obedit, ReebArc *ar lastBone = subdivideArcBy(arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision); } - return lastBone; + return lastBone; } float arcLengthRatio(ReebArc *arc) diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index bd05f7f6581..b750bd5ef1c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1536,7 +1536,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm) Scene *scene = CTX_data_scene(C); EditBone *ebone; RigGraph *rg; - + rg = newRigGraph(); if (obedit == ob) @@ -1588,7 +1588,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm Scene *scene = CTX_data_scene(C); EditBone *ebone; RigGraph *rg; - + rg = newRigGraph(); if (obedit == ob) @@ -2829,7 +2829,7 @@ void BIF_retargetArmature(bContext *C) { RigGraph *rigg; bArmature *arm; - + arm = ob->data; /* Put the armature into editmode */ diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 4b83af30799..158c0d23ddc 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -2157,7 +2157,7 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch) /********************************************/ -static int sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend) +static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const short mval[2], int extend) { ViewContext vc; rcti rect; @@ -2473,7 +2473,7 @@ static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev return OPERATOR_FINISHED; } -void BIF_sk_selectStroke(bContext *C, short mval[2], short extend) +void BIF_sk_selectStroke(bContext *C, const short mval[2], short extend) { ToolSettings *ts = CTX_data_tool_settings(C); SK_Sketch *sketch = contextSketch(C, 0); diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 46f702b69b2..2c40705b3ac 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -471,7 +471,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys) static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source) { - BVHTreeRayHit hit; + BVHTreeRayHit hit; BVHCallbackUserData data; MFace *mface; float end[3]; @@ -1127,7 +1127,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], det = INPR(edge1, pvec); if (det == 0.0f) - return 0; + return 0; inv_det = 1.0f / det; /* calculate distance from vert0 to ray origin */ @@ -1136,7 +1136,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], /* calculate U parameter and test bounds */ u = INPR(tvec, pvec) * inv_det; if (u < -EPSILON || u > 1.0f+EPSILON) - return 0; + return 0; /* prepare to test V parameter */ cross_v3_v3v3(qvec, tvec, edge1); @@ -1144,7 +1144,7 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3], /* calculate V parameter and test bounds */ v = INPR(dir, qvec) * inv_det; if (v < -EPSILON || u + v > 1.0f+EPSILON) - return 0; + return 0; isectco[0]= (1.0f - u - v)*vert0[0] + u*vert1[0] + v*vert2[0]; isectco[1]= (1.0f - u - v)*vert0[1] + u*vert1[1] + v*vert2[1]; diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 203d76086b3..3d6888d87dc 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -989,11 +989,11 @@ static float pose_propagate_get_boneHoldEndFrame (Object *ob, tPChanFCurveLink * } /* get reference value from F-Curve using RNA */ -static float pose_propagate_get_refVal (Object *ob, FCurve *fcu) +static short pose_propagate_get_refVal (Object *ob, FCurve *fcu, float *value) { PointerRNA id_ptr, ptr; PropertyRNA *prop; - float value; + short found= FALSE; /* base pointer is always the object -> id_ptr */ RNA_id_pointer_create(&ob->id, &id_ptr); @@ -1002,44 +1002,48 @@ static float pose_propagate_get_refVal (Object *ob, FCurve *fcu) if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) { if (RNA_property_array_check(&ptr, prop)) { /* array */ - if (fcu->array_index < RNA_property_array_length(&ptr, prop)) { + if (fcu->array_index < RNA_property_array_length(&ptr, prop)) { + found= TRUE; switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - value= (float)RNA_property_boolean_get_index(&ptr, prop, fcu->array_index); + *value= (float)RNA_property_boolean_get_index(&ptr, prop, fcu->array_index); break; case PROP_INT: - value= (float)RNA_property_int_get_index(&ptr, prop, fcu->array_index); + *value= (float)RNA_property_int_get_index(&ptr, prop, fcu->array_index); break; case PROP_FLOAT: - value= RNA_property_float_get_index(&ptr, prop, fcu->array_index); + *value= RNA_property_float_get_index(&ptr, prop, fcu->array_index); break; default: + found= FALSE; break; } } } else { /* not an array */ + found= TRUE; switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - value= (float)RNA_property_boolean_get(&ptr, prop); + *value= (float)RNA_property_boolean_get(&ptr, prop); break; case PROP_INT: - value= (float)RNA_property_int_get(&ptr, prop); + *value= (float)RNA_property_int_get(&ptr, prop); break; case PROP_ENUM: - value= (float)RNA_property_enum_get(&ptr, prop); + *value= (float)RNA_property_enum_get(&ptr, prop); break; case PROP_FLOAT: - value= RNA_property_float_get(&ptr, prop); + *value= RNA_property_float_get(&ptr, prop); break; default: + found= FALSE; break; } } } - return value; + return found; } /* propagate just works along each F-Curve in turn */ @@ -1062,7 +1066,8 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu, * doesn't need to firstly keyframe the pose (though this doesn't mean that * they can't either) */ - refVal = pose_propagate_get_refVal(ob, fcu); + if( !pose_propagate_get_refVal(ob, fcu, &refVal)) + return; /* find the first keyframe to start propagating from * - if there's a keyframe on the current frame, we probably want to save this value there too diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 7f681ce25c0..4f98b4ed2eb 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1509,7 +1509,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op)) void POSE_OT_group_deselect (wmOperatorType *ot) { /* identifiers */ - ot->name= "Deselecte Bone Group"; + ot->name= "Deselect Bone Group"; ot->idname= "POSE_OT_group_deselect"; ot->description= "Deselect bones of active Bone Group"; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 12a913d2854..62f9f1c0445 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -2573,7 +2573,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions) int totfaces; int countfaces = 0; #endif - + rg = newReebGraph(); rg->resolution = subdivisions; |