diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-03-30 22:00:55 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-09-14 09:29:26 +0300 |
commit | 3423174b37a0784dc12035ff3f2fb536835099e1 (patch) | |
tree | 3a54580902cdebdef5ebacd6099e86cc79ba75b3 /rigify/utils/__init__.py | |
parent | 12af8a28c14b608e9b9b08568d981273c86590c1 (diff) |
Rigify: redesign generate.py and introduce a base rig class.
The main goals are to provide an official way for rigs to
interact in a structured way, and to remove mode switching
within rigs.
This involves introducing a base class for rigs that holds
rig-to-rig and rig-to-bone references, converting the main
generator into a class and passing it to rigs, and splitting
the single generate method into multiple passes.
For backward compatibility, old rigs are automatically handled
via a wrapper that translates between old and new API.
In addition, a way to create objects that receive the generate
callbacks that aren't rigs is introduced via the GeneratorPlugin
class. The UI script generation code is converted into a plugin.
Making generic rig 'template' classes that are intended to be
subclassed in specific rigs involves splitting operations done
in each stage into multiple methods that can be overridden
separately. The main callback thus ends up simply calling a
sequence of other methods.
To make such code cleaner it's better to allow registering
those methods as new callbacks that would be automatically
called by the system. This can be done via decorators.
A new metaclass used for all rig and generate plugin classes
builds and validates a table of all decorated methods, and
allows calling them all together with the main callback.
A new way to switch parents for IK bones based on the new
features is introduced, and used in the existing limb rigs.
Reviewers: icappiello campbellbarton
Differential Revision: https://developer.blender.org/D4624
Diffstat (limited to 'rigify/utils/__init__.py')
-rw-r--r-- | rigify/utils/__init__.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/rigify/utils/__init__.py b/rigify/utils/__init__.py index 9fa6a3d2..f45acded 100644 --- a/rigify/utils/__init__.py +++ b/rigify/utils/__init__.py @@ -11,7 +11,7 @@ from .naming import strip_trailing_number, unique_name, org_name, strip_org, str from .naming import org, make_original_name, mch, make_mechanism_name, deformer, make_deformer_name from .naming import insert_before_lr, random_id -from .bones import new_bone, copy_bone_simple, copy_bone, flip_bone, put_bone, make_nonscaling_child +from .bones import new_bone, flip_bone, put_bone from .bones import align_bone_roll, align_bone_x_axis, align_bone_z_axis, align_bone_y_axis from .widgets import WGT_PREFIX, obj_to_bone, create_widget, write_widget, create_circle_polygon @@ -22,10 +22,13 @@ from .widgets_basic import create_sphere_widget, create_limb_widget, create_bone from .widgets_special import create_compass_widget, create_root_widget from .widgets_special import create_neck_bend_widget, create_neck_tweak_widget -from .animation import get_keyed_frames, bones_in_frame, overwrite_prop_animation - from .rig import RIG_DIR, METARIG_DIR, TEMPLATE_DIR, outdated_types, upgradeMetarigTypes from .rig import write_metarig, get_resource from .rig import connected_children_names, has_connected_children from .layers import get_layers, ControlLayersOption + +# Definitions so bad as to make them strictly compatibility only +from .bones import copy_bone as copy_bone_simple +from .bones import _legacy_copy_bone as copy_bone +from .bones import _legacy_make_nonscaling_child as make_nonscaling_child |