Commit Graph

73 Commits

Author SHA1 Message Date
39e4dc6202 replace PyInt_CheckExact with PyInt_Check, same for floats and strings so subclass and C/subtypes work.
was reported as a bug a while ago.
2007-07-01 05:41:23 +00:00
e192e7e024 remove unneeded checks from the python API 2007-06-29 08:59:26 +00:00
39a526a963 Python PyMethodDef supports single argument methods (METH_O) but was using METH_VARARGS everywhere and getting the single args from the tuple.
Use METH_O where applicable.
2007-06-16 12:24:41 +00:00
bcc3143119 more memory leak fixes, though only a few are likely to happen 2007-05-27 21:33:48 +00:00
30dd4fafd1 More memory leaks fixed - in IDProp, Bone.head, tail, matrix, ob.DupObjects (my fault) and in Effect module as well as a few others.
Also stopped using Py_BuildValue for strings, ints and floats.
2007-05-26 04:39:31 +00:00
f231bd0d57 Many long standing memory leaks fixed in the BPY api.
Data from Armature.c and logic.c still leaks.

Mostly todo with PyList_Append adding a refcount and the bpython api not decrefing.

Also added some features needed to fix a bug in mesh_clean.py (ob.pinShape and ob.activeShape)
2007-05-25 16:43:25 +00:00
c97be098f7 Python API
made all libdata hashable - use the object type,name and lib for the hash.
added .tag to libdata so we can test if data's been processed without using dictionaries
added libdataseq.tag (write only) setting the tag flag (which can always be dirty)
2007-03-26 02:10:24 +00:00
52e43441d1 removed unneeded dealloc functions 2007-03-15 01:47:53 +00:00
ee5dc4d0bf removed duplicate functionality, macro's and functions existed to check a PyObjects type, now only use macro's 2007-03-15 01:09:14 +00:00
5c5a80f644 made all python types that can do .__copy__(), also do .copy()
added copy function to lamp, texture and ipo types
2007-03-14 03:01:24 +00:00
1135434ed1 moved python functions that deal with blender libdata into gen_library.c from gen_utils and BPY_interface
small cleanup, removed unused functions and explicetly cast pointers..
2007-03-11 04:05:45 +00:00
a05f95f347 Image.c
* moved to getseters (use new generic ID funcs)
* added 'reflect' attribute

Text.c
* moved to getseters (new generic ID funcs too)

NLA.c
* moved to getseters (ditto)

Ipo.c
* bugfix, allow nested loops on an IPO's curves.

Blender.c
* removed undocumented function RemoveFakeuser, since actions now have the fakeUser attribute.
2007-02-25 12:41:50 +00:00
436e1697fd made attributes (name, property, users, fakeUser, lib) into functions all python types can use.
removed a lot of code duplication when moving to this.
Also removed unused functions GetMaterialByName(), same for Mesh, Object, World etc.
2007-02-25 07:36:50 +00:00
086d51c822 BPython API
* Added data.lib attributes to almost all data types, (except for Text3d and NLA)
  This is None or the path of the library as a string.
