Help to the new Python API

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

AEnema
Posts: 4
Joined: Fri Jul 18, 2003 11:16 am

Help to the new Python API

Postby AEnema » Fri Jul 18, 2003 11:23 am

I get a error in my ASE Exporter. In the old Blender version it worked.

objs = Blender.getCurrentScene().objects

Error:
Traceback (most recent call last):
File "ExportASE.py", line 370, in ?
AttributeError: 'module' object has no attribute 'getCurrentScene'

i have no idea to transform this code to the new blender/python api.

Michel
Posts: 208
Joined: Wed Oct 16, 2002 7:27 pm
Location: Somewhere below the rivers in Holland (but not Limburg)

Re: Help to the new Python API

Postby Michel » Fri Jul 18, 2003 11:55 am

AEnema wrote:objs = Blender.getCurrentScene().objects

Hi,

the function you're trying to use is from the old blender210 API which is no longer supported. The code below should work:

Code: Select all

import Blender

scene = Blender.Scene.GetCurrent()
objs = scene.GetChildren()


I have not tested this.

If you want to know what modules, functions, methods and variables are available, you can do a:

Code: Select all

import Blender

print dir (Blender)


You can also print the contents of the Blender.Scene module for example. Really helpful.

With regards,
Michel
You can have one of two things: Progress or Progress Reports.

AEnema
Posts: 4
Joined: Fri Jul 18, 2003 11:16 am

Postby AEnema » Fri Jul 18, 2003 2:59 pm

Thanks for your help.

The interpreter still gets a error when i call:

Code: Select all


scene = Blender.Scene.GetCurrent()

  File "ExportASE.py", line 372, in ?
AttributeError: 'module' object has no attribute 'GetCurrent'



:(
[/code]

AEnema
Posts: 4
Joined: Fri Jul 18, 2003 11:16 am

Postby AEnema » Fri Jul 18, 2003 3:06 pm

oh im so stupid ;o) have to write get not Get.

Thanks for help

ideasman
Posts: 1000
Joined: Tue Feb 25, 2003 2:37 pm

Postby ideasman » Fri Jul 18, 2003 3:21 pm

Hello, I am writing an ASE importer, Its works about 90% so far, have a little way to go.

Mabe we could share code?

AEnema
Posts: 4
Joined: Fri Jul 18, 2003 11:16 am

Postby AEnema » Fri Jul 18, 2003 3:38 pm

Oh hi,

sorry but this is not my ASE Exporter, im just trying to convert the old ASE Exporter to the new Blender Version.

Here is the E-Mail Adress from the writer of ASE Export: andrewc@piffle.org

Here you can download the exporter: http://www.piffle.org/3d/ase-export-filter.html


Return to “Python”

Who is online

Users browsing this forum: No registered users and 5 guests