Skip to content

Commit

Permalink
Tweaked printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
theFroh committed Oct 8, 2015
1 parent 30114a4 commit c524108
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Binary file modified imagepacker/__pycache__/imagepacker.cpython-34.pyc
Binary file not shown.
10 changes: 5 additions & 5 deletions imagepacker/imagepacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ def crop_by_extents(image, extent, wrap=False, crop=False):
w,h = image.size
coords = [math.floor(extent.min_x*w), math.floor(extent.min_y*h),
math.ceil(extent.max_x*w), math.ceil(extent.max_y*h)]
# # print("\nEXTENT")
# pprint(extent)
print("\nEXTENT")
pprint(extent)

if min(extent.min_x,extent.min_y) < 0 or max(extent.max_x,extent.max_y) > 1:
print("WARNING! UV Coordinates lying outside of [0:1] space!")

# pprint(coords)
pprint(coords)

if extent.to_wrap:
h_w, v_w = extent.wrapping()
Expand Down Expand Up @@ -197,7 +197,7 @@ def pack_images(image_paths, background=(0,0,0,0), format="PNG", extents=None, w
blocks = []
image_name_map = {}

image_paths.sort() # sort so we get repeatable file ordering
image_paths.sort() # sort so we get repeatable file ordering, I hope!

for filename in image_paths:
print("opening", filename)
Expand All @@ -206,7 +206,7 @@ def pack_images(image_paths, background=(0,0,0,0), format="PNG", extents=None, w
# rescale images
changes = None
if extents:
print(filename, image.size)
# print(filename, image.size)
image, changes = crop_by_extents(image, extents[filename], wrap, crop)

images.append(image)
Expand Down
8 changes: 4 additions & 4 deletions objuvpacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ def main():
parser.add_argument("-o","--output", nargs=1, help="output name, used for image and folder")
parser.add_argument("-a","--add", nargs="+", help="any additional images to pack")

# parser.add_argument('--crop', dest='crop', action='store_true')
parser.add_argument('--no-crop', dest='crop', action='store_false', help="do not attempt to crop textures to just what is used")
parser.add_argument('--no-wrap', dest='wrap', action='store_false', help="do not attempt to wrap textures outside of UV space")
parser.add_argument('--no-wrap', dest='wrap', action='store_false', help="do not attempt to wrap textures outside of UV space (must be cropping)")

parser.set_defaults(crop=True)

Expand Down Expand Up @@ -104,7 +103,6 @@ def main():
# raise ValueError("missing a required texture file " + line)
print("\tmissing a required texture file " + line)


# if dmap not in dmaps:
dmaps.append(dmap)
print("\tsaw texture map", dmap)
Expand Down Expand Up @@ -201,7 +199,7 @@ def __repr__(self):
# to see if the user wishes to un-wrap the texture

for name, extent in textents.items():
print(name, extent)
# print(name, extent)
if extent.wrapping():
h_w, v_w = extent.wrapping()
if h_w >= 2 or v_w >= 2:
Expand Down Expand Up @@ -284,6 +282,8 @@ def __repr__(self):
new_mtl.write("\n".join(new_mtl_lines))
output_image.save(outname, format="PNG")

print("\nRemember to convert the final packed texture into a JPEG if you do not need the transparency.")

output_image.show()

if __name__ == '__main__':
Expand Down

0 comments on commit c524108

Please sign in to comment.