diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-05-17 18:19:06 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-05-17 18:19:06 +0300 |
commit | 49aeee5a3dfa9fc0ae29e99f7c5c0cc0124e560e (patch) | |
tree | 49ace019e0509cd188f24d11c8f799ab676f6bbd /release/scripts/modules/keyingsets_utils.py | |
parent | 29a17d54da1f4b85a59487e032165bb44dc1b065 (diff) |
Bendy Bones: Advanced B-Bones for Easier + Simple Rigging
This commit/patch/branch brings a bunch of powerful new options for B-Bones and
for working with B-Bones, making it easier for animators to create their own
rigs, using fewer bones (which also means hopefully lighter + faster rigs ;)
This functionality was first demoed by Daniel at BConf15
Some highlights from this patch include:
* You can now directly control the shape of B-Bones using a series of properties
instead of being restricted to trying to indirectly control them through the
neighbouring bones. See the "Bendy Bones" panel...
* B-Bones can be shaped in EditMode to define a "curved rest pose" for the bone.
This is useful for things like eyebrows and mouths/eyelids
* You can now make B-Bones use custom bones as their reference bone handles,
instead of only using the parent/child bones. To do so, enable the
"Use Custom Reference Handles" toggle. If none are specified, then the BBone will
only use the Bendy Bone properties.
* Constraints Head/Tail option can now slide along the B-Bone shape, instead of
just linearly interpolating between the endpoints of the bone.
For more details, see:
* http://aligorith.blogspot.co.nz/2016/05/bendy-bones-dev-update.html
* http://aligorith.blogspot.co.nz/2016/05/an-in-depth-look-at-how-b-bones-work.html
-- Credits --
Original Idea: Daniel M Lara (pepeland)
Original Patch/Research: Jose Molina
Additional Development + Polish: Joshua Leung (aligorith)
Testing/Feedback: Daniel M Lara (pepeland), Juan Pablo Bouza (jpbouza)
Diffstat (limited to 'release/scripts/modules/keyingsets_utils.py')
-rw-r--r-- | release/scripts/modules/keyingsets_utils.py | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index 03400edc904..375ee3feebe 100644 --- a/release/scripts/modules/keyingsets_utils.py +++ b/release/scripts/modules/keyingsets_utils.py @@ -28,11 +28,14 @@ __all__ = ( "RKS_POLL_selected_objects", "RKS_POLL_selected_bones", "RKS_POLL_selected_items", + "RKS_ITER_selected_object", + "RKS_ITER_selected_bones", "RKS_ITER_selected_item", "RKS_GEN_available", "RKS_GEN_location", "RKS_GEN_rotation", "RKS_GEN_scaling", + "RKS_GEN_bendy_bones", ) import bpy @@ -93,11 +96,17 @@ def RKS_ITER_selected_item(ksi, context, ks): ksi.generate(context, ks, ob) -# all select objects only +# all selected objects only def RKS_ITER_selected_objects(ksi, context, ks): for ob in context.selected_objects: ksi.generate(context, ks, ob) + +# all seelcted bones only +def RKS_ITER_selected_bones(ksi, context, ks): + for bone in context.selected_pose_bones: + ksi.generate(context, ks, bone) + ########################### # Generate Callbacks @@ -207,3 +216,43 @@ def RKS_GEN_scaling(ksi, context, ks, data): ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping) else: ks.paths.add(id_block, path) + +# ------ + +# Property identifiers for Bendy Bones +bbone_property_ids = ( + "bbone_curveinx", + "bbone_curveiny", + "bbone_curveoutx", + "bbone_curveouty", + + "bbone_rollin", + "bbone_rollout", + + "bbone_scalein", + "bbone_scaleout", + + # NOTE: These are in the nested bone struct + # Do it this way to force them to be included + # in whatever actions are being keyed here + "bone.bbone_in", + "bone.bbone_out", +) + +# Add Keying Set entries for bendy bones +def RKS_GEN_bendy_bones(ksi, context, ks, data): + # get id-block and path info + # NOTE: This assumes that we're dealing with a bone here... + id_block, base_path, grouping = get_transform_generators_base_info(data) + + # for each of the bendy bone properties, add a Keying Set entry for it... + for propname in bbone_property_ids: + # add the property name to the base path + path = path_add_property(base_path, propname) + + # add Keying Set entry for this... + if grouping: + ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping) + else: + ks.paths.add(id_block, path) + |