本文整理汇总了Python中BPyMesh.mesh2linkedFaces方法的典型用法代码示例。如果您正苦于以下问题:Python BPyMesh.mesh2linkedFaces方法的具体用法?Python BPyMesh.mesh2linkedFaces怎么用?Python BPyMesh.mesh2linkedFaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPyMesh
的用法示例。
在下文中一共展示了BPyMesh.mesh2linkedFaces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: export_map
# 需要导入模块: import BPyMesh [as 别名]
# 或者: from BPyMesh import mesh2linkedFaces [as 别名]
def export_map(filepath):
pup_block = [\
('Scale:', PREF_SCALE, 1, 1000, 'Scale the blender scene by this value.'),\
('Face Width:', PREF_FACE_THICK, 0.01, 10, 'Thickness of faces exported as brushes.'),\
('Grid Snap', PREF_GRID_SNAP, 'snaps floating point values to whole numbers.'),\
'Null Texture',\
('', PREF_NULL_TEX, 1, 128, 'Export textureless faces with this texture'),\
'Unseen Texture',\
('', PREF_INVIS_TEX, 1, 128, 'Export invisible faces with this texture'),\
]
if not Draw.PupBlock('map export', pup_block):
return
Window.WaitCursor(1)
time= sys.time()
print 'Map Exporter 0.0'
file= open(filepath, 'w')
obs_mesh= []
obs_lamp= []
obs_surf= []
obs_empty= []
SCALE_MAT= Mathutils.Matrix()
SCALE_MAT[0][0]= SCALE_MAT[1][1]= SCALE_MAT[2][2]= PREF_SCALE.val
dummy_mesh= Mesh.New()
TOTBRUSH= TOTLAMP= TOTNODE= 0
for ob in Object.GetSelected():
type= ob.type
if type == 'Mesh': obs_mesh.append(ob)
elif type == 'Surf': obs_surf.append(ob)
elif type == 'Lamp': obs_lamp.append(ob)
elif type == 'Empty': obs_empty.append(ob)
if obs_mesh or obs_surf:
# brushes and surf's must be under worldspan
file.write('\n// entity 0\n')
file.write('{\n')
file.write('"classname" "worldspawn"\n')
print '\twriting cubes from meshes'
for ob in obs_mesh:
dummy_mesh.getFromObject(ob.name)
#print len(mesh_split2connected(dummy_mesh))
# Is the object 1 cube? - object-is-a-brush
dummy_mesh.transform(ob.matrixWorld*SCALE_MAT) # 1 to tx the normals also
if PREF_GRID_SNAP.val:
for v in dummy_mesh.verts:
co= v.co
co.x= round(co.x)
co.y= round(co.y)
co.z= round(co.z)
# High quality normals
BPyMesh.meshCalcNormals(dummy_mesh)
# Split mesh into connected regions
for face_group in BPyMesh.mesh2linkedFaces(dummy_mesh):
if is_cube_facegroup(face_group):
write_cube2brush(file, face_group)
TOTBRUSH+=1
elif is_tricyl_facegroup(face_group):
write_cube2brush(file, face_group)
TOTBRUSH+=1
else:
for f in face_group:
write_face2brush(file, f)
TOTBRUSH+=1
#print 'warning, not exporting "%s" it is not a cube' % ob.name
dummy_mesh.verts= None
valid_dims= 3,5,7,9,11,13,15
for ob in obs_surf:
'''
Surf, patches
'''
surf_name= ob.getData(name_only=1)
data= Curve.Get(surf_name)
mat = ob.matrixWorld*SCALE_MAT
# This is what a valid patch looks like
"""
// brush 0
{
patchDef2
#.........这里部分代码省略.........