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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-06 15:28:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-10 18:43:44 +0300
commite65784a0519e25e9ca560ab63758287cea45f123 (patch)
tree2452488152b951d029f68b34f20803254066b27b /doc/python_api/rst/info_best_practice.rst
parent468474a653c976615306254dfcc33a85a0b872a1 (diff)
Python API: add loop triangles access, remove tessfaces.
Loop triangles are tessellated triangles create from polygons, for renderers or exporters that need to match Blender's polygon tesselation exactly. These are a read-only runtime cache. Tessfaces are a legacy data structure from before Blender supported n-gons, and were already mostly removed from the C code. Details on porting code to loop triangles is in the release notes. Differential Revision: https://developer.blender.org/D3539
Diffstat (limited to 'doc/python_api/rst/info_best_practice.rst')
-rw-r--r--doc/python_api/rst/info_best_practice.rst16
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst
index 418f636030c..b9c9f234b72 100644
--- a/doc/python_api/rst/info_best_practice.rst
+++ b/doc/python_api/rst/info_best_practice.rst
@@ -164,26 +164,26 @@ for list removal, but these are slower.
Sometimes its faster (but more memory hungry) to just rebuild the list.
-Say you want to remove all triangular faces in a list.
+Say you want to remove all triangular polygons in a list.
Rather than...
.. code-block:: python
- faces = mesh.tessfaces[:] # make a list copy of the meshes faces
- f_idx = len(faces) # Loop backwards
- while f_idx: # while the value is not 0
- f_idx -= 1
+ polygons = mesh.polygons[:] # make a list copy of the meshes polygons
+ p_idx = len(polygons) # Loop backwards
+ while p_idx: # while the value is not 0
+ p_idx -= 1
- if len(faces[f_idx].vertices) == 3:
- faces.pop(f_idx) # remove the triangle
+ if len(polygons[p_idx].vertices) == 3:
+ polygons.pop(p_idx) # remove the triangle
It's faster to build a new list with list comprehension.
.. code-block:: python
- faces = [f for f in mesh.tessfaces if len(f.vertices) != 3]
+ polygons = [p for p in mesh.polygons if len(p.vertices) != 3]
Adding List Items