Commit Graph

185 Commits

Author SHA1 Message Date
Ken Hughes
8001a8b409 ===Python API===
Initial commit for new Modifier API.  Probably does about 70-75% of what it
should, but it's a start.
2006-04-23 02:34:50 +00:00
19345ba9ac CVS: ----------------------------------------------------------------------
ob.DupObjects was working but giving a warning. Fixed the warning and it also works in all test cases.
2006-04-20 12:22:00 +00:00
d4cef18e38 Previous commit broke pythons ob.DupObjects.
Though access was incorrect, fixing it made the linked list return a different length.
tested with all dupli types and it works properly now.
2006-04-19 10:38:20 +00:00
2b46b624f8 Error in accessing the listbase needed to use BLI_countlist(&lb) rather then BLI_countlist(lb)
fixed, thanks jms for the hint.
2006-04-18 15:37:32 +00:00
Stephen Swaney
342bb99a19 a little spring cleaning to remove some compiler warnings for
implicit declarations, redundant redeclarations, missing initializers,
nested externs and other cruft.

Cleaned up includes and moved extern _Type decls from Types.h into
Types.c since that is the only place where they are needed now.

Did not touch Ipo.[ch] since work is on-going there.
2006-04-16 15:28:50 +00:00
9d30a3a5ec Added matt's empty drawsize property to python. 2006-03-31 09:50:39 +00:00
7417d07482 Attempted to unify and document Dupli* stuff.
DupGroup
DupObjects
enableDupVerts
enableDupFrames
enableDupGroup
enableDupRot
enableDupNoSpeed

see the epydocs for documentation at http://members.iinet.net.au/~cpbarton/ideasman/BPY_API/Object.Object-class.html - will update in a tick.
2006-03-24 08:36:39 +00:00
Ken Hughes
4fcd19013b Fix various gcc warnings. 2006-03-19 20:45:50 +00:00
abab9fc3de Added object.dupliGroup so objects can access the groups they instance.
This is very confusing.
Since in object has
ob.setDupliGroup() # Enable/Disable Dupligroup
ob.getDupliGroup() # see if its enabled.
ob.dupliGroup # the group data this object is instancing.

