Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix block model overlay geometry #501

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion MCprep_addon/spawner/mcmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,12 @@ def add_model(
)

face.normal_update()

# Give slight offset by normal for overlay geometry
if face_mat == "#overlay":
bmesh.ops.translate(bm, verts=face.verts,
vec=0.02 * face.normal)

for j in range(len(face.loops)):
# uv coords order is determened by the rotation of the uv,
# e.g. if the uv is rotated by 180 degrees, the first index
Expand All @@ -378,7 +384,9 @@ def add_model(
face.material_index = materials.index(face_mat)

# Quick way to clean the model, hopefully it doesn't cause any UV issues
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.01)
# Ignore model has overlay geometry, causing issue
if not textures.get("overlay"):
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.005)

# make the bmesh the object's mesh
bm.to_mesh(mesh)
Expand Down