[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31087] trunk/blender: bugfix [#23194] export UVs miss the extension file
Campbell Barton
ideasman42 at gmail.com
Fri Aug 6 03:40:54 CEST 2010
Revision: 31087
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31087
Author: campbellbarton
Date: 2010-08-06 03:40:54 +0200 (Fri, 06 Aug 2010)
Log Message:
-----------
bugfix [#23194] export UVs miss the extension file
also made all other exporters do this.
Made some internal changes.
- moved path functions from bpy.utils to bpy.path (similar to os.path)
- added functions...
bpy.path.ensure_ext(path, ".ext", case_sensitive=False) # simple function to ensure the extension is set.
bpy.path.resolve_ncase(path) # useful for importing scenes made on windows where the path case doesnt match the files.
Modified Paths:
--------------
trunk/blender/release/scripts/io/export_3ds.py
trunk/blender/release/scripts/io/export_fbx.py
trunk/blender/release/scripts/io/export_mdd.py
trunk/blender/release/scripts/io/export_obj.py
trunk/blender/release/scripts/io/export_ply.py
trunk/blender/release/scripts/io/export_x3d.py
trunk/blender/release/scripts/io/netrender/client.py
trunk/blender/release/scripts/io/netrender/repath.py
trunk/blender/release/scripts/modules/bpy/__init__.py
trunk/blender/release/scripts/modules/bpy/utils.py
trunk/blender/release/scripts/modules/bpy_types.py
trunk/blender/release/scripts/modules/rigify/__init__.py
trunk/blender/release/scripts/op/image.py
trunk/blender/release/scripts/op/screen_play_rendered_anim.py
trunk/blender/release/scripts/op/uv.py
trunk/blender/release/scripts/op/wm.py
trunk/blender/release/scripts/ui/properties_data_armature_rigify.py
trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
Added Paths:
-----------
trunk/blender/release/scripts/modules/bpy/path.py
Modified: trunk/blender/release/scripts/io/export_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/export_3ds.py 2010-08-06 00:13:44 UTC (rev 31086)
+++ trunk/blender/release/scripts/io/export_3ds.py 2010-08-06 01:40:54 UTC (rev 31087)
@@ -922,7 +922,7 @@
"""
# import BPyMessages
-def save_3ds(filename, context):
+def write(filename, context):
'''Save the Blender scene to a 3ds file.'''
# Time the export
@@ -1107,12 +1107,7 @@
#primary.dump()
-# if __name__=='__main__':
-# if struct:
-# Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
-# else:
-# Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
-# # save_3ds('/test_b.3ds')
+# # write('/test_b.3ds')
from bpy.props import *
class Export3DS(bpy.types.Operator):
'''Export to 3DS file format (.3ds)'''
@@ -1127,7 +1122,10 @@
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
def execute(self, context):
- save_3ds(self.properties.filepath, context)
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".3ds")
+
+ write(filepath, context)
return {'FINISHED'}
def invoke(self, context, event):
Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py 2010-08-06 00:13:44 UTC (rev 31086)
+++ trunk/blender/release/scripts/io/export_fbx.py 2010-08-06 01:40:54 UTC (rev 31087)
@@ -75,7 +75,7 @@
image_paths = set()
for tex in textures:
- image_paths.add(bpy.utils.expandpath(tex.filepath))
+ image_paths.add(bpy.path.abspath(tex.filepath))
# Now copy images
copyCount = 0
@@ -176,7 +176,7 @@
name = 'unnamed' # blank string, ASKING FOR TROUBLE!
else:
- name = bpy.utils.clean_name(name) # use our own
+ name = bpy.path.clean_name(name) # use our own
while name in iter(dct.values()): name = increment_string(name)
@@ -200,14 +200,14 @@
# FORCE_CWD - dont use the basepath, just add a ./ to the filename.
# use when we know the file will be in the basepath.
# '''
-# fname = bpy.utils.expandpath(fname_orig)
+# fname = bpy.path.abspath(fname_orig)
# # fname = Blender.sys.expandpath(fname_orig)
# fname_strip = os.path.basename(fname)
# # fname_strip = strip_path(fname)
# if FORCE_CWD:
# fname_rel = '.' + os.sep + fname_strip
# else:
-# fname_rel = bpy.utils.relpath(fname, basepath)
+# fname_rel = bpy.path.relpath(fname, basepath)
# # fname_rel = Blender.sys.relpath(fname, basepath)
# if fname_rel.startswith('//'): fname_rel = '.' + os.sep + fname_rel[2:]
# return fname, fname_strip, fname_rel
@@ -354,8 +354,8 @@
new_fbxpath = fbxpath # own dir option modifies, we need to keep an original
for data in data_seq: # scene or group
- newname = BATCH_FILE_PREFIX + bpy.utils.clean_name(data.name)
-# newname = BATCH_FILE_PREFIX + BPySys.bpy.utils.clean_name(data.name)
+ newname = BATCH_FILE_PREFIX + bpy.path.clean_name(data.name)
+# newname = BATCH_FILE_PREFIX + BPySys.bpy.path.clean_name(data.name)
if BATCH_OWN_DIR:
@@ -1250,7 +1250,7 @@
file.write('\n\t}')
def copy_image(image):
- fn = bpy.utils.expandpath(image.filepath)
+ fn = bpy.path.abspath(image.filepath)
fn_strip = os.path.basename(fn)
if EXP_IMAGE_COPY:
@@ -3369,13 +3369,16 @@
if not self.properties.filepath:
raise Exception("filepath not set")
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".fbx")
+
GLOBAL_MATRIX = mtx4_identity
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
- write(self.properties.filepath,
+ write(filepath,
None, # XXX
context,
self.properties.EXP_OBS_SELECTED,
@@ -3395,7 +3398,8 @@
self.properties.BATCH_ENABLE,
self.properties.BATCH_GROUP,
self.properties.BATCH_FILE_PREFIX,
- self.properties.BATCH_OWN_DIR)
+ self.properties.BATCH_OWN_DIR,
+ )
return {'FINISHED'}
@@ -3413,7 +3417,7 @@
# NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
# - Draw.PupMenu alternative in 2.5?, temporarily replaced PupMenu with print
-# - get rid of bpy.utils.clean_name somehow
+# - get rid of bpy.path.clean_name somehow
# + fixed: isinstance(inst, bpy.types.*) doesn't work on RNA objects: line 565
# + get rid of BPyObject_getObjectArmature, move it in RNA?
# - BATCH_ENABLE and BATCH_GROUP options: line 327
@@ -3428,7 +3432,7 @@
# - bpy.data.remove_scene: line 366
# - bpy.sys.time move to bpy.sys.util?
# - new scene creation, activation: lines 327-342, 368
-# - uses bpy.utils.expandpath, *.relpath - replace at least relpath
+# - uses bpy.path.abspath, *.relpath - replace at least relpath
# SMALL or COSMETICAL
# - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')
Modified: trunk/blender/release/scripts/io/export_mdd.py
===================================================================
--- trunk/blender/release/scripts/io/export_mdd.py 2010-08-06 00:13:44 UTC (rev 31086)
+++ trunk/blender/release/scripts/io/export_mdd.py 2010-08-06 01:40:54 UTC (rev 31087)
@@ -171,10 +171,17 @@
return (ob and ob.type == 'MESH')
def execute(self, context):
- if not self.properties.filepath:
- raise Exception("filename not set")
- write(self.properties.filepath, context.scene, context.active_object,
- self.properties.frame_start, self.properties.frame_end, self.properties.fps)
+ filepath = self.properties.filepath
+ filepath = bpy.path.ensure_ext(filepath, ".mdd")
+
+ write(filepath,
+ context.scene,
+ context.active_object,
+ self.properties.frame_start,
+ self.properties.frame_end,
+ self.properties.fps,
+ )
+
return {'FINISHED'}
def invoke(self, context, event):
Modified: trunk/blender/release/scripts/io/export_obj.py
===================================================================
--- trunk/blender/release/scripts/io/export_obj.py 2010-08-06 00:13:44 UTC (rev 31086)
+++ trunk/blender/release/scripts/io/export_obj.py 2010-08-06 01:40:54 UTC (rev 31087)
@@ -66,7 +66,7 @@
dest_dir = os.path.dirname(filepath)
def copy_image(image):
- fn = bpy.utils.expandpath(image.filepath)
+ fn = bpy.path.abspath(image.filepath)
fn_strip = os.path.basename(fn)
if copy_images:
rel = fn_strip
@@ -182,7 +182,7 @@
copyCount = 0
# for bImage in uniqueImages.values():
-# image_path = bpy.utils.expandpath(bImage.filepath)
+# image_path = bpy.path.abspath(bImage.filepath)
# if bpy.sys.exists(image_path):
# # Make a name for the target path.
# dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
@@ -790,7 +790,7 @@
print("OBJ Export time: %.2f" % (time.clock() - time1))
# print "OBJ Export time: %.2f" % (sys.time() - time1)
-def do_export(filepath, context,
+def write(filepath, context,
EXPORT_APPLY_MODIFIERS = True, # not used
EXPORT_ROTX90 = True, # wrong
EXPORT_TRI = False, # ok
@@ -837,7 +837,7 @@
orig_frame = scn.frame_current
if EXPORT_ALL_SCENES: # Add scene name into the context_name
- context_name[1] = '_%s' % bpy.utils.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
+ context_name[1] = '_%s' % bpy.path.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
# Export an animation?
if EXPORT_ANIMATION:
@@ -927,27 +927,27 @@
def execute(self, context):
filepath = self.properties.filepath
- if not filepath.lower().endswith(".obj"):
- filepath += ".obj"
+ filepath = bpy.path.ensure_ext(filepath, ".obj")
- do_export(filepath, context,
- EXPORT_TRI=self.properties.use_triangles,
- EXPORT_EDGES=self.properties.use_edges,
- EXPORT_NORMALS=self.properties.use_normals,
- EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
- EXPORT_UV=self.properties.use_uvs,
- EXPORT_MTL=self.properties.use_materials,
- EXPORT_COPY_IMAGES=self.properties.copy_images,
- EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
- EXPORT_ROTX90=self.properties.use_rotate90,
- EXPORT_BLEN_OBS=self.properties.use_blen_objects,
- EXPORT_GROUP_BY_OB=self.properties.group_by_object,
- EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
- EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
- EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
- EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
- EXPORT_SEL_ONLY=self.properties.use_selection,
- EXPORT_ALL_SCENES=self.properties.use_all_scenes)
+ write(filepath, context,
+ EXPORT_TRI=self.properties.use_triangles,
+ EXPORT_EDGES=self.properties.use_edges,
+ EXPORT_NORMALS=self.properties.use_normals,
+ EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
+ EXPORT_UV=self.properties.use_uvs,
+ EXPORT_MTL=self.properties.use_materials,
+ EXPORT_COPY_IMAGES=self.properties.copy_images,
+ EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list