Fix handling Text and Curve objects
authorAntonio Ospite <ospite@studenti.unina.it>
Mon, 5 Jun 2006 21:15:37 +0000 (23:15 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Thu, 24 Sep 2009 15:25:19 +0000 (17:25 +0200)
Do not recalculate the normals for all object types, do this only for
Text and Curve objects which can have the normals inverted when they are
converted to mesh.

REMOVE that when blender fixes the issue.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
vrm.py

diff --git a/vrm.py b/vrm.py
index 312d8af..8914045 100755 (executable)
--- a/vrm.py
+++ b/vrm.py
@@ -554,7 +554,6 @@ class Renderer:
 
         # Render from the currently active camera 
         self.cameraObj = self._SCENE.getCurrentCamera()
 
         # Render from the currently active camera 
         self.cameraObj = self._SCENE.getCurrentCamera()
-        print dir(self._SCENE)
 
         # Get the list of lighting sources
         obj_lst = self._SCENE.getChildren()
 
         # Get the list of lighting sources
         obj_lst = self._SCENE.getChildren()
@@ -754,14 +753,19 @@ class Renderer:
             scene.link(obj)
             scene.unlink(old_obj)
 
             scene.link(obj)
             scene.unlink(old_obj)
 
-            # Mesh Cleanup
-            me = obj.getData(mesh=1)
-            for f in me.faces: f.sel = 1;
-            for v in me.verts: v.sel = 1;
-            me.remDoubles(0)
-            me.triangleToQuad()
-            me.recalcNormals()
-            me.update()
+
+            # XXX Workaround for Text and Curve which have some normals
+            # inverted when they are converted to Mesh, REMOVE that when
+            # blender will fix that!!
+            if old_obj.getType() in ['Curve', 'Text']:
+                me = obj.getData(mesh=1)
+                for f in me.faces: f.sel = 1;
+                for v in me.verts: v.sel = 1;
+                me.remDoubles(0)
+                me.triangleToQuad()
+                me.recalcNormals()
+                me.update()
+
 
     def _doSceneClipping(self, scene):
         """Clip objects against the View Frustum.
 
     def _doSceneClipping(self, scene):
         """Clip objects against the View Frustum.