1515from . import flags as p3d_flags
1616from .validator import LODValidator
1717from .. import get_prefs
18- from .. import utils
19- from .. import utils_compat as computils
18+ from ..utils import edit_bmesh
19+ from ..utils_compat import call_operator_ctx , mesh_auto_smooth , mesh_static_normals_iterator
2020from ..logger import ProcessLogger , ProcessLoggerNull
2121
2222
@@ -83,7 +83,7 @@ def apply_modifiers(obj):
8383 m = modifiers .pop (0 )
8484 try :
8585 ctx ["modifier" ] = m
86- computils . call_operator_ctx (bpy .ops .object .modifier_apply , ctx , modifier = m .name )
86+ call_operator_ctx (bpy .ops .object .modifier_apply , ctx , modifier = m .name )
8787 except :
8888 obj .modifiers .remove (m )
8989
@@ -95,13 +95,13 @@ def apply_transforms(obj):
9595 "selected_editable_objects" : [obj ],
9696 "edit_object" : None
9797 }
98- computils . call_operator_ctx (bpy .ops .object .transform_apply , ctx )
98+ call_operator_ctx (bpy .ops .object .transform_apply , ctx )
9999
100100
101101# In order to simplify merging the LOD parts, and the data access later on, the dereferenced
102102# flags need to be written directly into their respective integer bmesh layers.
103103def bake_flags_vertex (obj ):
104- with utils . edit_bmesh (obj ) as bm :
104+ with edit_bmesh (obj ) as bm :
105105 bm .verts .ensure_lookup_table ()
106106
107107 layer = p3d_flags .get_layer_flags_vertex (bm )
@@ -117,7 +117,7 @@ def bake_flags_vertex(obj):
117117
118118
119119def bake_flags_face (obj ):
120- with utils . edit_bmesh (obj ) as bm :
120+ with edit_bmesh (obj ) as bm :
121121 bm .faces .ensure_lookup_table ()
122122
123123 layer = p3d_flags .get_layer_flags_face (bm )
@@ -133,7 +133,7 @@ def bake_flags_face(obj):
133133
134134
135135def blank_flags_vertex (obj ):
136- with utils . edit_bmesh (obj ) as bm :
136+ with edit_bmesh (obj ) as bm :
137137 bm .verts .ensure_lookup_table ()
138138 layer = p3d_flags .get_layer_flags_vertex (bm )
139139
@@ -142,7 +142,7 @@ def blank_flags_vertex(obj):
142142
143143
144144def blank_flags_face (obj ):
145- with utils . edit_bmesh (obj ) as bm :
145+ with edit_bmesh (obj ) as bm :
146146 bm .faces .ensure_lookup_table ()
147147 layer = p3d_flags .get_layer_flags_face (bm )
148148
@@ -172,7 +172,7 @@ def merge_sub_objects(operator, main_obj, sub_objects):
172172 "selected_objects" : all_objects ,
173173 "selected_editable_objects" : all_objects
174174 }
175- computils . call_operator_ctx (bpy .ops .object .join , ctx )
175+ call_operator_ctx (bpy .ops .object .join , ctx )
176176
177177
178178def merge_proxy_objects (main_obj , proxy_objects , relative ):
@@ -201,7 +201,7 @@ def merge_proxy_objects(main_obj, proxy_objects, relative):
201201 "selected_objects" : all_objects ,
202202 "selected_editable_objects" : all_objects
203203 }
204- computils . call_operator_ctx (bpy .ops .object .join , ctx )
204+ call_operator_ctx (bpy .ops .object .join , ctx )
205205
206206 return proxy_lookup
207207
@@ -239,7 +239,7 @@ def get_sub_objects(obj, temp_collection):
239239 continue
240240
241241 if not child .mode == 'OBJECT' :
242- computils . call_operator_ctx (bpy .ops .object .mode_set , {"active_object" : child }, mode = 'OBJECT' )
242+ call_operator_ctx (bpy .ops .object .mode_set , {"active_object" : child }, mode = 'OBJECT' )
243243
244244 child_copy = duplicate_object (child , temp_collection )
245245
@@ -256,7 +256,7 @@ def sort_sections(obj):
256256 for i in range (len (obj .material_slots )):
257257 sections [i ] = []
258258
259- with utils . edit_bmesh (obj ) as bm :
259+ with edit_bmesh (obj ) as bm :
260260 bm .faces .ensure_lookup_table ()
261261
262262 for face in bm .faces :
@@ -282,8 +282,8 @@ def cleanup_normals(operator, obj):
282282 "active_object" : obj ,
283283 "object" : obj
284284 }
285- computils . call_operator_ctx (bpy .ops .mesh .customdata_custom_splitnormals_clear , ctx )
286- computils . mesh_auto_smooth (obj .data )
285+ call_operator_ctx (bpy .ops .mesh .customdata_custom_splitnormals_clear , ctx )
286+ mesh_auto_smooth (obj .data )
287287 mod = obj .modifiers .new ("Temp" , 'WEIGHTED_NORMAL' )
288288 mod .weight = 50
289289 mod .keep_sharp = True
@@ -337,7 +337,7 @@ def get_lod_data(operator, context, validator, temp_collection):
337337
338338 # Some operator polls fail later if an object is in edit mode.
339339 if not obj .mode == 'OBJECT' :
340- computils . call_operator_ctx (bpy .ops .object .mode_set , {"active_object" : obj }, mode = 'OBJECT' )
340+ call_operator_ctx (bpy .ops .object .mode_set , {"active_object" : obj }, mode = 'OBJECT' )
341341
342342 main_obj = duplicate_object (obj , temp_collection )
343343 is_valid = True
@@ -410,7 +410,7 @@ def process_normals(mesh):
410410 normals_index = {}
411411 normals_lookup_dict = {}
412412
413- for i , normal in computils . mesh_static_normals_iterator (mesh ):
413+ for i , normal in mesh_static_normals_iterator (mesh ):
414414 if normal not in normals_index :
415415 normals_index [normal ] = len (normals_index )
416416 output .append (normal )
0 commit comments