Fixed a silly bug when copying images.
This commit is contained in:
@@ -21,7 +21,7 @@ Run this script from "File->Export" menu to export all meshes.
|
|||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# OBJ Export v0.9b by Campbell Barton (AKA Ideasman)
|
# OBJ Export v1.0 by Campbell Barton (AKA Ideasman)
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
#
|
#
|
||||||
@@ -197,6 +197,7 @@ def copy_file(source, dest):
|
|||||||
file.write(data)
|
file.write(data)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
def copy_images(dest_dir):
|
def copy_images(dest_dir):
|
||||||
if dest_dir[-1] != sys.sep:
|
if dest_dir[-1] != sys.sep:
|
||||||
dest_dir += sys.sep
|
dest_dir += sys.sep
|
||||||
@@ -204,12 +205,14 @@ def copy_images(dest_dir):
|
|||||||
# Get unique image names
|
# Get unique image names
|
||||||
uniqueImages = {}
|
uniqueImages = {}
|
||||||
for matname, imagename in MTL_DICT.iterkeys(): # Only use image name
|
for matname, imagename in MTL_DICT.iterkeys(): # Only use image name
|
||||||
|
if imagename != None:
|
||||||
uniqueImages[imagename] = None # Should use sets here. wait until Python 2.4 is default.
|
uniqueImages[imagename] = None # Should use sets here. wait until Python 2.4 is default.
|
||||||
|
|
||||||
# Now copy images
|
# Now copy images
|
||||||
copyCount = 0
|
copyCount = 0
|
||||||
|
|
||||||
for imageName in uniqueImages.iterkeys():
|
for imageName in uniqueImages.iterkeys():
|
||||||
|
print imageName
|
||||||
bImage = Image.Get(imageName)
|
bImage = Image.Get(imageName)
|
||||||
image_path = sys.expandpath(bImage.filename)
|
image_path = sys.expandpath(bImage.filename)
|
||||||
if sys.exists(image_path):
|
if sys.exists(image_path):
|
||||||
@@ -543,13 +546,13 @@ def save_obj_ui(filename):
|
|||||||
orig_frame = Blender.Get('curframe')
|
orig_frame = Blender.Get('curframe')
|
||||||
|
|
||||||
if EXPORT_ALL_SCENES: # Add scene name into the context_name
|
if EXPORT_ALL_SCENES: # Add scene name into the context_name
|
||||||
context_name[1] = '_%s' % saneFilechars(scn.name)
|
context_name[1] = '_%s' % saneFilechars(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
|
||||||
|
|
||||||
# Export an animation?
|
# Export an animation?
|
||||||
if EXPORT_ANIMATION:
|
if EXPORT_ANIMATION:
|
||||||
scene_frames = range(context.startFrame(), context.endFrame()+1) # up to and including the end frame.
|
scene_frames = range(context.startFrame(), context.endFrame()+1) # up to and including the end frame.
|
||||||
else:
|
else:
|
||||||
scene_frames = [orig_frame]
|
scene_frames = [orig_frame] # Dont export an animation.
|
||||||
|
|
||||||
# Loop through all frames in the scene and export.
|
# Loop through all frames in the scene and export.
|
||||||
for frame in scene_frames:
|
for frame in scene_frames:
|
||||||
|
|||||||
Reference in New Issue
Block a user