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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-11-28 02:59:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2006-11-28 02:59:53 +0300
commita314527e2034df6ee53bb4d0e0c291dd6b3081c5 (patch)
tree2bc70d9828a8b7099c50a2de88b6dd1ee8512fc0 /release/scripts/import_obj.py
parentd2c2df27286b0cd425170dc95553a4485965f8d3 (diff)
when importing am OBJ referencing an unknown image (PSD in linux for eg) - it creates a dummy image.
checking the .depth of this dummy image raised an error. now a check for has_data is done.
Diffstat (limited to 'release/scripts/import_obj.py')
-rw-r--r--release/scripts/import_obj.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/release/scripts/import_obj.py b/release/scripts/import_obj.py
index 49d5c1c588c..fe16afea248 100644
--- a/release/scripts/import_obj.py
+++ b/release/scripts/import_obj.py
@@ -101,12 +101,12 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# Absolute path - c:\.. etc would work here
image= obj_image_load(imagepath, DIR, IMAGE_SEARCH)
-
+ has_data = image.has_data
texture.image = image
# Adds textures for materials (rendering)
if type == 'Kd':
- if image.depth == 32:
+ if has_data and image.depth == 32:
# Image has alpha
blender_material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL | Texture.MapTo.ALPHA)
texture.setImageFlags('MipMap', 'InterPol', 'UseAlpha')
@@ -117,7 +117,7 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# adds textures to faces (Textured/Alt-Z mode)
# Only apply the diffuse texture to the face if the image has not been set with the inline usemat func.
- unique_material_images[context_material_name]= image # set the texface image
+ unique_material_images[context_material_name]= image, has_data # set the texface image
elif type == 'Ka':
blender_material.setTexture(1, texture, Texture.TexCo.UV, Texture.MapTo.CMIR) # TODO- Add AMB to BPY API
@@ -148,7 +148,7 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
for name in unique_materials.iterkeys():
unique_materials[name]= Material.New(name)
- unique_material_images[name]= None # assign None to all material images to start with, add to later.
+ unique_material_images[name]= None, False # assign None to all material images to start with, add to later.
unique_materials[None]= None
@@ -441,10 +441,10 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
if verts_tex:
if context_material:
- image= unique_material_images[context_material]
+ image, has_data= unique_material_images[context_material]
if image: # Can be none if the material dosnt have an image.
blender_face.image= image
- if image.depth == 32:
+ if has_data and image.depth == 32:
blender_face.transp |= ALPHA
# BUG - Evil eekadoodle problem where faces that have vert index 0 location at 3 or 4 are shuffled.