[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11494] trunk/blender/release/scripts: Collada bug fix updates thanks to the Collada plugin script developers

Tom Musgrove LetterRip at gmail.com
Sun Aug 5 22:01:31 CEST 2007


Revision: 11494
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11494
Author:   letterrip
Date:     2007-08-05 22:01:30 +0200 (Sun, 05 Aug 2007)

Log Message:
-----------
Collada bug fix updates thanks to the Collada plugin script developers 

Materials imported correctly. And now are Exported in Collada 1.4.1 format not 1.4.0 format (You may need to make some updates to your code if your not compatible with 1.4.1 yet)

Skeletal non-animated dae's import better and crash less.

Skeletal Animation export when baking matrices fixed.

Texture and materials exported better when using "Use UV"

Basic Skeletal animation exporting.

Object Properties exporting and importing.

Countless bug fixes.

Modified Paths:
--------------
    trunk/blender/release/scripts/bpymodules/colladaImEx/collada.py
    trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py
    trunk/blender/release/scripts/bpymodules/colladaImEx/cutils.py
    trunk/blender/release/scripts/bpymodules/colladaImEx/helperObjects.py
    trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py
    trunk/blender/release/scripts/bpymodules/colladaImEx/xmlUtils.py
    trunk/blender/release/scripts/colladaExport14.py
    trunk/blender/release/scripts/colladaImport14.py

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/collada.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/collada.py	2007-08-05 19:54:06 UTC (rev 11493)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/collada.py	2007-08-05 20:01:30 UTC (rev 11494)
@@ -1,5 +1,5 @@
 # -------------------------------------------------------------------------
-# Illusoft Collada 1.4 plugin for Blender version 0.3.146
+# Illusoft Collada 1.4 plugin for Blender
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -559,7 +559,7 @@
 	
 	def SaveToXml(self, daeDocument):
 		node = super(DaeSkin, self).SaveToXml(daeDocument)
-		SetAttribute(node, DaeSyntax.SOURCE, "#" + self.source)
+		SetAttribute(node, DaeSyntax.SOURCE, "#" + StripString(self.source));
 		AppendTextChild(node, DaeSyntax.BIND_SHAPE_MATRIX, MatrixToString(self.bindShapeMatrix,ROUND))
 		AppendChilds(daeDocument, node, self.sources)
 		AppendChild(daeDocument,node,self.joints)
@@ -1016,13 +1016,13 @@
 	class DaeSpot(DaeTechniqueCommon):
 		def __init__(self):
 			super(DaeLight.DaeSpot,self).__init__()
-			self.defConstantAttenuation = 0.0
+			self.defConstantAttenuation = 1.0
 			self.defLinearAttenuation = 0.0
 			self.defQuadraticAttenuation = 0.0
 			self.defFalloffAngle = 180.0
 			self.defFalloffExponent = 0.0
 			
-			self.constantAttenuation = 0.0
+			self.constantAttenuation = 1.0
 			self.linearAttenuation = 0.0
 			self.quadraticAttenuation = 0.0
 			self.falloffAngle = 180.0
@@ -1069,7 +1069,7 @@
 	class DaePoint(DaeTechniqueCommon):
 		def __init__(self):
 			super(DaeLight.DaePoint,self).__init__()
-			self.constantAttenuation = 0.0
+			self.constantAttenuation = 1.0
 			self.linearAttenuation = 0.0
 			self.quadraticAttenuation = 0.0
 			self.syntax = DaeSyntax.POINT
@@ -1201,7 +1201,7 @@
 		node = super(DaeNode, self).SaveToXml(daeDocument)
 		if self.type == DaeSyntax.TYPE_JOINT:
 			SetAttribute(node, DaeSyntax.TYPE, self.type)##DaeNode.GetType(self.type))
-		SetAttribute(node, DaeSyntax.SID, self.sid)
+		SetAttribute(node, DaeSyntax.SID, StripString(self.sid))
 		
 		
 		
@@ -2151,7 +2151,6 @@
 		
 	def SaveToXml(self, daeDocument):
 		node = super(DaeFxMaterialInstance,self).SaveToXml(daeDocument)
