diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-02 21:58:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-02 21:58:28 +0400 |
commit | 9cbbc9d3afd8742a36969736f648743d4f943393 (patch) | |
tree | a1ef5a2d550493c0c6affd2a2accdc4a97307a66 /release | |
parent | fc59a6c6c8e847c6ad2c8132a5c10991f7f305b8 (diff) |
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.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/io/export_3ds.py | 5 | ||||
-rw-r--r-- | release/scripts/io/export_fbx.py | 12 | ||||
-rw-r--r-- | release/scripts/io/export_mdd.py | 2 | ||||
-rw-r--r-- | release/scripts/io/export_obj.py | 48 | ||||
-rw-r--r-- | release/scripts/io/export_ply.py | 4 | ||||
-rw-r--r-- | release/scripts/io/export_x3d.py | 21 | ||||
-rw-r--r-- | release/scripts/io/netrender/client.py | 8 | ||||
-rw-r--r-- | release/scripts/io/netrender/operators.py | 2 | ||||
-rwxr-xr-x | release/scripts/io/netrender/repath.py | 12 | ||||
-rw-r--r-- | release/scripts/io/netrender/ui.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/graphviz_export.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/__init__.py | 2 | ||||
-rw-r--r-- | release/scripts/op/image.py | 30 | ||||
-rw-r--r-- | release/scripts/op/uv.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/properties_data_armature_rigify.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/properties_data_modifier.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_text.py | 8 |
18 files changed, 85 insertions, 89 deletions
diff --git a/release/scripts/io/export_3ds.py b/release/scripts/io/export_3ds.py index 5833dd01f3c..9cb5f3a077b 100644 --- a/release/scripts/io/export_3ds.py +++ b/release/scripts/io/export_3ds.py @@ -494,8 +494,7 @@ def make_material_texture_chunk(id, images): 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 @@ class Export3DS(bpy.types.Operator): # 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 diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index f0b20837e26..5fe7f519b1d 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -75,7 +75,7 @@ def copy_images(dest_dir, textures): 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 @@ def write(filename, batch_objects = None, \ 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 @@ def write(filename, batch_objects = None, \ 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 @@ def write(filename, batch_objects = None, \ 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 @@ class ExportFBX(bpy.types.Operator): # 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 @@ class ExportFBX(bpy.types.Operator): 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 diff --git a/release/scripts/io/export_mdd.py b/release/scripts/io/export_mdd.py index 578813db2c6..3ae6ed3de9b 100644 --- a/release/scripts/io/export_mdd.py +++ b/release/scripts/io/export_mdd.py @@ -183,7 +183,7 @@ class ExportMDD(bpy.types.Operator): 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 diff --git a/release/scripts/io/export_obj.py b/release/scripts/io/export_obj.py index 2d09844e592..9c065c6dac9 100644 --- a/release/scripts/io/export_obj.py +++ b/release/scripts/io/export_obj.py @@ -65,15 +65,15 @@ def fixName(name): 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 @@ def write_mtl(scene, filename, copy_images, mtl_dict): 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 @@ def write_mtl(scene, filename, copy_images, mtl_dict): # 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 @@ def copy_images(dest_dir): 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 @@ def write_nurb(file, ob, ob_mat): 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 @@ def write(filename, objects, scene, 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 @@ def write(filename, objects, scene, # 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 @@ def do_export(filename, context, 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 @@ def do_export(filename, context, # 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 @@ class ExportOBJ(bpy.types.Operator): 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 diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py index 8249ce553bb..d0f2fab9c3e 100644 --- a/release/scripts/io/export_ply.py +++ b/release/scripts/io/export_ply.py @@ -203,7 +203,7 @@ def write(filename, scene, ob, \ 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])) + file.write('comment Created by Blender %s - www.blender.org, source file: %s\n' % (bpy.app.version_string, bpy.data.filepath.split('/')[-1].split('\\')[-1])) file.write('element vertex %d\n' % len(ply_verts)) @@ -310,7 +310,7 @@ class ExportPLY(bpy.types.Operator): def menu_func(self, context): - default_path = bpy.data.filename.replace(".blend", ".ply") + default_path = bpy.data.filepath.replace(".blend", ".ply") self.layout.operator(ExportPLY.bl_idname, text="Stanford (.ply)").path = default_path diff --git a/release/scripts/io/export_x3d.py b/release/scripts/io/export_x3d.py index 619c0b3d373..61f216af833 100644 --- a/release/scripts/io/export_x3d.py +++ b/release/scripts/io/export_x3d.py @@ -717,7 +717,7 @@ class x3d_class: def writeImageTexture(self, image): name = image.name - filename = image.filename.split('/')[-1].split('\\')[-1] + filename = image.filepath.split('/')[-1].split('\\')[-1] if name in self.texNames: self.writeIndented("<ImageTexture USE=\"%s\" />\n" % self.cleanStr(name)) self.texNames[name] += 1 @@ -794,28 +794,28 @@ class x3d_class: pic = tex.image # using .expandpath just in case, os.path may not expect // - basename = os.path.basename(bpy.utils.expandpath(pic.filename)) + basename = os.path.basename(bpy.utils.expandpath(pic.filepath)) pic = alltextures[i].image # pic = alltextures[i].getImage() if (namemat == "back") and (pic != None): self.file.write("\n\tbackUrl=\"%s\" " % basename) - # self.file.write("\n\tbackUrl=\"%s\" " % pic.filename.split('/')[-1].split('\\')[-1]) + # self.file.write("\n\tbackUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1]) elif (namemat == "bottom") and (pic != None): self.writeIndented("bottomUrl=\"%s\" " % basename) - # self.writeIndented("bottomUrl=\"%s\" " % pic.filename.split('/')[-1].split('\\')[-1]) + # self.writeIndented("bottomUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1]) elif (namemat == "front") and (pic != None): self.writeIndented("frontUrl=\"%s\" " % basename) - # self.writeIndented("frontUrl=\"%s\" " % pic.filename.split('/')[-1].split('\\')[-1]) + # self.writeIndented("frontUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1]) elif (namemat == "left") and (pic != None): self.writeIndented("leftUrl=\"%s\" " % basename) - # self.writeIndented("leftUrl=\"%s\" " % pic.filename.split('/')[-1].split('\\')[-1]) + # self.writeIndented("leftUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1]) elif (namemat == "right") and (pic != None): self.writeIndented("rightUrl=\"%s\" " % basename) - # self.writeIndented("rightUrl=\"%s\" " % pic.filename.split('/')[-1].split('\\')[-1]) + # self.writeIndented("rightUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1]) elif (namemat == "top") and (pic != None): self.writeIndented("topUrl=\"%s\" " % basename) - # self.writeIndented("topUrl=\"%s\" " % pic.filename.split('/')[-1].split('\\')[-1]) + # self.writeIndented("topUrl=\"%s\" " % pic.filepath.split('/')[-1].split('\\')[-1]) self.writeIndented("/>\n\n") ########################################################## @@ -1215,9 +1215,6 @@ def x3d_export_ui(filename): ######################################################### -# if __name__ == '__main__': -# Blender.Window.FileSelector(x3d_export_ui,"Export X3D", Blender.Get('filename').replace('.blend', '.x3d')) - from bpy.props import * class ExportX3D(bpy.types.Operator): @@ -1245,7 +1242,7 @@ class ExportX3D(bpy.types.Operator): def menu_func(self, context): - default_path = bpy.data.filename.replace(".blend", ".x3d") + default_path = bpy.data.filepath.replace(".blend", ".x3d") self.layout.operator(ExportX3D.bl_idname, text="X3D Extensible 3D (.x3d)").path = default_path diff --git a/release/scripts/io/netrender/client.py b/release/scripts/io/netrender/client.py index 5c01884a20e..9f6d1a7639e 100644 --- a/release/scripts/io/netrender/client.py +++ b/release/scripts/io/netrender/client.py @@ -101,7 +101,7 @@ def clientSendJob(conn, scene, anim = False): else: job.addFrame(scene.frame_current) - filename = bpy.data.filename + filename = bpy.data.filepath job.addFile(filename) job_name = netsettings.job_name @@ -113,7 +113,7 @@ def clientSendJob(conn, scene, anim = False): # LIBRARIES ########################### for lib in bpy.data.libraries: - file_path = bpy.utils.expandpath(lib.filename) + file_path = bpy.utils.expandpath(lib.filepath) if os.path.exists(file_path): job.addFile(file_path) @@ -122,7 +122,7 @@ def clientSendJob(conn, scene, anim = False): ########################### for image in bpy.data.images: if image.source == "FILE" and not image.packed_file: - file_path = bpy.utils.expandpath(image.filename) + file_path = bpy.utils.expandpath(image.filepath) if os.path.exists(file_path): job.addFile(file_path) @@ -149,7 +149,7 @@ def clientSendJob(conn, scene, anim = False): if modifier.domain_settings.highres: addPointCache(job, object, modifier.domain_settings.point_cache_high, default_path) elif modifier.type == "MULTIRES" and modifier.external: - file_path = bpy.utils.expandpath(modifier.filename) + file_path = bpy.utils.expandpath(modifier.filepath) job.addFile(file_path) # particles modifier are stupid and don't contain data diff --git a/release/scripts/io/netrender/operators.py b/release/scripts/io/netrender/operators.py index fbb0f0b4043..02cb864cd1a 100644 --- a/release/scripts/io/netrender/operators.py +++ b/release/scripts/io/netrender/operators.py @@ -39,7 +39,7 @@ class RENDER_OT_netslave_bake(bpy.types.Operator): scene = context.scene netsettings = scene.network_render - filename = bpy.data.filename + filename = bpy.data.filepath path, name = os.path.split(filename) root, ext = os.path.splitext(name) default_path = path + os.sep + "blendcache_" + root + os.sep # need an API call for that diff --git a/release/scripts/io/netrender/repath.py b/release/scripts/io/netrender/repath.py index 5287fc03221..7d399172906 100755 --- a/release/scripts/io/netrender/repath.py +++ b/release/scripts/io/netrender/repath.py @@ -87,20 +87,20 @@ def process(paths): # LIBRARIES ########################### for lib in bpy.data.libraries: - file_path = bpy.utils.expandpath(lib.filename) + file_path = bpy.utils.expandpath(lib.filepath) new_path = path_map.get(file_path, None) if new_path: - lib.filename = new_path + lib.filepath = new_path ########################### # IMAGES ########################### for image in bpy.data.images: if image.source == "FILE" and not image.packed_file: - file_path = bpy.utils.expandpath(image.filename) + file_path = bpy.utils.expandpath(image.filepath) new_path = path_map.get(file_path, None) if new_path: - image.filename = new_path + image.filepath = new_path ########################### @@ -119,10 +119,10 @@ def process(paths): if modifier.domain_settings.highres: processPointCache(modifier.domain_settings.point_cache_high) elif modifier.type == "MULTIRES" and modifier.external: - file_path = bpy.utils.expandpath(modifier.filename) + file_path = bpy.utils.expandpath(modifier.filepath) new_path = path_map.get(file_path, None) if new_path: - modifier.filename = new_path + modifier.filepath = new_path # particles modifier are stupid and don't contain data # we have to go through the object property diff --git a/release/scripts/io/netrender/ui.py b/release/scripts/io/netrender/ui.py index c554c3031fb..c60b10c484a 100644 --- a/release/scripts/io/netrender/ui.py +++ b/release/scripts/io/netrender/ui.py @@ -37,8 +37,8 @@ DONE = 2 ERROR = 3 def init_file(): - if netrender.init_file != bpy.data.filename: - netrender.init_file = bpy.data.filename + if netrender.init_file != bpy.data.filepath: + netrender.init_file = bpy.data.filepath netrender.init_data = True netrender.init_address = True diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index cdf79a760ba..9b411945da6 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -217,7 +217,7 @@ def expandpath(path): Returns the absolute path relative to the current blend file using the "//" prefix. """ if path.startswith("//"): - return _os.path.join(_os.path.dirname(_bpy.data.filename), path[2:]) + return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:]) return path @@ -231,7 +231,7 @@ def relpath(path, start=None): """ if not path.startswith("//"): if start is None: - start = _os.path.dirname(_bpy.data.filename) + start = _os.path.dirname(_bpy.data.filepath) return "//" + _os.path.relpath(path, start) return path diff --git a/release/scripts/modules/graphviz_export.py b/release/scripts/modules/graphviz_export.py index fd32a7ee3b9..874b79d8ea2 100644 --- a/release/scripts/modules/graphviz_export.py +++ b/release/scripts/modules/graphviz_export.py @@ -57,7 +57,7 @@ def graph_armature(obj, path, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=True, fileobject = open(path, "w") fw = fileobject.write fw(header) - fw('label = "%s::%s" ;' % (bpy.data.filename.split("/")[-1].split("\\")[-1], obj.name)) + fw('label = "%s::%s" ;' % (bpy.data.filepath.split("/")[-1].split("\\")[-1], obj.name)) arm = obj.data diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py index 8a9894c4380..ef8f62ad058 100644 --- a/release/scripts/modules/rigify/__init__.py +++ b/release/scripts/modules/rigify/__init__.py @@ -534,7 +534,7 @@ def generate_test_all(context, GRAPH=False): new_objects = rigify.generate_test(context) if GRAPH: - base_name = os.path.splitext(bpy.data.filename)[0] + base_name = os.path.splitext(bpy.data.filepath)[0] for obj, obj_new in new_objects: for obj in (obj, obj_new): fn = base_name + "-" + bpy.utils.clean_name(obj.name) diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index 9907362502e..873500d8343 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -70,7 +70,7 @@ class EditExternally(bpy.types.Operator): def invoke(self, context, event): try: - path = context.space_data.image.filename + path = context.space_data.image.filepath except: self.report({'ERROR'}, "Image not found on disk") return {'CANCELLED'} @@ -91,7 +91,7 @@ class SaveDirty(bpy.types.Operator): unique_paths = set() for image in bpy.data.images: if image.dirty: - path = bpy.utils.expandpath(image.filename) + path = bpy.utils.expandpath(image.filepath) if "\\" not in path and "/" not in path: self.report({'WARNING'}, "Invalid path: " + path) elif path in unique_paths: @@ -131,37 +131,37 @@ class ProjectEdit(bpy.types.Operator): self.report({'ERROR'}, "Could not make new image") return {'CANCELLED'} - filename = os.path.basename(bpy.data.filename) - filename = os.path.splitext(filename)[0] - # filename = bpy.utils.clean_name(filename) # fixes <memory> rubbish, needs checking + filepath = os.path.basename(bpy.data.filepath) + filepath = os.path.splitext(filepath)[0] + # filepath = bpy.utils.clean_name(filepath) # fixes <memory> rubbish, needs checking - if filename.startswith(".") or filename == "": + if filepath.startswith(".") or filepath == "": # TODO, have a way to check if the file is saved, assume .B25.blend tmpdir = context.user_preferences.filepaths.temporary_directory - filename = os.path.join(tmpdir, "project_edit") + filepath = os.path.join(tmpdir, "project_edit") else: - filename = "//" + filename + filepath = "//" + filepath obj = context.object if obj: - filename += "_" + bpy.utils.clean_name(obj.name) + filepath += "_" + bpy.utils.clean_name(obj.name) - filename_final = filename + "." + EXT + filepath_final = filepath + "." + EXT i = 0 - while os.path.exists(bpy.utils.expandpath(filename_final)): - filename_final = filename + ("%.3d.%s" % (i, EXT)) + while os.path.exists(bpy.utils.expandpath(filepath_final)): + filepath_final = filepath + ("%.3d.%s" % (i, EXT)) i += 1 - image_new.name = os.path.basename(filename_final) + image_new.name = os.path.basename(filepath_final) ProjectEdit._proj_hack[0] = image_new.name - image_new.filename_raw = filename_final # TODO, filename raw is crummy + image_new.filepath_raw = filepath_final # TODO, filepath raw is crummy image_new.file_format = 'PNG' image_new.save() - bpy.ops.image.external_edit(path=filename_final) + bpy.ops.image.external_edit(path=filepath_final) return {'FINISHED'} diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index ad25553a41c..1a64f61a11a 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -123,7 +123,7 @@ class ExportUVLayout(bpy.types.Operator): fw(' "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n') fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' % (image_width, image_height, image_width, image_height)) fw(' xmlns="http://www.w3.org/2000/svg" version="1.1">\n') - desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filename), obj.name, mesh.name, bpy.app.version_string) + desc = "%s, %s, %s (Blender %s)" % (basename(bpy.data.filepath), obj.name, mesh.name, bpy.app.version_string) fw('<desc>%s</desc>\n' % escape(desc)) # svg colors @@ -210,7 +210,7 @@ class ExportUVLayout(bpy.types.Operator): def menu_func(self, context): - default_path = bpy.data.filename.replace(".blend", ".svg") + default_path = bpy.data.filepath.replace(".blend", ".svg") self.layout.operator(ExportUVLayout.bl_idname).path = default_path diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py index 5ec50973ea4..0eba1fb045b 100644 --- a/release/scripts/ui/properties_data_armature_rigify.py +++ b/release/scripts/ui/properties_data_armature_rigify.py @@ -212,7 +212,7 @@ class Graph(bpy.types.Operator): import bpy reload(graphviz_export) obj = bpy.context.object - path = os.path.splitext(bpy.data.filename)[0] + "-" + bpy.utils.clean_name(obj.name) + path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name) path_dot = path + ".dot" path_png = path + ".png" saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False) @@ -249,7 +249,7 @@ class AsScript(bpy.types.Operator): def invoke(self, context, event): import os obj = context.object - self.properties.path = os.path.splitext(bpy.data.filename)[0] + "-" + bpy.utils.clean_name(obj.name) + ".py" + self.properties.path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name) + ".py" wm = context.manager wm.add_fileselect(self) return {'RUNNING_MODAL'} diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py index a6d6e098812..cd80d3e9c91 100644 --- a/release/scripts/ui/properties_data_modifier.py +++ b/release/scripts/ui/properties_data_modifier.py @@ -455,7 +455,7 @@ class DATA_PT_modifiers(DataButtonsPanel): row.operator("object.multires_pack_external", text="Pack External") row.label() row = col.row() - row.prop(md, "filename", text="") + row.prop(md, "filepath", text="") else: row.operator("object.multires_save_external", text="Save External...") row.label() diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 10740f788f5..1eca1a9e05c 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -57,11 +57,11 @@ class TEXT_HT_header(bpy.types.Header): row.prop(text, "use_module") row = layout.row() - if text.filename != "": + if text.filepath: if text.dirty: - row.label(text="File: *%s (unsaved)" % text.filename) + row.label(text="File: *%s (unsaved)" % text.filepath) else: - row.label(text="File: %s" % text.filename) + row.label(text="File: %s" % text.filepath) else: if text.library: row.label(text="Text: External") @@ -147,7 +147,7 @@ class TEXT_MT_text(bpy.types.Menu): layout.operator("text.save") layout.operator("text.save_as") - if text.filename != "": + if text.filepath: layout.operator("text.make_internal") layout.column() |