File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change 1- # pylint: disable=import-outside-toplevel
2-
31import bpy
2+ import serial
3+ import websocket
44
55from bpy .types import Operator
66from ..utils .live_mode import LiveMode
@@ -65,8 +65,6 @@ def execute(self, context):
6565 return {'CANCELLED' }
6666
6767 def open_serial (self , _context ):
68- import serial
69-
7068 try :
7169 serial_connection = serial .Serial (self .serial_port , self .serial_baud )
7270 except (serial .SerialException , ValueError ):
@@ -91,8 +89,6 @@ def open_serial(self, _context):
9189 return {'FINISHED' }
9290
9391 def open_socket (self , _context ):
94- import websocket
95-
9692 socket_url = f"ws://{ self .socket_host } :{ self .socket_port } { self .socket_path } "
9793 socket_connection = websocket .WebSocket ()
9894 socket_connection .settimeout (1 )
Original file line number Diff line number Diff line change 1- # pylint: disable=import-outside-toplevel, broad-exception-caught
1+ # pylint: disable=broad-exception-caught
22
33import time
44import math
55import bpy
6+ import serial
7+ import websocket
68
79from ..utils .servo_settings import get_active_pose_bones
810from ..utils .converter import calculate_position
11+ from serial .tools import list_ports
912
1013class LiveMode :
1114 COMMAND_START = 0x3C
@@ -26,9 +29,6 @@ def set_connection(cls, connection):
2629
2730 @classmethod
2831 def is_connected (cls ):
29- import serial
30- import websocket
31-
3232 method = bpy .context .window_manager .servo_animation .live_mode_method
3333
3434 if method == LiveMode .METHOD_SERIAL :
@@ -63,8 +63,6 @@ def disable_handler(cls):
6363
6464 @classmethod
6565 def get_serial_ports (cls ):
66- from serial .tools import list_ports
67-
6866 ports = []
6967
7068 for port in list_ports .comports ():
You can’t perform that action at this time.
0 commit comments