time1= Blender.sys.time()
- if obj.type != "Mesh":
+ if not obj or obj.type != "Mesh":
BPyMessages.Error_NoMeshActive()
return
-
+
+ is_editmode = Blender.Window.EditMode()
+ if is_editmode: Blender.Window.EditMode(0)
+
mesh = obj.getData(mesh=1)
if not mesh.faceUV:
+ if is_editmode: Blender.Window.EditMode(1)
BPyMessages.Error_NoMeshUvActive()
return
UVFaces = ExtractUVFaces(mesh, bAllFaces.val)
+ if is_editmode: Blender.Window.EditMode(1)
+
if not bSVG.val:
print "TGA export is running..."
UV_Export_TGA(UVFaces, bSize.val, bWSize.val, bWrap.val, name)
# add seams
SEAM = Mesh.EdgeFlags.SEAM
for ed in me.edges:
- print len(set(edge_uvs[ed.key]))
if len(set(edge_uvs[ed.key])) > 1:
ed.flag |= SEAM
# editmode if its enabled, we cant make
# changes to the mesh data while in editmode.
is_editmode = Window.EditMode()
- if is_editmode: Window.EditMode(1)
+ if is_editmode: Window.EditMode(0)
Window.WaitCursor(1)
# Run the mesh editing function
seams_from_islands(me)
+ if is_editmode: Window.EditMode(1)
+
# Timing the script is a good way to be aware on any speed hits when scripting
- print 'My Script finished in %.2f seconds' % (sys.time()-t)
+ print 'UV Seams from Islands finished in %.2f seconds' % (sys.time()-t)
Window.WaitCursor(0)
return; /* only draw shadow mesh */
} else if (G.sima->flag & SI_DRAWSHADOW) {
/* draw shadow mesh - this is the mesh with the modifier applied */
- DerivedMesh *finalDM, *cageDM;
-
glColor3ub(112, 112, 112);
- if (G.editMesh->derivedFinal && G.editMesh->derivedFinal->drawUVEdges) {
- G.editMesh->derivedFinal->drawUVEdges(G.editMesh->derivedFinal);
- }
-
- /* draw final mesh with modifiers applied */
- cageDM = editmesh_get_derived_cage_and_final(&finalDM, CD_MASK_BAREMESH | CD_MASK_MTFACE);
-
- if (finalDM->drawUVEdges &&
- DM_get_face_data_layer(finalDM, CD_MTFACE) &&
- /* When sync selection is enabled, all faces are drawn (except for hidden)
- * so if cage is the same as the final, theres no point in drawing the shadowmesh. */
- !((G.sima->flag & SI_SYNC_UVSEL && cageDM==finalDM))
+ if ( em->derivedFinal &&
+ em->derivedFinal->drawUVEdges &&
+ CustomData_has_layer(&em->derivedFinal->faceData, CD_MTFACE)
) {
+ /* we can use the existing final mesh */
glColor3ub(112, 112, 112);
- finalDM->drawUVEdges(finalDM);
+ G.editMesh->derivedFinal->drawUVEdges(G.editMesh->derivedFinal);
+ } else {
+ DerivedMesh *finalDM, *cageDM;
+
+ /* draw final mesh with modifiers applied */
+ cageDM = editmesh_get_derived_cage_and_final(&finalDM, CD_MASK_BAREMESH | CD_MASK_MTFACE);
+
+ if (finalDM->drawUVEdges &&
+ DM_get_face_data_layer(finalDM, CD_MTFACE) &&
+ /* When sync selection is enabled, all faces are drawn (except for hidden)
+ * so if cage is the same as the final, theres no point in drawing the shadowmesh. */
+ !((G.sima->flag & SI_SYNC_UVSEL && cageDM==finalDM))
+ ) {
+ glColor3ub(112, 112, 112);
+ finalDM->drawUVEdges(finalDM);
+ }
+
+ if (cageDM != finalDM)
+ cageDM->release(cageDM);
+ finalDM->release(finalDM);
}
-
- if (cageDM != finalDM)
- cageDM->release(cageDM);
- finalDM->release(finalDM);
}
/* draw transparent faces */