Cleanup: defer imports on startup
This commit is contained in:
@@ -6,7 +6,6 @@ from __future__ import annotations
|
||||
|
||||
import bpy
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
from bpy_extras.node_utils import find_node_input
|
||||
from bl_ui.utils import PresetPanel
|
||||
|
||||
from bpy.types import Panel, Menu
|
||||
@@ -1557,6 +1556,8 @@ class CYCLES_OBJECT_PT_visibility_culling(CyclesButtonsPanel, Panel):
|
||||
|
||||
|
||||
def panel_node_draw(layout, id_data, output_type, input_name):
|
||||
from bpy_extras.node_utils import find_node_input
|
||||
|
||||
if not id_data.use_nodes:
|
||||
layout.operator("cycles.use_shading_nodes", icon='NODETREE')
|
||||
return False
|
||||
|
||||
@@ -30,7 +30,6 @@ from bpy.types import (
|
||||
Object,
|
||||
Operator,
|
||||
)
|
||||
from bpy_extras import asset_utils
|
||||
from bpy.app.translations import pgettext_tip as tip_
|
||||
|
||||
|
||||
@@ -257,6 +256,8 @@ class POSELIB_OT_paste_asset(Operator):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context: Context) -> bool:
|
||||
from bpy_extras import asset_utils
|
||||
|
||||
if not asset_utils.SpaceAssetInfo.is_asset_browser(context.space_data):
|
||||
cls.poll_message_set("Current editor is not an asset browser")
|
||||
return False
|
||||
|
||||
@@ -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'):
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user