[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29163] trunk/blender: rename some rna properties filename --> filepath

Campbell Barton ideasman42 at gmail.com
Wed Jun 2 19:58:28 CEST 2010


Revision: 29163
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29163
Author:   campbellbarton
Date:     2010-06-02 19:58:28 +0200 (Wed, 02 Jun 2010)

Log Message:
-----------
rename some rna properties filename --> filepath
 * filename == "foo.ext"
 * filepath == "/path/to/and/including/foo.ext"

this was alredy followed in some places not not everywhere.

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/operators.py
    trunk/blender/release/scripts/io/netrender/repath.py
    trunk/blender/release/scripts/io/netrender/ui.py
    trunk/blender/release/scripts/modules/bpy/utils.py
    trunk/blender/release/scripts/modules/graphviz_export.py
    trunk/blender/release/scripts/modules/rigify/__init__.py
    trunk/blender/release/scripts/op/image.py
    trunk/blender/release/scripts/op/uv.py
    trunk/blender/release/scripts/ui/properties_data_armature_rigify.py
    trunk/blender/release/scripts/ui/properties_data_modifier.py
    trunk/blender/release/scripts/ui/space_text.py
    trunk/blender/source/blender/blenkernel/intern/customdata.c
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/blenkernel/intern/library.c
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/blenkernel/intern/sound.c
    trunk/blender/source/blender/blenlib/intern/bpath.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/space_image/image_buttons.c
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/makesdna/DNA_ID.h
    trunk/blender/source/blender/makesrna/intern/rna_ID.c
    trunk/blender/source/blender/makesrna/intern/rna_image.c
    trunk/blender/source/blender/makesrna/intern/rna_main.c
    trunk/blender/source/blender/makesrna/intern/rna_main_api.c
    trunk/blender/source/blender/makesrna/intern/rna_modifier.c
    trunk/blender/source/blender/makesrna/intern/rna_sound.c
    trunk/blender/source/blender/makesrna/intern/rna_text.c
    trunk/blender/source/blender/makesrna/intern/rna_vfont.c
    trunk/blender/source/blender/python/generic/bpy_internal_import.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/release/scripts/io/export_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/export_3ds.py	2010-06-02 17:38:38 UTC (rev 29162)
+++ trunk/blender/release/scripts/io/export_3ds.py	2010-06-02 17:58:28 UTC (rev 29163)
@@ -494,8 +494,7 @@
     mat_sub = _3ds_chunk(id)
 
     def add_image(img):
-        filename = os.path.basename(image.filename)
-# 		filename = image.filename.split('\\')[-1].split('/')[-1]
+        filename = os.path.basename(image.filepath)
         mat_sub_file = _3ds_chunk(MATMAPFILE)
         mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename)))
         mat_sub.add_subchunk(mat_sub_file)
@@ -1142,7 +1141,7 @@
 
 # Add to a menu
 def menu_func(self, context):
-    default_path = bpy.data.filename.replace(".blend", ".3ds")
+    default_path = bpy.data.filepath.replace(".blend", ".3ds")
     self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)").path = default_path
 
 

Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py	2010-06-02 17:38:38 UTC (rev 29162)
+++ trunk/blender/release/scripts/io/export_fbx.py	2010-06-02 17:58:28 UTC (rev 29163)
@@ -75,7 +75,7 @@
 
     image_paths = set()
     for tex in textures:
-        image_paths.add(Blender.sys.expandpath(tex.filename))
+        image_paths.add(bpy.utils.expandpath(tex.filepath))
 
     # Now copy images
     copyCount = 0
@@ -1255,7 +1255,7 @@
         file.write('\n\t}')
 
     def copy_image(image):
-        fn = bpy.utils.expandpath(image.filename)
+        fn = bpy.utils.expandpath(image.filepath)
         fn_strip = os.path.basename(fn)
 
         if EXP_IMAGE_COPY:
