Commit Graph

389 Commits

Author SHA1 Message Date
0737153338 BPython:
-- applied patch by Michael Reimpell that lets scripts registration info be either commented out or not (commented, it doesn't interfere with Python documentation tools.  The patch also fixes potential overflows, thanks (and sorry for the confusion) again, Michael.
-- fixed NMesh_hasFaceUV, it was returning true for false and vice-versa.  Reported by Jonas Petersen with patch, thanks.
-- added 'homedir' and 'uscriptsdir' to Blender.Get() to get Blender's home dir and the user defined scripts dir.
-- related to the above doc updates.
2004-11-02 05:13:52 +00:00
13e7525152 BPython -- a few fixes:
-- fixed bug #1689:
http://projects.blender.org/tracker/?func=detail&atid=125&aid=1689&group_id=9

Reported by Tom Musgrove (thanks), the problem was that Window.QHandle was not passing events to windows that had id's below the current active window.  It was a stupid mistake (mine), the code was iterating from curarea instead of from the first area in the areabase list.

-- fixed bug #1568:
http://projects.blender.org/tracker/index.php?func=detail&aid=1568&group_id=9&atid=125

Stephen investigated the problem, reported by Gabriel Beloin, and left hints in the bug report, thanks :).  I also implemented what he suggested, now Effect.Get('objname') returns a list with all objname's effects and as before, Get('objname, position') returns the effect at position 'position'.  Ref doc already updated.

-- Allowed menu registration lines to appear commented out -- Python comments: '#', of course -- (suggested by Michael Reimpell) in scripts:
Some Python doc tools need the doc strings between triple double-quotes, so to avoid conflicts scripts writers can now comment out the registration code, it should work anyway.  Michael also provided a patch for this a few days ago, too (thanks), but to keep changes at a minimum because of proximity to a release I didn't use it.
2004-10-31 04:09:19 +00:00
c245379175 Bugfixes:
Blender hemilight shadow flag now ignored (reported by varuag).
Texture axes were not exported for procedural textures.
Duplicate armatures were not handled correctly (reported by richie).
Triangle uv-coord splitting (reported by anael, richie & Alvaro).

Additions:
Material 'TexFace' mode now works too, as in Blender it functions as an extra
first texture channel, replacing the base color.

The new noise functions for procedural textures are now supported in yafray,
but is  not quite completed yet, still undergoing changes.
(needs yafray from cvs).

The 'power' button has been renamed to 'EmitPwr', since it controls background,
arealight (including lamp with radius) & material emit power.
This button can now be used with the 'SkyDome' method as well to control
background lighting.
To control indirect lighting power, a button called 'GI pwr' has been added,
only use this when really necessary, first try modifying 'EmitPwr' instead.

Removed:
The 'gradient' button. This includes the python code to set
this parameter as well.
2004-10-26 00:52:12 +00:00
fa9135385a BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
  image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
  be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
  accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
  now), same in Blender.Sound: renamed makeActive to setCurrent.  Stephen Swaney
  pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
  functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
  after reading a discussion on blender.org's Python forum where eeshlo mentioned the
  pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
  confirmed, talked to Theeth about this and as he suggested am changing the default
  back to 'worldspace'.
2004-10-20 05:51:24 +00:00
Nathan Letwory
9d579591a3 Make msvc happy by 'improving' order of declaration and removing superfluous layout issues. 2004-10-14 23:34:19 +00:00
Stephen Swaney
8edf8ff5fa bugfix: #1642 Matrix multiplication memory leak
another memory leak plugged.
2004-10-14 23:11:09 +00:00
Stephen Swaney
78a810d9af fix bad return types for errors in Matrix_coerce().
EXPP_ReturnPyObjError() should have been EXPP_ReturnIntError().
2004-10-14 19:06:44 +00:00
Stephen Swaney
7dda27fcd7 followup to vector memory leak fixes:
fix for problems with NMesh vertices.
  plug some more leaks in matrix module.
  new vector method newVectorProxy().

In BPy-Land, we have overloaded the meaning of our Vector
type.  One use is for vectors in the traditional mathmatical
sense.  The other legacy use is as a proxy for Blender data.
The recent memory leak fixed have lead to the Vector type
behaving as mathematical vectors.

However, the NMesh module is still using Vector types as a
proxy to manipulate NMVert data.  To support this usage, in
the vector module there is a new factory method
newVectorProxy().  This creates a Vector that references
memory outside the Vector.  Vectors created by
newVectorProxy() do NOT free their referenced memory.  The
newVectorProxy() is used only in bpy code and is not exposed
thru the scripting interface.

Anyone using newVectorProxy() must be aware of object
lifetime and scoping issues because the returned Vector
holds a pointer to memory it does not own.  This works in
the NMVert case since we are referencing memory belonging to
the NMVert object via an NMVert method.
2004-10-14 17:35:16 +00:00
Stephen Swaney
b711409f8d fix numerous memory leaks in the math types.
fixed bug:  #1633  Memory leak in M_Mathutils_Vector

