User Tools

Site Tools


projects:houseofcards:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:houseofcards:start [2016/07/09 18:05]
dwheele [Printing UVs for Object]
projects:houseofcards:start [2017/11/18 18:03] (current)
dwheele
Line 7: Line 7:
   * [[pythonoperators|Python Operators from Blender]]   * [[pythonoperators|Python Operators from Blender]]
   * [[cardfaceinfo|Card Face Graphic Info]]   * [[cardfaceinfo|Card Face Graphic Info]]
 +  * [[blenderarraynumbering|Blender Array Numbering]]
 +  * [[shufflecards|Shuffle Cards Routine in Python]]
 +  * [[physicssettings|Physics Settings]]
 +  * [[workingpython|Work Python Scripts (backup)]]
 +  * [[playingcardspecifics|Playing Card Specifics]]
  
 My example ''c:\Projects\HouseOfCards\panelTest.blend'' has one object "Panel" which has two material slots, My example ''c:\Projects\HouseOfCards\panelTest.blend'' has one object "Panel" which has two material slots,
Line 300: Line 305:
 Going back to non-BMESH method. In BMesh, it is difficult to assemble the correct types. Going back to non-BMESH method. In BMesh, it is difficult to assemble the correct types.
  
 +==== Get Face from Mesh defined by Vertex Group ====
 +
 +<code python>
 +import bpy
 +ob = bpy.data.objects["Panel"];
 +
 +
 +def getFaceFromObjectContainingVertexGroup(ob, vertexGroupName):
 +
 +  # First, get list of Vertexes in Vertex Group
 +
 +  groupIndex = -1
 +
 +  # This is an Object with a Mesh, see if it has the supported group name
 +  for i in range(0, len(ob.vertex_groups)):
 +    group = ob.vertex_groups[i]
 +    if group.name == vertexGroupName:
 +      groupIndex = i
 +
 +  # if we didn't find it, exit
 +  if (groupIndex < 0):
 +    return null
 +
 +  # Now access the vertices that are assigned to this group
 +
 +  bmVertGroupMembers = []
 +
 +  for v in ob.data.vertices:
 +    for vertGroup in v.groups:
 +      if vertGroup.group == groupIndex:
 +         print("Vertex %d is part of group."%(v.index))
 +         bmVertGroupMembers.append(v)
 +
 +  # at this point, we have a list of vertices in bmVertGroupMembers
 +  # belonging to group vertexGroupName, with index groupIndex
 +         
 +for f in me.polygons:
 +    print("Polygon", f.index, "from loop index", f.loop_start, "and length", f.loop_total)
 +    for i in f.loop_indices: # <-- python Range object with the proper indices already set
 +        l = me.loops[i] # The loop entry this polygon point refers to
 +        v = me.vertices[l.vertex_index] # The vertex data that loop entry refers to
 +        print("\tLoop index", l.index, "points to vertex index", l.vertex_index, \
 +            "at position", v.co)
 +        for j,ul in enumerate(me.uv_layers):
 +            print("\t\tUV Map", j, "has coordinates", ul.data[l.index].uv, \
 +                "for this loop index")
 +
 +</code>
  
projects/houseofcards/start.1468087544.txt.gz · Last modified: 2016/07/09 18:05 by dwheele