[Bf-python] New here but...

Gilbert, Joseph jgilbert at tigr.org
Mon Jun 7 21:17:16 CEST 2004


It's a good point. The reason for adding these to the mathutils module
itself was because they are not 'internal' vector methods. These methods
act on another object and so I just stuffed them in the main module.
What I mean is that the internal methods for the class Vector, for
instance, all act on itself. CopyVec() acts on another object. Because
vector, quaternion, euler and matrix are used elsewhere in the API - for
instance in object.getMatrix() - I thought we should keep anything not
internal (meaning self-acting) to the vector class, in the main
Mathutils module.  However, if it's a pain in the @$$, we could move
them into the classes themselves, this was simply a design decision on
my part. 
 
MatMultVec and VecMultMat is a little more complex because I wanted to
keep pre- and post- vector/matrix mutliplication explicitly separate.
Answer = vec.multMat(x) doesn't say wether you want pre- or -post
multiplication (although it does imply it :-) ) I thought that
MatMultVec(mat, vec) would be more clear than mat.multVec(vec) but again
this was sort of the way this was built. Maybe mat.preMultVec() and
mat.postMultVec() would be clear too. Of course the easiest way to do
this would be answer = mat * vec (which is allowable). 
 
Ive learned a bit since this module was written and there are some more
clean up that needs to be done here (especially the argument parsing
doh). Is there a set of functions that you think should be class
internal? -maybe the whole thing.
 
I agree the examples are really the meat for these new methods and if
they are sparse it's hard to understand how to use them. As stiv once
pointed out writing good documentation takes time and effort. A better
documentation with examples would be helpful Im sure.
 
Willian and michel know more about the old blender python and the
current python set up than I do, but for my part I don't mind the C API
:-). 
 
-----Original Message-----
From: bf-python-admin at blender.org [mailto:bf-python-admin at blender.org]
On Behalf Of blake e
Sent: Monday, June 07, 2004 1:46 PM
To: bf-python at blender.org
Subject: [Bf-python] New here but...
 
I would still like to ask some questions.  I have been encouraged to
take a look at the blender python docs, and perhaps edit/change/add-to
them.  I don't know if this effort is welcomed or not, but at least I'll
get to learn a bit about how the Python/C API works.
 
My question is:  Should the Mathutils methods be where they are, or
should they be methods of their respective classes?  What I mean is from
a python point of view it makes more since for the CopyVec function to
be a method of the Vector class.  It would also allow you to drop the
Vec leaving you with 
 
vec_new = my_vector.copy()
 
I don't know if this makes sense for methods which take two arguments
though.
 
vec_new = my_vector.Cross(vec_fu)
 
 seems a little odd.  The mixed type operations aren't so bad though 
 
vec_new = my_vector.MatMul(matrix)
 
I know how easy this would be to change in python, just copy the method
into the appropriate class, and replace vec with self...  Looking at the
code though it seems like it is much more difficult to do in C.
 
On a side note as I understand it Bpython used to be partly coded in
Python?  Can I ask why this changed (or for a link to the relevant
information)?  It seems to me from the outside that it would be much
more useful if the Bpython modules were actually in written in Python.
I just did a short test and it seems I cannot inherit from Blender
classes.  I can think of other reasons why it would be nice to have a
~/.blender/python dir, but I will wait to hear the reasons against
Bpython before I make myself look more foolish.
 
Back to what I am supposed to be doing, would it be helpful to have
examples at the class, or method level instead of just at the module
level?  When I'm using the API reference I look at the documentation to
know what is available, but I look at the examples to know how things
work.  Does anyone else think this would be useful?
 
Lol, I've seen posts like this on other forums/newsgroups, and they
always seem to go horribly wrong for the person who posted them.  The
people who have worked so many hard hours creating their software seem
to get very PO'd when someone comes in out of nowhere and starts saying
how they think it should be done.  Hopefully my willingness to actually
do the things I'm proposing will help take some of the edge off your
anger, but I am bracing myself none the less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20040607/16208a0c/attachment.html>


More information about the Bf-python mailing list