From cfdef7a88af35131a1b10af6a2b511f9e0bb5bfb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 29 Mar 2007 14:35:01 +0000 Subject: [PATCH] ICVS: ---------------------------------------------------------------------- import OBJ dosnt raise a Py Error when no image is given for a material export FBX works much better, tested 179 models and dosnt crash on any now. tested import export with large scene, 375,000 tri's. Mesh.py doc note about UV coords,, editmesh_add minor typo --- release/scripts/export_fbx.py | 8 ++++---- release/scripts/import_obj.py | 18 ++++++++++++------ source/blender/python/api2_2x/doc/Mesh.py | 1 + source/blender/src/editmesh_add.c | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/release/scripts/export_fbx.py b/release/scripts/export_fbx.py index c4a7ed7d8b2..5f05c3d4347 100644 --- a/release/scripts/export_fbx.py +++ b/release/scripts/export_fbx.py @@ -1615,7 +1615,7 @@ Objects: {''') ''' MultiLayer: 0 MultiTake: 1 Shading: Y - Culling: "CullingOff"hr + Culling: "CullingOff" TypeFlags: "Null" }''') @@ -1698,7 +1698,7 @@ Objects: {''') UV: ''') i = -1 - ii = 0 + ii = 0 # Count how many UVs we write for f in me.faces: for uv in f.uv: @@ -1711,11 +1711,11 @@ Objects: {''') i=0 file.write(',%.6f,%.6f' % tuple(uv)) i+=1 - ii+=1 + ii+=1 # One more UV file.write('\n UVIndex: ') i = -1 - for j in xrange(len(me.faces)): + for j in xrange(ii): if i == -1: file.write('%i' % j) i=0 diff --git a/release/scripts/import_obj.py b/release/scripts/import_obj.py index 699be0a265e..4d534a772fb 100644 --- a/release/scripts/import_obj.py +++ b/release/scripts/import_obj.py @@ -209,23 +209,29 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_ context_material.setAlpha(float(line_split[1])) elif line_lower.startswith('map_ka'): img_filepath= line_value(line.split()) - load_material_image(context_material, context_material_name, img_filepath, 'Ka') + if img_filepath: + load_material_image(context_material, context_material_name, img_filepath, 'Ka') elif line_lower.startswith('map_ks'): img_filepath= line_value(line.split()) - load_material_image(context_material, context_material_name, img_filepath, 'Ks') + if img_filepath: + load_material_image(context_material, context_material_name, img_filepath, 'Ks') elif line_lower.startswith('map_kd'): img_filepath= line_value(line.split()) - load_material_image(context_material, context_material_name, img_filepath, 'Kd') + if img_filepath: + load_material_image(context_material, context_material_name, img_filepath, 'Kd') elif line_lower.startswith('map_bump'): img_filepath= line_value(line.split()) - load_material_image(context_material, context_material_name, img_filepath, 'Bump') + if img_filepath: + load_material_image(context_material, context_material_name, img_filepath, 'Bump') elif line_lower.startswith('map_d') or line_lower.startswith('map_tr'): # Alpha map - Dissolve img_filepath= line_value(line.split()) - load_material_image(context_material, context_material_name, img_filepath, 'D') + if img_filepath: + load_material_image(context_material, context_material_name, img_filepath, 'D') elif line_lower.startswith('refl'): # Reflectionmap img_filepath= line_value(line.split()) - load_material_image(context_material, context_material_name, img_filepath, 'refl') + if img_filepath: + load_material_image(context_material, context_material_name, img_filepath, 'refl') mtl.close() diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index 888a87cc47a..8657edbab2b 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -198,6 +198,7 @@ class MVert: v.no= no @type no: vector @ivar uvco: The vertex texture "sticky" coordinates (x, y), + B{Note}: These are not seen in the UV editor and they are not a part of UV a UVLayer. Use face UV's for that. if present. Available for MVerts only. Use L{Mesh.vertexUV} to test for presence before trying to access; otherwise an exception will may be thrown. diff --git a/source/blender/src/editmesh_add.c b/source/blender/src/editmesh_add.c index be461b5c8ac..9358be773f7 100644 --- a/source/blender/src/editmesh_add.c +++ b/source/blender/src/editmesh_add.c @@ -1225,7 +1225,7 @@ void add_primitiveMesh(int type) add_numbut(0, NUM|INT, "Vertices:", 2, 500, &tot, NULL); add_numbut(1, NUM|FLO, "Radius:", 0.001*G.vd->grid, 100*G.vd->grid, &dia, NULL); add_numbut(2, NUM|FLO, "Depth:", 0.001*G.vd->grid, 100*G.vd->grid, &d, NULL); - add_numbut(3, TOG|INT, "Cap Ends", 0, 0, &(fill), NULL); + add_numbut(3, TOG|INT, "Cap End", 0, 0, &(fill), NULL); if (!(do_clever_numbuts("Add Cone", 4, REDRAW))) return; d/=2; ext= 0;