@@ -1282,7 +1282,7 @@
             Property: "Height", "int", "",0''')
         if tex:
             fname_rel, fname_strip = copy_image(tex)
-# 			fname, fname_strip, fname_rel = derived_paths(tex.filename, basepath, EXP_IMAGE_COPY)
+# 			fname, fname_strip, fname_rel = derived_paths(tex.filepath, basepath, EXP_IMAGE_COPY)
         else:
             fname = fname_strip = fname_rel = ''
 
@@ -1347,7 +1347,7 @@
 
         if tex:
             fname_rel, fname_strip = copy_image(tex)
-# 			fname, fname_strip, fname_rel = derived_paths(tex.filename, basepath, EXP_IMAGE_COPY)
+# 			fname, fname_strip, fname_rel = derived_paths(tex.filepath, basepath, EXP_IMAGE_COPY)
         else:
             fname = fname_strip = fname_rel = ''
 
@@ -3414,7 +3414,7 @@
 
 
 # if __name__ == "__main__":
-# 	bpy.ops.EXPORT_OT_ply(filename="/tmp/test.ply")
+# 	bpy.ops.EXPORT_OT_ply(path="/tmp/test.ply")
 
 
 # NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
@@ -3441,7 +3441,7 @@
 
 
 def menu_func(self, context):
-    default_path = bpy.data.filename.replace(".blend", ".fbx")
+    default_path = bpy.data.filepath.replace(".blend", ".fbx")
     self.layout.operator(ExportFBX.bl_idname, text="Autodesk FBX (.fbx)").path = default_path
 
 

Modified: trunk/blender/release/scripts/io/export_mdd.py
===================================================================
--- trunk/blender/release/scripts/io/export_mdd.py	2010-06-02 17:38:38 UTC (rev 29162)
+++ trunk/blender/release/scripts/io/export_mdd.py	2010-06-02 17:58:28 UTC (rev 29163)
@@ -183,7 +183,7 @@
 
 
 def menu_func(self, context):
-    default_path = bpy.data.filename.replace(".blend", ".mdd")
+    default_path = bpy.data.filepath.replace(".blend", ".mdd")
     self.layout.operator(ExportMDD.bl_idname, text="Lightwave Point Cache (.mdd)").path = default_path
 
 

Modified: trunk/blender/release/scripts/io/export_obj.py
===================================================================
--- trunk/blender/release/scripts/io/export_obj.py	2010-06-02 17:38:38 UTC (rev 29162)
+++ trunk/blender/release/scripts/io/export_obj.py	2010-06-02 17:58:28 UTC (rev 29163)
@@ -65,15 +65,15 @@
     else:
         return name.replace(' ', '_')
 
-def write_mtl(scene, filename, copy_images, mtl_dict):
+def write_mtl(scene, filepath, copy_images, mtl_dict):
 
     world = scene.world
     worldAmb = world.ambient_color
 
-    dest_dir = os.path.dirname(filename)
+    dest_dir = os.path.dirname(filepath)
 
     def copy_image(image):
-        fn = bpy.utils.expandpath(image.filename)
+        fn = bpy.utils.expandpath(image.filepath)
         fn_strip = os.path.basename(fn)
         if copy_images:
             rel = fn_strip
@@ -86,9 +86,9 @@
         return rel
 
 
-    file = open(filename, "w")
+    file = open(filepath, "w")
     # XXX
-#	file.write('# Blender MTL File: %s\n' % Blender.Get('filename').split('\\')[-1].split('/')[-1])
+#	file.write('# Blender MTL File: %s\n' % Blender.Get('filepath').split('\\')[-1].split('/')[-1])
     file.write('# Material Count: %i\n' % len(mtl_dict))
     # Write material/image combinations we have used.
     for key, (mtl_mat_name, mat, img) in mtl_dict.items():
@@ -131,15 +131,15 @@
             # write relative image path
             rel = copy_image(img)
             file.write('map_Kd %s\n' % rel) # Diffuse mapping image
-# 			file.write('map_Kd %s\n' % img.filename.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
+# 			file.write('map_Kd %s\n' % img.filepath.split('\\')[-1].split('/')[-1]) # Diffuse mapping image
 
         elif mat: # No face image. if we havea material search for MTex image.
             for mtex in mat.texture_slots:
                 if mtex and mtex.texture.type == 'IMAGE':
                     try:
-                        filename = copy_image(mtex.texture.image)
-# 						filename = mtex.texture.image.filename.split('\\')[-1].split('/')[-1]
-                        file.write('map_Kd %s\n' % filename) # Diffuse mapping image
+                        filepath = copy_image(mtex.texture.image)
+# 						filepath = mtex.texture.image.filepath.split('\\')[-1].split('/')[-1]
+                        file.write('map_Kd %s\n' % filepath) # Diffuse mapping image
                         break
                     except:
                         # Texture has no image though its an image type, best ignore.
@@ -189,7 +189,7 @@
     copyCount = 0
 
 # 	for bImage in uniqueImages.values():
-# 		image_path = bpy.utils.expandpath(bImage.filename)
+# 		image_path = bpy.utils.expandpath(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]
@@ -282,7 +282,7 @@
 
     return tot_verts
 
-def write(filename, objects, scene,
+def write(filepath, objects, scene,
           EXPORT_TRI=False,
           EXPORT_EDGES=False,
           EXPORT_NORMALS=False,
@@ -351,23 +351,23 @@
         return ret
 
 
-    print('OBJ Export path: "%s"' % filename)
+    print('OBJ Export path: "%s"' % filepath)
     temp_mesh_name = '~tmp-mesh'
 
     time1 = time.clock()
 #	time1 = sys.time()
 #	scn = Scene.GetCurrent()
 
-    file = open(filename, "w")
+    file = open(filepath, "w")
 
     # Write Header
-    file.write('# Blender v%s OBJ File: %s\n' % (bpy.app.version_string, bpy.data.filename.split('/')[-1].split('\\')[-1] ))
+    file.write('# Blender v%s OBJ File: %s\n' % (bpy.app.version_string, bpy.data.filepath.split('/')[-1].split('\\')[-1] ))
     file.write('# www.blender.org\n')
 
     # Tell the obj file what material file to use.
     if EXPORT_MTL:
-        mtlfilename = '%s.mtl' % '.'.join(filename.split('.')[:-1])
-        file.write('mtllib %s\n' % ( mtlfilename.split('\\')[-1].split('/')[-1] ))
+        mtlfilepath = '%s.mtl' % '.'.join(filepath.split('.')[:-1])
+        file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] ))
 
     if EXPORT_ROTX90:
         mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X')
@@ -782,22 +782,22 @@
 
     # Now we have all our materials, save them
     if EXPORT_MTL:
-        write_mtl(scene, mtlfilename, EXPORT_COPY_IMAGES, mtl_dict)
+        write_mtl(scene, mtlfilepath, EXPORT_COPY_IMAGES, mtl_dict)
 # 	if EXPORT_COPY_IMAGES:
-# 		dest_dir = os.path.basename(filename)
-# # 		dest_dir = filename
+# 		dest_dir = os.path.basename(filepath)
+# # 		dest_dir = filepath
 # # 		# Remove chars until we are just the path.
 # # 		while dest_dir and dest_dir[-1] not in '\\/':
 # # 			dest_dir = dest_dir[:-1]
 # 		if dest_dir:
 # 			copy_images(dest_dir, mtl_dict)
 # 		else:
-# 			print('\tError: "%s" could not be used as a base for an image path.' % filename)
+# 			print('\tError: "%s" could not be used as a base for an image path.' % filepath)
 
     print("OBJ Export time: %.2f" % (time.clock() - time1))
 #	print "OBJ Export time: %.2f" % (sys.time() - time1)
 
-def do_export(filename, context,
+def do_export(filepath, context,
               EXPORT_APPLY_MODIFIERS = True, # not used
               EXPORT_ROTX90 = True, # wrong
               EXPORT_TRI = False, # ok
@@ -817,7 +817,7 @@
               EXPORT_POLYGROUPS = False,
               EXPORT_CURVE_AS_NURBS = True):
     
-    base_name, ext = splitExt(filename)
+    base_name, ext = splitExt(filepath)
     context_name = [base_name, '', '', ext] # Base name, scene name, frame number, extension
 
     orig_scene = context.scene
@@ -853,7 +853,7 @@
 
         # Loop through all frames in the scene and export.
         for frame in scene_frames:
-            if EXPORT_ANIMATION: # Add frame to the filename.
+            if EXPORT_ANIMATION: # Add frame to the filepath.
                 context_name[2] = '_%.6d' % frame
 
             scn.frame_current = frame
@@ -964,7 +964,7 @@
 
 
 def menu_func(self, context):
-    default_path = bpy.data.filename.replace(".blend", ".obj")
+    default_path = bpy.data.filepath.replace(".blend", ".obj")
     self.layout.operator(ExportOBJ.bl_idname, text="Wavefront (.obj)").path = default_path
 
 

Modified: trunk/blender/release/scripts/io/export_ply.py
===================================================================
--- trunk/blender/release/scripts/io/export_ply.py	2010-06-02 17:38:38 UTC (rev 29162)
+++ trunk/blender/release/scripts/io/export_ply.py	2010-06-02 17:58:28 UTC (rev 29163)
@@ -203,7 +203,7 @@
 
     file.write('ply\n')
     file.write('format ascii 1.0\n')
-    file.write('comment Created by Blender %s - www.blender.org, source file: %s\n' % (bpy.app.version_string, bpy.data.filename.split('/')[-1].split('\\')[-1]))

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list