Here is a small patch to blendercal to enable it to
work with Python 2.3.

--
Greg
diff -r -u blendercal-orig/__init__.py blendercal/__init__.py
--- blendercal-orig/__init__.py 2007-10-09 19:24:14.000000000 +1300
+++ blendercal/__init__.py      2007-10-09 20:10:13.000000000 +1300
@@ -37,8 +37,8 @@
 influence from Loic Dachary, especially in the bcdata.AnimationData().
 """
 
-# A decorator to catch any exception semi-gracefully. Sometiem later
-# this will create a Blender panel to show the exception.
+## A decorator to catch any exception semi-gracefully. Sometiem later
+## this will create a Blender panel to show the exception.
 def exception(function):
        return function
 
@@ -53,7 +53,6 @@
 
 # A function that will parse the passed-in sequences and set the appropriate
 # values in bcconf.
[EMAIL PROTECTED]
 def ParseArgs(parse):
        args  = []
        strip = lambda s: s.rstrip().lstrip().replace("\t", "").replace("\n", 
"")
@@ -90,3 +89,5 @@
        # Return args; since this will be False by default, we'll use this
        # to determine if the user passed a --blendercal argument.
        return args
+
+ParseArgs = exception(ParseArgs)
diff -r -u blendercal-orig/bcdata.py blendercal/bcdata.py
--- blendercal-orig/bcdata.py   2007-10-09 19:26:14.000000000 +1300
+++ blendercal/bcdata.py        2007-10-09 20:11:30.000000000 +1300
@@ -25,7 +25,6 @@
                if obj.getType() == t and not obj.getName().startswith("_"):
                        yield obj, obj.getData()
 
[EMAIL PROTECTED]
 def SkeletonData():
        # This function returns a single blendercal.bcobject.Skeleton instance
        # and sets blendercal.bcobject.Skeleton.ARMATURE to the appropriate 
Blender
@@ -54,7 +53,9 @@
        
        return skeleton
 
[EMAIL PROTECTED]
+SkeletonData = blendercal.exception(SkeletonData)
+
[EMAIL PROTECTED]
 def MeshData():
        # This function returns a list of blender.bcobject.Mesh objects, one for
        # each mesh in your Blender scene. The Cal3D notion of a Mesh is 
actually more
@@ -256,7 +257,7 @@
                        # preventing another iteration of all the vertices here.
                        for i, v in enumerate(vlist):
                                weights = data.getVertexInfluences(v.index)
-                               total   = sum(w for b, w in weights)
+                               total   = sum([w for b, w in weights])
                        
                                for b, w in weights:
                                        
vertices[i].influences.append(bcobject.Influence(
@@ -300,7 +301,8 @@
 
        return meshes
 
[EMAIL PROTECTED]
+MeshData = blendercal.exception(MeshData)
+
 def AnimationData():
        # This function demonstrates a new way of parsing and retrieving 
animation
        # data in Blender. With version 242 and above, users can call the the
@@ -369,7 +371,8 @@
 
        return animations
 
[EMAIL PROTECTED]
+AnimationData = blendercal.exception(AnimationData)
+
 def ExportData(filename, skeldata, meshdata, animdata, prefixfiles=False):
        dirname  = os.path.dirname(filename)
        basename = os.path.splitext(os.path.basename(filename))[0]
@@ -419,3 +422,5 @@
                print >> file(os.path.join(dirname, matfile), "w"), material
                
                print >> cfg, "material=%s" % matfile
+
+ExportData = blendercal.exception(ExportData)
diff -r -u blendercal-orig/bcobject.py blendercal/bcobject.py
--- blendercal-orig/bcobject.py 2007-10-09 19:28:16.000000000 +1300
+++ blendercal/bcobject.py      2007-10-09 20:09:32.000000000 +1300
@@ -12,7 +12,7 @@
 # hashable and unordered.
 from sets import ImmutableSet
 
-CONCAT = lambda s, j="": j.join(str(v) for v in s)
+CONCAT = lambda s, j="": j.join([str(v) for v in s])
 STRFLT = lambda f: "%%.%df" % bcconf.FLOATPRE % f
 
 class Cal3DObject(object):
@@ -550,7 +550,7 @@
                
                # If one UV is None, the rest will also be None.
                if len(uvs) and (uvs[0][0] != None):
-                       self.maps.extend(Map(uv) for uv in uvs)
+                       self.maps.extend([Map(uv) for uv in uvs])
                
                submesh.vertices.append(self)
 
@@ -710,7 +710,7 @@
                        STRFLT(invertrot.z),
                        STRFLT(invertrot.w),
                        self.parent and "%d" % self.parent.id or "-1",
-                       "".join("##<CHILDID>%s</CHILDID>\n" % c.id for c in 
self.children)
+                       "".join(["##<CHILDID>%s</CHILDID>\n" % c.id for c in 
self.children])
                )
 
 class Animation(Cal3DObject):
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user

Reply via email to