domlysz / BlenderGIS

Blender addons to make the bridge between Blender and geographic data
GNU General Public License v3.0
7.72k stars 1.35k forks source link

Blender 3.0 compatibility issue : can't export shapefile #602

Closed ChameleonScales closed 2 years ago

ChameleonScales commented 2 years ago

Blender and OS versions

Blender 3.0 BlenderGIS Master 2.2.6 (also tested with release 2.2.5) Debian 11

Describe the bug

Using the simplest and most compatible shapefile I could think of (created in QGIS 3.22.1), I could not re-export it from BlenderGIS no matter my export settings. This is likely due to an API change since 3.0 because it works on Blender 2.93.4. Attached below is the shapefile which contains one small polyline rectangle, projected in EPSG:4326 - WGS84 somewhere in France. shapefile-example.zip

How to Reproduce

  1. GIS > Import > Shapefile
  2. select shapefile-example.shp
  3. Import settings:
    • Elevation: None
    • CRS: WGS84 latlon (also tried Web Mercator)
  4. the import works
  5. GIS > Export > Shapefile
  6. Export settings: I tried all combinations
  7. Error

Error message

In Blender's Info panel :

Python: Exception ignored in: <function Writer.__del__ at 0x7fc82870b790>
Traceback (most recent call last):
  File "/home/geophom/.config/blender/3.0/scripts/addons/BlenderGIS-master/core/lib/shapefile.py", line 1104, in __del__
    self.close()
  File "/home/geophom/.config/blender/3.0/scripts/addons/BlenderGIS-master/core/lib/shapefile.py", line 1125, in close
    self.__shapefileHeader(self.shp, headerType='shp')
  File "/home/geophom/.config/blender/3.0/scripts/addons/BlenderGIS-master/core/lib/shapefile.py", line 1299, in __shapefileHeader
    f.write(pack("<4d", zbox[0], zbox[1], mbox[0], mbox[1]))
TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/home/geophom/.config/blender/3.0/scripts/addons/BlenderGIS-master/operators/io_export_shp.py", line 171, in execute
    bm.from_object(obj, context.evaluated_depsgraph_get(), deform=True) #'deform' allows to consider modifier deformation
TypeError: 'deform' is an invalid keyword argument for from_object()

location: <unknown location>:-1

Full BlenderGIS log: bgis.log

Simple2Sample commented 2 years ago

I get the same error. Try using an old version of Blender. I will try it now and report back.

ChameleonScales commented 2 years ago

Indeed it works on Blender 2.93.4. I updated the title and description.

Simple2Sample commented 2 years ago

Yup. I tried it on 2.83 and it worked.

Hareden commented 2 years ago

Is it ok now?

Hareden commented 2 years ago

I get the same error. Try using an old version of Blender. I will try it now and report back.

is blender 3.0 ok now??can it export a shp file?

Simple2Sample commented 2 years ago

I haven't tried it in 3.0. Try for yourself. If it doesn't work then you can simply use 2.83.

Hareden commented 2 years ago

我没有在3.0中尝试过。自己试试。如果它不起作用,那么你可以简单地使用2.83。

thanks to your reply. Actually i use blender 3.1 ,cause the same problem. i don`t have 2.83,it is difficult to download blender 2.83 in China because of my Internet.

Hareden commented 2 years ago

I haven't tried it in 3.0. Try for yourself. If it doesn't work then you can simply use 2.83.

why does blender 3.0 or 3.1 cause this problem? Did the Author give a result?

Simple2Sample commented 2 years ago

The only solution for now is to use something before 3.0. You could also modify the library yourself if you are capable of doing that.

Hareden commented 2 years ago

现在唯一的解决方案是使用3.0之前的东西。如果您有能力,您也可以自己修改库。

Thanks to your reply again! i will download blender 2.xxx and fix this add-ons again if i have time.

domlysz commented 2 years ago

Fixed 58f27894f051053de7813d267fde97e09d44861a