Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-11 08:12:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-11 08:12:13 +0400
commitad8251bfdda50def103063b9fa8fc8c89aa0ccb9 (patch)
tree1308fd27c16c754e86873eee231b3d2c05e57af1
parent7033ee2c6b74066525ddb42230c72cfc6d4d45ee (diff)
update to povray export
- use library paths for images. - remove path searching code for images, if image paths are incorrect users should deal with this. - rename splitHyphen --> string_strip_hyphen
-rw-r--r--render_povray/render.py47
1 files changed, 12 insertions, 35 deletions
diff --git a/render_povray/render.py b/render_povray/render.py
index a6c218a0..72c71b86 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -105,38 +105,15 @@ def imgMapBG(wts):
return image_mapBG
-def findInSubDir(filename, subdirectory=""):
- pahFile = ""
- if subdirectory:
- path = subdirectory
- else:
- path = os.getcwd()
- try:
- for root, dirs, names in os.walk(path):
- if filename in names:
- pahFile = os.path.join(root, filename)
- return pahFile
- except OSError:
- return ""
-
-
def path_image(image):
- import os
- fn = bpy.path.abspath(image)
- if not os.path.isfile(fn):
- fn = findInSubDir(os.path.basename(fn), os.path.dirname(bpy.data.filepath))
- fn = os.path.realpath(fn)
- return fn
+ return bpy.path.abspath(image.filepath, library=image.library)
-##############end find image texture
+# end find image texture
+# -----------------------------------------------------------------------------
-def splitHyphen(name):
- hyphidx = name.find("-")
- if hyphidx == -1:
- return name
- else:
- return name[:].replace("-", "")
+def string_strip_hyphen(name):
+ return name.replace("-", "")
def safety(name, Level):
@@ -153,7 +130,7 @@ def safety(name, Level):
except:
prefix = ""
prefix = "shader_"
- name = splitHyphen(name)
+ name = string_strip_hyphen(name)
if Level == 2:
return prefix + name
elif Level == 1:
@@ -221,7 +198,7 @@ def write_pov(filename, scene=None, info_callback=None):
def uniqueName(name, nameSeq):
if name not in nameSeq:
- name = splitHyphen(name)
+ name = string_strip_hyphen(name)
return name
name_orig = name
@@ -229,7 +206,7 @@ def write_pov(filename, scene=None, info_callback=None):
while name in nameSeq:
name = "%s_%.3d" % (name_orig, i)
i += 1
- name = splitHyphen(name)
+ name = string_strip_hyphen(name)
return name
def writeMatrix(matrix):
@@ -867,8 +844,8 @@ def write_pov(filename, scene=None, info_callback=None):
else:
name_orig = DEF_OBJ_NAME
dataname_orig = DEF_OBJ_NAME
- name = splitHyphen(bpy.path.clean_name(name_orig))
- dataname = splitHyphen(bpy.path.clean_name(dataname_orig))
+ name = string_strip_hyphen(bpy.path.clean_name(name_orig))
+ dataname = string_strip_hyphen(bpy.path.clean_name(dataname_orig))
## for slot in ob.material_slots:
## if slot.material != None and slot.link == 'OBJECT':
## obmaterial = slot.material
@@ -1061,7 +1038,7 @@ def write_pov(filename, scene=None, info_callback=None):
texturesAlpha = ""
for t in material.texture_slots:
if t and t.texture.type == 'IMAGE' and t.use and t.texture.image:
- image_filename = path_image(t.texture.image.filepath)
+ image_filename = path_image(t.texture.image)
imgGamma = ""
if image_filename:
if t.use_map_color_diffuse:
@@ -1583,7 +1560,7 @@ def write_pov(filename, scene=None, info_callback=None):
# XXX No enable checkbox for world textures yet (report it?)
#if t and t.texture.type == 'IMAGE' and t.use:
if t and t.texture.type == 'IMAGE':
- image_filename = path_image(t.texture.image.filepath)
+ image_filename = path_image(t.texture.image)
if t.texture.image.filepath != image_filename:
t.texture.image.filepath = image_filename
if image_filename != "" and t.use_map_blend: