text utility functions.

- st = text.as_string()
 - text.from_string(st)
This commit is contained in:
Campbell Barton
2010-05-18 09:07:58 +00:00
parent 496be8244e
commit ba728620ce

View File

@@ -410,6 +410,19 @@ class MeshFace(StructRNA):
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