fix relative texture copy error
This commit is contained in:
parent
09addf54dc
commit
d644c55ae4
@ -1,7 +1,7 @@
|
|||||||
import bpy,bmesh,bpy_extras,mathutils
|
import bpy,bmesh,bpy_extras,mathutils
|
||||||
import pathlib,zipfile,time,os,tempfile,math
|
import pathlib,zipfile,time,os,tempfile,math
|
||||||
import struct,shutil
|
import struct,shutil
|
||||||
from bpy_extras import node_shader_utils
|
from bpy_extras import io_utils,node_shader_utils
|
||||||
|
|
||||||
bm_current_version = 10
|
bm_current_version = 10
|
||||||
|
|
||||||
@ -229,6 +229,8 @@ def export_bm(context,filepath,export_mode, export_target, no_component_suffix):
|
|||||||
|
|
||||||
# ====================== export texture
|
# ====================== export texture
|
||||||
ftexture = open(os.path.join(tempFolder, "texture.bm"), "wb")
|
ftexture = open(os.path.join(tempFolder, "texture.bm"), "wb")
|
||||||
|
source_dir = os.path.dirname(bpy.data.filepath)
|
||||||
|
|
||||||
for texture in textureList:
|
for texture in textureList:
|
||||||
# write finfo first
|
# write finfo first
|
||||||
write_string(finfo, texture.name)
|
write_string(finfo, texture.name)
|
||||||
@ -236,14 +238,16 @@ def export_bm(context,filepath,export_mode, export_target, no_component_suffix):
|
|||||||
write_long(finfo, ftexture.tell())
|
write_long(finfo, ftexture.tell())
|
||||||
|
|
||||||
# confirm internal
|
# confirm internal
|
||||||
filename = os.path.basename(texture.filepath)
|
texture_filepath = io_utils.path_reference(texture.filepath, source_dir, tempTextureFolder,
|
||||||
|
'ABSOLUTE', "", None, texture.library)
|
||||||
|
filename = os.path.basename(texture_filepath)
|
||||||
write_string(ftexture, filename)
|
write_string(ftexture, filename)
|
||||||
if (is_external_texture(filename)):
|
if (is_external_texture(filename)):
|
||||||
write_int(ftexture, 1)
|
write_int(ftexture, 1)
|
||||||
else:
|
else:
|
||||||
# copy internal texture
|
# copy internal texture
|
||||||
write_int(ftexture, 0)
|
write_int(ftexture, 0)
|
||||||
shutil.copy(texture.filepath, os.path.join(tempTextureFolder, filename))
|
shutil.copy(texture_filepath, os.path.join(tempTextureFolder, filename))
|
||||||
|
|
||||||
ftexture.close()
|
ftexture.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user