fix for bug while importing transparent faces:
image.has_data can't be called before you load an image, otherwise it will return false even for valid images. The workaround is to try to run image.glLoad() before. That will crash if the image is corrupted (for we are using try/catch here). Campbell (ideasman42) thinks it would be better to have an api call proper for that. Since 2.4xx is close to its end I really don't think it's time to keep working in its API. Specially if we have similar functions doing what we need. @ Arystanbek (kazanbas): I'm done with the obj fixes I told you. You are free to go with the importers :) You may want to take a look at implementing a proper image.load() to 2.5 as Campbell suggested.
This commit is contained in:
		@@ -125,6 +125,16 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
 | 
			
		||||
		image= obj_image_load(imagepath, DIR, IMAGE_SEARCH)
 | 
			
		||||
		has_data = image.has_data
 | 
			
		||||
		texture.image = image
 | 
			
		||||
 | 
			
		||||
		if not has_data:
 | 
			
		||||
			try:
 | 
			
		||||
				# first time using this image. We need to load it first
 | 
			
		||||
				image.glLoad()
 | 
			
		||||
			except:
 | 
			
		||||
				# probably the image is crashed
 | 
			
		||||
				pass
 | 
			
		||||
			else:
 | 
			
		||||
				has_data = image.has_data
 | 
			
		||||
		
 | 
			
		||||
		# Adds textures for materials (rendering)
 | 
			
		||||
		if type == 'Kd':
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user