~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to release/scripts/uv_export.py

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
""" 
9
9
 
10
10
__author__ = "Martin 'theeth' Poirier"
11
 
__url__ = ("http://www.blender.org", "http://www.elysiun.com")
12
 
__version__ = "2.1"
 
11
__url__ = ("http://www.blender.org", "http://blenderartists.org/")
 
12
__version__ = "2.3"
13
13
 
14
14
__bpydoc__ = """\
15
15
This script exports the UV face layout of the selected mesh object to
33
33
"""
34
34
 
35
35
 
36
 
# $Id: uv_export.py,v 1.17 2007/01/18 08:39:31 letterrip Exp $
 
36
# $Id: uv_export.py,v 1.18 2007/03/26 15:55:23 theeth Exp $
37
37
#
38
38
# --------------------------------------------------------------------------
39
39
# ***** BEGIN GPL LICENSE BLOCK *****
94
94
# Cleanup code
95
95
# Filename handling enhancement and bug fixes
96
96
# --------------------------
 
97
#       Version 2.3
 
98
# Added check for excentric UVs (only affects TGA)
 
99
# --------------------------
97
100
 
98
101
FullPython = False
99
102
 
107
110
 
108
111
from math import *
109
112
 
110
 
 
111
113
def ExportConfig():
112
114
        conf = {}
113
115
        
323
325
        
324
326
        
325
327
def UV_Export_TGA(vList, size, wsize, wrap, file):
 
328
        extreme_warning = False
 
329
        
326
330
        minx = 0
327
331
        miny = 0
328
332
        scale = 1.0
366
370
 
367
371
                        step = int(ceil(size*sqrt((co1[0]-co2[0])**2+(co1[1]-co2[1])**2)))
368
372
                        if step:
369
 
                                for t in range(step):
370
 
                                        x = int(floor((co1[0] + t*(co2[0]-co1[0])/step) * size))
371
 
                                        y = int(floor((co1[1] + t*(co2[1]-co1[1])/step) * size))
372
 
 
373
 
                                        if wrap:
374
 
                                                x = x % wrapSize
375
 
                                                y = y % wrapSize
376
 
                                        else:
377
 
                                                x = int ((x - minx) * scale)
378
 
                                                y = int ((y - miny) * scale)
379
 
                                                
380
 
                                        co = x * 1 + y * 1 * size;
381
 
                                        
382
 
                                        img[co] = 0
383
 
                                        if wsize > 1:
384
 
                                                for x in range(-1*wsize + 1,wsize):
385
 
                                                        for y in range(-1*wsize,wsize):
386
 
                                                                img[co + 1 * x + y * 1 * size] = 0
387
 
        
 
373
                                try:
 
374
                                        for t in xrange(step):
 
375
                                                        x = int(floor((co1[0] + t*(co2[0]-co1[0])/step) * size))
 
376
                                                        y = int(floor((co1[1] + t*(co2[1]-co1[1])/step) * size))
 
377
                
 
378
                                                        if wrap:
 
379
                                                                x = x % wrapSize
 
380
                                                                y = y % wrapSize
 
381
                                                        else:
 
382
                                                                x = int ((x - minx) * scale)
 
383
                                                                y = int ((y - miny) * scale)
 
384
                                                                
 
385
                                                        co = x * 1 + y * 1 * size;
 
386
                                                        
 
387
                                                        img[co] = 0
 
388
                                                        if wsize > 1:
 
389
                                                                for x in range(-1*wsize + 1,wsize):
 
390
                                                                        for y in range(-1*wsize,wsize):
 
391
                                                                                img[co + 1 * x + y * 1 * size] = 0
 
392
                                except OverflowError:
 
393
                                        if not extreme_warning:
 
394
                                                print "Skipping extremely long UV edges, check your layout for excentric values"
 
395
                                                extreme_warning = True
 
396
                
388
397
                for v in f:
389
398
                        x = int(v[0] * size)
390
399
                        y = int(v[1] * size)
485
494
        if bEdit.val and not bEditPath.val:
486
495
                SetEditorAndExport()
487
496
        else:
488
 
                Export()
 
497
                Export()
 
 
b'\\ No newline at end of file'