[Bf-python] TypeError adding Text to a scene
Nery Chucuy
idesisnery at gmail.com
Mon Oct 5 15:53:31 CEST 2009
Hello Ron,
I've been using Python API for some time and yes, the documentation is not
that clear but if you put a attention you'll get what you want.
What I think you want to use in this case is not a Text but a Text3d. Text
is for the TextEditor and Text3d is for the object that appears through the
menu: Add>Text.
Hope this helps,
Nery Chucuy (idesisnery)
2009/10/5 Ron Wheeler <rwheeler at artifact-software.com>
> In general, the API documentation is terrible (examples use methods or
> properties that do not appear in the documentation,
> lots of properties and methods seem to work that are not documented)
> but I have not been able to find the sources for any of the
> documentation or find the code for the classes in the sources so I can
> read them for the whole story.
>
> I am currently stuck on trying to add Text to a scene as a child of a
> mesh that I want to animate with a script.
>
> The following code is supposed to generate a text Object that I can
> associate to a mesh as a child.
>
> It generates an error.
> The scn is OK and I can add a camara, a Lamp and a bunch of meshes to it
> but creating text in the scene does not seem to work.
>
>
> def makeTextObject(scn,name,text,type="top"):
> myTxt=Text.New("MyText")
> myTxt.write("test Text")
> print "Made a text called " + myTxt.name
>
> textOb = scn.objects.new(myTxt) #Generates the TypeError
>
> print "Made a Text object called " + textOb.name + "containing" + text
> return textOb
>
>
>
> TypeError: expected an object and optionally a string as arguments
>
> x
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20091005/a22b74e9/attachment.html>
More information about the Bf-python
mailing list