[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28819] trunk/blender/release/scripts/ modules/bpy_types.py: text utility functions.

Campbell Barton ideasman42 at gmail.com
Tue May 18 11:08:03 CEST 2010


Revision: 28819
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28819
Author:   campbellbarton
Date:     2010-05-18 11:07:58 +0200 (Tue, 18 May 2010)

Log Message:
-----------
text utility functions.
 - st = text.as_string()
 - text.from_string(st)

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_types.py

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2010-05-18 08:10:05 UTC (rev 28818)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2010-05-18 09:07:58 UTC (rev 28819)
@@ -410,6 +410,19 @@
         return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[3]), ord_ind(verts[3], verts[0])
 
 
+class Text(bpy_types.ID):
+    __slots__ = ()
+
+    def as_string(self):
+        """Return the text as a string."""
+        return "\n".join(line.line for line in self.lines)
+
+    def from_string(self, string):
+        """Replace text with this string."""
+        self.clear()
+        self.write(string)
+
+
 import collections
 
 





More information about the Bf-blender-cvs mailing list