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

terrain analysis errors #912

Open vac9181 opened 3 months ago

vac9181 commented 3 months ago

Blender and OS versions

Operating system: win11 64bit

Blender Version 4.1.1

Describe the bug trying to make a dem and trying to use the terrain analysis i get two errors

How to Reproduce use the node menu in gis and click terrain analysis

Error message

Python: Traceback (most recent call last): File "C:\Users\Ian\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderGIS-master\operators\nodes_terrain_analysis_builder.py", line 71, in execute scaleNodesGroupTree.inputs.new('NodeSocketFloat','val') ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'ShaderNodeTree' object has no attribute 'inputs'

Python: Traceback (most recent call last): File "C:\Users\Ian\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderGIS-master\operators\nodes_terrain_analysis_builder.py", line 63, in execute scaleNodesGroupTree.inputs.clear() ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'ShaderNodeTree' object has no attribute 'inputs'

vac9181 commented 3 months ago

anyone know a work around for this or is it a case of waiting for him to fix it?

Joe-Maz commented 2 months ago

Hi, Had the same problem when using blender 4.1 because they changed a few things. I looked into it and changed a few things for myself in a file named: nodes_terrain_analysis_builder.py

I have pasted what I changed and you can try it for yourself.

Copy and paste this between lines 59 & 77 in your file located:

C:\Users\You\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\BlenderGIS-master\operators.

Make a copy of the original just in case.

#groupsTree.remove(groupsTree['Normalize'])
            scaleNodesGroupTree = groupsTree['Normalize']
            scaleNodesGroupTree.nodes.clear()
            scaleNodesGroupTree.interface.clear()
        else:
            scaleNodesGroupTree = groupsTree.new('Normalize', 'ShaderNodeTree') # = bpy.types.node_tree
        scaleNodesGroupName = scaleNodesGroupTree.name #Normalize.001 if normalize already exists
        #  group inputs
        scaleInputsNode = scaleNodesGroupTree.nodes.new('NodeGroupInput')
        scaleInputsNode.location = (-350,0)
        scaleNodesGroupTree.interface.new_socket(name='val', in_out='INPUT', socket_type='NodeSocketFloat')
        scaleNodesGroupTree.interface.new_socket(name='min', in_out='INPUT', socket_type='NodeSocketFloat')
        scaleNodesGroupTree.interface.new_socket(name='max', in_out='INPUT', socket_type='NodeSocketFloat')
        #  group outputs
        scaleOutputsNode = scaleNodesGroupTree.nodes.new('NodeGroupOutput')
        scaleOutputsNode.location = (300,0)
        scaleNodesGroupTree.interface.new_socket(name='val', in_out='OUTPUT', socket_type='NodeSocketFloat')

Hope it works for you!

vac9181 commented 2 months ago

you sir just fixed it for me thank you . it wasn't working i tried doing it 4 times and i was getting an error about line 71 but it turns out i had opened 4.1 and was adding your fix to that blender and not 4.2 LOL but 4.2 is all working now thanks again