[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31322] trunk/blender: bugfix [#22037] OBJ exporter produce wrong UV

Campbell Barton ideasman42 at gmail.com
Fri Aug 13 18:59:12 CEST 2010


Revision: 31322
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31322
Author:   campbellbarton
Date:     2010-08-13 18:59:11 +0200 (Fri, 13 Aug 2010)

Log Message:
-----------
bugfix [#22037] OBJ exporter produce wrong UV

Modified Paths:
--------------
    trunk/blender/release/scripts/io/import_scene_obj.py
    trunk/blender/source/blender/makesrna/intern/rna_material_api.c

Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_obj.py	2010-08-13 16:34:21 UTC (rev 31321)
+++ trunk/blender/release/scripts/io/import_scene_obj.py	2010-08-13 16:59:11 UTC (rev 31322)
@@ -375,38 +375,32 @@
                 # Image has alpha
 
                 # XXX bitmask won't work?
-                blender_material.add_texture(texture, "UV", ("COLOR", "ALPHA"))
+                blender_material.add_texture(texture, 'UV', {'COLOR', 'ALPHA'})
                 texture.mipmap = True
                 texture.interpolation = True
                 texture.use_alpha = True
-                blender_material.z_transparency = True
+                blender_material.transparency = True
                 blender_material.alpha = 0.0
-
-# 				blender_material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL | Texture.MapTo.ALPHA)
-# 				texture.setImageFlags('MipMap', 'InterPol', 'UseAlpha')
-# 				blender_material.mode |= Material.Modes.ZTRANSP
-# 				blender_material.alpha = 0.0
             else:
-                blender_material.add_texture(texture, "UV", "COLOR")
-# 				blender_material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL)
+                blender_material.add_texture(texture, 'UV', 'COLOR')
 
             # 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, has_data # set the texface image
 
         elif type == 'Ka':
-            blender_material.add_texture(texture, "UV", "AMBIENT")
+            blender_material.add_texture(texture, 'UV', 'AMBIENT')
 # 			blender_material.setTexture(1, texture, Texture.TexCo.UV, Texture.MapTo.CMIR) # TODO- Add AMB to BPY API
 
         elif type == 'Ks':
-            blender_material.add_texture(texture, "UV", "SPECULARITY")
+            blender_material.add_texture(texture, 'UV', 'SPECULARITY')
 # 			blender_material.setTexture(2, texture, Texture.TexCo.UV, Texture.MapTo.SPEC)
 
         elif type == 'Bump':
-            blender_material.add_texture(texture, "UV", "NORMAL")
+            blender_material.add_texture(texture, 'UV', 'NORMAL')
 # 			blender_material.setTexture(3, texture, Texture.TexCo.UV, Texture.MapTo.NOR)
         elif type == 'D':
-            blender_material.add_texture(texture, "UV", "ALPHA")
+            blender_material.add_texture(texture, 'UV', 'ALPHA')
             blender_material.z_transparency = True
             blender_material.alpha = 0.0
 # 			blender_material.setTexture(4, texture, Texture.TexCo.UV, Texture.MapTo.ALPHA)
@@ -415,7 +409,7 @@
             # Todo, unset deffuse material alpha if it has an alpha channel
 
         elif type == 'refl':
-            blender_material.add_texture(texture, "UV", "REFLECTION")
+            blender_material.add_texture(texture, 'UV', 'REFLECTION')
 # 			blender_material.setTexture(5, texture, Texture.TexCo.UV, Texture.MapTo.REF)
 
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_material_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_material_api.c	2010-08-13 16:34:21 UTC (rev 31321)
+++ trunk/blender/source/blender/makesrna/intern/rna_material_api.c	2010-08-13 16:59:11 UTC (rev 31322)
@@ -42,7 +42,7 @@
   Adds material to the first free texture slot.
   If all slots are busy, replaces the first.
 */
-static void rna_Material_add_texture(Material *ma, Tex *tex, int mapto, int texco)
+static void rna_Material_add_texture(Material *ma, Tex *tex, int texco, int mapto)
 {
 	int i;
 	MTex *mtex;
@@ -71,8 +71,8 @@
 	if (tex)
 		id_us_plus(&tex->id);
 	
-	mtex->texco= mapto;
-	mtex->mapto= texco;
+	mtex->texco= texco;
+	mtex->mapto= mapto;
 }
 
 #else
@@ -121,6 +121,7 @@
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm= RNA_def_enum(func, "texture_coordinates", prop_texture_coordinates_items, TEXCO_UV, "", "Source of texture coordinate information."); /* optional */
 	parm= RNA_def_enum(func, "map_to", prop_texture_mapto_items, MAP_COL, "", "Controls which material property the texture affects."); /* optional */
+	RNA_def_property_flag(parm, PROP_ENUM_FLAG);
 }
 
 #endif





More information about the Bf-blender-cvs mailing list