Commit Graph

56 Commits

Author SHA1 Message Date
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
3b0adf0bf4 added shadAlpha access to materials in python 2006-10-15 08:43:59 +00:00
dda63a9dde added comparison function to many python types so you can do == and =! 2006-10-06 16:48:28 +00:00
0fa174f03e Added tangent_v and tangent space modes to python material modes.
removed polyfill from Mathutils docs
2006-09-06 13:15:05 +00:00
8e7095a464 Added __copy__ to armature, material, curve, group 2006-08-15 11:24:08 +00:00
3526235446 Added .radius support for curves, and material's lightGroup 2006-08-13 10:13:19 +00:00
Ken Hughes
962c81208b ===Python API===
Removed recently added Material API methods getRbFriction() and
getRbRestitution().  Erwin had already added attributes rbFriction and
rbRestitution, and current API design goal is to eventualy replace
all getStuff()/setStuff() with attributes.
2006-06-11 15:35:40 +00:00
9c2707572a added friction and restitution for the Collada Physics export/import
See http://colladablender.illusoft.com
2006-06-02 20:59:29 +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
Ken Hughes
362c8baac4 Bugfix #3652: material.setSpecCol() only accepted a tuple, not separate
parameters as it used to (prior to my tp_getset update).  Fixed this and
other similar situations.
2006-01-01 16:28:57 +00:00
Ken Hughes
826591d778 -- Added BPy support for new Material modes. Recent additions of new mode
bits broke input-checking in the API, so added a bitmask #define in
   DNA_material_types.h which contains all valid mode bits.
2005-12-15 21:54:00 +00:00
Ken Hughes
39ca3e3fa4 -- Bugfix #3548: material.setMode() was doing incorrect range check on
inputs, returned error setting RAYMIRROR or RAYTRANSP modes.
2005-12-06 17:08:09 +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
b777b23e07 Bugfixes for #3102, #3104
- Fix incorrect usage of PySequence_Fast_GET_ITEM()
- make EXPP_setFloatRange() convert its argument to float instead of short
2005-10-03 22:06:16 +00:00
b6ecdb8c35 Project file update for elbeem
Warning clean up of python project
2005-09-26 14:46:14 +00:00
Stephen Swaney
5bac916e83 Part of Bpy Cleanup: change attribute access to use tp_getset.
for these modules.  Adds some new convenience funcs to gen_utils.

This is internal change only and presents little change to the
BPy  API except for cleanup of some inconsistencies.

A big contribution from Ken Hughes.  Thanks!
2005-09-21 19:48:40 +00:00
Stephen Swaney
24c8bcf884 bugfix: #2924 Bugs in api2_2x/Material.c
- BPy_Material_methods[] "setFilter" calls Material_setFresnelMirrFac()
 - Material_setSpecSmooth() should be setting param[3], not param[2]

Contributed by Ken Hughes.  Thanks!
2005-08-21 15:16:16 +00:00
Stephen Swaney
bb5ae49992 A large collection of fixes from Ken Hughes including:
- corrections to constants
 - parameter type checking
 - correct use of METH_VARARGS vs METH_NOARGS
 - return objects instead of strings in Scene.getChildren() as per doc.
 - correct logical operators

Thanks, Ken!
2005-08-21 15:00:17 +00:00
8b060dd5ad - update to constant.c
- give it the key/items interface
  - creates some factory functions for const generation
- genutils methods
  - method for getting module constants
  - method for throwing errors with a print string
- updates to function names
- clean up interpreter launch a bit
2005-08-17 14:26:00 +00:00
ebd83b9bc4 _updates and warning fix_
* fixed a few warnings in the python project
* added timeline to py project
2005-08-07 12:09:50 +00:00
f6ff9ec608 Scripts updated:
- Jean-Michel Soler: 1) paths import -- ai module; 2) tex2uvbaker;
- Campbell Barton: obj exporter.

BPython:
- Campbell also provided a patch (+docs) to add shader data access to Blender.Material.

Again, thanks guys and sorry for the long delay.
2005-08-01 03:06:24 +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
7625378e6d BPython:
- Fix for bug #2621 reported by Yann Cointepas (material.setMode didn't accept integer param, only strings, making it inconsistent with material.getMode):
http://projects.blender.org/tracker/index.php?func=detail&aid=2621&group_id=9&atid=125
    Applied patch #2626 by Ken Hughes to both Material.c and doc (Material.py):
http://projects.blender.org/tracker/index.php?func=detail&aid=2626&group_id=9&atid=127

