Extracting attributes from modules

plowboy_lifestyle at my-deja.com plowboy_lifestyle at my-deja.com
Wed Dec 20 18:15:58 EST 2000


Hi,
  I use python as an embedded scripting tool in the 3D
modeling application called Blender and I'm looking for some
clarification from a pro.
I have this difficulty when I try learn about the various features of
the embedded API from my scripts. A typical blender script looks
something like this:

import Blender
from Blender import *

print dir()

this program is supposed to give me a list of the objects in the name
space including everything from the module blender. The output looks
something like this (hopefully I can explain all this without being
application specific):

['Blender','Camera','Object','World',...etc.]

so I explore further with

print dir(Object)

and I get:

['Get','GetSelected','Update','__doc__','__name__']

if I use the get function I find out that it returns an object from
within the modelling program, like a sphere or a mesh, whatever I'm
using and I can manipulate it by setting various variable like "LocX" or
"LocY" for the various locations of the 3D objects, like so:

mySphere = Object.Get('theSphere')
mySphere.LocX = mySphere.LocX + 5

this program will have the effect of moving the object in space positive
5 units on the x axis.

so this is my actual question; Even though I can find out about various
attributes like LocX and etc. from the manuals for this application,
there is no way for me to find them from python it seems, for example:

print dir (Object.Get)
print dir (mySphere)
print dir (mySphere.LocX)
print Object.Get.__doc__
print mySphere.__doc__
print dir(type(mySphere))

all output an empty list or "none", even though

print myShere.LocX

works fine at printing out a floating point number.
I'm only trying to get a list of names of attributes of the object but
they seem hidden. Obviously I'm new to python. Can someone explain why
this works this way?

Thanks,
IB


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list