Spaces:
Paused
Paused
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 |
-
|
| 3810 |
-
|
| 3811 |
-
|
| 3812 |
-
|
| 3813 |
-
|
| 3814 |
-
|
| 3815 |
-
|
| 3816 |
-
|
| 3817 |
-
|
| 3818 |
-
|
| 3819 |
-
|
| 3820 |
-
|
| 3821 |
-
|
| 3822 |
-
|
| 3823 |
-
|
| 3824 |
-
bpy.ops.
|
| 3825 |
-
bpy.ops.object.mode_set(mode='OBJECT')
|
| 3826 |
|
| 3827 |
-
|
| 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
|