Made the remaining UV py scripts work with editmesh now.
DrawShadow option didnt check the final derived mesh had CD_MTFACE's can would crash when enabled with mirror modifier.
This commit is contained in:
parent
adef239fc0
commit
1fde6d4570
@ -183,12 +183,16 @@ def ExportCallback(f):
|
||||
|
||||
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
|
||||
|
||||
@ -207,6 +211,8 @@ def ExportCallback(f):
|
||||
|
||||
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)
|
||||
|
@ -37,7 +37,6 @@ def seams_from_islands(me):
|
||||
# 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
|
||||
|
||||
@ -59,7 +58,7 @@ def main():
|
||||
# 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)
|
||||
|
||||
@ -68,8 +67,10 @@ def main():
|
||||
# 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)
|
||||
|
||||
|
||||
|
@ -481,12 +481,16 @@ void draw_uvs_sima(void)
|
||||
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) {
|
||||
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);
|
||||
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);
|
||||
@ -505,6 +509,7 @@ void draw_uvs_sima(void)
|
||||
cageDM->release(cageDM);
|
||||
finalDM->release(finalDM);
|
||||
}
|
||||
}
|
||||
|
||||
/* draw transparent faces */
|
||||
if(G.f & G_DRAWFACES) {
|
||||
|
Loading…
Reference in New Issue
Block a user