Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-06-22 15:52:48 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-06-22 15:52:48 +0300
commitd30b480adef09eec91cc68179a27b6a7d5a743ad (patch)
treed2a710bee15ef4e667d879e8b11ba64986cbe4e5 /io_import_images_as_planes.py
parent1883ee23fb258e05c91b4fb2121d7150b6673cd9 (diff)
Fix (unreported) wrong alignement of planes when importing multiple images at once.
Also, name meshes from image names too.
Diffstat (limited to 'io_import_images_as_planes.py')
-rw-r--r--io_import_images_as_planes.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py
index 8b5ea337..8e54c91b 100644
--- a/io_import_images_as_planes.py
+++ b/io_import_images_as_planes.py
@@ -19,7 +19,7 @@
bl_info = {
"name": "Import Images as Planes",
"author": "Florian Meyer (tstscr), mont29, matali",
- "version": (2, 0, 1),
+ "version": (2, 0, 2),
"blender": (2, 74, 0),
"location": "File > Import > Images as Planes or Add > Mesh > Images as Planes",
"description": "Imports images and creates planes with the appropriate aspect ratio. "
@@ -382,7 +382,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
if plane.mode is not 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
plane.dimensions = x, y, 0.0
- plane.name = material.name
+ plane.data.name = plane.name = material.name
bpy.ops.object.transform_apply(scale=True)
plane.data.uv_textures.new()
plane.data.materials.append(material)
@@ -394,15 +394,11 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
def align_planes(self, planes):
gap = self.align_offset
- offset = 0
- for i, plane in enumerate(planes):
- offset += (plane.dimensions.x / 2.0) + gap
- if i == 0:
- continue
- move_local = mathutils.Vector((offset, 0.0, 0.0))
- move_world = plane.location + move_local * plane.matrix_world.inverted()
- plane.location += move_world
- offset += (plane.dimensions.x / 2.0)
+ offset = (planes[0].dimensions.x / 2.0) + gap
+ for plane in planes[1:]:
+ move_global = mathutils.Vector((offset + (plane.dimensions.x / 2.0), 0.0, 0.0))
+ plane.location = plane.matrix_world * move_global
+ offset += plane.dimensions.x + gap
def generate_paths(self):
return (fn.name for fn in self.files if is_image_fn(fn.name, self.extension)), self.directory