The math types ( matrix, vector, quad ) now make
copies of data passed to them rather than holding
a pointer to memory that cannot be freed, or that
may go away unexpectedly.

This also clarifies the problem of who is responsible
for freeing memory allocations.

Pre-checkin files are tagged mem_leak-1 in case this
breaks something.
2004-10-12 23:58:03 +00:00
Stephen Swaney
be32f6d5b8 bugfix: #1624 Can not switch layers of some objects through python.
All Bases were not getting updated with new layer.
2004-10-11 20:33:51 +00:00
Stephen Swaney
afbf2c25ce fix memory leak in Object.GetSelected().
bugfix: #1631 Memory Leak in newMatrixObject
  PyMem_Malloc()s not followed with PyMem_Free().
  allocation error checking contributed by Tom Musgrove.
2004-10-11 17:05:14 +00:00
Stephen Swaney
073120c2b1 bugfix: #1607 Missing entry in Lamp Types
added Lamp types 'Area' and 'Photon'.
updated docs.
2004-10-09 05:41:03 +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
086ab43712 correct doc error for Curve.getControlPoint() 2004-10-04 04:35:52 +00:00
Stephen Swaney
820a83dda8 Tweak the bpy 'import site failed' msg.
A half-hearted attempt to make the World's Scariest Warning Msg
just a tad less scary.
2004-10-01 05:28:14 +00:00
Stephen Swaney
f2f97a5092 fix doc errors pointed out by wavk:
get/setMode() should be get/setFlag(), bitfield order was incorrect.

spellchecked Curve.py.
2004-09-29 18:24:08 +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
Nathan Letwory
16593b506a make sure this also builds on Windows. 2004-09-23 21:27:16 +00:00
e7d3039d12 - Blender: added option 'scriptsdir' to Blender.Get();
- small updates to the docs;
- Object: small fix to getMatrix: check during_script() to avoid undesired loops; added old behavior (pre 2.34) as option: .getMatrix('oldlocal');
- tentative fix for bug #1275: scene REDRAW scriptlinks were not being executed (the call to do so was missing):
http://projects.blender.org/tracker/index.php?func=detail&aid=1275&group_id=9&atid=125
    added the call in drawview.c, in drawview3dspace().  This causes the scriptlink to be called for each visible view3d, but that's what happens with object redraw scriptlinks, too.  Anyway, this is still a test.  The place was chosen based on the idea that a scene redraw scriptlink is like an object redraw one, but for all objs in the scene at once.

- Window.Theme: new submodule, to get/set theme options in Blender;
- Added the script save_theme.py (Help menu for now), to save the current theme in Blender as an executable script (currently shown in the Scripts->Misc menu).

There's more work to do for themes, like defining a proper place for them in the interface, adding documentation (for now the added script and the ones it generates can give a pretty good idea of how to use the new module), probably extending themes to support SpaceScript and so on.
2004-09-21 05:28:17 +00:00
Stephen Swaney
273c8e0804 New bpy method for World module to set World for current scene:
my_world.makeActive()

Contributed by Campbell Barton (ideasman)
2004-09-20 16:22:32 +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
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
Stephen Swaney
81b5108f49 Bpy access to more texture features: Musgrave, Voronoi, and Distorted Noise.
Contributed by Joilnen B. Leite ( pidhash).  Thanks!
2004-08-26 02:16:26 +00:00
446e1fae7c ** Note: two new files added, projectfiles will need an update.
Scripts:
  Campbell Barton (Ideasman, thanks) updated his Wavefront OBJ importer.
BPython:
- Finally committed pending contributions:
    Chris Keith wrote the Blender.Sound module -- still some testing to do this week;
    Joseph (joeedh) added the OnLoad scene script event;
    Satish Goda added 6 GLU functions to Blender.BGL.  Great additions, thanks all!
- Small changes to Blender.Load (leave editmode as Blender wants) and Window.EditMode (allow definition of "undo string");
- Fixed bug #1539: Window.RedrawAll() crashed Blender if an empty spacescript was available while using it in a gui-less script.
- doc updates.
2004-08-17 04:26:00 +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
Nathan Letwory
7c9b4e6f9a Fix for #1509
Running the system info script with a text window (empty) open caused dereferencing of a null-pointer with obviously unwanted results.

Catching the possible situation before it happens.
2004-08-09 18:25:08 +00:00
Nathan Letwory
266a1c1041 Fix typo in documentation 2004-08-07 14:14:55 +00:00
Stephen Swaney
0e4cfa3fcf pidhash noticed some discrepancies in the bpy doc between getMode(), getFlag(),
getType() and their associated setters.  I changed the doc to match the
implementation.

Also did a little spellcheck.
2004-08-04 20:52:55 +00:00
Stephen Swaney
fa6d79b277 updated docs 2004-08-04 08:03:39 +00:00
452c8cf838 Done.
Scripts:
- Jean-Michel Soler probably lost some hours of sleep since Sunday,
  but he managed to send me the updated path import scripts a few
  hours ago.  My tests with Inkscape .svg and .ps and Gimp worked fine.
  He also tested a lot and sent me info about what is already
  supported.  I'll send Ton a doc about bundled scripts including this
  info.  Importers: .ai, .svg, .eps/.ps, Gimp 1-1.2.5 / 2.0.

