Refactor: lazy import anim_utils from bpy_extras
Import `anim_utils` from `bpy_extras` in a lazy way, instead of at the top of the module. This will improve load times of Blender. No functional changes. Pull Request: https://projects.blender.org/blender/blender/pulls/147215
This commit is contained in:
@@ -30,7 +30,6 @@ from bpy.types import (
|
||||
FCurve,
|
||||
Keyframe,
|
||||
)
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
FCurveValue = Union[float, int]
|
||||
|
||||
@@ -78,6 +77,7 @@ class PoseActionCreator:
|
||||
|
||||
def create(self) -> Optional[Action]:
|
||||
"""Create a single-frame Action containing only the given bones, or None if no anim data was found."""
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
try:
|
||||
dst_action = self._create_new_action()
|
||||
@@ -116,6 +116,8 @@ class PoseActionCreator:
|
||||
|
||||
def _store_animated_parameters(self, dst_channelbag: ActionChannelbag) -> None:
|
||||
"""Store the current value of any animated bone properties."""
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
if self.params.src_action is None:
|
||||
return
|
||||
src_channelbag = anim_utils.action_get_channelbag_for_slot(self.params.src_action, self.params.src_action_slot)
|
||||
|
||||
@@ -16,8 +16,6 @@ import sys
|
||||
|
||||
import bpy
|
||||
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
IS_TESTING = False
|
||||
|
||||
|
||||
@@ -153,6 +151,7 @@ def update_data_paths(rna_update, log=sys.stdout):
|
||||
and options is an opaque data.
|
||||
class_name, fcurve and options may be None!
|
||||
"""
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
rna_update_from_map = {}
|
||||
for ren_class, ren_from, ren_to, options in rna_update:
|
||||
|
||||
@@ -14,7 +14,6 @@ from bpy.app.translations import (
|
||||
pgettext_rpt as rpt_,
|
||||
contexts as i18n_contexts,
|
||||
)
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
|
||||
class SelectPattern(Operator):
|
||||
@@ -821,6 +820,8 @@ class TransformsToDeltasAnim(Operator):
|
||||
return (obs is not None)
|
||||
|
||||
def execute(self, context):
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
# map from standard transform paths to "new" transform paths
|
||||
STANDARD_TO_DELTA_PATHS = {
|
||||
"location": "delta_location",
|
||||
|
||||
@@ -8,7 +8,6 @@ from bpy.props import (
|
||||
EnumProperty,
|
||||
IntProperty,
|
||||
)
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
|
||||
class CopyRigidbodySettings(Operator):
|
||||
@@ -107,6 +106,8 @@ class BakeToKeyframes(Operator):
|
||||
return (obj and obj.rigid_body)
|
||||
|
||||
def execute(self, context):
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
bake = []
|
||||
objects = []
|
||||
scene = context.scene
|
||||
|
||||
@@ -14,7 +14,6 @@ from bpy.props import (
|
||||
IntProperty,
|
||||
)
|
||||
from bpy.app.translations import pgettext_rpt as rpt_
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
|
||||
def _animated_properties_get(strip):
|
||||
@@ -146,6 +145,8 @@ class SequencerFadesClear(Operator):
|
||||
return strip is not None
|
||||
|
||||
def execute(self, context):
|
||||
from bpy_extras import anim_utils
|
||||
|
||||
scene = context.scene
|
||||
animation_data = scene.animation_data
|
||||
if animation_data is None:
|
||||
|
||||
Reference in New Issue
Block a user