quick question:
instead of text.as_string() would be better to define the __str__ for
this class?
so str(text) could be used?

2010/5/18 Campbell Barton <[email protected]>:
> 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
>
>
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> [email protected]
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to