Report problems with the new Python API here please!

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

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

Report problems with the new Python API here please!

Post by Michel » Tue Jul 01, 2003 11:19 pm

Hi,

I would like to collect all problems, bugs, inconsistencies and small changes in this topic. When you have found a problem, please first check if somebody else has already reported it. If the problem you've found is not posted yet, please give a complete report on how to reproduce it - if applicable with a few lines of Python code.

Do not ask for any new modules to be added for the 2.28 release. After 2.28 is released, new modules can be added.

Thank you for testing.

With regards,
Michel
Last edited by Michel on Mon Aug 25, 2003 3:25 pm, edited 1 time in total.

JA-forreal
Posts: 0
Joined: Sat Mar 22, 2003 10:45 pm

Post by JA-forreal » Wed Jul 02, 2003 8:38 am

I love the new updated version. I don't know if this has been said before, but the famous OBJ script still will not run in the new 2.28 version. I guess we have to use ver. 2.23 for OBJ imports and exports for now

jms
Posts: 33
Joined: Sat Oct 19, 2002 3:04 pm

Re: Report problems with the new Python API here please!

Post by jms » Wed Jul 02, 2003 9:25 am

Michel wrote:Hi,

I would like to collect all problems, bugs, inconsistencies and small changes in this topic. ..
OK.

in module BLender.Object

Code: Select all

import Blender
OBJLIST=Blender.Object.Get()
for o in OBJLIST:
     print o.name,o.Layer,
return this:

Using a clean Global Dictionary.
Run Python script "Text" ...
Traceback (most recent call last):
File "Text", line 4, in ?
AttributeError: 'str' object has no attribute 'name'
Last edited by jms on Wed Jul 02, 2003 10:46 am, edited 4 times in total.
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.

gowen
Posts: 4
Joined: Fri Oct 18, 2002 9:58 am

Post by gowen » Wed Jul 02, 2003 10:38 am

I notice that the object names are now being reported differently to version 2.23.

For instance I have a tyre of radius 3.5 with an anti-clockwise forward rotation called Tyre01-3.5

my script extracts the data using the .name. so:

mTyre = Blender.link
rad = eval(mTyre.name[7:])
dir=eval(mTyre.name[6] + "1")

Under version 2.23 this works fine, but under this test version it doesn't. Adding the line:

print mTyre.name

shows that the returned name is now OBTyre01-3.5 instead of Tyre01-3.5.

I know it's a minor issue, solved by adding 2 to the substring arguments, but it's one people need to be aware of. I assume this is a permanent feature of the code and not just some test diagnostic s

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

Post by Michel » Wed Jul 02, 2003 11:09 am

gowen wrote:Under version 2.23 this works fine, but under this test version it doesn't. Adding the line:

print mTyre.name

shows that the returned name is now OBTyre01-3.5 instead of Tyre01-3.5.

I know it's a minor issue, solved by adding 2 to the substring arguments, but it's one people need to be aware of. I assume this is a permanent feature of the code and not just some test diagnostics
Whoops, this is a stupid error. This will be fixed. Thanks!

With regards,
Michel

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

Re: Report problems with the new Python API here please!

Post by Michel » Wed Jul 02, 2003 11:11 am

jms wrote: in module BLender.Object

Code: Select all

import Blender
OBJLIST=Blender.Object.Get()
for o in OBJLIST:
     print o.name,o.Layer,
return this:

Using a clean Global Dictionary.
Run Python script "Text" ...
Traceback (most recent call last):
File "Text", line 4, in ?
AttributeError: 'str' object has no attribute 'name'
I will look into this! Thank you.

With regards,
Michel

jms
Posts: 33
Joined: Sat Oct 19, 2002 3:04 pm

Re: Report problems with the new Python API here please!

Post by jms » Wed Jul 02, 2003 11:23 am

Michel wrote:
jms wrote: in module BLender.Object

Code: Select all

import Blender
OBJLIST=Blender.Object.Get()
for o in OBJLIST:
     print o.name,o.Layer,
return this:

Using a clean Global Dictionary.
Run Python script "Text" ...
Traceback (most recent call last):
File "Text", line 4, in ?
AttributeError: 'str' object has no attribute 'name'
I will look into this! Thank you.

With regards,
Michel
This seems to work:

Code: Select all

import Blender
O=Blender.Object.Get()
Olist=[]
for o in O:
     print type(o)
     Olist.append(Blender.Object.Get(o))
