Beispiel #1
0
def make_cristae(name='Cristae',
                 loc=(0, 0, 0),
                 scale=(0.1, 1, 1),
                 loop_cut_scale_val=2.4):
    # Initial box
    cristae = geom.box(loc=loc, scale=(0.1, 1, 1), name=name)

    # Loop cut on front face 2x horizontally and vertically
    face = getPolygonByNormal(cristae, Vector((1, 0, 0)))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 0).index, 2)
    bpy.ops.transform.resize(value=(1, cristae_disc_loop_cut_scale_val, 1))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 1).index, 2)
    bpy.ops.transform.resize(value=(1, 1, cristae_disc_loop_cut_scale_val))

    # Subdivision surface 4x
    modifiers.subsurf(4)

    # Set base material
    setMaterial(cristae, makeMaterial('Cristae.Base', (1, 1, 1), (1, 1, 1), 1))

    selectVerticesAndAssignMaterial(
        cristae, 'Cristae.Pinch', {'y': {
            'lt': -0.89
        }}, makeMaterial('Cristae.Pinch', (1, 0, 0), (1, 1, 1), 1))
    selectVerticesAndAssignMaterial(
        cristae, 'Cristae.Wall', {'y': {
            'gte': -0.91
        }}, makeMaterial('Cristae.Wall', (0, 0, 1), (1, 1, 1), 1))

    setMode('OBJECT')
Beispiel #2
0
def make_cristae(name='Cristae', loc=(0,0,0), scale=(0.1, 1, 1), side='right', loop_cut_scale_val=2.4, subsurf_level=2):
    # Initial box
    cristae = geom.box(loc=loc, scale=scale, name=name)

    # Loop cut on front face 2x horizontally and vertically
    face = getPolygonByNormal(cristae, Vector((1, 0, 0)))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 0).index, 2)
    bpy.ops.transform.resize(value=(1, loop_cut_scale_val, 1))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 1).index, 2)
    bpy.ops.transform.resize(value=(1, 1, loop_cut_scale_val))

    # Subdivision surface
    modifiers.subsurf(subsurf_level)

    # Set base material
    setMaterial(cristae, makeMaterial('Membrane.Inner.Base', (1,1,1), (1,1,1), 1))

    # TODO figure out what these numbers should be procedurally
    # was 0.89, 0.91 with 4x subdiv.
    pinchThreshold = 0.90
    wallThreshold = 0.95

    if side == 'right':
        selectVerticesAndAssignMaterial(cristae, 'Membrane.Inner.Pinch', {'y': {'lt': -pinchThreshold}}, makeMaterial('Membrane.Inner.Pinch', (1,0,0), (1,1,1), 1))
        selectVerticesAndAssignMaterial(cristae, 'Membrane.Inner.Wall', {'y': {'gte': -wallThreshold}}, makeMaterial('Membrane.Inner.Wall', (0,0,1), (1,1,1), 1))
    elif side == 'left':
        selectVerticesAndAssignMaterial(cristae, 'Membrane.Inner.Pinch', {'y': {'gte': pinchThreshold}}, makeMaterial('Membrane.Inner.Pinch', (1,0,0), (1,1,1), 1))
        selectVerticesAndAssignMaterial(cristae, 'Membrane.Inner.Wall', {'y': {'lt': wallThreshold}}, makeMaterial('Membrane.Inner.Wall', (0,0,1), (1,1,1), 1))

    setMode('OBJECT')
Beispiel #3
0
def make_cristae(name='Cristae',
                 loc=(0, 0, 0),
                 scale=(0.1, 1, 1),
                 side='right',
                 loop_cut_scale_val=2.4,
                 subsurf_level=2):
    # Initial box
    cristae = geom.box(loc=loc, scale=scale, name=name)

    # Loop cut on front face 2x horizontally and vertically
    face = getPolygonByNormal(cristae, Vector((1, 0, 0)))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 0).index, 2)
    bpy.ops.transform.resize(value=(1, loop_cut_scale_val, 1))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 1).index, 2)
    bpy.ops.transform.resize(value=(1, 1, loop_cut_scale_val))

    # Subdivision surface
    modifiers.subsurf(subsurf_level)

    # Set base material
    setMaterial(cristae,
                makeMaterial('Membrane.Inner.Base', (1, 1, 1), (1, 1, 1), 1))

    # TODO figure out what these numbers should be procedurally
    # was 0.89, 0.91 with 4x subdiv.
    pinchThreshold = 0.90
    wallThreshold = 0.95

    if side == 'right':
        selectVerticesAndAssignMaterial(
            cristae, 'Membrane.Inner.Pinch', {'y': {
                'lt': -pinchThreshold
            }}, makeMaterial('Membrane.Inner.Pinch', (1, 0, 0), (1, 1, 1), 1))
        selectVerticesAndAssignMaterial(
            cristae, 'Membrane.Inner.Wall', {'y': {
                'gte': -wallThreshold
            }}, makeMaterial('Membrane.Inner.Wall', (0, 0, 1), (1, 1, 1), 1))
    elif side == 'left':
        selectVerticesAndAssignMaterial(
            cristae, 'Membrane.Inner.Pinch', {'y': {
                'gte': pinchThreshold
            }}, makeMaterial('Membrane.Inner.Pinch', (1, 0, 0), (1, 1, 1), 1))
        selectVerticesAndAssignMaterial(
            cristae, 'Membrane.Inner.Wall', {'y': {
                'lt': wallThreshold
            }}, makeMaterial('Membrane.Inner.Wall', (0, 0, 1), (1, 1, 1), 1))

    setMode('OBJECT')
def make_cristae(name='Cristae', loc=(0,0,0), scale=(0.1, 1, 1), loop_cut_scale_val=2.4):
    # Initial box
    cristae = geom.box(loc=loc, scale=(0.1, 1, 1), name=name)

    # Loop cut on front face 2x horizontally and vertically
    face = getPolygonByNormal(cristae, Vector((1, 0, 0)))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 0).index, 2)
    bpy.ops.transform.resize(value=(1, cristae_disc_loop_cut_scale_val, 1))

    edit.loop_cut(getEdgeForFaceAtIndex(cristae, face, 1).index, 2)
    bpy.ops.transform.resize(value=(1, 1, cristae_disc_loop_cut_scale_val))

    # Subdivision surface 4x
    modifiers.subsurf(4)

    # Set base material
    setMaterial(cristae, makeMaterial('Cristae.Base', (1,1,1), (1,1,1), 1))

    selectVerticesAndAssignMaterial(cristae, 'Cristae.Pinch', {'y': {'lt': -0.89}}, makeMaterial('Cristae.Pinch', (1,0,0), (1,1,1), 1))
    selectVerticesAndAssignMaterial(cristae, 'Cristae.Wall', {'y': {'gte': -0.91}}, makeMaterial('Cristae.Wall', (0,0,1), (1,1,1), 1))

    setMode('OBJECT')