Commit Graph

216 Commits

Author SHA1 Message Date
dda63a9dde added comparison function to many python types so you can do == and =! 2006-10-06 16:48:28 +00:00
32b1e2383b 3rd attempt to commit, metaball fixes and small vector optimization 2006-09-30 14:14:49 +00:00
b4e97c01ff -> Enter/Exit editmode wait cursor flags
The wait cursor was being called during editmode enter and exit for meshes.
This was a problem for several reasons. First of all, python modules like
Mesh now make use of editmode features. These methods that wrap editmode
tools may be called many times during the execution of a script
and lead to the wait cursor rapidly flickering on and off.

The other problem was that the wait cursor wasn't being called for editmode
enter and exit of all data types. This is unified now.

-New Arguments

enter_editmode() should be passed a nonzero integer or simply EM_WAITCURSOR
if the wait cursor is desired. Currently only the python API passes a '0'
to enter_editmode()

exit_editmode() has several options and they are passed in as the bitflags
EM_FREEDATA, EM_FREEUNDO and EM_WAITCURSOR. These flags are defined in
BDR_editobject.h.
2006-09-28 01:55:44 +00:00
e6251f6ae7 removed .parent by mistake in Object.c
made some of the importers raise a nice error if a file disnt exist rather then a python error. will eventually apply to all.
2006-09-26 04:39:46 +00:00
e8495d1fdd Extra generic errors for Scene, Groups and Metaballs to raise errors when trying to do anything with a python objects thats had its data removed in Blender.
Added to existing scn.objects
scn.objects.active    (get/set the active object for the scene)

scn.objects.selected    - an iterator that only uses selected objects
scn.objects.context    - an iterator on objects in the user context (visible in the current 3d views layer and selected)
These are the same type as scn.objects but .add() .remove() .new() .active etc raise errors. so scn.objects.selected.add() will raise an error.

Made nested loops possible with scn.objects, metaball.elements and ob.modifiers, by initializing the iter value as NULL and creating copys of the pyobject when _getIter() is called if ->iter is not NULL.
This is how pythons xrange() works.
2006-09-24 08:30:38 +00:00
d728cd1a52 new read only object property to be used for the collada exporter
ob.parentType and a constant dict Blender.Object.ParentTypes
2006-09-23 15:07:03 +00:00
Ken Hughes
c3b9a550a3 ===Python API===
Internal code clean-up: make M_Object_New use existing code instead of
duplicating the steps of object initialization/creation.
2006-09-11 17:55:52 +00:00
20818be156 Adds toggle to Object API for enabling NLA animation versus active Action
animation. Object.enableNLAOverride=True sets to use NLA;
Object.enableNLAOverride=False sets to use active Action;
status=Object.enableNLAOverride shows current status
2006-08-30 15:22:19 +00:00
b92837c7c3 Object.c - Fixed dupli variable flags 2006-08-16 06:19:08 +00:00
2fc1f4ac42 - updated python api doc string for Object_SetDrawMode() 2006-08-15 11:06:00 +00:00
Ken Hughes
0a3f16304f ===Python API===
Long-awaited refactor of Object module.  Should not break backward
compatibility -- at least it didn't in my tests -- but I'm requesting users
to put it through heavier testing and report problems through the bug
tracker.
2006-08-14 18:01:28 +00:00
515fe83f97 added __copy__ to mesh and object types, fixed a monor bug in setTexMesh and made Mesh.c use G.totMesh properly. 2006-08-13 01:51:47 +00:00
b44ae44c72 Made RotationMatrix accept values outside 360,
added object.type to be used instead of .getType()
2006-08-08 14:34:38 +00:00
b227c98c44 Addition to Mathutils
vec.normalized()
 mat.inverted()
 mat.transposed()
 made vec/float possible

 normalize/invert/transpose now return None because they modify the data in place.
 use the ...(ed) versions to return a modified copy.


Fixed Memory leaks from not decreffing PyFloat_AS_DOUBLE from these python functions...
(found when testing above functions)
  ob.rbMass
  ob.rbRadius
  matrix.determinant()
  quat*float
  vec*float
  matrix.transpose()
  EXPP_setModuleConstant

