Skip to content
Snippets Groups Projects
Commit cb3f170d authored by Bastien Montagne's avatar Bastien Montagne
Browse files

Name added planes from the image name (like already done for textures and materials).

parent fc3ce74d
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
bl_info = { bl_info = {
"name": "Import Images as Planes", "name": "Import Images as Planes",
"author": "Florian Meyer (tstscr), mont29, matali", "author": "Florian Meyer (tstscr), mont29, matali",
"version": (1, 9), "version": (1, 9, 1),
"blender": (2, 66, 4), "blender": (2, 69, 0),
"location": "File > Import > Images as Planes or Add > Mesh > Images as Planes", "location": "File > Import > Images as Planes or Add > Mesh > Images as Planes",
"description": "Imports images and creates planes with the appropriate aspect ratio. " "description": "Imports images and creates planes with the appropriate aspect ratio. "
"The images are mapped to the planes.", "The images are mapped to the planes.",
...@@ -52,7 +52,7 @@ from bpy_extras.image_utils import load_image ...@@ -52,7 +52,7 @@ from bpy_extras.image_utils import load_image
DEFAULT_EXT = "*" DEFAULT_EXT = "*"
EXT_FILTER = getattr(collections, "OrderedDict", dict)(( EXT_FILTER = getattr(collections, "OrderedDict", dict)((
(DEFAULT_EXT, ((), "All image formats", "Import all know image (or movie) formats.")), (DEFAULT_EXT, ((), "All image formats", "Import all known image (or movie) formats.")),
("jpeg", (("jpeg", "jpg", "jpe"), "JPEG ({})", "Joint Photographic Experts Group")), ("jpeg", (("jpeg", "jpg", "jpe"), "JPEG ({})", "Joint Photographic Experts Group")),
("png", (("png", ), "PNG ({})", "Portable Network Graphics")), ("png", (("png", ), "PNG ({})", "Portable Network Graphics")),
("tga", (("tga", "tpic"), "Truevision TGA ({})", "")), ("tga", (("tga", "tpic"), "Truevision TGA ({})", "")),
...@@ -386,6 +386,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper): ...@@ -386,6 +386,7 @@ class IMPORT_OT_image_to_plane(Operator, AddObjectHelper):
if plane.mode is not 'OBJECT': if plane.mode is not 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT') bpy.ops.object.mode_set(mode='OBJECT')
plane.dimensions = x, y, 0.0 plane.dimensions = x, y, 0.0
plane.name = material.name
bpy.ops.object.transform_apply(scale=True) bpy.ops.object.transform_apply(scale=True)
plane.data.uv_textures.new() plane.data.uv_textures.new()
plane.data.materials.append(material) plane.data.materials.append(material)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment