Commit Graph

1233 Commits

Author SHA1 Message Date
Ken Hughes
8b64628e30 Python API
----------
Fixing various typos (hey guys, it's helpful to proofread the documentation
before you commit it :-) )
2006-12-17 04:24:19 +00:00
1041ad4719 added fakeUser and users to more pytypes 2006-12-17 02:16:29 +00:00
0c5eea3911 =IDProperties Python update=
Updated epydocs for next-to-latest
id properties commit.
2006-12-17 00:58:23 +00:00
Ken Hughes
08a7208aa6 Python API
----------
A more robust attempt to avoid creating non-Empty objects with no data while
maintaining backward compatibility.
2006-12-17 00:21:57 +00:00
3a84791b53 =IDProperties Python update=
Updated id properties interface as per
discussed in python meeting.  Basically,
id properties are now entirely accessed
through the dict-like interface if IDGroupType.
Also, tp_getsetters are used throughout the code
now.

Using the dict interface allowed for a major cleanup
of the wrapping code.  The biggest change is that ID
properties are no longer wrapped in a structure with 
.type .name and .data members; instead when you get
properties from the group it returns the direct value.
Ints, strings and floats return simple python types,
while arrays and groups return special wrappers though.

This means to detect the type of an ID property, you
have to use type().  For string and int types this is
easy; for group and array types (which of course have
their own wrappers) you use type() with Blender.IDGroupType
or Blender.IDArrayType.

Update of epydocs plus a temporary gui script will be
forthcoming; the gui script will be removed before release
as of course by then we'll have a built-in gui for id
properties.
2006-12-16 23:54:45 +00:00
47ee194922 adding ed.key and face.edge_keys
avoids a lot of boiler place code in scripts that need to build connectivity.
2006-12-16 23:46:43 +00:00
a9447e4273 Enable/Disable DupFaces from the Python API.
Fixed a (own) bug in fakeUsers and added fakeUsers to Objects and Materials as well as Mesh.
2006-12-16 22:04:21 +00:00
dfb811d73d fixed issue: rbHalfExtents was accidently named wrongly rbShapeBoundType 2006-12-16 21:14:36 +00:00
3c9a11f24e Sys.c was getting the path seperator out of the python dict and converting it to a char for all path functions.
made DIRSEP a constant and refer to that directly.
Draw.c's PupBlock limit was 24, made 120 to match blenders internal limit.
2006-12-16 03:36:54 +00:00
956add11b4 Wasnt initializing a pointer as null, messed up making new object names 2006-12-15 09:58:16 +00:00
c5fba51131 object_apply_def - use new BPy Object API funcs, no error in localview
off_export - minor changes
uv_archimap - cleanup. slightly slower but less duplicate code
uv_from_adjacent - nothing

BPY_menus - renamed py slot UvCalculation to UVCalculation to be consistant
2006-12-14 03:43:02 +00:00
1031caafc1 python multi UV support -
active index was incorrect, removing layers after they had non was crashing blender, now raise an error.
2006-12-13 03:21:14 +00:00
228bebfaa8 name changes from theeths suggestions
totUvLayers -> totalUVLayers
addUvLayers -> addUVLayers
2006-12-13 02:55:49 +00:00
080a5d5664 exposed CustomData_get_active_layer_index in BKE_customdata.h (needed by python to get the active layer)
added python api stuff to deal with Color and UV/Image layers.

me.activeUvLayer - int
me.activeColorLayer - int
me.totUvLayers - int
me.totColorLayers - int

me.addUvLayer()
me.addColorLayer()
me.removeUvLayer()
me.removeColorLayer()


Variable names may need changing.
2006-12-13 00:50:02 +00:00
824f391c75 mesh_edges2curves - edge key optimize and made use of scn.objects rather then Object.New()..
Object.py - passIndex mistake
2006-12-12 21:38:04 +00:00
80ee52e444 Multiple UV and vertex color layers: (still work in progress)
These can be created and deleted in the Mesh panel in the same place as
before. There is always one active UV and vertex color layer, that is
edited and displayed.

Important things to do:
- Render engine, material support
- Multires and NMesh now lose non active layers

Also CustomData changes to support muliple layers of the same type, and
changes to layer allocation, updated documentation is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
2006-12-12 21:29:09 +00:00
47adee414c added ob.passIndex to bpy, changed passIndex tooltip to a better one ton suggested. 2006-12-12 21:01:43 +00:00
97b6a65c74 Added a new Python slot "UvCalculate", moved Archimap and "UVs from adjacent" into it.
Removed 1/2 1/4 1/8 uv mapping options.
made re-evaluating the py-scripts dir use the wait cursor (could take a while at times)
2006-12-12 04:18:45 +00:00
Chris Want
95c3e8041c Kludge to ensure that the BPY_*.[od] files are deleted during
"make clean".
2006-12-12 01:30:24 +00:00
Ken Hughes
675ab02726 Python API
----------

