[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28368] trunk/blender: Spline IK - Influence Control

Nathan Vegdahl cessen at cessen.com
Fri Apr 23 10:34:24 CEST 2010


Woo hoo!  Thanks Aligorith! :-D

--Nathan V

On Fri, Apr 23, 2010 at 7:14 AM, Joshua Leung <aligorith at gmail.com> wrote:
> Revision: 28368
>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28368
> Author:   aligorith
> Date:     2010-04-23 07:14:00 +0200 (Fri, 23 Apr 2010)
>
> Log Message:
> -----------
> Spline IK - Influence Control
>
> Made the 'Influence' slider work for Spline IK too, and made that setting visible now that it works.
>
> Note that there is still some popping that can occur when going to/from influence = 0.0. I'm not sure exactly what's causing this yet, but hopefully it won't be too noticeable in practice.
>
> Modified Paths:
> --------------
>    trunk/blender/release/scripts/ui/properties_object_constraint.py
>    trunk/blender/source/blender/blenkernel/intern/armature.c
>
> Modified: trunk/blender/release/scripts/ui/properties_object_constraint.py
> ===================================================================
> --- trunk/blender/release/scripts/ui/properties_object_constraint.py    2010-04-23 04:16:08 UTC (rev 28367)
> +++ trunk/blender/release/scripts/ui/properties_object_constraint.py    2010-04-23 05:14:00 UTC (rev 28368)
> @@ -37,7 +37,7 @@
>             # match enum type to our functions, avoids a lookup table.
>             getattr(self, con.type)(context, box, con, wide_ui)
>
> -            if con.type not in ('RIGID_BODY_JOINT', 'SPLINE_IK', 'NULL'):
> +            if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
>                 box.prop(con, "influence")
>
>     def space_template(self, layout, con, wide_ui, target=True, owner=True):
>
> Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
> ===================================================================
> --- trunk/blender/source/blender/blenkernel/intern/armature.c   2010-04-23 04:16:08 UTC (rev 28367)
> +++ trunk/blender/source/blender/blenkernel/intern/armature.c   2010-04-23 05:14:00 UTC (rev 28368)
> @@ -2006,6 +2006,11 @@
>                rangle= dot_v3v3(rmat[1], splineVec);
>                rangle= acos( MAX2(-1.0f, MIN2(1.0f, rangle)) );
>
> +               /* multiply the magnitude of the angle by the influence of the constraint to
> +                * control the influence of the SplineIK effect
> +                */
> +               rangle *= tree->con->enforce;
> +
>                /* construct rotation matrix from the axis-angle rotation found above
>                 *      - this call takes care to make sure that the axis provided is a unit vector first
>                 */
> @@ -2073,13 +2078,26 @@
>                }
>        }
>
> -       /* step 5: set the location of the bone in the matrix
> -        *      - when the 'no-root' option is affected, the chain can retain
> -        *        the shape but be moved elsewhere
> -        */
> +       /* step 5: set the location of the bone in the matrix */
>        if (ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) {
> +               /* when the 'no-root' option is affected, the chain can retain
> +                * the shape but be moved elsewhere
> +                */
>                VECCOPY(poseHead, pchan->pose_head);
>        }
> +       else if (tree->con->enforce < 1.0f) {
> +               /* when the influence is too low
> +                *      - blend the positions for the 'root' bone
> +                *      - stick to the parent for any other
> +                */
> +               if (pchan->parent) {
> +                       VECCOPY(poseHead, pchan->pose_head);
> +               }
> +               else {
> +                       // FIXME: this introduces popping artifacts when we reach 0.0
> +                       interp_v3_v3v3(poseHead, pchan->pose_head, poseHead, tree->con->enforce);
> +               }
> +       }
>        VECCOPY(poseMat[3], poseHead);
>
>        /* finally, store the new transform */
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>


More information about the Bf-committers mailing list