prochitecture / blosm

GNU General Public License v3.0
11 stars 3 forks source link

Error when importing karl-marx-allee.osm in Blender #45

Closed vvoovv closed 1 year ago

vvoovv commented 1 year ago

The import in command line works without any errors.

Any ideas?

image

polarkernel commented 1 year ago

The import in command line works without any errors. Any ideas?

Puuh, very difficult to guess, it happens in a very late state of the process. Is your current code available on GitHub, so that I might try to debug?

vvoovv commented 1 year ago

It's _streets_forgn branch.

GUI settings: image

Please let me know if you can reproduce the problem.

polarkernel commented 1 year ago

It's streets_for_gn branch.

I don't get the same GUI. Did I miss some settings? The addon version shows 2.5.1 .

1

vvoovv commented 1 year ago

Try to check the option Enable experimental features at the bottom of the addon preferences.

polarkernel commented 1 year ago

Try to check the option Enable experimental features ...

That worked to get the GUI. Additionally, I had to install the latest assets. After selection of the osm-file and pressing 'Import', only the indicator (below) appears at the bottom of Blender. Nothing else happens, and the method do() of StreetGenerator does not get executed.

2

vvoovv commented 1 year ago

I'll try to install everything from scratch and check what else is required.

vvoovv commented 1 year ago
polarkernel commented 1 year ago

Nothing changed, same indicator x'collections' as above, and no message in console. Was I right before to download the assets from Gumroad, or are there others elsewhere?

vvoovv commented 1 year ago

Was I right before to download the assets from Gumroad? Yes.

The file above does contain 'collections' as it can be seen in its first line.

ADDON_ASSETS is the folder you set here: image

Right?

polarkernel commented 1 year ago

Yes.

1

2

vvoovv commented 1 year ago

What are the first few lines in the file C:\SpecialPrograms\blender-osm\assets\default\asset_info\asset_info.json?

polarkernel commented 1 year ago

Sorry, was out for a moment. The first lines of this file are

{"collections": [
{
    "assets": [
        {
            "category": "part",
            "part": "level",
            "class": "apartments_base",
            "name": "pro_6908.png",
            "type": "texture",
            "path": "/default/textures/facades/appartments",
            "cladding": 1,
            "featureWidthM": 1.5,
            "featureLpx": 185,
            "featureRpx": 452,
            "numTilesU": 3,
            "numTilesV": 4
        }
    ]
},
vvoovv commented 1 year ago

The file is the right one. The key "collections" is there. The error simply can't happen. Try restarting Blender.

polarkernel commented 1 year ago

Try restarting Blender.

This made it work! Now I get the error that you experienced for this issue. I will now try to find the reason. Thanks for your support!

polarkernel commented 1 year ago

There is an issue just after the beginning, where the border of the scene is determined for the clipper. In the two lines 165 and 166, these border limits get:

        minX, minY = self.app.projection.fromGeographic(self.app.minLat, self.app.minLon)
        maxX, maxY = self.app.projection.fromGeographic(self.app.maxLat, self.app.maxLon)

In the command line version, these are

1

while in Blender these become

2

At least the minYvalue will clip out all way-segments.

vvoovv commented 1 year ago

There is an issue just after the beginning

I committed the fix.

To proceed:

There is another error: image

polarkernel commented 1 year ago

It seems that I still have a configuration issue:

File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\__init__.py", line 299, in importOsm
    a.render()
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\app\blender.py", line 436, in render
    m.render()
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\building2\manager.py", line 15, in render
    renderer.render(building, self.data)
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\building2\renderer.py", line 188, in render
    action.do(building, buildingStyle, self)
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\action\volume\__init__.py", line 89, in do
    self.generateVolume(footprint)
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\action\volume\__init__.py", line 96, in generateVolume    
    volumeGenerator.do(footprint)
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\action\volume\roof.py", line 85, in do
    roofItem = self.init(footprint)
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\action\volume\roof.py", line 110, in init
    return self.getRoofItem(footprint)
  File "C:\Users\Roger\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\blosm\action\volume\roof_hipped.py", line 45, in getRoofItem    
    return ItemRoofHipped.getItem(self.itemFactory, footprint)
AttributeError: 'RoofHipped' object has no attribute 'itemFactory'
vvoovv commented 1 year ago

Strange, that I am getting the same error now and not getting the error from my previous message. I'll fix it.

polarkernel commented 1 year ago

It seems that I still have a configuration issue

I think, this is not true. Before I turned off Blender, I discovered that StreetGeneratorfinished its work without any error. The ways are all already rendered, the problem must be with the buildings. Berlin seems to have an extreme number of streetlights :)

1

vvoovv commented 1 year ago

Yes, the problem is seemingly in my code.

vvoovv commented 1 year ago

I committed an number of fixes.

Quite often I am getting the error mentioned above: image Maybe you can reproduce it.

Sometimes I am getting an error from my code. I will try to fix it.

polarkernel commented 1 year ago

Maybe you can reproduce it.

I was able to reproduce this error. It always appeared when I reimported from OSM, after a first import, without closing Blender. The reason was very strange and unexpected. I use the ID of way sections throughout the code for identification of them. It is built by the class variable NetSection.ID in the class NetSection, which is incremented for any new instance of this class. The same ID is then used in instances of the class WaySection. I was not yet able to find where, but new instances of this class are built during the construction of way-clusters, their ID maybe based on the length of the container of way-sections and not of the actual ID's.

Anyway, what I didn't expect was, that the class variable NetSection.ID sin't zero, when a new instance of StreetGenerator is created and its method go() is called. But I found, that it appears with the last value it had, before the last call of go() ended. It seems that class variables are initialized only once, when their file is imported, and then never again.

I fixed the bug for now by an instruction NetSection.ID = 0 at the beginning of go(), to get the state as I expected it. This fix is committed. There is still an error, but as I assume in your code.

polarkernel commented 1 year ago

Should the file _prochitecture_carriageway_withsidewalks.blend be added to assets in the branch? For now, I have put it in my .gitignore file.

vvoovv commented 1 year ago

Should the file _prochitecture_carriageway_withsidewalks.blend be added to assets in the branch? For now, I have put it in my .gitignore file.

Not yet. It was a test GN-setup. I will create a new one.

vvoovv commented 1 year ago

I committed the fix that eliminated the problem.