print str(Olist), type(Olist[0])
but crash often on win32
if str() is not used.
Last edited by jms on Wed Jul 02, 2003 12:53 pm, edited 1 time in total.
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.

t_revs
Posts: 19
Joined: Tue Oct 22, 2002 4:08 pm

Post by t_revs » Wed Jul 02, 2003 11:42 am

Can't seem to get name in PutRaw to return anything except None, as in:-


Code: Select all

import Blender
from Blender.NMesh import Col
from Blender.Draw import *
import string

meshname="Cube"
me= Blender.NMesh.GetRaw(meshname)

i = 1
for f in me.faces:
	new = Blender.NMesh.GetRaw()
	new.verts = f.v
	f.mat = 0
	new.faces = [f]

	ob=Blender.NMesh.PutRaw(new)
	ob.name="Cube" + "." +  string.zfill(`i`, 3)
	print ob.name
	i = i + 1

print i ,"pieces"
print "-------------------------------"

Blender.Redraw()

T&N
Posts: 0
Joined: Wed Jul 02, 2003 4:49 pm
Contact:

Post by T&N » Wed Jul 02, 2003 4:57 pm

I have a set of python scripts inside blender file, example: main.py, first.py
This files are not in my disk only in the blender file.
In the main.py I just to import the first.py with:
import first
or
from first import *
With the old python It works OK, but now an error message appears
"ImportError: No module named first" :?:

jms
Posts: 33
Joined: Sat Oct 19, 2002 3:04 pm

Blender.Lamp.Get()

Post by jms » Wed Jul 02, 2003 5:28 pm

Win32 = > Win98:

Code: Select all

import Blender
L=Blender.Lamp.Get()
print L
crash...

Code: Select all

import Blender
L=Blender.Lamp.Get()
print str(L)
not.
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.

jms
Posts: 33
Joined: Sat Oct 19, 2002 3:04 pm

_Blender ?

Post by jms » Wed Jul 02, 2003 5:31 pm

Code: Select all

import _Blender
Run Python script "Text.001" ...
Traceback (most recent call last):
File "Text.001", line 1, in ?
ImportError: No module named _Blender
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.

jms
Posts: 33
Joined: Sat Oct 19, 2002 3:04 pm

world module

Post by jms » Wed Jul 02, 2003 6:06 pm

a Blender.World.getCurrent()/setCurrent() functions could be useful.
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.

ray_theray
Posts: 47
Joined: Wed Oct 16, 2002 3:05 am
Location: NM, US
Contact:

Post by ray_theray » Wed Jul 02, 2003 8:30 pm

This doesn't work:

Code: Select all

objs = Blender.Object.Get()
#objs returns ['Plane', 'Camera', etc...]
for obj in objs:
    #obj returns Plane (no quotes)
    name = obj.getData()
Fails with

Code: Select all

AttributeError: 'str' object has no attribute 'getData()'
Also, it appears that materials are now linked to objects (before it was linked with object data). In the settings window, I have "Material linked to" set to ObData as well.
-ray_theray

jms
Posts: 33
Joined: Sat Oct 19, 2002 3:04 pm

Post by jms » Wed Jul 02, 2003 9:05 pm

Problem with matrix too:

Code: Select all

import Blender

L=Blender.Object.Get('Lamp.001')
print L.getMatrix()

"""
2.27 new-py
((0.0, 0.0, 0.0, 0.0), 
 (0.0, 0.0, 0.0, 0.0), 
 (0.0, 0.0, 0.0014120666310191154, 0.0),
 (0.0, 0.0, 0.0, 0.008771928958594799))
"""

"""
2.27 normal
((1.0, 0.0, 0.0, 0.0), 
 (0.0, -4.3711388286737929e-008, 1.0, 0.0), 
 (0.0, -1.0, -4.3711388286737929e-008, 0.0), 
 (-0.25819849967956543, -7.2443208694458008, 5.5631
518363952637, 1.0))
"""
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.

basse
Posts: 13
Joined: Tue Oct 15, 2002 11:10 pm

Post by basse » Wed Jul 02, 2003 10:07 pm

this is perhaps not really a bug report for the new API, but in any case, this is what I got trying to run it:
./blender: /usr/lib/libstdc++.so.5: version `GLIBCPP_3.2.2' not found (required by ./blender)

system: redhat 8.0


.b

Locked