forked from LeenkxTeam/LNXSDK
		
	Terrain Generation fix
This commit is contained in:
		@ -2319,7 +2319,10 @@ class LnxGenTerrainButton(bpy.types.Operator):
 | 
			
		||||
        node.location = (-200, -200)
 | 
			
		||||
        node.inputs[0].default_value = 5.0
 | 
			
		||||
        links.new(nodes['Bump'].inputs[2], nodes['_TerrainHeight'].outputs[0])
 | 
			
		||||
        links.new(nodes['Principled BSDF'].inputs[20], nodes['Bump'].outputs[0])
 | 
			
		||||
        if bpy.app.version[0] >= 4:
 | 
			
		||||
            links.new(nodes['Principled BSDF'].inputs[22], nodes['Bump'].outputs[0]) 
 | 
			
		||||
        else:
 | 
			
		||||
            links.new(nodes['Principled BSDF'].inputs[20], nodes['Bump'].outputs[0])
 | 
			
		||||
 | 
			
		||||
        # Create sectors
 | 
			
		||||
        root_obj = bpy.data.objects.new("Terrain", None)
 | 
			
		||||
@ -2352,7 +2355,16 @@ class LnxGenTerrainButton(bpy.types.Operator):
 | 
			
		||||
            disp_mod.texture.extension = 'EXTEND'
 | 
			
		||||
            disp_mod.texture.use_interpolation = False
 | 
			
		||||
            disp_mod.texture.use_mipmap = False
 | 
			
		||||
            disp_mod.texture.image = bpy.data.images.load(filepath=scn.lnx_terrain_textures+'/heightmap_' + j + '.png')
 | 
			
		||||
            try:
 | 
			
		||||
                disp_mod.texture.image = bpy.data.images.load(filepath=scn.lnx_terrain_textures+'/heightmap_' + j + '.png')
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                if i == 0:  # Only show message once
 | 
			
		||||
                    if scn.lnx_terrain_textures.startswith('//') and not bpy.data.filepath:
 | 
			
		||||
                        self.report({'INFO'}, "Generating terrain... Save .blend file and add your heightmaps for each sector in "
 | 
			
		||||
                                   "the \"Bundled\" folder using the format \"heightmap_01.png\", \"heightmap_02.png\", etc.")
 | 
			
		||||
                    else:
 | 
			
		||||
                        self.report({'INFO'}, f"Heightmap not found: {scn.lnx_terrain_textures}/heightmap_{j}.png - using blank image")
 | 
			
		||||
                
 | 
			
		||||
            f = 1
 | 
			
		||||
            levels = 0
 | 
			
		||||
            while f < disp_mod.texture.image.size[0]:
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user