Page 5 of 5

Posted: Mon Sep 29, 2003 5:35 am
by theeth
agreed, but it sure beats having to rename all the functions in the whole script.

Martin

FileSelector after DrawProgressBar crashes

Posted: Wed Oct 01, 2003 5:21 pm
by reimpell
Hi!
Blender crashes if FileSelector is used after DrawProgressBar.

Code: Select all

import Blender

def my_callback(filename):
  print "You chose the file:", filename

Blender.Window.DrawProgressBar (0.0, "Importing data ...")
Blender.Window.FileSelector (my_callback, "Choose one!")
Kind regards
Michael

Used versions:
Blender 2.28c (blender-2.28c-linux-glibc2.2.5-i386)
Python 2.2.2

applying matrix on a vertex.

Posted: Sun Oct 05, 2003 12:54 pm
by assassin
theeth wrote:apply the deformation matrix to the vertice coordinates.

Martin
Yeah. But can I do that.

Just tell me if this works

if this is the deform matrix
i0 i4 i8 i12
i1 i5 i9 i13
i2 i6 i10 i14
13 i7 i11 i15

so does this work?

newx=(x*i0)+(y*i1)+(z*i2)+i3
newy=(x*i4)+(y*i5)+(z*i6)+i7
newz=(x*i8)+(y*i9)+(z*i10)+i11

Ok . Does this work? And you say that i have to use deform matrix
rather than the getMatrix() function.

If this is not right , please correct me.

Posted: Mon Oct 20, 2003 1:17 am
by der_ton
The getParent() method of a Bone doesn´t return the parent, but returns 0 if the bone has no parent, or 1 if it has, acting like the hasParent() method.
(using 2.28c Win, Python 2.2.3)

I couldn´t find it any of the other posts in this topic, sorry if it´s a repost.

der_ton, desperately waiting for more armature/bone-related API functionality :)

API Doc is missing ipo.getCurves()

Posted: Fri Oct 24, 2003 10:18 pm
by Snafubar
I suspect the API Document is missing ipo.getCurves().

You can get the ipo of an object, but you can't get the curves of the ipo!
Well, actually, you can... but I had to find it!

strings blender | grep -i curve



Jamie.

Posted: Mon Oct 27, 2003 8:27 pm
by gpg
Sorry, I forgot to document this function...

I do it right now.

BTW, I have implemented a probably more handy function : getCurve(string)
to which you pass the name of the requested IpoCurve. It returns an IpoCurve object, not a list.

Tks for your attention!

Facemodes screwed up in Python

Posted: Tue Oct 28, 2003 12:59 pm
by artificer
Hi,
Sorry if this has been mentioned before, I've searched for it, but can't find it anywhere.

Basically, the problem appears to be that the NMFace.mode field is uninitialised when getting the mesh data from a newly created mesh.
It stays this way even through file saves/loads.
This leads to completely random face modes.
The problem goes away if you go into face-select mode and back out once.

The following script demonstrates the problem:

Code: Select all

from Blender import NMesh, Object, Window

selection = Object.GetSelected()

for obj in selection:
  if obj.getType() == "Mesh":
    mesh = NMesh.GetRawFromObject(obj.getName())

    print "facemodes for", obj.getName()

    for face in mesh.faces:
      print face.mode,

    print
Note that the facemodes are different every time the script is run, which suggests to me that the mode field is freshly created with each new NMesh object, rather than copied across from an uninitialised blender field.

Thanks for any help with this (it's kinda screwing up my export script),
artificer

Re: Facemodes screwed up in Python

Posted: Tue Nov 04, 2003 1:42 am
by artificer
OK, I've just tested it with 2.30, and the problem is still there.
After more experimentation, I've found that the problem only appears
when a mesh has no UV coordinates: Create coordinates -> all facemodes
are 1, delete coordinates -> all facemodes are random.

Just wondering, does this thread still get read?
Seems like this post has been here a while with no response. :-(

Thanks,
artificer

Re: Facemodes screwed up in Python

Posted: Tue Nov 04, 2003 8:53 am
by Michel
artificer wrote:Just wondering, does this thread still get read?
Seems like this post has been here a while with no response. :-(
Hi,

This thread has been started when the pre release of 2.28 has been made. At that moment there was no official release number in the bug tracker.
Now with the 4th official release after that particular pre-release (2.28, 2.28a, 2.28c and 2.30), problems should be reported in the bug tracker.

I'm sorry that I didn't post this comment just after 2.28 had been released; it could've saved some troubles :oops:

You can find the tracker through the projects link at the top of the blender.org page.

With regards,
Michel

Posted: Wed Nov 05, 2003 3:03 am
by artificer
Michel wrote:Now with the 4th official release after that particular pre-release (2.28, 2.28a, 2.28c and 2.30), problems should be reported in the bug tracker.

Ah, OK, I'll do that then. :)

Thanks,

artificer

update(1) does not do a full update...

Posted: Fri Nov 07, 2003 7:45 pm
by Snafubar
Although the docs do not explicitly state that 'update(1)' will update the scene's matrices and mesh deformations, I believe it should.

I posted a workaround to the getMatrix() thread, about using RedrawAll() after a setCurrent(frame) to make blender do a real full update, updating the scene's transforms, according to IPO curves, etc...
As well, that workaround works for the scene's mesh deformations: calling RedrawAll() makes sure the getRawObject() call produces the properly deformed mesh.

HOWEVER :!: If the 3D view is not visible, then RedrawAll( ) will NOT update the transforms and meshes! So, this workaround only works if the 3D view is visible.

That is why I think update(1) should do this: RedrawAll is not guaranteed.
Of course, you are free to think I'm on crack...

Thanks,
Jamie.[/i]

unable to import library modules

Posted: Wed Nov 12, 2003 2:51 am
by philetus
hi,

on windows xp the following code:

Code: Select all

import Blender
import math
import random
results in the error:

Code: Select all

ImportError: No module named random
'import site' failed; use -v for traceback
sys_init:warning - no sitedirs added from site module
it seems like the python 'Lib' directory is not on the path, but sys.path.[0] is 'C:\Python23\Lib', which I think is right.

any suggestions how to load library modules?

Re: unable to import library modules

Posted: Thu Nov 13, 2003 9:33 am
by Michel
philetus wrote:hi,

on windows xp the following code:

Code: Select all

import Blender
import math
import random
results in the error:

Code: Select all

ImportError: No module named random
'import site' failed; use -v for traceback
sys_init:warning - no sitedirs added from site module
it seems like the python 'Lib' directory is not on the path, but sys.path.[0] is 'C:\Python23\Lib', which I think is right.

any suggestions how to load library modules?
Hi,

You appear to have installed Python 2.3. Blender currently only supports Python 2.2.x. At Elysiun you can find a lot more information on how to get Python to work in Blender. Click here.

I'm locking this topic now because the intend of the topic was to have problems in the new API reported before an official blender release was made (before 2.28 ). No offense meant to any of you who have been posting new messages after 2.28 of course; just post new messages or report bugs in the bug tracker :)

With regards,
Michel