Page Menu
Home
Search
Configure Global Search
Log In
Files
F89592
op.txt
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Robert Forsman (mutantbob)
May 21 2014, 5:09 PM
Size
1 KB
Subscribers
None
op.txt
View Options
import bpy
import bmesh
def copy_stuff(src, dst, bm):
dst.material_index = src.material_index
#for l in bm.faces.layers.tex.values():
# dst[l] = src[l]
class RotateFaceVertexOrderOp(bpy.types.Operator):
"""Rotate Face Vertex Order"""
bl_idname="object.rotate_face_vertex_order_operator"
bl_label = "Rotate Face Vertex Order Operator"
def execute(self, context):
mesh = context.active_object.data
bm = bmesh.from_edit_mesh(mesh)
for face in bm.faces:
if (face.select):
vs = face.verts[:]
vs2 = vs[1:]+vs[:1]
#face.verts =vs2
tex_copy = [ [l, face[l].image] for l in bm.faces.layers.tex.values() ]
tex_copy2 = [ [l, face[l]] for l in bm.faces.layers.tex.values() ]
mi = face.material_index
print (tex_copy[0][1])
print ("copied")
bm.faces.remove(face)
f2=bm.faces.new(vs2)
if False:
f2.copy_from(face)
else:
f2.material_index = mi
for tc in tex_copy:
f2[tc[0]].image = tc[1]
print (tc[1])
#for tc in tex_copy2:
# f2[tc[0]] = tc[1]
print ("face done")
f2.select = True
bmesh.update_edit_mesh(mesh)
return {'FINISHED'}
# VIEW3D_MT_edit_mesh_faces
def add_object_button(self, context):
self.layout.operator(RotateFaceVertexOrderOp.bl_idname,
text=RotateFaceVertexOrderOp.__doc__,
icon='PLUGIN')
def register():
bpy.utils.register_class(RotateFaceVertexOrderOp)
bpy.types.VIEW3D_MT_edit_mesh_faces.append(add_object_button)
if __name__ == "__main__":
register()
File Metadata
Details
Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1f/22/7d1f3b95c7151fb93255dac04ba7
Event Timeline
Log In to Comment