Commit Graph

236 Commits

Author SHA1 Message Date
60a2977dcf adding ob.activeMaterial - allows you to get/set the active material for an object. 2006-12-22 04:46:37 +00:00
Ken Hughes
2260add0f0 Python API
----------
Correcting typos in Object documentation.
2006-12-19 17:17:14 +00:00
1ec3e6f3b6 adding ob_arm.makeParentBone([ob1, ob2...], bonename)
ob.parentbonename is also settable now as long as it already has a bone parent
2006-12-19 09:41:45 +00:00
Ken Hughes
65eda9e6e1 Missing variable initialization from earlier Object.New() patch. 2006-12-17 06:58:02 +00:00
Ken Hughes
940e625702 Python API
----------
Bugfix #5447: bug in determining whether a Curve was a CurNurb or SurfNurb.
2006-12-17 05:55:56 +00:00
1041ad4719 added fakeUser and users to more pytypes 2006-12-17 02:16:29 +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
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
47adee414c added ob.passIndex to bpy, changed passIndex tooltip to a better one ton suggested. 2006-12-12 21:01:43 +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
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
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
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
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
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
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
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
8768707610 =ID Properties=
This commit adds supports for per-ID properties to blender.
See http://mediawiki.blender.org/index.php/BlenderDev/ID_Property
for more information on how it all works.

ID properties are accesable by python; but note that 
bindings have only been added to Object and Material thus
far.  However adding more bindings is easy and I plan
on adding several more hopefully within an hour of this inital 
commit.

A generic UI panel is also planned, that will go wherever its
needed; for example in the material buttons, editing buttons, etc.
I'll likely submit the initial code for that as a patch, though,
so matt and ton and others can go over it and make sure it's
all good. :)

VERY important, if you intend to use ID properties please
go to http://mediawiki.blender.org/index.php/BlenderDev/PropertyStandards
and start writing the appropriate standards for it.
2006-11-17 04:46:48 +00:00
de3c54569d BPyRender sets renderlayers right now
Object groups were get/set without user counts changeing.
2006-10-11 10:33:34 +00:00
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