Skip to content

Commit

Permalink
Fixed code generation for meshmap node when there's no current mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Nov 20, 2023
1 parent a935f06 commit 0d240a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addons/material_maker/engine/nodes/gen_meshmap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ func _get_shader_code(uv : String, output_index : int, context : MMGenContext) -
code = code.replace("$NODE", "o%d" % get_instance_id())
code = code.replace("$TEXTURE", texture_name)
code = code.replace("$UV", uv)
var aabb : AABB
if current_mesh:
var aabb : AABB = current_mesh.get_aabb()
code = code.replace("$AABB_POSITION", "vec3(%.09f, %.09f, %.09f)" % [aabb.position.x, aabb.position.y, aabb.position.z])
code = code.replace("$AABB_SIZE", "vec3(%.09f, %.09f, %.09f)" % [aabb.size.x, aabb.size.y, aabb.size.z])
aabb = current_mesh.get_aabb()
code = code.replace("$AABB_POSITION", "vec3(%.09f, %.09f, %.09f)" % [aabb.position.x, aabb.position.y, aabb.position.z])
code = code.replace("$AABB_SIZE", "vec3(%.09f, %.09f, %.09f)" % [aabb.size.x, aabb.size.y, aabb.size.z])
rv.code = code
rv.output_values[rv.output_type] = "%s_%d" % [ genname, variant_index ]
return rv
Expand Down

0 comments on commit 0d240a4

Please sign in to comment.