示例#1
0
文件: loop.py 项目: triazo/meshblend
# Eventually needs to be [([quad_net(as index)], [faces(as indexes)], (patch1...patch4))]
data_structure_thingy = []


for q in quad_nets:
    f1 = centroids_to_faces[quad_net_v[quad_nets[q]["points"][1]]]
    f2 = centroids_to_faces[quad_net_v[quad_nets[q]["points"][5]]]
    f3 = centroids_to_faces[quad_net_v[quad_nets[q]["points"][9]]]
    f4 = centroids_to_faces[quad_net_v[quad_nets[q]["points"][13]]]
    q_faces = [f1, f2, f3, f4]
    data_structure_thingy.append(
        (quartic_patches(*control_points(q_obj, quad_nets[q])), quad_nets[q]["points"], quad_nets[q]["new_face"])
    )


import random
import importlib

import uv_map
import image

importlib.reload(uv_map)
importlib.reload(image)

nonce = "".join(["0123456789abcdef"[random.randint(0, 15)] for x in range(8)])

image.make_image(data_structure_thingy, "colors-" + nonce + ".png")
uv_map.map_patches(q_obj, "colors-" + nonce + ".png", data_structure_thingy)
print("Done")
示例#2
0
    
    for i in patch[1]:
        bm.verts[i].select = True
        
    bmesh.update_edit_mesh(ob.data, True)
    
def select_all(ob):
    bpy.ops.object.mode_set(mode='EDIT')
    bm = bmesh.from_edit_mesh(ob.data)
    bm.faces.ensure_lookup_table()
    for f in bm.faces:
        f.select = True

def deselect_all():
    scn = bpy.context.scene
    for o in scn.objects:
        o.select = False
        
    scn.objects.active = None
    
if __name__ == "__main__":
    print("Created nonce: %s"%nonce)
    if bpy.context.active_object:
        bpy.ops.object.mode_set(mode='OBJECT')
    deselect_all()
    ob, patches = new_grid(30,30,.1)
    #test_select(ob, patches[0])
    image.make_image(patches, "colors-"+nonce+".png")
    uv_map.map_patches(ob,"colors-"+nonce+".png",patches)
    select_all(ob)
    print("Done")