[Bf-python] TypeError adding Text to a scene

Ron Wheeler rwheeler at artifact-software.com
Mon Oct 5 14:02:41 CEST 2009


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



More information about the Bf-python mailing list