- Small C doc strings update I forgot to add before, for Render slinks (reminder about Render slinks docs also by Ken).

Thanks both -- btw, Ken Hughes has contributed considerably improving bpy documentation and fixing bugs for this release.
2005-05-27 05:39:41 +00:00
589ce4a005 BPython:
- based on a request by Campbell (he also provided a patch for scene.Layer) access to layers was improved a little, keeping the old method (ob.Layers is a bitmask) and adding the nicer one (ob.layers is a list of ints).  Done for objects and scenes.  House-cleaning: .Layer was renamed to .Layers (actually just using strncmp instead of strcmp, so both work, same done for Window.ViewLayers).
- finally committing patch by Ken Hughes to let .clearScriptLinks() accept a parameter (list of strings) to clear only specified texts.
- doc updates and fixes (JMS reported a problem in nmesh.transform() example code).

Thanks all who contributed.
2005-04-21 19:44:52 +00:00
Stephen Swaney
7df1facbfa New Material method: insertIpoKey( key_type )
inserts material ipo key at current frame.
contributed by Johnny Matthews.
2005-03-20 18:28:36 +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
34977b8937 BPython:
- applied Campbell Barton's patch for access to Oops location and selection of materials, mesh data and objects, slightly modified. Thanks, Campbell;
- got rid of warnings in many files, hopefully not introducing any other during the process.  Mostly this was done: 1) new EXPP_incr_ret_True/False functions were added and used instead of "Py_INCREF(Py_True/False); return Py_True/False;".  Currently at least the functions use the fact that PyTrue/False == 1/0 and use 1 and 0 to avoid the warnings. 2) Filling of certain types structs got 0's added for all not defined data and methods.  This is surely Python version specific, since these structs can change size and content at each major version number Python update.
2005-02-09 15:53:35 +00:00
9f43accdb2 BPython:
- patch by Jonathan Merritt: new function Blender.Draw.Image() + its doc;
- patch by Campbell Barton: .users attribute for many types;
- tiny internal change in nmesh.hasVertexUV() method.

Thanks to Jonathan and Campbell for the patches and the patience!
2005-01-13 03:04:12 +00:00
aad31875d7 Special bf-committers request; Lamp/World/Material now each have 10
channels to link texture to.

The amount of code changes seems large, but is mostly getting rind of
hardcoded values (6 and 8) for channels, replacing it with MAX_MTEX.

Further did some fixes;
- Ipo for Lamp showed too many mapping channels
- Texture MapTo buttons for lamp missed the slider to blend texture color
- Lamp texture mapping "View" only worked for Spot, now it uses lamp-
  view vector for all types. (Nice for projections!)
2004-12-04 21:49:02 +00:00
c6c86b8df0 Fixes in bpython:
-- Alexander Szakaly reported and provided a patch for Material.c and NMesh.c to solve crash in material handling when there's no material.
-- Ton reported a crash with advancing a frame after creating a new script link.  I couldn't reproduce the crash, but added a check in BPY_do_pyscript to make sure the passed ID pointer is valid.

