diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-11-10 02:41:48 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-11-10 02:41:48 +0300 |
commit | d0cd641de34c571942d93afa07a8d54bd9d08a43 (patch) | |
tree | 46a3fe8aae9d766b4f7dfea5026736f6cc0250e5 /source/blender | |
parent | d34261edab6e6d0c428af96874e9846528c45339 (diff) |
Bugfixes for Armatures, SplineIK, and F-Curve RNA:
* Fixed the handling of the 'draw_active' flag for drawing of armatures. This is now cleared from bones in old files (so one bone always got represented as active in the viewport even when others were selected), and the flag is correctly set temporarily when drawing the bones (only one place had been done).
* Fixed typo with SplineIK that was making the root bone of the bone chains always be ignored. Similar functionality can come back at some point, but in a more useful form.
* Shortened the UI names for the F-Curve colouring modes to increase readability. The old ones were too long to be able to distinguish between entries in the UI.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 31 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 4 |
4 files changed, 30 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b0153a1fca3..25151714569 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1694,8 +1694,6 @@ static void splineik_init_tree_from_pchan(Object *ob, bPoseChannel *pchan_tip) /* setup new empty array for the points list */ if (ikData->points) MEM_freeN(ikData->points); - // NOTE: just do chainlen+1 always for now, since we may get crashes otherwise - //ikData->numpoints= (ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT)? ikData->chainlen : ikData->chainlen+1; ikData->numpoints= ikData->chainlen+1; ikData->points= MEM_callocN(sizeof(float)*ikData->numpoints, "Spline IK Binding"); @@ -1754,6 +1752,7 @@ static void splineik_init_tree_from_pchan(Object *ob, bPoseChannel *pchan_tip) maxScale = totLength / splineLen; /* apply scaling correction to all of the temporary points */ + // TODO: this is really not adequate enough on really short chains for (i = 0; i < segcount; i++) jointPoints[i] *= maxScale; } @@ -1833,7 +1832,6 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o } /* step 1b: get xyz positions for the head endpoint of the bone */ - /* firstly, calculate the position that the path suggests */ if ( where_on_path(ikData->tar, tree->points[index+1], vec, dir, NULL, &rad) ) { /* store the position, and convert it to pose space */ Mat4MulVecfl(ob->imat, vec); @@ -1842,12 +1840,6 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* set the new radius (it should be the average value) */ radius = (radius+rad) / 2; } - if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) && (pchan == tree->root)) - { - // this is the root bone, and it can be controlled however we like... - // TODO: how do we calculate the offset of the root, if we don't even know the binding? - VECCOPY(poseHead, pchan->pose_head); - } /* step 2: determine the implied transform from these endpoints * - splineVec: the vector direction that the spline applies on the bone @@ -1927,7 +1919,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o } /* step 5: set the location of the bone in the matrix */ - VECCOPY(poseMat[3], pchan->pose_head); + VECCOPY(poseMat[3], poseHead); /* finally, store the new transform */ Mat4CpyMat4(pchan->pose_mat, poseMat); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e1a13b65efa..30f8119ee76 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2367,6 +2367,8 @@ static void direct_link_bones(FileData *fd, Bone* bone) bone->prop= newdataadr(fd, bone->prop); if(bone->prop) IDP_DirectLinkProperty(bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); + + bone->flag &= ~BONE_DRAW_ACTIVE; link_list(fd, &bone->childbase); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 230bacf4f7f..fca7d6d7a9f 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1629,10 +1629,11 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, ARegion *ar, Base *bas flag= bone->flag; if ( (bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) ) flag &= ~BONE_CONNECTED; - - if(bone==arm->act_bone) + + /* set temporary flag for drawing bone as active */ + if (bone == arm->act_bone) flag |= BONE_DRAW_ACTIVE; - + /* set color-set to use */ set_pchan_colorset(ob, pchan); @@ -1708,6 +1709,10 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, ARegion *ar, Base *bas flag= bone->flag; if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) flag &= ~BONE_CONNECTED; + + /* set temporary flag for drawing bone as active */ + if (bone == arm->act_bone) + flag |= BONE_DRAW_ACTIVE; draw_custom_bone(scene, v3d, rv3d, pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length); @@ -1800,6 +1805,10 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, ARegion *ar, Base *bas if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) flag &= ~BONE_CONNECTED; + /* set temporary flag for drawing bone as active */ + if (bone == arm->act_bone) + flag |= BONE_DRAW_ACTIVE; + /* extra draw service for pose mode */ constflag= pchan->constflag; if (pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE)) @@ -1875,12 +1884,12 @@ static void draw_pose_channels(Scene *scene, View3D *v3d, ARegion *ar, Base *bas Mat4CpyMat4(bmat, pchan->pose_mat); bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - + /* do cached text draw immediate to include transform */ view3d_cached_text_draw_begin(); drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); view3d_cached_text_draw_end(v3d, ar, 1, bmat); - + glPopMatrix(); } } @@ -1959,6 +1968,10 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) flag= eBone->flag; if ( (eBone->parent) && ((eBone->parent->flag & BONE_HIDDEN_A) || (eBone->parent->layer & arm->layer)==0) ) flag &= ~BONE_CONNECTED; + + /* set temporary flag for drawing bone as active */ + if (eBone == arm->act_edbone) + flag |= BONE_DRAW_ACTIVE; if (arm->drawtype==ARM_ENVELOPE) draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone); @@ -1994,6 +2007,10 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) flag= eBone->flag; if ( (eBone->parent) && ((eBone->parent->flag & BONE_HIDDEN_A) || (eBone->parent->layer & arm->layer)==0) ) flag &= ~BONE_CONNECTED; + + /* set temporary flag for drawing bone as active */ + if (eBone == arm->act_edbone) + flag |= BONE_DRAW_ACTIVE; if (arm->drawtype == ARM_ENVELOPE) { if (dt < OB_SOLID) @@ -2063,12 +2080,12 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) get_matrix_editbone(eBone, bmat); bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - + /* do cached text draw immediate to include transform */ view3d_cached_text_draw_begin(); drawaxes(eBone->length*0.25f, 0, OB_ARROWS); view3d_cached_text_draw_end(v3d, ar, 1, bmat); - + glPopMatrix(); } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index a914deb37a6..cdaebb2a3db 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -652,8 +652,8 @@ static void rna_def_fcurve(BlenderRNA *brna) {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_mode_color_items[] = { - {FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Automatic Rainbow", ""}, - {FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Automatic XYZ to RGB", ""}, + {FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Auto Rainbow", ""}, + {FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Auto XYZ to RGB", ""}, {FCURVE_COLOR_CUSTOM, "CUSTOM", 0, "User Defined", ""}, {0, NULL, 0, NULL, NULL}}; |