Skip to content

Commit

Permalink
Updated map import addon to work with both Blender v3 (tested with v3…
Browse files Browse the repository at this point in the history
….6.5) and blender v4 (tested with v4.0.0)
  • Loading branch information
Jonathan-Greve committed Nov 15, 2023
1 parent 5d346b4 commit 712cf93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Binary file modified blender_addons/map_import_addon.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion blender_addons/map_import_addon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bl_info = {
"name": "Guild Wars Map Browser Map Importer",
"author": "Jonathan Bjørn Greve",
"version": (1, 0),
"version": (1, 1),
"blender": (3, 6, 5),
"location": "File > Import > GW Map Browser Map Folder",
"description": "Import a Guild Wars Map from a JSON file provided by Guild Wars Map Browser.",
Expand Down
10 changes: 8 additions & 2 deletions blender_addons/map_import_addon/import_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,16 @@ def create_water_surface(water_level=0.0, terrain_min_x_max_y=(-50000, 50000), t
bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')
bsdf.inputs['Base Color'].default_value = (0.0, 0.344, 0.55, 1) # Blue color
bsdf.inputs['Roughness'].default_value = 0.05 # Sharp reflections
bsdf.inputs['Transmission'].default_value = 0.95 # Transparency
bsdf.inputs['IOR'].default_value = 1.333 # Index of Refraction
bsdf.inputs['Alpha'].default_value = 0.8 # Transparency
bsdf.inputs['Emission'].default_value = (0.002, 0.004, 0.022, 1)

print(f'blender version: {bpy.app.version}')
if (4, 0, 0) >= bpy.app.version:
bsdf.inputs['Transmission Weight'].default_value = 0.95
bsdf.inputs['Emission Color'].default_value = (0.002, 0.004, 0.022, 1)
else:
bsdf.inputs['Transmission'].default_value = 0.95
bsdf.inputs['Emission'].default_value = (0.002, 0.004, 0.022, 1)

# Add Output node and link nodes
output_node = nodes.new('ShaderNodeOutputMaterial')
Expand Down

0 comments on commit 712cf93

Please sign in to comment.