-		print "x"
 		SetAttribute(node, DaeFxSyntax.TARGET, StripString('#'+self.object.id))
 		SetAttribute(node, DaeFxSyntax.SYMBOL, StripString(self.object.id))
 		AppendChild(daeDocument,node,self.bind);
@@ -2236,8 +2235,8 @@
 		self.maxfilter = DaeMaxFilter();
 	
 	def LoadFromXml(self, daeDocument, xmlNode):
-		super(DaeFxSampler2D, self).LoadFromXml(daeDocument, xmlNode)		
-		self.source = xmlUtils.ReadContents(xmlNode);
+		super(DaeFxSampler2D, self).LoadFromXml(daeDocument, xmlNode)
+		self.source = str(xmlUtils.ReadContents(xmlUtils.FindElementByTagName(xmlNode, DaeSyntax.SOURCE)))
 		self.minfilter = CreateObjectFromXml(daeDocument, xmlNode, "minfilter", DaeMinFilter);
 		self.maxfilter = CreateObjectFromXml(daeDocument, xmlNode, "maxfilter", DaeMaxFilter);
 		
@@ -3463,7 +3462,10 @@
 	return True
 
 def StripString(text):
-	return text.replace(' ','_').replace('.','_')
+    if text != None:
+	   return text.replace(' ','_').replace('.','_')
+    else:
+        return text;
 
 def CreateExtra(colladaInstance):
 	if isinstance(colladaInstance, DaeEntity):

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py	2007-08-05 19:54:06 UTC (rev 11493)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/cstartup.py	2007-08-05 20:01:30 UTC (rev 11494)
@@ -1,5 +1,5 @@
 # --------------------------------------------------------------------------
-# Illusoft Collada 1.4 plugin for Blender version 0.3.146
+# Illusoft Collada 1.4 plugin for Blender
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -34,7 +34,7 @@
 	print "Error! Could not find Blender modules!"
 	_ERROR = True
 
-__version__ = '0.3.146'
+__version__ = '0.3.159'
 
 # Show the wait cursor in blender
 Blender.Window.WaitCursor(1)
@@ -237,6 +237,35 @@
 	colladaReg = Blender.Registry.GetKey('collada',True)
 	if not (colladaReg is None):
 		fileButton.val = colladaReg.get('path', '')
+		fileParts = []
+		filePath = "";
+		fileParts = fileButton.val.split("\\");
+		partCount = len(fileParts);
+		if partCount > 0 :
+			for i in range(partCount):
+				if i == 0:
+					filePath = fileParts[i];
+				else :
+					if i != partCount - 1:
+						filePath = filePath + "\\" + fileParts[i];
+					else:
+						filePath = filePath + "\\";	
+
+		blenderFilename = Blender.Get('filename');
+		fileParts = []
+		fileParts = blenderFilename.split("\\");
+		partCount = len(fileParts);		
+		if partCount > 0 :
+			blenderFileOnlyName = fileParts[partCount -1];
+			blenderFileOnlyName = blenderFileOnlyName.replace(".blend", ".dae");
+			filePath = filePath + blenderFileOnlyName;
+		else :
+			filePath = filePath + "untitled.dae";
+
+
+		if len(filePath) > 0 :
+			fileButton.val = filePath;
+				
 		if doImport:
 			toggleOnlyMainScene.val = colladaReg.get('onlyMainScene', False)
 			toggleNewScene.val = colladaReg.get('newScene', False)
@@ -394,7 +423,7 @@
 		else:
 			toggleUseUVVal = 0
 			
-		toggleUseUV = Blender.Draw.Toggle('Use UV Image',15,45, yval, 150, 20, toggleUseUVVal, 'Use UV Image instead of materials.')
+		toggleUseUV = Blender.Draw.Toggle('Use UV Image Mats',15,45, yval, 150, 20, toggleUseUVVal, 'Use UV Image instead of the material textures. Use this if you did not use the Material Textures window. Note: If you reimport this file, they will have moved to the materials section!!')
 		
 		# Create Lookat  Option
 		if not (toggleLookAt is None):

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/cutils.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/cutils.py	2007-08-05 19:54:06 UTC (rev 11493)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/cutils.py	2007-08-05 20:01:30 UTC (rev 11494)
@@ -1,5 +1,5 @@
 # --------------------------------------------------------------------------
