diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-24 11:11:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-24 11:11:42 +0400 |
commit | 199da926e833a87c90e817f47bbee9d586d195ae (patch) | |
tree | c957cf89760bb86f7a7028384caec687bedc26c9 | |
parent | c204e1a522962420e0df103e03edc26990ce7117 (diff) |
fix for exception if the image data cant be loaded
-rw-r--r-- | io_import_images_as_planes.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py index ba3030f2..1c3989e3 100644 --- a/io_import_images_as_planes.py +++ b/io_import_images_as_planes.py @@ -124,12 +124,18 @@ def create_material_for_texture(self, texture): def create_image_plane(self, context, material): img = material.texture_slots[0].texture.image - x = img.size[0] / img.size[1] - y = 1 + px, py = img.size + + # can't load data + if px == 0 or py == 0: + px = py = 1 + + x = px / py + y = 1.0 if self.use_dimension: - x = (img.size[0] * (1.0 / self.factor)) * 0.5 - y = (img.size[1] * (1.0 / self.factor)) * 0.5 + x = (px * (1.0 / self.factor)) * 0.5 + y = (py * (1.0 / self.factor)) * 0.5 verts = [(-x, -y, 0), (x, -y, 0), |