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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-11 15:09:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-11 15:09:15 +0300
commita2f135e7d725d3a9232dfef1ee19ecae2efb9e31 (patch)
tree9523e898ac2162a9a167740cec314cec8a1ab813
parent914ac4194f3070cc12338e533b6e29610faeb3aa (diff)
use mesh.validate() to ensure all meshes of imported data is ok and wont crash blender.
-rw-r--r--io_mesh_ply/import_ply.py1
-rw-r--r--io_mesh_raw/import_raw.py2
-rw-r--r--io_mesh_stl/blender_utils.py1
-rw-r--r--io_scene_3ds/import_3ds.py4
-rw-r--r--io_scene_obj/import_obj.py2
-rw-r--r--io_scene_x3d/import_x3d.py4
6 files changed, 10 insertions, 4 deletions
diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py
index 1dac3a8d..8e5db68e 100644
--- a/io_mesh_ply/import_ply.py
+++ b/io_mesh_ply/import_ply.py
@@ -307,6 +307,7 @@ def load_ply(filepath):
for j, col in enumerate(f_col):
col.r, col.g, col.b = ply_col[j]
+ mesh.validate()
mesh.update()
scn = bpy.context.scene
diff --git a/io_mesh_raw/import_raw.py b/io_mesh_raw/import_raw.py
index b8e96209..4b5b7304 100644
--- a/io_mesh_raw/import_raw.py
+++ b/io_mesh_raw/import_raw.py
@@ -107,6 +107,8 @@ def addMeshObj(mesh, objName):
o.select = False
mesh.update()
+ mesh.validate()
+
nobj = bpy.data.objects.new(objName, mesh)
scn.objects.link(nobj)
nobj.select = True
diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py
index 3d0ef076..f763929a 100644
--- a/io_mesh_stl/blender_utils.py
+++ b/io_mesh_stl/blender_utils.py
@@ -34,6 +34,7 @@ def create_and_link_mesh(name, faces, points):
bpy.context.scene.objects.link(ob)
# update mesh to allow proper display
+ mesh.validate()
mesh.update()
diff --git a/io_scene_3ds/import_3ds.py b/io_scene_3ds/import_3ds.py
index e53222bd..0a86cdc1 100644
--- a/io_scene_3ds/import_3ds.py
+++ b/io_scene_3ds/import_3ds.py
@@ -324,6 +324,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
uf.uv3 = contextMeshUV[v3 * 2:(v3 * 2) + 2]
# always a tri
+ bmesh.validate()
+ bmesh.update()
+
ob = bpy.data.objects.new(contextObName, bmesh)
object_dictionary[contextObName] = ob
SCN.objects.link(ob)
@@ -338,7 +341,6 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
object_matrix[ob] = contextMatrix_rot.copy()
importedObjects.append(ob)
- bmesh.update()
#a spare chunk
new_chunk = chunk()
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 37c8df3d..1056fde0 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -842,8 +842,8 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
# me_edges[ed].flag |= SHARP
# del SHARP
+ me.validate()
me.update(calc_edges=CREATE_EDGES)
-# me.calcNormals()
ob = bpy.data.objects.new("Mesh", me)
new_objects.append(ob)
diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index b4b9fe09..e9393234 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -1699,7 +1699,7 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
#for f in faces:
# bpymesh.faces.extend(faces, smooth=True)
- # bpymesh.calcNormals()
+ bpymesh.validate()
bpymesh.update()
if len(bpymesh.faces) != len(faces):
@@ -1916,7 +1916,7 @@ def importMesh_PointSet(geom, ancestry):
bpymesh.vertices.add(len(points))
bpymesh.vertices.foreach_set("co", [a for v in points for a in v])
- # bpymesh.calcNormals() # will just be dummy normals
+ # No need to validate
bpymesh.update()
return bpymesh