[Bf-blender-cvs] [6e2da0883f6] master: Fix T61309: mesh_utils.triangle_random_points fails with a TypeError
Philipp Oeser
noreply at git.blender.org
Fri Feb 8 13:59:57 CET 2019
Commit: 6e2da0883f6359c5c1a35cbc7691f543e9603722
Author: Philipp Oeser
Date: Fri Feb 8 13:08:01 2019 +0100
Branches: master
https://developer.blender.org/rB6e2da0883f6359c5c1a35cbc7691f543e9603722
Fix T61309: mesh_utils.triangle_random_points fails with a TypeError
Caused by an error in rBe65784a0519e.
And since we are going over loop triangles anyways, we can remove the
part quecking for quads [remainder of tessface era] entirely.
Reviewers: campbellbarton
Maniphest Tasks: T61309
Differential Revision: https://developer.blender.org/D4324
===================================================================
M release/scripts/modules/bpy_extras/mesh_utils.py
===================================================================
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py
index 85356206482..e76d1f1815e 100644
--- a/release/scripts/modules/bpy_extras/mesh_utils.py
+++ b/release/scripts/modules/bpy_extras/mesh_utils.py
@@ -454,19 +454,6 @@ def triangle_random_points(num_points, loop_triangles):
tv = (verts[ltv[0]].co, verts[ltv[1]].co, verts[ltv[2]].co)
for k in range(num_points):
- # If this is a quad, we need to weight its 2 tris by their area
- if len(tv) != 1:
- area1 = area_tri(*tv[0])
- area2 = area_tri(*tv[1])
- area_tot = area1 + area2
-
- area1 = area1 / area_tot
- area2 = area2 / area_tot
-
- vecs = tv[0 if (random() < area1) else 1]
- else:
- vecs = tv[0]
-
u1 = random()
u2 = random()
u_tot = u1 + u2
@@ -475,10 +462,10 @@ def triangle_random_points(num_points, loop_triangles):
u1 = 1.0 - u1
u2 = 1.0 - u2
- side1 = vecs[1] - vecs[0]
- side2 = vecs[2] - vecs[0]
+ side1 = tv[1] - tv[0]
+ side2 = tv[2] - tv[0]
- p = vecs[0] + u1 * side1 + u2 * side2
+ p = tv[0] + u1 * side1 + u2 * side2
sampled_points[num_points * i + k] = p
More information about the Bf-blender-cvs
mailing list