[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14345] trunk/blender/release/scripts: fix for - [#7894] colladaExport14.py script export error.

Campbell Barton ideasman42 at gmail.com
Sun Apr 6 21:48:15 CEST 2008


Revision: 14345
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14345
Author:   campbellbarton
Date:     2008-04-06 21:48:15 +0200 (Sun, 06 Apr 2008)

Log Message:
-----------
fix for - [#7894] colladaExport14.py script export error.

Would fail on meshes with zero materials and textures with no images, and also when it is referred from the user scripts dir rather then the scripts dir.

Modified Paths:
--------------
    trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py
    trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py
    trunk/blender/release/scripts/colladaExport14.py

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py	2008-04-06 19:14:04 UTC (rev 14344)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py	2008-04-06 19:48:15 UTC (rev 14345)
@@ -125,7 +125,12 @@
 
 	doImport = doImp
 	if scriptsLoc == "":
-		scriptsLocation = Blender.Get('scriptsdir')+Blender.sys.sep+'bpymodules'+Blender.sys.sep+'colladaImEx'+Blender.sys.sep
+		scriptsLoc = Blender.Get('scriptsdir')
+		if not scriptsLoc: scriptsLoc = Blender.Get('uscriptsdir')
+		if scriptsLoc:
+			scriptsLocation = scriptsLoc+Blender.sys.sep+'bpymodules'+Blender.sys.sep+'colladaImEx'+Blender.sys.sep
+		else:
+			print 'Could not find a scripts path'
 	else:
 		scriptsLocation = scriptsLoc
 	

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py	2008-04-06 19:14:04 UTC (rev 14344)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py	2008-04-06 19:48:15 UTC (rev 14345)
@@ -2050,7 +2050,7 @@
 			daePhysicsMaterial = collada.DaePhysicsMaterial()
 
 			physicsMaterials = bNode.getData().getMaterials()
-			if not (physicsMaterials is None):
+			if (not (physicsMaterials is None)) and len(physicsMaterials) > 0:
 				physicsMaterial = physicsMaterials[0]
 				if not (physicsMaterial is None):
 					daePhysicsMaterial.techniqueCommon.restitution = physicsMaterial.rbRestitution
@@ -3100,7 +3100,7 @@
 			textures = bMaterial.getTextures()
 			for mTex in textures:
 				# Check if this texture is mapped to Color
-				if not mTex is None and mTex.mapto == Blender.Texture.MapTo.COL:
+				if not mTex is None and mTex.mapto == Blender.Texture.MapTo.COL and mTex.tex.image != None:
 					texture = mTex.tex
 					textureNode = TextureNode(self.document);
 					textureNode.AddImageTexture(daeEffect, texture.image);

Modified: trunk/blender/release/scripts/colladaExport14.py
===================================================================
--- trunk/blender/release/scripts/colladaExport14.py	2008-04-06 19:14:04 UTC (rev 14344)
+++ trunk/blender/release/scripts/colladaExport14.py	2008-04-06 19:48:15 UTC (rev 14345)
@@ -61,7 +61,7 @@
 
 try:
 	import colladaImEx.cstartup
-	if Blender.Get('scriptsdir') is None:
+	if not Blender.Get('scriptsdir') and not Blender.Get('uscriptsdir'):
 		if scriptsDir == '' or scriptsDir is None:
 			Blender.Draw.PupMenu("Cannot find folder %t | Please set path in file 'colladaImport14.py'")
 			error = True
@@ -118,5 +118,5 @@
 	try:
 		reload(colladaImEx.cstartup)
 		colladaImEx.cstartup.Main(False, loc)
-	except StandardError:
+	except ImportError:
 		pass





More information about the Bf-blender-cvs mailing list