- Jean-Michel also contributed his Texture Baker script.

- Campbell Barton contributed two new scripts: a mesh cleaner and a
  vloop skinning / lofting script.  He also sent updates to his obj
  import / export ones.

- A Vanpoucke (xand) contributed his Axis Orientation Copy script.

And that makes 8 last minute additions.  Thanks a lot to the authors
and special thanks to JMS and Campbell for their hard work : ).

BPython:

- tiny addition (I'm forced to call it a showstopper bug ;) so JMS's
path import scripts (that actually convert to obj and make Blender
load the .obj curves) can use Blender.Load() and not rename G.sce,
the default filename.  Blender.Load(filename, 1) doesn't update G.sce.
Nothing should break because of this, Load(filename) still works fine.

- Made Blender complain again if script is for a newer Blender version than the one running it.
2004-08-04 06:16:46 +00:00
7ce069850f First of all thanks Kent Mein for committing the fix to space.c and Peter den Bak for reporting and testing it.
- making Blender not warn about 2.34 scripts, as Ton requested.  Will turn this on again before release;
- small fix to the new helpwebsites and helpsystem additions in BPy_menus.c, should solve problem reported by Jean-Luc Peurière about empty menus on startup;
- updated version info of a few scripts to 2.34, since they use recently added bpython api functions.
2004-07-30 05:18:14 +00:00
28f0f2d048 Help menu!
Thanks to Willian for integrating the webbrowser module.

Some of the URLs (Python reference, Release notes) will
need to be updated upon release. These are contained in
http://www.blender3d.org/Help/index.php
2004-07-29 12:12:20 +00:00
Stephen Swaney
7ed803f6a8 some code cleanup. minor bug fixage: don't try to free null ptrs.
accidentally ran CurNurb.c thru indent utility  Doh!
2004-07-29 12:00:34 +00:00
6b1eb45dda Scripts:
- Campbell Barton updated his sel_same.py script;
- Added to Mesh scripts a call to Window.EditMode(0) to leave editmode before changing meshes.

BPython:
- small doc fixes / updates;
- added a call to undo_push_mesh inside Window.EditMode(0).

Mesh scripts could change the mesh but not the editmesh -- that would then overwrite the changed mesh.  Made all mesh scripts leave edit mode before changing a mesh.
2004-07-28 17:46:29 +00:00
2f5c4123d6 fixed a typo in Mathutil.Matrix (inverse --> invert) 2004-07-28 09:00:46 +00:00
Stephen Swaney
58fb16aa13 Add missing funcs to Lamp method table:
getIpo
  setIpo
  clearIpo
Methods were implemented but not in instance method table.
2004-07-27 20:15:57 +00:00
Stephen Swaney
0a092a5ffa fix epydoc formatting errors. 2004-07-27 14:18:32 +00:00
7b943f2a6d Scripts:
- Ben Omari sent an update version of his DirectX8.py, Jean-Michel Soler updated his disp_paint.py and Campbell Barton contributed a new one: sel_same.py (for now it's in the UV menu).  Thanks all, great scripts;
- small updates in some other scripts.

BPython:
- Finished wrapping radiosity functions for the Radio submodule;
- doc updates.
2004-07-27 03:13:45 +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
5f034d61b8 Stupid mistake, forgot to add radiosity include dir to the source/blender/python/api2_2x/Makefile, breaking the makefiles build. Thanks intrr for reporting. 2004-07-26 02:13:42 +00:00
Stephen Swaney
6d581008a8 a shot-in-the-dark attempt to fix the 'missing radio.h' problem.
changed #include <radio.h> to #include "radio.h"
2004-07-25 20:12:57 +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
d7dd942678 fix warning: function declaration isn't a prototype 2004-07-21 21:26:11 +00:00
Stephen Swaney
bce2c02fdd New Curve method Curve.appendPoint( numcurve, newpoint ) to add
points to a Curve.

New supporting module CurNurb to provide access to the curves in a Curve
and their associated points.

Curve module now supports Python iterator and sequence protocols.
This allows typical python programming idioms using 'for' statement
and the [] operator.

# example 1
for curve in a_curve:
	for point in curve:
		print point

#example 2

curnurb = a_curve[0]
curnurb.append( [1,1,1,1] )

Still under construction.  Epydoc will follow.
2004-07-21 21:01:15 +00:00
Nathan Letwory
5c4e6908e7 Kent Mein pointed out some embarrasing syntax errors in example. Corrected those. 2004-07-21 17:25:50 +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
6dca057ac5 BPython:
- added image.getBindCode() docstring to Image's epydoc file (thanks Satish Goda).
Scripts:
- Adding Apply_def.py to "Mesh" scripts menu (thanks author: Theeth);
- Updating JMS's disp_paint.py (also changed its name to remove version info);
- minor updates in docs and scripts.
2004-07-18 15:54:17 +00:00