diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-05-18 13:07:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-05-18 13:07:58 +0400 |
commit | ba728620ce64ec55c4a8c1ba35f5ff994ca869a2 (patch) | |
tree | 2b23e0b73cc7a9179dd11ad87d90a22635cd0e38 /release/scripts/modules/bpy_types.py | |
parent | 496be8244ef62868fd7345f06bea05febd912281 (diff) |
text utility functions.
- st = text.as_string()
- text.from_string(st)
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 6e4596a1109..edead35dafe 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -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 |