* Main was giving a warning, Include Curve.h rather then CurNurb.h
* Added Library.LinkedLibs(), returns a list of externaly linked libs.
2007-02-23 14:51:20 +00:00
9afe662c12 renameing datablocks was imposing a name limit on the python side.
This isnt needed because the limit is alredy being set by rename_id()
some other minor changed- use None returning maro
2006-12-27 05:04:20 +00:00
Ken Hughes
a4a031e434 Python API
----------
Bugfix submitted through bf-committers: Ipo.getNBezPoints() could cause
segfault due to incorrect check for end-of-list.
2006-12-23 18:16:20 +00:00
Ken Hughes
318a694a25 Get rid of various warnings with gcc under linux 2006-11-17 17:50:43 +00:00
dda63a9dde added comparison function to many python types so you can do == and =! 2006-10-06 16:48:28 +00:00
Ken Hughes
f000ce6fba ===Python API===
Bugfix: key curve names compared using strncmp instead of strcmp,
resulting in wrong comparisons.
2006-07-02 21:37:06 +00:00
Ken Hughes
6d0b3bf2b7 Bugfix #4516: Allow ipo.addCurve() to create Key IPO curve for a
corresponding keyblock.
2006-06-28 17:13:39 +00:00
87949e5c67 warnings cleanup for the python project on windows 2006-04-24 15:09:07 +00:00
Ken Hughes
94ebee891c Some Ipo getseters calling setter methods; added the necessary wrapper
functions to make this work correctly.
2006-04-24 05:24:58 +00:00
Ken Hughes
fe1495cf24 Little bit of code clean-up and commenting. 2006-04-23 14:17:14 +00:00
Ken Hughes
4aa28f13f4 ===Python API===
New Ipo and IpoCurve API.  Ipo and IpoCurve objects support the [] operator,
for accessing the curves of a particular Ipo and for accessing the value
of an IpoCurve at a specific time.  Both modules were also "tp_getset"-ified.
Also, code for an alternative method (Antont wanted this) of accessing curves
via Ipo attributes is included for now, for people to try and see if it's
actually preferable to the Ipo [] operator.

These are all new additions; nothing was intentionally removed from the API.
If you find the something in the existing API has changed, let me know.
2006-04-21 20:27:52 +00:00
Ken Hughes
75032534f3 Bugfix for Toni: Ipo_addCurve() needed to call set_icu_vars() in order to
properly initialize data for new Ipo curves.
2006-01-05 19:25:38 +00:00
Ken Hughes
bf05bbef86 Fix unchecked parameter in M_Ipo_Recalc, and some documentation fixes. 2005-12-05 05:23:35 +00:00
cce655b5e7 - warning fixes
* various warnings the python api is putting out
2005-11-07 19:34:44 +00:00
Ken Hughes
7040e6c157 -- patch submitted by Johnny Matthews which lets a user get an Ipo curve by
its adrcode in addition to its string name (shape keys don't have fixed
   or unique string names, and they are stored in the key, not the Ipo).
   This will make it easier to later use constants from dictionaries to
   access a curve.
2005-10-31 14:05:47 +00:00
Ken Hughes
edd998c042 -Bugfix #3254: Ipo.addCurve() didn't check if curve already existed before
creating (reported by Toni)
2005-10-25 04:46:49 +00:00
Ken Hughes
5166a1ee92 - Bugfix #3202: ipo.addCurve() created curve but didn't add to the Ipo
(thanks, lguillaume).  I think we need much more testing of the Ipo
  module following Ton's refactoring.
2005-10-17 03:48:02 +00:00
4bd9775936 Stupid me! Committed in wrong console with wrong dir... here's the rest of
all files for the Ipo/Action/NLA makeover...
2005-10-10 18:05:30 +00:00
Ken Hughes
33fcdf2ada Bugfix #2650.
Calling ipo.delCurve() with a curve that's not been displayed in the
Ipo curve editor caused a segfault.
2005-10-03 21:05:41 +00:00
e60291d39c Header file clean up and warning fixes
- Mostly this cleans up the #includes and header files in the python project.
- Warning fixes are mostly casting issues and misc fixes. General warning clean up.
- #include Python.h MUST come as the first include to avoid the POSIX redefine warning in the unix makefiles
- fno-strict-aliasing flag added to makefile to fix a unavoidable type punning warning in types.c
2005-07-18 03:50:37 +00:00
Stephen Swaney
bb84abaaa8 updates to doc strings in code and doc from Ken Hughes.
add alias .recalc() for IpoCurve.Recalc() to match api standard.
2005-05-24 15:14:32 +00:00
Stephen Swaney
f8ae055f4b corrections and missing ipo channels for Camera, World, Material
and Lamp.  Contributions from Ken Hughes.
2005-05-20 12:16:54 +00:00
Stephen Swaney
626e930c47 New IPO methods.
Ipo.delCurve( curve_name ) deletes named curve from IPO.
Ipocurve.delBezier( int ) deletes point at index from Ipocurve.

