zeffii / BlenderPythonRecipes

curated snippets for bpy (mostly for Blender <= 2.79 ), some changes are needed to maintain compatibility with 2.8+
GNU General Public License v2.0
121 stars 9 forks source link

Images for WIKI #1

Open zeffii opened 9 years ago

zeffii commented 9 years ago

image

zeffii commented 9 years ago

image

zeffii commented 9 years ago

image

zeffii commented 9 years ago

image

zeffii commented 9 years ago

image

zeffii commented 9 years ago

showing uv sphere and dupl_type = faces image

zeffii commented 9 years ago

showing vertex rotations / normals dupli image

zeffii commented 9 years ago

using sverchok for dots image

zeffii commented 9 years ago

image

verts and vert normals from object.data

import bpy

mesh = bpy.data.objects['parent_cube_Object'].data

for v in mesh.vertices:
    print(v.co[:], v.normal[:])

scripted node for vertex normals

def sv_main(radius=0.3, amp=0.5):
    verts_out = []
    edges_out = []

    in_sockets = [
        ['s', 'radius', radius],
        ['s', 'amp', amp]
    ]

    tverts = [(1.0, 1.0, -1.0), 
    (0.9606616497039795, 0.19629505276679993, 0.19629505276679993),
    (1.0, -1.0, -1.0),
    (0.9931027889251709, 0.08285775035619736, 0.08285775035619736),
    (-1.0, -1.0, -1.0) ,
    (0.39362773299217224, 0.6500137448310852, 0.6500137448310852),
    (-1.0, 1.0, -1.0) ,
    (-0.3027436137199402, -0.6739097237586975, -0.6739097237586975),
    (1.0, 1.0, 1.0) ,
    (0.7344889640808105, -0.47981199622154236, -0.47981199622154236),
    (1.0, -1.0, 1.0) ,
    (-0.9146702289581299, 0.2857448160648346, 0.2857448160648346),
    (-1.0, -1.0, 1.0) ,
    (-0.3505356013774872, -0.6622211337089539, -0.6622211337089539),
    (-1.0, 1.0, 1.0) ,
    (-0.20111697912216187, -0.6926481127738953, -0.6926481127738953)]

    vertss = []
    tedges = []
    for i in range(0, len(tverts), 2):
        second_vert = [
          tverts[i][0] + (tverts[i+1][0]*amp),
          tverts[i][1] + (tverts[i+1][1]*amp),
          tverts[i][2] + (tverts[i+1][2]*amp)
        ]
        vertss.extend([tverts[i], second_vert])
        tedges.append([i, i+1])

    out_sockets = [
        ['v', 'verts', [vertss]],
        ['s', 'edges', [tedges]]
    ]

    return in_sockets, out_sockets
zeffii commented 9 years ago

image

zeffii commented 8 years ago

image

shows spin bmesh

zeffii commented 8 years ago

image

zeffii commented 8 years ago

image