Thanks both.
2004-11-07 15:05:35 +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
Stephen Swaney
0848aed9fc More Material settings: mirror and transparency.
Contributed by Joilnen B. Leite (pidhash)
2004-09-14 20:03:01 +00:00
c04bec851c creator.c wasn't updated in my last commit, here it is (the change reverts my previous change to it, since it was made unnecessary by handling onload scriptlinks a little differently, as can be checked in blender.c and editscreen.c).
- BPython:  finishing object and nmesh .setMaterials commit, fixing two bugs.  Also fixed a crash with object.track (pointer wasn't checked for validity).  All based on reports and patch by Yann Vernier, thanks again.
2004-07-21 03:19:52 +00:00
7b3b3ae432 Trying to fix bug reported by Peter den Bak and Meino Christian Cramer (thanks!):
-- splash screen disappeared (duh, I did that!) and Blender quits upon exiting from some 225 games:

It was troublesome to find how to run demos in general with the screen correctly redrawn before they started, etc.  Ended up making the above error in screenmain().  About the games, I don't have them and will need some time to get the files for testing, but I'll do it, though only on linux.

BPython:
-- Window: added GetScreens, SetScreen and improved GetScreenInfo.
-- Object, NMesh: updated (added in NMesh) method getMaterials to return either only valid materials as before or also empty slots (as None).  This previous omission can be considered a bug, since it made info about materials incomplete / incompatible with face mat indices.  Thanks Yann Vernier for bringing this up and sending/proposing a patch that also fixed a bug related to assigning lists of materials with different lengths to obj and its mesh. setMaterials also accepts Py_None entries now, which become empty slots in Blender.
-- doc updates.
2004-07-20 08:16:46 +00:00
61efb63b0c BPython:
- Added function Blender.Save(filename) to save .blend files.
- Added scriptlink-related methods (get, clear, add) to Scene and Materials.  Will still add method remove and add these methods to World, Object, Camera and Lamp.
- Updates and small fixes in docs.
2004-06-24 09:43:13 +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
5e7f9dfa08 BPython:
-- New module: Blender.Texture, by new developer Alex Mole.
Most of it is done: guess only Ipo, envmap, colorband and plugin were not implemented yet.
2003-11-23 17:46:06 +00:00
9c6275c55b Exppython:
- Small fix in NMesh.c
- Updates to ipo related methods in Camera, World and Material
- Doc updates
2003-10-28 00:29:37 +00:00
6b1b9c1890 iaccess to the IPOs of a Camera, a World, or of a Material 2003-10-26 16:51:53 +00:00
d423c0828f Exppython:
- Added "Radio" to Material modes
- Fixed bug in bone.getParent (bug report on blender.org py forum)
- Added more types to object.shareFrom (method to share obdata)
- Added nmesh.get/setMaxSmoothAngle and nmesh.get/setSubDivLevels
- Updated NMesh doc
2003-10-26 06:03:18 +00:00
fe07b232b7 * got rid of a warning in editipo.c:
changed "get_ipo(key, ..." to "get_ipo((ID *)key, ..." in line 107.
* changed insert_meshkey(Mesh *me) to insert_meshkey(Mesh *me, short offline):
   To call this function from a script, so that it doesn't pop the
   "relative / absolute" dialog window when the "offline" arg is non-zero.

Exppython:

* NMesh module:
   - Added method NMesh.addMaterial(mat) to the NMesh module:
   alternative safer (aka slower) way to add materials.
   - Added optional arg to NMesh_update():
   if given and equal to 1, the mesh normals are recalculated.
   - Fixed NMesh.getVertexInfluences: it was segfaulting when a NULL bone was
   linked to the vertex.  Thanks to Jiba on the bf-python mailing list for
   bug report and sample .blend file.  Also made this method give an IndexError
   when the vertex index is out of range.
* Material module:
   Added specR, specG, specB vars for compatibility with the 2.25 API.
   Pointed by Manuel Bastioni.
* Image module:
    Exposed image width, height and depth parameters.
    From a suggestion by jms.
* BPython Ref Doc:
  - Small updates to reflect the above additions.
  - Added info for the Bone type in the Armature doc.
2003-07-30 21:15:41 +00:00
916f527253 * Fixed problems in with script linking.
I had to update many files to get this to work.
2003-07-27 15:56:32 +00:00
9cb79c6534 Exppython:
- "last minute" updates to documentation and two modules.
2003-07-13 16:28:17 +00:00
c467b19c75 Exppython:
- More documentation files for epydoc.
- Few minor changes in other files.
2003-07-12 18:02:54 +00:00
aa820ec420 Exppython:
- Continued getting rid of print methods and updating repr ones:
    Needed to fix crashes on Windows >= 98 systems.
- Found and fixed a few small memory leaks in EXPP_interface, related to
  execution of script links.
2003-07-05 01:18:41 +00:00
28b8e667a0 Exppython:
- Fixed a problem with control of the global Python dictionary persistence:
    Blender.ReleaseGlobalDict(bool) should now work fine.
- Trying to fix the sigsegv crashes on Windows:
    They happen when we try to "print" our objects, like Lamps or Cameras.
    Following advice from the Python Embedding doc, removed the tp_print
    method from Camera and also improved its tp_repr one, that will be used
    as print, repr() and str() for Cameras.  If this test works all other objs
    will be updated accordingly.
2003-07-04 02:56:07 +00:00
fad2aeb3fb - small fix in Sys.c to compile on Windows:
Thanks Florian Eggenberger for telling us about it. And Greg McBride for
   pointing a possible fix.
- Draw.Text and Draw.GetStringWidth updated:
   Now they accept an optional second parameter to set font size and Draw.Text
   returns the drawn string width.
- Partially fixed the update() and PutRaw() bugs in NMesh:
   A total fix will require bigger changes, but what was done (unless buggy)
   takes care of the common cases.
2003-07-01 05:19:14 +00:00