Changeset View
Changeset View
Standalone View
Standalone View
oscurart_tools/oscurart_meshes.py
| Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Lines | |||||
| # -------------------------- OBJECT TO MESH ------------------------------ | # -------------------------- OBJECT TO MESH ------------------------------ | ||||
| def DefOscObjectToMesh(): | def DefOscObjectToMesh(): | ||||
| ACTOBJ = bpy.context.object | ACTOBJ = bpy.context.object | ||||
| MESH = ACTOBJ.to_mesh( | MESH = ACTOBJ.to_mesh( | ||||
| scene=bpy.context.scene, | scene=bpy.context.scene, | ||||
| apply_modifiers=True, | apply_modifiers=True, | ||||
| settings="RENDER", | settings="RENDER", | ||||
| calc_tessface=True) | calc_loop_triangles=True) | ||||
| OBJECT = bpy.data.objects.new(("%s_Freeze") % (ACTOBJ.name), MESH) | OBJECT = bpy.data.objects.new(("%s_Freeze") % (ACTOBJ.name), MESH) | ||||
| bpy.context.scene.objects.link(OBJECT) | bpy.context.scene.objects.link(OBJECT) | ||||
| class OscObjectToMesh(Operator): | class OscObjectToMesh(Operator): | ||||
| """It creates a copy of the final state of the object as it being see in the viewport""" | """It creates a copy of the final state of the object as it being see in the viewport""" | ||||
| bl_idname = "mesh.object_to_mesh_osc" | bl_idname = "mesh.object_to_mesh_osc" | ||||
| bl_label = "Object To Mesh" | bl_label = "Object To Mesh" | ||||
| ▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | def defPasteUvsIsland(self, uvOffset, rotateUv,context): | ||||
| if rotateUv: | if rotateUv: | ||||
| bpy.ops.object.mode_set(mode="OBJECT") | bpy.ops.object.mode_set(mode="OBJECT") | ||||
| for poly in selPolys: | for poly in selPolys: | ||||
| bpy.context.object.data.polygons[poly].select = True | bpy.context.object.data.polygons[poly].select = True | ||||
| bpy.ops.object.mode_set(mode="EDIT") | bpy.ops.object.mode_set(mode="EDIT") | ||||
| bm = bmesh.from_edit_mesh(bpy.context.object.data) | bm = bmesh.from_edit_mesh(bpy.context.object.data) | ||||
| bmesh.ops.reverse_uvs(bm, faces=[f for f in bm.faces if f.select]) | bmesh.ops.reverse_uvs(bm, faces=[f for f in bm.faces if f.select]) | ||||
| bmesh.ops.rotate_uvs(bm, faces=[f for f in bm.faces if f.select]) | bmesh.ops.rotate_uvs(bm, faces=[f for f in bm.faces if f.select]) | ||||
| #bmesh.update_edit_mesh(bpy.context.object.data, tessface=False, destructive=False) | #bmesh.update_edit_mesh(bpy.context.object.data, loop_triangles=False, destructive=False) | ||||
| class CopyUvIsland(Operator): | class CopyUvIsland(Operator): | ||||
| """Copy Uv Island""" | """Copy Uv Island""" | ||||
| bl_idname = "mesh.uv_island_copy" | bl_idname = "mesh.uv_island_copy" | ||||
| bl_label = "Copy Uv Island" | bl_label = "Copy Uv Island" | ||||
| bl_options = {"REGISTER", "UNDO"} | bl_options = {"REGISTER", "UNDO"} | ||||
| ▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines | |||||