Fix some typos in the documentation.
2006-12-11 17:13:56 +00:00
9c3cacd283 added the flag group_exclusive to material
added restrictDraw/Select/Render to objects in python
updated group and scene docs for last commit
made 3ds import use new scn.objects rather then Object.New() - (removed import as instance for now)
fixes off import error from this report http://blenderartists.org/forum/showthread.php?t=84182
2006-12-11 08:57:39 +00:00
b69fdd21ba renamed objects.add() and .remove() to .link() and .unlink() for scene and group objects to be less pythonic and more like blender.
for scn.objects.new() a optional second argument can be used to spesify the name.

We still need a way to add a new Empty (some constant)
2006-12-11 03:23:17 +00:00
Ken Hughes
ba36ef9f3f Python API
----------

Bugfix #5373: creating a curve or text object using Object.New() without
linking any data to the object would later cause a segfault when ob->data
was later dereferenced.  This problem will be fixed (hopefully soon) in the
API when new objects are created with data and linked to scenes all in one
step, but for now check for curves that ob->data is defined before using,
otherwise print an error message to the console and skip the object.
2006-12-09 06:17:14 +00:00
Ken Hughes
02884e88d8 Python API
==========

Fix typo in Scene documentation.
2006-12-07 20:15:52 +00:00
4f8079d49c Modifier Stack: Limit calculation to required data.
This commit upgrades the modifier stack to only calculate the data which is
needed, either by modifiers further down the stack or by other functions at
the end of the stack (e.g. drawing functions).

This speeds up modifier stack recalculation, especially where vertex
groups and UV coordinates are concerned. For example, a mesh with an Armature
modifier followed by a Subsurf modifier would previously have required the
Subsurf modifier to interpolate all the vertex groups in the mesh, slowing
down modifier calculations considerably. With this update, vertex group data
is not propagated beyond the Armature modifier, so calculations are faster.

Note that this depends on the order of modifiers in the stack. If the Armature
and Subsurf modifiers were swapped in the above example, the Subsurf modifier
would have to interpolate vertex groups, as they are needed by the Armature
modifier.
2006-12-05 17:42:03 +00:00
Nathan Letwory
d6e9265895 ==SCons==
* make blender_python understand we're doing a debug build when BF_DEBUG=1. Otherwise
 we get linking errors with scons/mingw
2006-12-04 14:32:07 +00:00
c520a2a6b2 =IDProperties Small Update=
BPy conventions were not being followed for PyObject_New;
now they are.  I still doubt the usefullness of doing this,
however its important to maintain module standards.  

Which reminds me, anyone know where I can get that source code
prettier that was used on the api files?  It was kindof
hard following the coding style of bpy with it being so
different from normal blender, and also what with having
to write the IDProperty code from scratch. :)
2006-12-04 04:51:32 +00:00
28bbf2d616 - added support for generic 6DOF constraint
- only 6DOF constraint shows buttons for limits
- added python support for rigidbody constraint (untested, but required for COLLADA Physics support)
2006-12-02 03:48:36 +00:00
Ken Hughes
e906417a3a Python API
==========

Bugfix: using del operator on me.verts would cause a crash.
2006-12-01 21:20:40 +00:00
Stephen Swaney
e3b72755cc clean up some warnings. no executable changes. 2006-12-01 17:53:04 +00:00
71da111613 =IDProperties bugfix=
Another bug from the tracker, reported by Mike Stramba.
A duplicated Py_XDECREF in the wrong place made assigning
arrays from Vector objects not work.

Also, fixed nasty bug in C API of idproperties (the function
to look up a property from a group was broken).  Fixed a memory
leak too.

In addition, made "del group['property']" delete properties
from group; previously this would just crash (or at least it
should have).  Added a small addition to the example in the
epydocs for IDGroup.
2006-12-01 03:04:36 +00:00
4941107f92 - enabled compound collision objects, requires 'clear parent inverse'
- fixed some issues with kinematic objects, introduced during Bullet 2.x upgrade
2006-12-01 01:04:27 +00:00
99d66e1d5e =IDProperties bugfix=
Fixed the bug of "print type(property)" crashed blender;
just needed to add PyType_Ready init code for all ID property
python types; I made a function IDProp_Init_Types and put
code to call it in types_initAll().

Also added GPL/BL headers to idproperty files.
2006-11-29 23:31:46 +00:00
0c85ea07f1 =IDProperties bugfix=
Misspelled __members__ __member__ in IDProperty's
getattr function; this made "print dir(prop)" not
work.  Eventually I need to replace the whole thing
with getsetters.

