diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2022-11-13 00:54:17 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-11-13 16:23:29 +0300 |
commit | 01e8af3348fac2babe3b5218dbe4ecdaa0e1eace (patch) | |
tree | 3a6239133282569da143ce22bda34f14f98af473 /rigify/rigs/limbs/simple_tentacle.py | |
parent | 68419fb3659f09e8447d351a25b1bd8e56211a5a (diff) |
Introduce a method to annotate types and names of entries in the
`bones` container of rig components and apply it, and other type
annotations, to a number of not very complex rig classes.
- Introduce BaseRigMixin as a typed base class for mixins intended
for use in rig classes (using BaseRig as a parent causes issues).
- Introduce TypedBoneDict that does not suppress the unknown attribute
analysis in PyCharm, and use it in a system of subclasses to
annotate the bones in various rigs. BaseBoneDict is necessary
because the annotation affects all subclasses, so TypedBoneDict
cannot inherit from BoneDict with the annotation.
- Add or adjust other type annotations of rig methods and utilities.
- Fix other warnings, e.g. undeclared attributes, excessively long
lines, whitespace style issues and typos.
Diffstat (limited to 'rigify/rigs/limbs/simple_tentacle.py')
-rw-r--r-- | rigify/rigs/limbs/simple_tentacle.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/rigify/rigs/limbs/simple_tentacle.py b/rigify/rigs/limbs/simple_tentacle.py index d26d009d..9be9bd07 100644 --- a/rigify/rigs/limbs/simple_tentacle.py +++ b/rigify/rigs/limbs/simple_tentacle.py @@ -3,6 +3,7 @@ import bpy from itertools import count +from typing import Optional from ...utils.bones import align_chain_x_axis from ...utils.widgets_basic import create_circle_widget @@ -14,6 +15,8 @@ from ..chain_rigs import TweakChainRig class Rig(TweakChainRig): + copy_rotation_axes: tuple[bool, bool, bool] + def initialize(self): super().initialize() @@ -50,7 +53,7 @@ class Rig(TweakChainRig): for args in zip(count(0), ctrls, [None] + ctrls): self.rig_control_bone(*args) - def rig_control_bone(self, i, ctrl, prev_ctrl): + def rig_control_bone(self, _i: int, ctrl: str, prev_ctrl: Optional[str]): if prev_ctrl: self.make_constraint( ctrl, 'COPY_ROTATION', prev_ctrl, @@ -59,12 +62,11 @@ class Rig(TweakChainRig): ) # Widgets - def make_control_widget(self, i, ctrl): + def make_control_widget(self, i: int, ctrl: str): create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5) - @classmethod - def add_parameters(self, params): + def add_parameters(cls, params): """ Add the parameters of this rig type to the RigifyParameters PropertyGroup """ @@ -80,9 +82,8 @@ class Rig(TweakChainRig): items = [('automatic', 'Automatic', ''), ('manual', 'Manual', '')] params.roll_alignment = bpy.props.EnumProperty(items=items, name="Bone roll alignment", default='automatic') - @classmethod - def parameters_ui(self, layout, params): + def parameters_ui(cls, layout, params): """ Create the ui for the rig parameters. """ |