From 01e8af3348fac2babe3b5218dbe4ecdaa0e1eace Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 12 Nov 2022 23:54:17 +0200 Subject: Rigify: annotate and fix warnings in basic rig components. 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. --- rigify/rigs/spines/super_spine.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'rigify/rigs/spines/super_spine.py') diff --git a/rigify/rigs/spines/super_spine.py b/rigify/rigs/spines/super_spine.py index 7d60a57e..dc56f7a2 100644 --- a/rigify/rigs/spines/super_spine.py +++ b/rigify/rigs/spines/super_spine.py @@ -32,8 +32,8 @@ class Rig(SubstitutionRig, BoneUtilityMixin): if neck_pos >= len(orgs): self.raise_error("Neck is too short.") - spine_orgs = orgs[0 : neck_pos-1] - head_orgs = orgs[neck_pos-1 : ] + spine_orgs = orgs[0: neck_pos-1] + head_orgs = orgs[neck_pos-1:] if self.params.use_tail: tail_pos = self.params.tail_pos @@ -42,8 +42,8 @@ class Rig(SubstitutionRig, BoneUtilityMixin): if tail_pos >= pivot_pos: self.raise_error("Tail cannot be above or the same as pivot.") - tail_orgs = list(reversed(spine_orgs[0 : tail_pos])) - spine_orgs = spine_orgs[tail_pos : ] + tail_orgs = list(reversed(spine_orgs[0: tail_pos])) + spine_orgs = spine_orgs[tail_pos:] pivot_pos -= tail_pos # Split the bone chain and flip the tail @@ -65,17 +65,17 @@ class Rig(SubstitutionRig, BoneUtilityMixin): # Create the parts self.assign_params(spine_orgs[0], params_copy, pivot_pos=pivot_pos, make_fk_controls=False) - result = [ self.instantiate_rig(basic_spine.Rig, spine_orgs[0]) ] + result = [self.instantiate_rig(basic_spine.Rig, spine_orgs[0])] if tail_orgs: self.assign_params(tail_orgs[0], params_copy, connect_chain=True) - result += [ self.instantiate_rig(basic_tail.Rig, tail_orgs[0]) ] + result += [self.instantiate_rig(basic_tail.Rig, tail_orgs[0])] if head_orgs: self.assign_params(head_orgs[0], params_copy, connect_chain=True) - result += [ self.instantiate_rig(super_head.Rig, head_orgs[0]) ] + result += [self.instantiate_rig(super_head.Rig, head_orgs[0])] return result @@ -86,10 +86,10 @@ def add_parameters(params): super_head.Rig.add_parameters(params) params.neck_pos = bpy.props.IntProperty( - name = 'neck_position', - default = 6, - min = 0, - description = 'Neck start position' + name='neck_position', + default=6, + min=0, + description='Neck start position' ) params.tail_pos = bpy.props.IntProperty( -- cgit v1.2.3