[Bf-extensions-cvs] [ae74dc5] master: Fix T40041: Incorrect UVs with FBX export.
Bastien Montagne
noreply at git.blender.org
Tue May 6 21:13:17 CEST 2014
Commit: ae74dc51cf37ee77786a4c76122feb7225bae648
Author: Bastien Montagne
Date: Tue May 6 21:08:51 2014 +0200
https://developer.blender.org/rBAae74dc51cf37ee77786a4c76122feb7225bae648
Fix T40041: Incorrect UVs with FBX export.
Export actually works perfectly well, here (Unity probably just does not supports scale in tex mapping...).
But importer completely ignored texmap data when working with non-nodal materials - we at least can support
offset and scale data here!
===================================================================
M io_scene_fbx/import_fbx.py
===================================================================
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 1ed46ee..ecb152f 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1214,7 +1214,7 @@ def load(operator, context, filepath="",
if not use_cycles:
# Simple function to make a new mtex and set defaults
- def material_mtex_new(material, image):
+ def material_mtex_new(material, image, tex_map):
tex = texture_cache.get(image)
if tex is None:
tex = bpy.data.textures.new(name=image.name, type='IMAGE')
@@ -1225,6 +1225,10 @@ def load(operator, context, filepath="",
mtex.texture = tex
mtex.texture_coords = 'UV'
mtex.use_map_color_diffuse = False
+
+ # No rotation here...
+ mtex.offset[:] = tex_map[0]
+ mtex.scale[:] = tex_map[2]
return mtex
for fbx_uuid, fbx_item in fbx_table_nodes.items():
@@ -1303,7 +1307,10 @@ def load(operator, context, filepath="",
if fbx_lnk_type.props[0] == b'OP':
lnk_type = fbx_lnk_type.props[3]
- mtex = material_mtex_new(material, image)
+ # tx/rot/scale (rot is ignored here!).
+ tex_map = texture_mapping_get(fbx_lnk)
+
+ mtex = material_mtex_new(material, image, tex_map)
if lnk_type == b'DiffuseColor':
mtex.use_map_color_diffuse = True
More information about the Bf-extensions-cvs
mailing list