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

« back to all changes in this revision

Viewing changes to release/scripts/bpymodules/BPyImage.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:
26
26
# Comprehensive image loader, will search and find the image                #
27
27
# Will return a blender image or a new image if the image is missing        #
28
28
#===========================================================================#
29
 
import Blender
 
29
import bpy
30
30
from Blender import sys
31
31
try:
32
32
        import os
101
101
                #if path.endswith('\\') or path.endswith('/'):
102
102
                #       raise 'INVALID PATH'
103
103
                try:
104
 
                        img = Blender.Image.Load(path)
 
104
                        img = bpy.data.images.new(filename=path)
105
105
                        if VERBOSE: print '\t\tImage loaded "%s"' % path
106
106
                        return img
107
107
                except:
109
109
                                if sys.exists(path): print '\t\tImage failed loading "%s", mabe its not a format blender can read.' % (path)
110
110
                                else: print '\t\tImage not found, making a place holder "%s"' % (path)
111
111
                        if PLACE_HOLDER:
112
 
                                img= Blender.Image.New(stripPath(path),1,1,24)
 
112
                                img= bpy.data.images.new(stripPath(path),4,4)
113
113
                                img.filename= path
114
114
                                return img #blank image
115
115
                        else:
123
123
        imageFileName_lower =  imageFileName.lower() # image path only
124
124
        
125
125
        if VERBOSE: print '\tSearchingExisting Images for "%s"' % imagePath
126
 
        for i in Blender.Image.Get():
 
126
        for i in bpy.data.images:
127
127
                if stripPath(i.filename.lower()) == imageFileName_lower:
128
128
                        if VERBOSE: print '\t\tUsing existing image.'
129
129
                        return i
188
188
        else:
189
189
                if VERBOSE: print '\tNo Path: "%s"' % tmpPath
190
190
 
191
 
        tmpPath = addSlash(Blender.Get('texturesdir'))
 
191
        tmpPath = addSlash(bpy.config.textureDir)
192
192
        if tmpPath and sys.exists(tmpPath):
193
193
                if VERBOSE: print '\t\tSearching in %s' % tmpPath
194
194
                paths[tmpPath] = [os.listdir(tmpPath)] # Orig name for loading