0xZohar commited on
Commit
22bb3de
·
verified ·
1 Parent(s): 898920f

Upload code/ImportLDraw/loadldraw/loadldraw.py with huggingface_hub

Browse files
code/ImportLDraw/loadldraw/loadldraw.py CHANGED
@@ -3806,25 +3806,24 @@ def createBlenderObjectsFromNode(node,
3806
  if bpy.context.window is None:
3807
  debugPrint("Skipping edge bevel (background mode - no UI context)")
3808
  unlinkFromScene(ob)
3809
- continue
3810
-
3811
- area_type = 'VIEW_3D' # change this to use the correct Area Type context you want to process in
3812
- areas = [area for area in bpy.context.window.screen.areas if area.type == area_type]
3813
-
3814
- if len(areas) <= 0:
3815
- raise Exception(f"Make sure an Area of type {area_type} is open or visible on your screen!")
3816
- selectObject(ob)
3817
- bpy.ops.object.mode_set(mode='EDIT')
3818
-
3819
- with bpy.context.temp_override(
3820
- window=bpy.context.window,
3821
- area=areas[0],
3822
- regions=[region for region in areas[0].regions if region.type == 'WINDOW'][0],
3823
- screen=bpy.context.window.screen):
3824
- bpy.ops.mesh.customdata_bevel_weight_edge_add()
3825
- bpy.ops.object.mode_set(mode='OBJECT')
3826
 
3827
- unlinkFromScene(ob)
3828
 
3829
  # The lines out of an empty shown in the viewport are scaled to a reasonable size
3830
  ob.empty_display_size = 250.0 * globalScaleFactor
 
3806
  if bpy.context.window is None:
3807
  debugPrint("Skipping edge bevel (background mode - no UI context)")
3808
  unlinkFromScene(ob)
3809
+ else:
3810
+ area_type = 'VIEW_3D' # change this to use the correct Area Type context you want to process in
3811
+ areas = [area for area in bpy.context.window.screen.areas if area.type == area_type]
3812
+
3813
+ if len(areas) <= 0:
3814
+ raise Exception(f"Make sure an Area of type {area_type} is open or visible on your screen!")
3815
+ selectObject(ob)
3816
+ bpy.ops.object.mode_set(mode='EDIT')
3817
+
3818
+ with bpy.context.temp_override(
3819
+ window=bpy.context.window,
3820
+ area=areas[0],
3821
+ regions=[region for region in areas[0].regions if region.type == 'WINDOW'][0],
3822
+ screen=bpy.context.window.screen):
3823
+ bpy.ops.mesh.customdata_bevel_weight_edge_add()
3824
+ bpy.ops.object.mode_set(mode='OBJECT')
 
3825
 
3826
+ unlinkFromScene(ob)
3827
 
3828
  # The lines out of an empty shown in the viewport are scaled to a reasonable size
3829
  ob.empty_display_size = 250.0 * globalScaleFactor