Not yet added
ob.groups # Groups that use this object.
2006-03-18 17:24:59 +00:00
Ken Hughes
04ce5e8efe Bugfix: Object.link() was not correctly handling object/datablock material
counting, causing "Error Totblock" messages on exit due to memory not being
freed.  Added a call to test_object_materials() after the new data is linked.
2006-03-11 01:17:21 +00:00
8afc4cf192 fix for bug 3903
.
2006-03-03 17:45:23 +00:00
0caa0ddb82 Fixed mistake where BLI_countlist(&(lb)) should be BLI_countlist(lb) 2006-03-02 01:00:13 +00:00
b7ff45f914 new emptys now have default settings for new emptys. 2006-02-27 06:00:00 +00:00
9e0d2837d5 Applied JMS's Patch. for better Python Dupli Access.
Made some fixes and changes.
* The matricies returned were wrapped. Wrapping Display Mesh matricies segfaulted sometimes. - Made a copy instead.
* Added 1 missing epydoc from the patch.
* Renamed getDupliMatrices to getDupliObjects, and changed to return a list of (object, matrix) tuples instead of just the matrix. This is much more usefull because it allows python to know what objects are used for dupliGroups and for dupliverts where there is more then 1 child. also cleaned up this function a bit.
2006-02-27 04:05:55 +00:00
Ken Hughes
7592c09c2b ===Python API===
Allow object.setMatrix() to accept 3x3 matrices by extending to a 4x4
internally.  Also check the dimensions of the new matrix and throw an
exception if not a 3x3 or 4x4.
2006-02-16 20:09:32 +00:00
a3d0d456ac More things for easying the job of replacing proxy/working armatures in the scenes of Elephants Dream with the final ones: 1) adds removing Fakeusers from Actions to PyAPI, now with a hackish call in the Blender module. Possibility of better ways should be discussed on bf-python. 2) adds BPY Object.copyNLA(otherob) - that was simple 'cause the copy_nla function was nicely in kernel nla.c. 3) Object.convertActionToStrip(), here it gets tricky: the function to convert the active action of an object to a NLA strip was buried inside the respective function in the GUI editnla.c which had also code for reading mouse coordinates and whatnot. So I took the actual copying out of it and moved it to the kernel nla.c as a new function, bActionStrip *convert_action_to_strip (Object *ob). that code used other functions, of which find_stridechannel() was also in editnla.c but free of UI code so i moved it to kernel too. kept things with UI code in editnla.c. tried to be careful with keeping mallocs and the pointer business intact, and tested that this works and after usage Blender gives no memory warnings or anything, so seems ok - but certainly is best reviewed by ppl more active with c coding than me. hopefully this little refactor makes it possible to add this function to the menus too, which was not straightforward earlier when Matt took a look at it. 2006-02-08 16:58:12 +00:00
afb5a2acf5 yet another temporary strange but straightforward hack for a script at orange to work! that is: while Joseph is working on the actual Constraint API for bones etc., this allows our armature script to set influences with a simple call: armatureobject.setConstraintInfluenceForBone(bonename, constraintname, influence); fails silently at failure ('cause the c calls used do and no retvals are checked) and is in the strange place (as the current api is largely not object level) but works for us for now (e.g. next few weeks). 2006-02-01 22:21:46 +00:00
240e25ab65 Cleanup of blender/ module; Makefiles now compile this warning free.
Mostly was unused variables, unused functions, missing prototypes and
missing include files.
2006-01-28 20:17:48 +00:00
Chris Want
c8b48e70e6 Final merge of HEAD (bf-blender) into the orange branch.
Here are my notes on things to look out for as potential problem
spots:

source/blender/blenkernel/intern/displist.c:
+ is initfastshade(void) supposed to be empty? I had
to make it empty to get the merged tree to compile.

source/blender/python/api2_2x/Armature.c:
+ went with the version that had Armature_getLayers()

source/blender/python/api2_2x/Object.c
+ went with the version of Object_getPose() from bf-blender.
(#ifdef 0-ed the other version)

source/blender/python/api2_2x/Pose.[ch]
+ had problems linking due to no Pose_Init() ... copied these
two files straight from bf-blender.

source/blender/src/drawview.c:
+ view3d_panel_properties() had things shifted a few things shifted
a few pixels, otherwise, things were painless

source/blender/src/splash.jpg.c:
+ went with bf-blender version (orange is dead)

source/gameengine:
+ went with bf-blender version -- does not compile due to IMB_rect* stuff,
Ton should look into this.
2006-01-28 16:35:18 +00:00
427b132ad0 ==python api==
patch from jean-michel soler (jms) - .insertShapeKey()

Python API, a function to insert a shape key in an object . It works on Mesh, Lattice curve ans surface .
Example of use :

import Blender
OBJECT=Blender.Object.GetSelected()[0]
OBJECT.insertShapeKey()

a docstring to follow soon
2006-01-17 06:47:48 +00:00
Stephen Swaney
adcef46599 Object.Get( name ) was throwing an AttributeError.
Change to throw more correct ValueError when name
is not found as per IRC discussion
2006-01-14 02:13:15 +00:00
5f0232f68f *pose code for python
- adds object.getPose
- ability to manipulate poses /posebones
- fixes a overflow bug in matrix sequence accessor
- adds code to get vec/roll from mat3
- few internal fixes to NLA
- ability to set bone matrices
2006-01-11 19:40:06 +00:00
e7285229b8 Tuesday merger of bf-blender into orange branch. 2006-01-10 22:10:14 +00:00
1377e65531 Changed so all errors raise an excepton. - As per Toni's suggestions.
TypeError for pythonCoder error.
RuntimeError for blender not being able to be joined. (Sorry stivs, no BadJuJu yet)

Documented this in the epydocs also.
2006-01-05 15:53:07 +00:00
f47899fc0f Orange; merger with bf-blender.
(Merging is *not* fun work, especially not with bugfixes in main branch
for code that got cleaned up in the other! Poor Hos... :)
2006-01-03 21:43:31 +00:00
9f8348a22a *bpy fix
- include file capitialized wrong
2006-01-03 17:24:24 +00:00
5233f73589 *warnings fixes
- fixes a number of warnings in bpy project
2006-01-03 16:27:34 +00:00
d14f6c9cbc replaced more M_Object_Get for the faster Object_CreatePyObject.
Object.GetSelected now dosnt return None if there is no 3d view. - wasnt documented and likely would mess up scripts that always expected a list. - Just return an empty list instead.
2006-01-03 06:14:53 +00:00
5f48930a75 Moved Object.Join() into a function of an object.
eg.
ret_val = ob.join(objects)
Now it dosent depend on the current selection, or change the selection context.

Made respective join_* functions return 0 if the join was not mode, 1 when it workes.
2006-01-03 02:35:45 +00:00
80f903ed73 Small commit, hopefully the last Duplicate change.
Made pythons duplicate not redraw, documented adduplicate()
2006-01-02 23:26:54 +00:00
8b0c3de7d9 Changed adduplicate() to take the dupflags as an argument. so faking the Alt Key isnt needed anymore in Blender or python.
Changed Pythons Object.Duplicate() to take keyword parms to enable duplication of spesific data.
Eg- Object.Duplicate(mesh=1) # to duplicate mesh data also.
2006-01-02 10:40:13 +00:00
625c553e20 Added a python hook to Joining objects
Object.Join()

Seperated the join calls from space.c and view3dmenu into join_menu() in space.c, like the select_group_menu(),
okee's from join_curve, join_mesh.. etc are in join_menu() so python can call them without UI menu's in the way.
this is also a bit neater since there were 2 places that were doing what join_menu() does now.

- Cam
2005-12-30 14:17:15 +00:00
f310f296b2 Added the function Duplicate to the object module.
Object.Duplicate(linked=1)

Basicly a wrapper for adduplicate();

There was previously no easy way to copy objects in python. even the ways that do exist dont take modifiers, particles etc into account.
Uses the current selection.. epydocs included also.

- Cam
2005-12-30 11:54:53 +00:00
ccf117376d Fixed a python segfault when linking a new object to a scene that had no data and was a Surf. the data wasnt created and blender died. Now an error is raised instead. 2005-12-29 12:06:42 +00:00
72d805f17d Orange: monday merger with bf-blender (loadsa bugfixes).
ALso: a bit tidying up in editaction.c and python Object.c
2005-12-19 18:56:08 +00:00
87d9ca4b99 orange: py2.3 compat 2005-12-18 21:20:11 +00:00
fae20e494e orange: animation baking code. also a patch to autokey, to only key the keys made. 2005-12-18 20:14:22 +00:00
7998a07386 orange: added Object.insertPoseKey to continue with the attempt to make nla/path walkcycle baking to actions 2005-12-14 17:44:08 +00:00
65ce2c2cee * warnings fixes 2005-11-29 05:08:29 +00:00
Ken Hughes
427cae9eeb -- Fix bugs caused (by me) by incorrect use of Py_RETURN_NONE macro in
"if" statements.  The macro defined in gen_utils.h expands to two
   statements; putting after an "if" statement without {} means the second
   statement should always be executed.  I'm not sure if just putting
   braces around both statements would cause other compilers to complain.
   But this explains an earlier bug in the Object module which only
   appeared on MacOS/X.
2005-11-28 05:21:25 +00:00
Stephen Swaney
bc293ba7e1 patch #3475 for bug #2867 Object.makeParent with noninverse doesn't clear parentinv matrix
Contributed by Stephane SOPPERA (soppera).  Thanks!
2005-11-27 01:42:46 +00:00
Ken Hughes
97c13508ff -- added Object.protectFlags attribute; let user get/set transform lock bits 2005-11-18 19:44:44 +00:00
Ken Hughes
2de340199d -- fixed bug with returning NULL from Object_CreatePyObject() on MacOS/X.
The code prior to the last commit worked... but can't see the differene
2005-11-18 16:03:03 +00:00
Ken Hughes
32c91c897b -- Fix for the "LIB ERROR: base removed" problem; BPy Object was decrementing
us.id when objects were destroyed but not always incrementing when
   created.  The intent of modifying us.id is to make Python a "user" of the
   data so it persists even when it is deleted from Blenders UI.  The original
   commit was unintentional but Ton thought the idea was OK.
2005-11-17 18:35:11 +00:00
Ken Hughes
a85ba68eb4 -- Added OB_RECALC_OB to Object_set* methods. 2005-11-15 16:34:25 +00:00
f09a3611be *armature api for python
- don't get too excited
- allows you to get armatures from a scene
- makeEditable()/saveChanges() puts the armature into out of editmode (pythonically)
- Armature.bones is a dictionary that contains all the bones in the armature and can be iterated
- getters are available for:
name,
roll (dictionary) keys are BONESPACE, ARMATURESPACE
head (dictionary) keys are BONESPACE, ARMATURESPACE
tail (dictionary) keys are BONESPACE, ARMATURESPACE
matrix (dictionary) keys are BONESPACE, ARMATURESPACE
weight
deform_dist
subdivisions
options (list of constants)
parent
children

Setter work only in editmode. Some are not fully implemented.
Type class is embedded in the module. This means the construct is called as follows:
Blender.Armature.ArmatureType()

import Blender.Armature as Armature
arm = Armature.Get('myarm')
for name, bone in arm.bones.items():
...print name, bone, bone.matrix['ARMATURESPACE']

more documentation is forth coming. This is an alpha for this api.
2005-11-07 20:03:32 +00:00
Ken Hughes
0089c0bc53 -- Added Object.effects, a read-only attribute which returns a list of the
particle effects belonging to an object (based on patch from jms)
2005-11-06 22:29:49 +00:00
Ken Hughes
e01e5a4cbf -- Bugfix 3333: BPy method ob.getEuler() was returning PyObject which wrapped
stack-allocated data (thanks, pontus).
2005-11-02 23:28:36 +00:00
Ken Hughes
cb9988332a - fix issues in with Mesh_fromNMesh pointed out by Ton earlier; errors from
Python routines should properly be propagated back to give an error as
  intended.
2005-10-30 03:05:54 +00:00
Ken Hughes
a9a545d784 Lots of BPy Mesh additions:
- added faces.uvSel attribute: can get/set selection status of UV vertices in
  UV Editor window
- make mesh.faceUV, mesh.vertexUV and mesh.vertexColor writable: users
  can now enable/disable UV faces, vertex colors, "sticky" vertices
- fixed bug with mesh tool methods: before it would only work if an object
  linked to the mesh was selected
- added mesh.quadToTriangle() and mesh.triangleToQuad() methods
- added selected() method to verts, edges, faces; returns list of indices
  of selected items
- mesh.getFromObject() now gets derived mesh data
- ported vertex group methods from NMesh (required change to Object.c)
- ported module dictionaries from NMesh
2005-10-27 19:37:37 +00:00