From 211f0843ed2d98125406c90dcca52375d9350ca5 Mon Sep 17 00:00:00 2001 From: Oxicid Date: Mon, 17 Apr 2023 22:16:30 +0200 Subject: [PATCH 1/2] Added check for material in the slot --- io_export_dxf/export_dxf.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py index f763b3a39..bfc1303a0 100644 --- a/io_export_dxf/export_dxf.py +++ b/io_export_dxf/export_dxf.py @@ -93,21 +93,13 @@ def getCommons(ob, settings): if DEBUG: print('ob_layer_nr=', ob_layer_nr) #-------------- materials = ob.material_slots - if materials: + if materials and materials[0].material: ob_material = materials[0] ob_mat_color = ob_material.material.diffuse_color else: ob_mat_color, ob_material = None, None if DEBUG: print('ob_mat_color, ob_material=', ob_mat_color, ob_material) #-------------- - data_materials = ob.material_slots - if data_materials: - data_material = data_materials[0] - data_mat_color = data_material.material.diffuse_color - else: data_mat_color, data_material = None, None - if DEBUG: - print('data_mat_color, data_material=', data_mat_color, data_material) #-------------- - entitylayer = ENTITYLAYER_DEF c = settings['entitylayer_from'] #["default_LAYER","obj.name","obj.layer","obj.material","obj.data.name","obj.data.material","..vertexgroup","..group","..map_table"] @@ -120,7 +112,7 @@ def getCommons(ob, settings): elif c=="obj.name": entitylayer = ob.name elif c=="obj.data.material" and ob_material: - entitylayer = data_material.name + entitylayer = ob_material.name elif c=="obj.data.name": entitylayer = ob.data.name @@ -138,8 +130,8 @@ def getCommons(ob, settings): entitycolor = ob.color elif cfrom=="obj.material" and ob_mat_color: entitycolor = ob_mat_color - elif cfrom=="obj.data.material" and data_mat_color: - entitycolor = data_mat_color + elif cfrom=="obj.data.material" and ob_mat_color: + entitycolor = ob_mat_color entityltype = ENTITYLTYPE_DEF etype = settings['entityltype_from'] -- 2.30.2 From 227b47fffcd182e5a9bdf5f22703fbc6f68316a1 Mon Sep 17 00:00:00 2001 From: Oxicid Date: Mon, 17 Apr 2023 22:18:22 +0200 Subject: [PATCH 2/2] Update 'io_export_dxf/__init__.py' --- io_export_dxf/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_export_dxf/__init__.py b/io_export_dxf/__init__.py index abcdbcce2..31686a6c8 100644 --- a/io_export_dxf/__init__.py +++ b/io_export_dxf/__init__.py @@ -3,7 +3,7 @@ bl_info = { "name": "Export Autocad DXF Format (.dxf)", "author": "Remigiusz Fiedler (AKA migius), Vaclav Klecanda", - "version": (2, 2, 3), + "version": (2, 2, 4), "blender": (2, 80, 0), "location": "File > Export > AutoCAD DXF", "description": "The script exports Blender geometry to DXF format r12 version.", -- 2.30.2