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.
This commit is contained in:
parent
fc59a6c6c8
commit
9cbbc9d3af
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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'}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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'}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -2316,7 +2316,7 @@ int CustomData_verify_versions(struct CustomData *data, int index)
|
|||
|
||||
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
|
||||
{
|
||||
char *path = (id->lib)? id->lib->filename: G.sce;
|
||||
char *path = (id->lib)? id->lib->filepath: G.sce;
|
||||
|
||||
BLI_strncpy(filename, external->filename, FILE_MAX);
|
||||
BLI_path_abs(filename, path);
|
||||
|
|
|
@ -1562,7 +1562,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
|
|||
BLI_strncpy(name, ima->name, sizeof(name));
|
||||
|
||||
if(ima->id.lib)
|
||||
BLI_path_abs(name, ima->id.lib->filename);
|
||||
BLI_path_abs(name, ima->id.lib->filepath);
|
||||
else
|
||||
BLI_path_abs(name, G.sce);
|
||||
|
||||
|
@ -1669,7 +1669,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
|
|||
|
||||
BLI_strncpy(str, ima->name, FILE_MAX);
|
||||
if(ima->id.lib)
|
||||
BLI_path_abs(str, ima->id.lib->filename);
|
||||
BLI_path_abs(str, ima->id.lib->filepath);
|
||||
else
|
||||
BLI_path_abs(str, G.sce);
|
||||
|
||||
|
@ -1727,7 +1727,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
|||
/* get the right string */
|
||||
BLI_strncpy(str, ima->name, sizeof(str));
|
||||
if(ima->id.lib)
|
||||
BLI_path_abs(str, ima->id.lib->filename);
|
||||
BLI_path_abs(str, ima->id.lib->filepath);
|
||||
else
|
||||
BLI_path_abs(str, G.sce);
|
||||
|
||||
|
|
|
@ -1225,7 +1225,7 @@ static void image_fix_relative_path(Image *ima)
|
|||
{
|
||||
if(ima->id.lib==NULL) return;
|
||||
if(strncmp(ima->name, "//", 2)==0) {
|
||||
BLI_path_abs(ima->name, ima->id.lib->filename);
|
||||
BLI_path_abs(ima->name, ima->id.lib->filepath);
|
||||
BLI_path_rel(ima->name, G.sce);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1080,7 +1080,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
|
|||
char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
|
||||
char *blendfilename;
|
||||
|
||||
blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filename: G.sce;
|
||||
blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce;
|
||||
|
||||
BLI_split_dirfile(blendfilename, NULL, file);
|
||||
i = strlen(file);
|
||||
|
|
|
@ -256,7 +256,7 @@ void sound_load(struct Main *bmain, struct bSound* sound)
|
|||
BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
|
||||
|
||||
if(sound->id.lib)
|
||||
path = sound->id.lib->filename;
|
||||
path = sound->id.lib->filepath;
|
||||
else
|
||||
path = bmain ? bmain->name : G.sce;
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
|
|||
/* get the path info from this datatype */
|
||||
Image *ima = (Image *)bpi->data;
|
||||
|
||||
bpi->lib = ima->id.lib ? ima->id.lib->filename : NULL;
|
||||
bpi->lib = ima->id.lib ? ima->id.lib->filepath : NULL;
|
||||
bpi->path = ima->name;
|
||||
bpi->name = ima->id.name+2;
|
||||
bpi->len = sizeof(ima->name);
|
||||
|
@ -356,7 +356,7 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
|
|||
/* get the path info from this datatype */
|
||||
bSound *snd = (bSound *)bpi->data;
|
||||
|
||||
bpi->lib = snd->id.lib ? snd->id.lib->filename : NULL;
|
||||
bpi->lib = snd->id.lib ? snd->id.lib->filepath : NULL;
|
||||
bpi->path = snd->name;
|
||||
bpi->name = snd->id.name+2;
|
||||
bpi->len = sizeof(snd->name);
|
||||
|
@ -377,7 +377,7 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
|
|||
/* get the path info from this datatype */
|
||||
VFont *vf = (VFont *)bpi->data;
|
||||
|
||||
bpi->lib = vf->id.lib ? vf->id.lib->filename : NULL;
|
||||
bpi->lib = vf->id.lib ? vf->id.lib->filepath : NULL;
|
||||
bpi->path = vf->name;
|
||||
bpi->name = vf->id.name+2;
|
||||
bpi->len = sizeof(vf->name);
|
||||
|
@ -424,7 +424,7 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
|
|||
|
||||
if (bpi->data) {
|
||||
Mesh *me = (Mesh *)bpi->data;
|
||||
bpi->lib = me->id.lib ? me->id.lib->filename : NULL;
|
||||
bpi->lib = me->id.lib ? me->id.lib->filepath : NULL;
|
||||
bpi->path = me->fdata.external->filename;
|
||||
bpi->name = me->id.name+2;
|
||||
bpi->len = sizeof(me->fdata.external->filename);
|
||||
|
|
|
@ -507,7 +507,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, c
|
|||
// printf("blo_find_main: converted to %s\n", name1);
|
||||
|
||||
for (m= mainlist->first; m; m= m->next) {
|
||||
char *libname= (m->curlib)?m->curlib->filename:m->name;
|
||||
char *libname= (m->curlib)?m->curlib->filepath:m->name;
|
||||
|
||||
if (BLI_streq(name1, libname)) {
|
||||
if(G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
|
||||
|
@ -520,7 +520,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, c
|
|||
|
||||
lib= alloc_libblock(&m->library, ID_LI, "lib");
|
||||
strncpy(lib->name, name, sizeof(lib->name)-1);
|
||||
BLI_strncpy(lib->filename, name1, sizeof(lib->filename));
|
||||
BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath));
|
||||
|
||||
m->curlib= lib;
|
||||
|
||||
|
@ -5233,8 +5233,8 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
for(newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
|
||||
if(newmain->curlib) {
|
||||
if(strcmp(newmain->curlib->filename, lib->filename)==0) {
|
||||
printf("Fixed error in file; multiple instances of lib:\n %s\n", lib->filename);
|
||||
if(strcmp(newmain->curlib->filepath, lib->filepath)==0) {
|
||||
printf("Fixed error in file; multiple instances of lib:\n %s\n", lib->filepath);
|
||||
|
||||
change_idid_adr(&fd->mainlist, fd, lib, newmain->curlib);
|
||||
// change_idid_adr_fd(fd, lib, newmain->curlib);
|
||||
|
@ -5249,8 +5249,8 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
|
|||
}
|
||||
}
|
||||
/* make sure we have full path in lib->filename */
|
||||
BLI_strncpy(lib->filename, lib->name, sizeof(lib->name));
|
||||
cleanup_path(fd->relabase, lib->filename);
|
||||
BLI_strncpy(lib->filepath, lib->name, sizeof(lib->name));
|
||||
cleanup_path(fd->relabase, lib->filepath);
|
||||
|
||||
// printf("direct_link_library: name %s\n", lib->name);
|
||||
// printf("direct_link_library: filename %s\n", lib->filename);
|
||||
|
@ -5283,7 +5283,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
|
|||
/* Libraries store both relative and abs paths, recreate relative paths,
|
||||
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
|
||||
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
|
||||
strncpy(lib->name, lib->filename, sizeof(lib->name));
|
||||
strncpy(lib->name, lib->filepath, sizeof(lib->name));
|
||||
BLI_path_rel(lib->name, basepath);
|
||||
}
|
||||
}
|
||||
|
@ -12216,7 +12216,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
|
|||
if(flag & FILE_RELPATH) {
|
||||
|
||||
/* use the full path, this could have been read by other library even */
|
||||
BLI_strncpy(mainl->curlib->name, mainl->curlib->filename, sizeof(mainl->curlib->name));
|
||||
BLI_strncpy(mainl->curlib->name, mainl->curlib->filepath, sizeof(mainl->curlib->name));
|
||||
|
||||
/* uses current .blend file as reference */
|
||||
BLI_path_rel(mainl->curlib->name, G.sce);
|
||||
|
@ -12333,10 +12333,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
if(fd==NULL) {
|
||||
|
||||
/* printf and reports for now... its important users know this */
|
||||
BKE_reportf(basefd->reports, RPT_INFO, "read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
|
||||
if(!G.background && basefd->reports) printf("read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
|
||||
BKE_reportf(basefd->reports, RPT_INFO, "read library: '%s', '%s'\n", mainptr->curlib->filepath, mainptr->curlib->name);
|
||||
if(!G.background && basefd->reports) printf("read library: '%s', '%s'\n", mainptr->curlib->filepath, mainptr->curlib->name);
|
||||
|
||||
fd= blo_openblenderfile(mainptr->curlib->filename, basefd->reports);
|
||||
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
|
||||
|
||||
/* allow typing in a new lib path */
|
||||
if(G.rt==-666) {
|
||||
|
@ -12344,19 +12344,19 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
char newlib_path[240] = { 0 };
|
||||
printf("Missing library...'\n");
|
||||
printf(" current file: %s\n", G.sce);
|
||||
printf(" absolute lib: %s\n", mainptr->curlib->filename);
|
||||
printf(" absolute lib: %s\n", mainptr->curlib->filepath);
|
||||
printf(" relative lib: %s\n", mainptr->curlib->name);
|
||||
printf(" enter a new path:\n");
|
||||
|
||||
if(scanf("%s", newlib_path) > 0) {
|
||||
strcpy(mainptr->curlib->name, newlib_path);
|
||||
strcpy(mainptr->curlib->filename, newlib_path);
|
||||
cleanup_path(G.sce, mainptr->curlib->filename);
|
||||
strcpy(mainptr->curlib->filepath, newlib_path);
|
||||
cleanup_path(G.sce, mainptr->curlib->filepath);
|
||||
|
||||
fd= blo_openblenderfile(mainptr->curlib->filename, basefd->reports);
|
||||
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
|
||||
|
||||
if(fd) {
|
||||
printf("found: '%s', party on macuno!\n", mainptr->curlib->filename);
|
||||
printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12379,8 +12379,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
else mainptr->curlib->filedata= NULL;
|
||||
|
||||
if (fd==NULL) {
|
||||
BKE_reportf(basefd->reports, RPT_ERROR, "Can't find lib '%s'\n", mainptr->curlib->filename);
|
||||
if(!G.background && basefd->reports) printf("ERROR: can't find lib %s \n", mainptr->curlib->filename);
|
||||
BKE_reportf(basefd->reports, RPT_ERROR, "Can't find lib '%s'\n", mainptr->curlib->filepath);
|
||||
if(!G.background && basefd->reports) printf("ERROR: can't find lib %s \n", mainptr->curlib->filepath);
|
||||
}
|
||||
}
|
||||
if(fd) {
|
||||
|
@ -12397,8 +12397,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
|
||||
append_id_part(fd, mainptr, id, &realid);
|
||||
if (!realid) {
|
||||
BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
|
||||
if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
|
||||
BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
|
||||
if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
|
||||
}
|
||||
|
||||
change_idid_adr(mainlist, basefd, id, realid);
|
||||
|
@ -12433,8 +12433,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|||
ID *idn= id->next;
|
||||
if(id->flag & LIB_READ) {
|
||||
BLI_remlink(lbarray[a], id);
|
||||
BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
|
||||
if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
|
||||
BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
|
||||
if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
|
||||
change_idid_adr(mainlist, basefd, id, NULL);
|
||||
|
||||
MEM_freeN(id);
|
||||
|
|
|
@ -5488,7 +5488,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
|
|||
int h= settings->imapaint.screen_grab_size[1];
|
||||
int maxsize;
|
||||
|
||||
RNA_string_get(op->ptr, "filename", filename);
|
||||
RNA_string_get(op->ptr, "filepath", filename);
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
|
||||
|
||||
|
@ -5541,5 +5541,5 @@ void PAINT_OT_image_from_view(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER;
|
||||
|
||||
RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "File Name", "Name of the file");
|
||||
RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
|
||||
}
|
||||
|
|
|
@ -841,7 +841,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn
|
|||
|
||||
if(ima->source != IMA_SRC_GENERATED) {
|
||||
row= uiLayoutRow(layout, 1);
|
||||
uiItemR(row, &imaptr, "filename", 0, "", 0);
|
||||
uiItemR(row, &imaptr, "filepath", 0, "", 0);
|
||||
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
|
||||
}
|
||||
|
||||
|
|
|
@ -891,7 +891,7 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *C, Pointe
|
|||
uiLayout *col, *row;
|
||||
|
||||
col= uiLayoutColumn(layout, 0);
|
||||
uiItemR(col, ptr, "filename", 0, "", 0);
|
||||
uiItemR(col, ptr, "filepath", 0, "", 0);
|
||||
uiItemR(col, ptr, "image_type", 0, "", 0);
|
||||
|
||||
row= uiLayoutRow(layout, 0);
|
||||
|
|
|
@ -117,7 +117,7 @@ typedef struct Library {
|
|||
ID *idblock;
|
||||
struct FileData *filedata;
|
||||
char name[240]; /* path name used for reading, can be relative and edited in the outliner */
|
||||
char filename[240]; /* temp. absolute filepath, only used while reading */
|
||||
char filepath[240]; /* temp. absolute filepath, only used while reading */
|
||||
int tot, pad; /* tot, idblock and filedata are only fo read and write */
|
||||
struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */
|
||||
} Library;
|
||||
|
|
|
@ -399,9 +399,9 @@ static void rna_def_library(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
|
||||
RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Filename", "Path to the library .blend file");
|
||||
RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
|
||||
/* TODO - lib->filename isnt updated, however the outliner also skips this, probably only needed on read. */
|
||||
|
||||
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
|
||||
|
|
|
@ -296,15 +296,15 @@ static void rna_def_image(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image");
|
||||
RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Filename", "Image/Movie file name");
|
||||
RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
|
||||
RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_reload_update");
|
||||
|
||||
/* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
|
||||
prop= RNA_def_property(srna, "filename_raw", PROP_STRING, PROP_FILEPATH);
|
||||
prop= RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Filename", "Image/Movie file name (without data refreshing)");
|
||||
RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");
|
||||
|
||||
prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, image_type_items);
|
||||
|
|
|
@ -55,20 +55,20 @@ static int rna_Main_fileissaved_get(PointerRNA *ptr)
|
|||
return G.relbase_valid;
|
||||
}
|
||||
|
||||
static void rna_Main_filename_get(PointerRNA *ptr, char *value)
|
||||
static void rna_Main_filepath_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
Main *bmain= (Main*)ptr->data;
|
||||
BLI_strncpy(value, bmain->name, sizeof(bmain->name));
|
||||
}
|
||||
|
||||
static int rna_Main_filename_length(PointerRNA *ptr)
|
||||
static int rna_Main_filepath_length(PointerRNA *ptr)
|
||||
{
|
||||
Main *bmain= (Main*)ptr->data;
|
||||
return strlen(bmain->name);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void rna_Main_filename_set(PointerRNA *ptr, const char *value)
|
||||
static void rna_Main_filepath_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
Main *bmain= (Main*)ptr->data;
|
||||
BLI_strncpy(bmain->name, value, sizeof(bmain->name));
|
||||
|
@ -308,9 +308,9 @@ void RNA_def_main(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_text(srna, "Main", "Main data structure representing a .blend file and all its datablocks");
|
||||
RNA_def_struct_ui_icon(srna, ICON_BLENDER);
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_maxlength(prop, 240);
|
||||
RNA_def_property_string_funcs(prop, "rna_Main_filename_get", "rna_Main_filename_length", "rna_Main_filename_set");
|
||||
RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");
|
||||
|
||||
|
|
|
@ -260,9 +260,9 @@ Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int f
|
|||
image->id.us--;
|
||||
return image;
|
||||
}
|
||||
Image *rna_Main_images_load(Main *bmain, char *filename)
|
||||
Image *rna_Main_images_load(Main *bmain, char *filepath)
|
||||
{
|
||||
return BKE_add_image_file(filename, 0);
|
||||
return BKE_add_image_file(filepath, 0);
|
||||
}
|
||||
void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
|
||||
{
|
||||
|
@ -316,9 +316,9 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall
|
|||
BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb));
|
||||
}
|
||||
|
||||
VFont *rna_Main_fonts_load(Main *bmain, char *filename)
|
||||
VFont *rna_Main_fonts_load(Main *bmain, char *filepath)
|
||||
{
|
||||
return load_vfont(filename);
|
||||
return load_vfont(filepath);
|
||||
}
|
||||
void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
|
||||
{
|
||||
|
@ -465,7 +465,7 @@ void RNA_api_main(StructRNA *srna)
|
|||
/*
|
||||
func= RNA_def_function(srna, "add_image", "rna_Main_add_image");
|
||||
RNA_def_function_ui_description(func, "Add a new image.");
|
||||
parm= RNA_def_string(func, "filename", "", 0, "", "Filename to load image from.");
|
||||
parm= RNA_def_string(func, "filepath", "", 0, "", "File path to load image from.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "image", "Image", "", "New image.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
@ -692,7 +692,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
|
||||
func= RNA_def_function(srna, "load", "rna_Main_images_load");
|
||||
RNA_def_function_ui_description(func, "Load a new image into the main database");
|
||||
parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the file to load.");
|
||||
parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the file to load.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
/* return type */
|
||||
parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
|
||||
|
@ -791,7 +791,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
|
||||
func= RNA_def_function(srna, "load", "rna_Main_fonts_load");
|
||||
RNA_def_function_ui_description(func, "Load a new font into the main database");
|
||||
parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the font to load.");
|
||||
parm= RNA_def_string(func, "filepath", "File Path", 0, "", "path of the font to load.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
/* return type */
|
||||
parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock.");
|
||||
|
|
|
@ -370,7 +370,7 @@ static int rna_MultiresModifier_external_get(PointerRNA *ptr)
|
|||
return CustomData_external_test(&me->fdata, CD_MDISPS);
|
||||
}
|
||||
|
||||
static void rna_MultiresModifier_filename_get(PointerRNA *ptr, char *value)
|
||||
static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
CustomDataExternal *external= ((Mesh*)ob->data)->fdata.external;
|
||||
|
@ -378,7 +378,7 @@ static void rna_MultiresModifier_filename_get(PointerRNA *ptr, char *value)
|
|||
BLI_strncpy(value, (external)? external->filename: "", sizeof(external->filename));
|
||||
}
|
||||
|
||||
static void rna_MultiresModifier_filename_set(PointerRNA *ptr, const char *value)
|
||||
static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
CustomDataExternal *external= ((Mesh*)ob->data)->fdata.external;
|
||||
|
@ -389,7 +389,7 @@ static void rna_MultiresModifier_filename_set(PointerRNA *ptr, const char *value
|
|||
}
|
||||
}
|
||||
|
||||
static int rna_MultiresModifier_filename_length(PointerRNA *ptr)
|
||||
static int rna_MultiresModifier_filepath_length(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
CustomDataExternal *external= ((Mesh*)ob->data)->fdata.external;
|
||||
|
@ -606,9 +606,9 @@ static void rna_def_modifier_multires(BlenderRNA *brna)
|
|||
RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
|
||||
RNA_def_property_ui_text(prop, "External", "Store multires displacements outside the .blend file, to save memory");
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filename_get", "rna_MultiresModifier_filename_length", "rna_MultiresModifier_filename_set");
|
||||
RNA_def_property_ui_text(prop, "Filename", "Path to external displacements file");
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length", "rna_MultiresModifier_filepath_set");
|
||||
RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop= RNA_def_property(srna, "optimal_display", PROP_BOOLEAN, PROP_NONE);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "BKE_sound.h"
|
||||
#include "BKE_context.h"
|
||||
|
||||
static void rna_Sound_filename_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
static void rna_Sound_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
sound_load(bmain, (bSound*)ptr->data);
|
||||
}
|
||||
|
@ -70,10 +70,10 @@ static void rna_def_sound(BlenderRNA *brna)
|
|||
|
||||
//rna_def_ipo_common(srna);
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Filename", "Sound sample file used by this Sound datablock");
|
||||
RNA_def_property_update(prop, 0, "rna_Sound_filename_update");
|
||||
RNA_def_property_update(prop, 0, "rna_Sound_filepath_update");
|
||||
|
||||
prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
|
||||
|
@ -82,7 +82,7 @@ static void rna_def_sound(BlenderRNA *brna)
|
|||
prop= RNA_def_property(srna, "caching", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
|
||||
RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM");
|
||||
RNA_def_property_update(prop, 0, "rna_Sound_filename_update");
|
||||
RNA_def_property_update(prop, 0, "rna_Sound_filepath_update");
|
||||
}
|
||||
|
||||
void RNA_def_sound(BlenderRNA *brna)
|
||||
|
|
|
@ -174,9 +174,9 @@ static void rna_def_text(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_icon(srna, ICON_TEXT);
|
||||
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_NONE);
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set");
|
||||
RNA_def_property_ui_text(prop, "Filename", "Filename of the text file");
|
||||
RNA_def_property_ui_text(prop, "File Path", "Filename of the text file");
|
||||
|
||||
prop= RNA_def_property(srna, "dirty", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISDIRTY);
|
||||
|
|
|
@ -44,10 +44,10 @@ void RNA_def_vfont(BlenderRNA *brna)
|
|||
RNA_def_struct_sdna(srna, "VFont");
|
||||
RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_ui_text(prop, "Filename", "");
|
||||
RNA_def_property_ui_text(prop, "File Path", "");
|
||||
|
||||
prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
|
||||
|
|
|
@ -59,7 +59,7 @@ void bpy_import_main_set(struct Main *maggie)
|
|||
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
|
||||
void bpy_text_filename_get(char *fn, Text *text)
|
||||
{
|
||||
sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filename : G.sce, text->id.name+2);
|
||||
sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
|
||||
}
|
||||
|
||||
PyObject *bpy_text_import( Text *text )
|
||||
|
|
|
@ -1518,7 +1518,7 @@ static void wm_link_make_library_local(Main *main, const char *libname)
|
|||
|
||||
/* and now find the latest append lib file */
|
||||
for(lib= main->library.first; lib; lib=lib->id.next)
|
||||
if(BLI_streq(libname, lib->filename))
|
||||
if(BLI_streq(libname, lib->filepath))
|
||||
break;
|
||||
|
||||
/* make local */
|
||||
|
|
|
@ -1830,7 +1830,7 @@ static void initPySysObjects(Main *maggie)
|
|||
while(lib) {
|
||||
/* lib->name wont work in some cases (on win32),
|
||||
* even when expanding with gp_GamePythonPath, using lib->filename is less trouble */
|
||||
initPySysObjects__append(sys_path, lib->filename);
|
||||
initPySysObjects__append(sys_path, lib->filepath);
|
||||
lib= (Library *)lib->id.next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue