Cleanup: defer imports on startup

This commit is contained in:
Campbell Barton
2024-10-01 10:01:16 +10:00
parent c6fd26a3f5
commit 6cbdf0223b
4 changed files with 12 additions and 4 deletions

View File

@@ -5,7 +5,6 @@
import bpy
from bpy.types import Operator
from bpy.props import BoolProperty
from bpy_extras.node_utils import find_base_socket_type, connect_sockets
from bpy.app.translations import pgettext_data as data_
from .node_editor.node_functions import (
@@ -206,6 +205,8 @@ class NODE_OT_connect_to_output(Operator, NodeEditorBase):
def create_links(self, path, node, active_node_socket_id, socket_type):
"""Create links at each step in the node group path."""
from bpy_extras.node_utils import connect_sockets
path = list(reversed(path))
# Starting from the level of the active node.
for path_index, path_element in enumerate(path[:-1]):
@@ -240,6 +241,11 @@ class NODE_OT_connect_to_output(Operator, NodeEditorBase):
self.remove_socket(tree, socket)
def invoke(self, context, event):
from bpy_extras.node_utils import (
find_base_socket_type,
connect_sockets,
)
space = context.space_data
# Ignore operator when running in wrong context.
if self.run_in_geometry_nodes != (space.tree_type == 'GeometryNodeTree'):

View File

@@ -31,7 +31,6 @@ from bpy_extras.object_utils import (
world_to_camera_view,
)
from bpy_extras.image_utils import load_image
from bpy_extras.io_utils import ImportHelper
# -----------------------------------------------------------------------------
@@ -131,6 +130,7 @@ def load_images(filenames, directory, force_reload=False, frame_start=1, find_se
"""
import os
from itertools import repeat
from bpy_extras.image_utils import load_image
if find_sequences: # If finding sequences, we need some pre-processing first.
file_iter = find_image_sequences(filenames)