Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-12-01 21:28:26 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-12-01 21:28:45 +0300
commit008bcf44ef35726f4c1373e46b4dd6e3a5a069e2 (patch)
treebe7522f0d1bd7ea23a6d71c781ae9b3c8995c2cb /rigify/base_rig.py
parent287f8443007100b2b27097c5fa5bf37e810801d7 (diff)
Rigify: internal API enhancements.
Add a LazyRigComponent class that has to be explicitly enabled to start receiving callbacks. Support calling GeneratorPlugin instance callbacks in the same stage they were created.
Diffstat (limited to 'rigify/base_rig.py')
-rw-r--r--rigify/base_rig.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/rigify/base_rig.py b/rigify/base_rig.py
index d878143b..c25e701d 100644
--- a/rigify/base_rig.py
+++ b/rigify/base_rig.py
@@ -267,14 +267,25 @@ class RigUtility(BoneUtilityMixin, MechanismUtilityMixin):
self.owner.register_new_bone(new_name, old_name)
-class RigComponent(GenerateCallbackHost, RigUtility):
- """Base class for utility classes that generate part of a rig using callbacks."""
+class LazyRigComponent(GenerateCallbackHost, RigUtility):
+ """Base class for utility classes that generate part of a rig using callbacks. Starts as disabled."""
def __init__(self, owner):
super().__init__(owner)
- self.owner.rigify_sub_objects = objects = self.owner.rigify_sub_objects or []
+ self.is_component_enabled = False
+
+ def enable_component(self):
+ if not self.is_component_enabled:
+ self.is_component_enabled = True
+ self.owner.rigify_sub_objects = objects = self.owner.rigify_sub_objects or []
+ objects.append(self)
+
- objects.append(self)
+class RigComponent(LazyRigComponent):
+ """Base class for utility classes that generate part of a rig using callbacks."""
+ def __init__(self, owner):
+ super().__init__(owner)
+ self.enable_component()
#=============================================