MCPcopy Create free account
hub / github.com/TEA-Lab/TwoByTwo / triangulate_object

Function triangulate_object

data_util/blender_triangulate.py:4–18  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

2import sys
3
4def triangulate_object(obj):
5 bpy.ops.object.select_all(action='DESELECT')
6 obj.select_set(True)
7 # Select the object
8 bpy.context.view_layer.objects.active = obj
9 # Switch to object mode
10 bpy.ops.object.mode_set(mode='OBJECT')
11 # Switch to edit mode
12 bpy.ops.object.mode_set(mode='EDIT')
13 # Select all faces
14 bpy.ops.mesh.select_all(action='SELECT')
15 # Triangulate the mesh
16 bpy.ops.mesh.quads_convert_to_tris()
17 # Switch back to object mode
18 bpy.ops.object.mode_set(mode='OBJECT')
19
20def main():
21 input_path = sys.argv[-2]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected