Skip to content

Commit

Permalink
fix uv bug and remove offsetting the entire level
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomityGuy committed Jul 11, 2022
1 parent 1e504d6 commit 62a32c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion blender_plugin/io_dif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"author": "RandomityGuy",
"description": "Dif import and export plugin for blender",
"blender": (2, 80, 0),
"version": (1, 2, 2),
"version": (1, 2, 3),
"location": "File > Import-Export",
"warning": "",
"category": "Import-Export",
Expand Down
6 changes: 5 additions & 1 deletion blender_plugin/io_dif/export_dif.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ def add_triangle(self, p1, p2, p3, uv1, uv2, uv3, n, material):
p2arr = (ctypes.c_float * len(p2))(*p2)
p3arr = (ctypes.c_float * len(p3))(*p3)

uv1 = (uv1[0], -uv1[1])
uv2 = (uv2[0], -uv2[1])
uv3 = (uv3[0], -uv3[1])

uv1arr = (ctypes.c_float * len(uv1))(*uv1)
uv2arr = (ctypes.c_float * len(uv2))(*uv2)
uv3arr = (ctypes.c_float * len(uv3))(*uv3)
Expand Down Expand Up @@ -332,7 +336,7 @@ def save(

depsgraph = context.evaluated_depsgraph_get()

off = get_offset(depsgraph, applymodifiers)
off = [0, 0, 0] #get_offset(depsgraph, applymodifiers)

tris = 0

Expand Down
6 changes: 3 additions & 3 deletions blender_plugin/io_dif/import_dif.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def plane_to_uv(pt, plane):

coord0 = [
plane_to_uv(pt0, tex_gen.planeX),
plane_to_uv(pt0, tex_gen.planeY),
-plane_to_uv(pt0, tex_gen.planeY),
]
coord1 = [
plane_to_uv(pt1, tex_gen.planeX),
plane_to_uv(pt1, tex_gen.planeY),
-plane_to_uv(pt1, tex_gen.planeY),
]
coord2 = [
plane_to_uv(pt2, tex_gen.planeX),
plane_to_uv(pt2, tex_gen.planeY),
-plane_to_uv(pt2, tex_gen.planeY),
]

indices.append((index0, len(normals), len(tex_coords)))
Expand Down

0 comments on commit 62a32c6

Please sign in to comment.