Пример #1
0
def setMesh(bmesh, ob, matrix = None) :
	""" Update a mesh from a bmesh object
	"""
	#Before setting mesh data assign matrix:
	if matrix is not None :
		ob.matrix_world = matrix
	bmesh.normal_update()
	bmesh.to_mesh(ob.data)
	return ob
Пример #2
0
def setMesh(bmesh, ob, matrix=None):
    """ Update a mesh from a bmesh object
	"""
    #Before setting mesh data assign matrix:
    if matrix is not None:
        ob.matrix_world = matrix
    bmesh.normal_update()
    bmesh.to_mesh(ob.data)
    return ob
Пример #3
0
def setNamedMesh(bmesh, object_name, scene = None, matrix = None) :
	""" Update a mesh from a bmesh object name
	"""
	try :
		ob = getObject(object_name)
		#Before setting mesh data assign matrix:
		if matrix is not None :
			ob.matrix_world = matrix
		bmesh.normal_update()
		bmesh.to_mesh(ob.data)
		return ob
	except :
		return createMesh(bmesh, scene, object_name)
Пример #4
0
def setNamedMesh(bmesh, object_name, scene=None, matrix=None):
    """ Update a mesh from a bmesh object name
	"""
    try:
        ob = getObject(object_name)
        #Before setting mesh data assign matrix:
        if matrix is not None:
            ob.matrix_world = matrix
        bmesh.normal_update()
        bmesh.to_mesh(ob.data)
        return ob
    except:
        return createMesh(bmesh, scene, object_name)
Пример #5
0
def createMesh(bmesh, scene = None, matrix = None, name = "Object") :
	"""
	Create a blender mesh object from a specified bmesh and context
	bmesh:		Mesh to create a object for
	scene:		Scene the new object will be added to
	name:		Name of the object added 
	"""
	mesh = bpy.data.meshes.new(name + "_Mesh") 		# create a new mesh with the name
	newOb = bpy.data.objects.new(name, mesh)	# create an object with that mesh
	if matrix is not None :
		newOb.matrix_world = matrix
	#Link to scene
	if scene is not None :
		scene.objects.link(newOb)  
	#Set bmesh
	bmesh.normal_update()  	
	bmesh.to_mesh(newOb.data)					
	return newOb
Пример #6
0
def createMesh(bmesh, scene=None, matrix=None, name="Object"):
    """
	Create a blender mesh object from a specified bmesh and context
	bmesh:		Mesh to create a object for
	scene:		Scene the new object will be added to
	name:		Name of the object added
	"""
    mesh = bpy.data.meshes.new(name +
                               "_Mesh")  # create a new mesh with the name
    newOb = bpy.data.objects.new(name, mesh)  # create an object with that mesh
    if matrix is not None:
        newOb.matrix_world = matrix
    #Link to scene
    if scene is not None:
        scene.objects.link(newOb)
    #Set bmesh
    bmesh.normal_update()
    bmesh.to_mesh(newOb.data)
    return newOb