Contributed by Ken Hughes (khughes).  Thanks!
2005-04-24 19:03:39 +00:00
a96ed881dc BPython:
- Scripts:
    fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
    cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
    small updates to help_browser.py script.

 The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place).  Updated Scripts win->Scripts menu so it won't show all available entries, only  the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees.  The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).

- Modules:
    Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
    NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).

- Bugs fixed:
    #2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
    Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text).  Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.

    #1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
    Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
    Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file.  After more testing we can make further updates.  Updated many places to not call redraws if in bg mode, now it is officially available.  Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.

- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
c78e44cdc5 big warning hunt commit
lot of casts, added prototypes, missing includes and some true errors
2005-03-09 19:45:59 +00:00
Stephen Swaney
aa3656dc45 bugfix: #2093 Ipo.addCurve() adds curves of undefined type
added some error checking and did a little cleanup.
still more to be done.
2005-01-07 01:38:14 +00:00
Stephen Swaney
626503e463 bugfix: #2032 Ipo_woIcuName() uses CAM instead of WO constants
Wrong constant names.  Fix contributed by Joilnen B. Leite <pidhash>
2004-12-21 01:15:42 +00:00
Stephen Swaney
36abceed6b bugfix: #2025 getCurveBP (and others) segfault
This method is now unsupported.  The original intent appears to
return the first BPoint of an Ipo curve.  However, BPoint Ipo curves
are not implemented and the first point therefore never existed.

The segfault was from an unchecked input parameter.

Calling this method now always throws a NotImplemented exception.
2004-12-17 17:34:51 +00:00
Stephen Swaney
0fdc0ce297 Another step in the Big Bpy Cleanup.
- move static declarations and data definitions out of headers.
  the BGL module still need cleaning.

- move declarations out of modules.h and into appropriate .h files.
  modules.h still exists as a container for the few modules that
  need to #include almost everything.

- all files now have a $Id tag and have been formatted by indent

there are no changes to executable code.

pre-commit versions are tagged with bpy-cleanup-pre-20041007
for the sake of paranoia.
2004-10-07 19:25:40 +00:00
Stephen Swaney
a509b8adc9 Another round in the Great BPy Cleanup:
Run everything thru indent to cleanup spaces vs tabs.
Clean up some of the comments by hand.
BGL.c was not touched due to all that macro wackyness.

There are no functional changes to the code.
Pre-indent versions of source are tagged with
tag bpy-cleanup-20040925 , just in case.
2004-09-25 20:30:40 +00:00
Stephen Swaney
a2ea84903e One small part of the Great Bpy Code Cleanup.
Add cvs $Id tag to files
2004-09-18 18:47:03 +00:00
f284ba64b0 Ipo.c
Removed a block of a bunch of unused vars...
	Added a return NULL to the end of a funtion that is suppose to
		return something and could fall through.

editconstraint.c
	Added a newline to the end of the file to get rid of a stupid warning.

Kent
2004-09-03 14:31:06 +00:00
Nathan Letwory
2ea5ce017e Fix two problems in my code as reported on Forums and in release article thread on frontpage:
* Quaternion action ipos accidently got swapped in the Ipo module
* Ipos not editable if not linked to a datablock (was possible in 2.33a)

Also fixed a typo in Object.getMatrix(): localespace -> localspace

And I add:

* channels Key 32 through Key 63 for relative vertex keys
2004-08-14 09:20:38 +00:00
73f1da749b Nathan's huge ipo patch.
- now more than 31 channels possible for ipos
- added lotsa new channels all over
- Texture block has ipo now too
- recoded getname_ei functions

(Will ask nathan to give release log info when he's back!)
2004-07-26 21:44:55 +00:00
Stephen Swaney
f64c5cacf7 roll back changes made in Ipo.c version 1.25 so we can
easily apply Nathan's ipo patch which was made against
version 1.24.

this version is the same as 1.24
2004-07-26 07:15:00 +00:00
c50e3f374f BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.

Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.

Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
Stephen Swaney
a703837179 Replace deprecated methods from old api:
PythonReturnErrorObject
  PythonIncRef

Fix some compiler warnings about missing initializers
in method tables.
2004-06-06 22:42:51 +00:00