示例#1
0
for orga in h1.organelles:
    # create master for organelle
    bg = bl.newEmpty('organelle_%d'%orga.number)
    g = Geom('organelle_%d'%orga.number)
    bl.addObjectToScene(sc,bg)
    gs = Geom('surface')
    bgs = bl.newEmpty('surface')
    bl.addObjectToScene(sc,bgs, parent=bg)
    gc = Geom('cytoplasm')
    bgc = bl.newEmpty('cytoplasm')
    bl.addObjectToScene(sc,bgc, parent=bg)
    orgaToMasterGeom[orga] = g
    orgaToMasterGeom[orga.number] = gs
    orgaToMasterGeom[-orga.number] = gc
    
    tetobj,tetmesh = bl.createsNmesh('surfaceMesh',orga.vertices,orga.vnormals,orga.faces)
    tetobj.setMaterials([Material.Get("wire")])
    tetobj.colbits = 1<<0 #objMAt
    tetobj.setDrawMode(32)#drawwire
    tetobj.setDrawType(2)#wire
    #tet = IndexedPolygons('surfaceMesh', vertices=orga.vertices,
    #                      faces=orga.faces, normals=orga.vnormals,
    #                      inheritFrontPolyMode=False,
    #                      frontPolyMode='line',
    #                      inheritCulling=0, culling='none',
    #                      inheritShading=0, shading='flat')
    #vi.AddObject(tet, parent=g)
    bl.addObjectToScene(sc,tetobj, parent=bg)

#cp = vi.clipP[0]
#vi.GUI.clipvar[0][0].set(1)
    #sph = Spheres('spheres', inheritMaterial=False, centers=verts1,
     #             materials=colors1, radii=radii1, visible=1)
    #vi.AddObject(sph, parent=master)

# display extra cellular meshes
meshGeoms = {}
for pos, rot, ingr, ptInd in h1.molecules:
    if ingr.mesh: # display mesh
        geom = ingr.mesh
        mat = rot.copy()
        mat[:3, 3] = pos
        if not meshGeoms.has_key(geom):
            meshGeoms[geom] = [mat]
            geom.Set(materials = [ingr.color], inheritMaterial=0)
            #create the mesh
            geom.ob,geom.mesh = bl.createsNmesh(geom.name,geom.getVertices(),None,geom.getFaces(),
				color=[ingr.color],smooth=False,proxyCol=False)	
        else:
            meshGeoms[geom].append(mat)


for geom, mats in meshGeoms.items():
    instancesExtra = []
    for i,mat in enumerate(mats):
        instancesExtra.append(bl.setInstance(geom.name+str(i),geom.ob, mat))
        bl.addObjectToScene(sc,instancesExtra[-1], parent=bg)

# display organelle spheres
for orga in h1.organelles:
    vertsIn = []
    radiiIn = []
    colorsIn =[]
示例#3
0
# display extra cellular meshes
meshGeoms = {}
for pos, rot, ingr, ptInd in h1.molecules:
    if ingr.mesh:  # display mesh
        geom = ingr.mesh
        mat = rot.copy()
        mat[:3, 3] = pos
        if geom not in meshGeoms:
            meshGeoms[geom] = [mat]
            geom.Set(materials=[ingr.color], inheritMaterial=0)
            #create the mesh
            geom.ob, geom.mesh = bl.createsNmesh(geom.name,
                                                 geom.getVertices(),
                                                 None,
                                                 geom.getFaces(),
                                                 color=[ingr.color],
                                                 smooth=False,
                                                 proxyCol=False)
        else:
            meshGeoms[geom].append(mat)

for geom, mats in list(meshGeoms.items()):
    instancesExtra = []
    for i, mat in enumerate(mats):
        instancesExtra.append(bl.setInstance(geom.name + str(i), geom.ob, mat))
        bl.addObjectToScene(sc, instancesExtra[-1], parent=bg)

# display organelle spheres
for orga in h1.organelles:
    vertsIn = []