Still need to find out why "print type(a_property)" crashes
blender. :S
2006-11-29 22:30:41 +00:00
b7f6b4799e =IDProperties bugfix=
IDProperties was doing a name check where it shouldn't;
thise made executing "prop['value'] = something" not work
if the property 'value' already existed.  Fixed it by
making the code replace existing properties, like it
should.
2006-11-29 22:19:21 +00:00
008d789f15 =IDProperties small update=
This update changes Object.properties to Object.game_properties 
(as discussed) so .properties can be used for ID Properties.

This should be fine as, after all, .properties was undocumented anyway :)
2006-11-28 04:34:26 +00:00
Alexander Ewering
314b7adc17 Uncommitted my potential fix for
http://projects.blender.org/tracker/index.php?func=detail&aid=4786&group_id=9&atid=125

It seems like you can't quote the executable path on win32 using system().

So, playing back a rendered animation now works again on win32, however,
the bug remains... no idea how to correct it.
2006-11-25 14:53:31 +00:00
9f5713df2f Bugfix: test_index_face got wrong number of vertices when converting NMesh
to Mesh if there were vertex colors.
2006-11-23 20:37:45 +00:00
b1f787715a Fix for bug #5296: Mesh.update destroys vertex groups. Code wasn't
updated for customdata layers yet.
2006-11-23 18:36:13 +00:00
Nathan Letwory
d38a8b20b9 * free socket names
* some misc changes
2006-11-23 11:54:50 +00:00
Nathan Letwory
f4aa5064e9 * add two files for development of pynodes - note that the module in this is not enabled,
so don't bother to try and get it working just yet. It all will come in due time
 :)
2006-11-23 05:59:09 +00:00
Ken Hughes
7b9fac49f5 Bugfix #5289: "Shape Wizard Widget" script was using non-existant key:
changed so "Key 0" is substituted for "Basis".  This may not be correct...
Also, fix to make ob.setEuler() accept a tuple again.
2006-11-23 00:28:09 +00:00
e10a86eef9 (Partial) fix for bug #5289:
Crash using Shape Widget Wizard script, was an error in customdata copy.
The script still throws a python error though, but that seems unrelated
to this crash.
2006-11-22 23:12:38 +00:00
Ken Hughes
2dbed48e24 Python API
==========

Bugfix #4951:  This might be a serious change for python script writers.
-- ob.getMatrix('localspace') did not return the correct matrix when the object
   had a parent; this has been corrected.
-- ob.setMatrix(m) did not work predictably (more correctly, in an easy-to-
   predict manner) when an object had a parent.  The method has been changed
   so that if thee is a parent, it ASSUMES the matrix is "localspace",
   relative to the parent.  The documentation now states this.
-- ob.mat and ob.matrix are now read-only attributes, while ob.matrixLocal
   (which calls Object_setMatrix() ) is now read-write.

Ton is not thrilled (is that a fair summary, Ton? ;-) with this method since
the ob->obmat is calculated from the loc/rot/size attributes of an object.
I'll let him speak on this, but I believe his desire is for this method to be
deprecated in the future and replaced with something else.
2006-11-21 21:15:15 +00:00
Ken Hughes
973e8920f0 Python API
==========

Fix epydoc warnings after IDProperty addition to Material.py
2006-11-21 19:17:13 +00:00
Ken Hughes
ed3559aa8e Python API
==========
Bugfix #4905:  correcting errors and out-of-date NLA API documentation.
2006-11-21 19:00:12 +00:00
19a4f41172 =ID Properties Python Doc Update=
The epydocs are now updated to have idproperties;
all the modules that have bindings for ID properties
now has docs for them.  E.g Materials have a .properties
members, Image, Texture, Scene, Object, NMEsh, and Mesh.

I realized that .properties was already taken in
Objects, so I renamed it to .idproperties.  There was
also a nasty little problem with an example inside
Object.getType; the entire example was being pasted inside
the return field.  I fixed it by just moving the return
definition to after the example, like it should be.
2006-11-20 11:07:56 +00:00
e435fbc3c5 Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.

Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData


Replaced TFace by MTFace:

This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.


Removed DispListMesh:

This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.


Removed ssDM and meshDM DerivedMesh backends:

The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.


This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
6e086d4cfe =ID Properties Python Update=
ID Properties binding have now been added for textures.  Also,
the beginnings of supporting "del IDProperty Object" (which 
basically removes the property from it's parent group then frees
it) in python were done; really the only thing now is to figure 
out exactly *how* you overload the del operator. :S
2006-11-19 16:00:04 +00:00
2bb9d5471e Fix for bug #5250: inaccurate conversion between edit and pose mode bones.
Using acos(dot(u, v)) to find the angle between two vectors is quite
inaccurate, and there's a better way to do it, as explained here:
http://www.plunk.org/~hatch/rightway.php

Also changed the use of atan for computing roll to atan2 in some places,
the latter avoids accuracy and division by zero issues.
2006-11-18 23:07:32 +00:00