forked from bartvdbraak/blender
=== Patch ===
[#6666] Updates to UV layout export script Moving from NMesh API to Mesh
This commit is contained in:
parent
e6fe5214b9
commit
d9e85385fd
@ -9,7 +9,7 @@ Tooltip: 'Export the UV face layout of the selected object to a .TGA or .SVG fil
|
|||||||
|
|
||||||
__author__ = "Martin 'theeth' Poirier"
|
__author__ = "Martin 'theeth' Poirier"
|
||||||
__url__ = ("http://www.blender.org", "http://blenderartists.org/")
|
__url__ = ("http://www.blender.org", "http://blenderartists.org/")
|
||||||
__version__ = "2.3"
|
__version__ = "2.4"
|
||||||
|
|
||||||
__bpydoc__ = """\
|
__bpydoc__ = """\
|
||||||
This script exports the UV face layout of the selected mesh object to
|
This script exports the UV face layout of the selected mesh object to
|
||||||
@ -25,11 +25,7 @@ selected, define size and wire size parameters and push "Export" button.
|
|||||||
There are more options to configure, like setting export path, if image should
|
There are more options to configure, like setting export path, if image should
|
||||||
use object's name and more.
|
use object's name and more.
|
||||||
|
|
||||||
Notes:<br>
|
Notes:<br>See change logs in scripts for a list of contributors.
|
||||||
Jean-Michel Soler (jms) wrote TGA functions used by this script.<br>
|
|
||||||
Zaz added the default path code and Selected Face option.<br>
|
|
||||||
Macouno fixed a rounding error in the step calculations<br>
|
|
||||||
Jarod added the SVG file export<br>
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -97,10 +93,16 @@ Notes:<br>
|
|||||||
# Version 2.3
|
# Version 2.3
|
||||||
# Added check for excentric UVs (only affects TGA)
|
# Added check for excentric UVs (only affects TGA)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
# Version 2.4
|
||||||
|
# Port from NMesh to Mesh by Daniel Salazar (zanqdo)
|
||||||
|
# --------------------------
|
||||||
|
|
||||||
|
|
||||||
FullPython = False
|
FullPython = False
|
||||||
|
|
||||||
import Blender
|
import Blender
|
||||||
|
import bpy
|
||||||
|
import BPyMessages
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import os
|
import os
|
||||||
@ -175,18 +177,14 @@ def ExportCallback(f):
|
|||||||
obj = Blender.Scene.GetCurrent().objects.active
|
obj = Blender.Scene.GetCurrent().objects.active
|
||||||
|
|
||||||
time1= Blender.sys.time()
|
time1= Blender.sys.time()
|
||||||
|
|
||||||
if not obj:
|
|
||||||
Blender.Draw.PupMenu("ERROR%t|No Active Object!")
|
|
||||||
return
|
|
||||||
|
|
||||||
if obj.type != "Mesh":
|
if obj.type != "Mesh":
|
||||||
Blender.Draw.PupMenu("ERROR%t|Not a Mesh!")
|
BPyMessages.Error_NoMeshActive()
|
||||||
return
|
return
|
||||||
|
|
||||||
mesh = obj.getData()
|
mesh = obj.getData(mesh=1)
|
||||||
if not mesh.hasFaceUV():
|
if not mesh.faceUV:
|
||||||
Blender.Draw.PupMenu("ERROR%t|No UV coordinates!")
|
BPyMessages.Error_NoMeshUvActive()
|
||||||
return
|
return
|
||||||
|
|
||||||
# just for information...
|
# just for information...
|
||||||
@ -259,18 +257,9 @@ def GetDefaultFilename():
|
|||||||
return filename
|
return filename
|
||||||
|
|
||||||
def ExtractUVFaces(mesh, allface):
|
def ExtractUVFaces(mesh, allface):
|
||||||
FaceList = []
|
|
||||||
|
|
||||||
if allface:
|
if allface: return [f.uv for f in mesh.faces]
|
||||||
faces = mesh.faces
|
else: return [f.uv for f in mesh.faces if f.sel]
|
||||||
else:
|
|
||||||
faces = mesh.getSelectedFaces()
|
|
||||||
|
|
||||||
for f in faces:
|
|
||||||
FaceList.append(f.uv)
|
|
||||||
|
|
||||||
return FaceList
|
|
||||||
|
|
||||||
|
|
||||||
def Buffer(height=16, width=16, profondeur=1,rvb=255 ):
|
def Buffer(height=16, width=16, profondeur=1,rvb=255 ):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user