Checked all instances of PyFloat_AS_DOUBLE so I dont think there are any mroe leaks there.
2006-07-27 01:18:21 +00:00
6bd0091a08 BPython:
-local matrices again, previous commit had matrix multiplication with
inverted order.
2006-07-09 14:49:53 +00:00
c8a37212da BPython API:
-fixing object.getMatrix("localspace") and object.matrixLocal to return
the local matrix (returns global space matrix if the object doesn't
have a parent).
2006-07-09 13:04:42 +00:00
f2d80ee097 wasnt decref'ing items I got from PySequence_GetItem for PolyFill or ob.join() fixed and tested, memory dosent increse when used in a large loop. 2006-07-02 10:37:24 +00:00
7dc92c6b25 === warnings cleanup ===
added missing includes for undefined symbols in windows release build

warnings:
creator.c(490) : 'libtiff_init' undefined;
transform_manipulator.c(237) : 'EM_editselection_center' undefined;
src\transform_manipulator.c(241) : 'EM_editselection_normal' undefined;
transform_manipulator.c(242) : 'EM_editselection_plane' undefined;
\python\api2_2x\Object.c(3658) : 'get_local_bounds' undefined;
2006-06-28 17:46:46 +00:00
d5246c43de Object_join Was raising exceptions about being in background mode when it wasnt, this seems to fix it. memory corruption is an unlikely resion because its the first check. 2006-06-26 04:26:51 +00:00
a6fc975d49 join could crash blender in background mode or if the mesh was not in the current scene. added exceptions for both and notes in the EpyDocs. 2006-06-26 02:43:15 +00:00
b58998729b Last minute patch from Chris Want
Nkey "Properties Panel" now has Dimension ("Dim") buttons too.
This reads from the actual bounding box value to see the size. Note that
dimensions for animated & deformed objects will change per frame.

(Cleaned up buttons layout for patch, and added support for Curve, Text and
Surface objects)
2006-06-12 20:01:18 +00:00
76d2d388f2 added rbRadius and rbHalfExtents members for python / rigid body access. rbRadius is read/write. rbHalfExtents is read-only (it is derived from the mesh) 2006-05-31 20:48:44 +00:00
Ken Hughes
677cf7f133 ===Python API===
Adding support for Action Strips to the API.  A new attribute "actionStrips"
has been added to the Object API to access them.
2006-05-22 14:19:52 +00:00
Ken Hughes
18b622ca6b ===Python API===
Change code for rigid body access to use attributes instead of methods; also
add documentation to epydoc.
2006-05-17 16:08:54 +00:00
91c5d75c4d added 2 more Rigid Body Python access, should be enough to make a start for Collada 1.4 Physics Import/Export 2006-05-16 23:47:29 +00:00
a88675d0e4 Added first Rigid Body python access (mass). Basic others will follow. This helps Collada 1.4 Import/Export. 2006-05-16 23:17:56 +00:00
bb69543fa9 *added new Object method Object.evaluatePose(frame)
- the new methods will advance an object's pose correctly to any frame

Example:
myobj = Blender.Object.Get('obert')
for x in range(10):
  myobj.evaluatePose(x)
  pose = myobj.getPose()
  print 'Data at Frame %d' % x
  for bone in pose.bones.values():
    print bone.head, bone.tail
    print bone.head, bone.tail
2006-05-16 20:32:21 +00:00
Ken Hughes
cd3af13a1b ===Python API===
New Constraint API.  Constraints are accessible through a "constraints"
attribute in poses and objects.  Would be REALLY NICE for armature users to
pound on this code.
2006-05-07 14:57:58 +00:00
53e777aae1 added optional 'worldspace' arg to getLocation/getSize/getEuler
getSize is never flipped, but added a note in the docs.
correction to getEuler, its not wrapped.

also removed all // comments to shut GCC up.
2006-05-07 08:12:18 +00:00
89dab4397d Pydrivers: Ipo Drivers controlled by Python expressions
wiki with info: http://mediawiki.blender.org/index.php/BlenderDev/PyDrivers

(there are two sample .blends in the patch tracker entry, last link in
the wiki page)

Notes:

In usiblender.c I just made Python exit before the main library gets
freed. I found a situation with pydrivers where py's gc tried to del
objects on exit and their ID's were not valid anymore (so sigsegv).

Ton needs to check the depsgraph part.

For now pydrivers can reference their own object, something normal
ipodrivers can't. This seems to work fine and is quite useful, but if
tests prove the restriction is necessary, we just need to uncomment a
piece of code in EXPP_interface.c, marked with "XXX".

Thanks Ton for the ipodrivers code and adding the hooks for the py part
and Martin for the "Button Python Evaluation" patch from which I started
this one.

Anyone interested, please check the wiki, the .blends (they have
README's) and tell me about any issue.
2006-04-30 16:22:31 +00:00
87949e5c67 warnings cleanup for the python project on windows 2006-04-24 15:09:07 +00:00
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