mirror of
https://github.com/godotengine/collada-exporter.git
synced 2026-01-06 02:09:47 +03:00
Implemented some small fixes suggested in Blender Code Review
This commit is contained in:
@@ -142,13 +142,6 @@ class ExportDAE(bpy.types.Operator, ExportHelper):
|
|||||||
# return self.batch_mode == 'OFF'
|
# return self.batch_mode == 'OFF'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check(self, context):
|
|
||||||
return True
|
|
||||||
"""
|
|
||||||
isretur_def_change = super().check(context)
|
|
||||||
return (is_xna_change or is_def_change)
|
|
||||||
"""
|
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
if not self.filepath:
|
if not self.filepath:
|
||||||
raise Exception("filepath not set")
|
raise Exception("filepath not set")
|
||||||
|
|||||||
@@ -161,11 +161,12 @@ class DaeExporter:
|
|||||||
self.sections[section].append(line)
|
self.sections[section].append(line)
|
||||||
|
|
||||||
def export_image(self, image):
|
def export_image(self, image):
|
||||||
if (image in self.image_cache):
|
img_id = self.image_cache.get(image)
|
||||||
return self.image_cache[image]
|
if img_id:
|
||||||
|
return img_id
|
||||||
|
|
||||||
imgpath = image.filepath
|
imgpath = image.filepath
|
||||||
if (imgpath.find("//") == 0 or imgpath.find("\\\\") == 0):
|
if imgpath.startswith("//"):
|
||||||
# If relative, convert to absolute
|
# If relative, convert to absolute
|
||||||
imgpath = bpy.path.abspath(imgpath)
|
imgpath = bpy.path.abspath(imgpath)
|
||||||
|
|
||||||
@@ -187,9 +188,7 @@ class DaeExporter:
|
|||||||
# If file is not found save it as png file in the destination
|
# If file is not found save it as png file in the destination
|
||||||
# folder
|
# folder
|
||||||
img_tmp_path = image.filepath
|
img_tmp_path = image.filepath
|
||||||
if img_tmp_path.endswith((".bmp", ".rgb", ".png", ".jpeg",
|
if img_tmp_path.lower().endswith(bpy.path.extensions_image):
|
||||||
".jpg", ".jp2", ".tga", ".cin",
|
|
||||||
".dpx", ".exr", ".hdr", ".tif")):
|
|
||||||
image.filepath = basedir + "/" + \
|
image.filepath = basedir + "/" + \
|
||||||
os.path.basename(img_tmp_path)
|
os.path.basename(img_tmp_path)
|
||||||
else:
|
else:
|
||||||
@@ -234,8 +233,9 @@ class DaeExporter:
|
|||||||
return imgid
|
return imgid
|
||||||
|
|
||||||
def export_material(self, material, double_sided_hint=True):
|
def export_material(self, material, double_sided_hint=True):
|
||||||
if (material in self.material_cache):
|
material_id = self.material_cache.get(material)
|
||||||
return self.material_cache[material]
|
if material_id:
|
||||||
|
return material_id
|
||||||
|
|
||||||
fxid = self.new_id("fx")
|
fxid = self.new_id("fx")
|
||||||
self.writel(S_FX, 1, '<effect id="' + fxid + '" name="' +
|
self.writel(S_FX, 1, '<effect id="' + fxid + '" name="' +
|
||||||
@@ -1760,9 +1760,9 @@ class DaeExporter:
|
|||||||
bones = []
|
bones = []
|
||||||
# find bones used
|
# find bones used
|
||||||
for p in x.fcurves:
|
for p in x.fcurves:
|
||||||
dp = str(p.data_path)
|
dp = p.data_path
|
||||||
base = "pose.bones[\""
|
base = "pose.bones[\""
|
||||||
if (dp.find(base) == 0):
|
if dp.startswith(base):
|
||||||
dp = dp[len(base):]
|
dp = dp[len(base):]
|
||||||
if (dp.find('"') != -1):
|
if (dp.find('"') != -1):
|
||||||
dp = dp[:dp.find('"')]
|
dp = dp[:dp.find('"')]
|
||||||
|
|||||||
Reference in New Issue
Block a user