-# Illusoft Collada 1.4 plugin for Blender version 0.3.146
+# Illusoft Collada 1.4 plugin for Blender
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/helperObjects.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/helperObjects.py	2007-08-05 19:54:06 UTC (rev 11493)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/helperObjects.py	2007-08-05 20:01:30 UTC (rev 11494)
@@ -1,5 +1,5 @@
 # --------------------------------------------------------------------------
-# Illusoft Collada 1.4 plugin for Blender version 0.3.146
+# Illusoft Collada 1.4 plugin for Blender
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -33,7 +33,9 @@
 	
 	def __init__(self, armatureBObject, daeNode):
 		self.armatureBObject = armatureBObject
-		self.blenderArmature = armatureBObject.data
+		self.blenderArmature = Blender.Armature.New ();
+		self.armatureBObject.link(self.blenderArmature);
+		print self.armatureBObject;
 		self.boneInfos = dict()
 		self.rootBoneInfos = dict()
 		# The real blender name of this armature
@@ -115,8 +117,8 @@
 	
 	# Factory method
 	def CreateArmature(cls,objectName,armatureName, realArmatureName, daeNode):		
-		armatureBObject = Blender.Object.New('Armature',objectName)
-		armatureBObject.data.name = str(realArmatureName)
+		armatureBObject = armature_obj = Blender.Object.New ('Armature', objectName)
+		armatureBObject.name = str(realArmatureName)
 		armature = Armature(armatureBObject, daeNode)		
 		armature.name = armatureName
 		cls._armatures[armatureName] = armature
@@ -259,4 +261,3 @@
 		return None
 	GetAnimationInfo = classmethod(GetAnimationInfo)
 
-	
\ No newline at end of file

Modified: trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py
===================================================================
--- trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py	2007-08-05 19:54:06 UTC (rev 11493)
+++ trunk/blender/release/scripts/bpymodules/colladaImEx/translator.py	2007-08-05 20:01:30 UTC (rev 11494)
@@ -1,5 +1,5 @@
 # --------------------------------------------------------------------------
-# Illusoft Collada 1.4 plugin for Blender version 0.3.146
+# Illusoft Collada 1.4 plugin for Blender
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
@@ -46,14 +46,15 @@
 		clearScene = _clearScene
 		lookAt = _lookAt
 		exportPhysics = _exportPhysics
+		usePhysics = _exportPhysics
 		exportCurrentScene = _exportCurrentScene
 		useRelativePaths = _exportRelativePaths
 		useUV = _useUV
 		sampleAnimation = _sampleAnimation
 		onlyMainScene= _onlyMainScene
-		
+
 		replaceNames = clearScene
-		
+
 		self.isImporter = isImporter
 		self.fileName = ''
 		if self.isImporter:
@@ -150,9 +151,7 @@
 		self.filePath = ''
 		
 		
-		
-		
-		self.currentBScene = Blender.Scene.getCurrent()
+		self.currentBScene = Blender.Scene.GetCurrent()
 				
 		self.progressCount = 0.4
 		self.progressField = (1.0 - self.progressCount)
@@ -229,7 +228,7 @@
 			self.currentBScene = Blender.Scene.New('Scene')
 			self.currentBScene.makeCurrent()
 		else:
-			self.currentBScene = Blender.Scene.getCurrent()
+			self.currentBScene = Blender.Scene.GetCurrent()
 		
 		# Create a new Collada document
 		Blender.Window.DrawProgressBar(0.1, 'Get Collada Document')
@@ -305,7 +304,7 @@
 			return matrix
 	
 	def Export(self, fileName):
-		global __version__, filename
+		global __version__, filename, usePhysics
 		filename = fileName
 		self.ids = []
 		self.isImport = False
@@ -338,13 +337,15 @@
 			if not exportCurrentScene or self.currentBScene == bScene:
 				self.fps = bScene.getRenderingContext( ).framesPerSec()
 				daeInstanceVisualScene = collada.DaeVisualSceneInstance()
-				daeInstancePhysicsScene = collada.DaePhysicsSceneInstance()
+				if usePhysics:

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list