Commit Graph

427 Commits

Author SHA1 Message Date
Stephen Swaney
454041cc4f New Bpy type Text3d for accessing Blender's Font objects.
Contributed by Joilnen Leite (pidhash).
2005-03-06 14:55:00 +00:00
52b84f0e69 BPython:
- Gert de Roost reported an inconsistency between nmesh.getMode and .setMode.  Now .setMode() optionally accepts an int value, as returned by getMode().
- Campbell Barton pointed that object.getData(name_only=True) was by mistake returning the obj name, not the obdata name, as it should.  Fixed now.
- small doc updates

Thanks both for the reports.
2005-03-01 02:37:19 +00:00
Stephen Swaney
6c62b0d8b7 Part of Big Cleanup: move data declarations out of header files.
BGL.[ch] work done by Joilnen Leite (pidhash).  Thanks!

updated 0-todo.txt.
No changes to executable code.
2005-02-27 20:07:26 +00:00
Stephen Swaney
db892de35f Updates to NMesh doc contributed by Campbell Barton.
Corrections and useful user-oriented hints.
2005-02-27 15:15:39 +00:00
3cd546e484 Patch submitted by Michael Reimpell
- Adds NormalMap to python's list of Texture Image flags
2005-02-21 22:00:11 +00:00
34b61ee4e9 -AngleBetweenVecs() was returning only 8-digit precision. This changes the precision to 16-digits and should fix some problems regarding spurious numbers being returned by python after running this function. 2005-02-21 18:26:53 +00:00
b7eaee3ad2 BPython bug fixes:
-- Ton caught a redraw trying to free a busy slider button in a script.  Made sure the redraws don't happen in the scripts win during slider updates, but the realtime slider (automatically updates the 3d view) isn't working yet as it probably shouldn't with the current code. There's a pre 2.25 comment in Draw.c about it being hackish and wrong;
-- Melchior FRANZ reported a bug related to a script dict being freed too early (when two instances of the same script were on: one with a gui and the other with a file selector -- selecting the file triggered the problem);
-- bug #2074 reported by Roland Hess: totally empty string button -- no prepended but->str (e.g. "OB:") neither but->poin (the actual string) -- crashing Blender.  Crash happened on editscreen.c: screen_delayed_push_undo calls strncpy() without checking the passed string.  Didn't mess with it, better let the coder in charge of undo (Ton, right?) choose a preferred way to deal with it (report error, simply use blank string).  Staying on the python side at least for now, I just made but->str = " " (a space) when user doesn't define it, so the crash shouldn't happen anymore.

http://projects.blender.org/tracker/?func=detail&atid=125&aid=2074&group_id=9

Thanks guys for reporting the problems.
2005-02-16 03:32:57 +00:00
bc3329e49f <strings.h> is not defined on Win32 systems 2005-02-12 17:11:57 +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
05bf482f6a BPython:
- NMesh: made nmesh.update accept an optional 'vertex_shade' param to init vcols with shading info, like when you enter vpaint mode or press the relevant "make" button for a mesh without vcols.  This is still a test, the functionality was requested by Manuel Bastioni for the SSS script they are working on:
http://www.dedalo-3d.com/index.php?filename=SXCOL/makehuman/articles/subsurface_scattering_in_python.html
- sys: made makename() accept files with max FILE_MAXDIR+FILE_MAXFILE name length, should fix #2192.  Was only FILE_MAXFILE, a mistake;
- Image: added .setFilename(), contributed by Campbell Barton;
- Camera: added camera.get/setScale for the new param added by Ton for ortho cameras.  Requested by Jean-Michel Soler for the Texture Baker script;
- related doc updates.
2005-02-09 05:19:24 +00:00
3ede12b115 BPython:
- NMesh: added face.sel and face.hide attributes to NMFaces, to set / get selection and visibility state of faces as they appear in edit mode.
- doc updates, including the right fix to two edge related methods, thanks to Stephane Soppera for pointing it (my fault, Stephane).
2005-02-03 03:04:32 +00:00
41b251fab0 BPython:
- Fix related to bug #2157: crash in Blender.Image.image.reload() method.  "G.sima" was not being checked for validity.  Fix by Joilnen B. Leite (pidhash).  Thanks!
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2157&group_id=9
- Added optional argument to Blender.Object.object.getData() method: getData(only_name = True) or (only_name = 1) or (1) will return only the obdata name, not a wrapper for the given struct.  This is a test based on a request by Campbell Barton who submitted code for his proposed .getDataName() method (thanks!).
- doc updates and small fixes.
2005-02-02 03:38:31 +00:00
Stephen Swaney
c153a593ac bugfix: #2117 Overflow in Armature.Bone.setName()
contributed by Joilnen B. Leite (pidhash).
2005-01-25 06:05:17 +00:00
Yann Vernier
7f4f5deac4 Separated some variable declarations from the code, for wider compiler support. 2005-01-23 20:15:06 +00:00
Yann Vernier
79c4e8a247 Changes Mathutils.Vector() to be less picky about its argument(s). 2005-01-23 17:04:02 +00:00
Yann Vernier
8d0ef2163d This should make the Texture stype attribute work for EnvMaps. 2005-01-23 16:32:51 +00:00
1da3b9f517 BPython:
- Stephane Soppera added long missed support for edge data in Blender.NMesh + related doc;
- Michael Reimpell improved script registration (fixes bug report #2160) and the file and image selectors in Blender.Window (improved with suggestions from Yann Vernier).  They now suppport methods as callbacks;
- World.get/setMode were not registered, so could not be directly called (reported by Ken Hughes).  Still needs some work to improve things, including docs.

Scripts:
- Jean-Michel Soler updated his texture baker based on input from Appolux;
- Campbell and Jean-Michel improved the bvh importer: faster, better float units scaling (by Campbell); supports Poser 3.01 files (by jms).

Thanks guys!
2005-01-22 02:48:03 +00:00
3ba66e20b9 BPython:
- Added Blender.UpdateMenus() + doc: so scripts can automatically update Blender menus when they create (or download or whatever) new scripts to be registered.
- Removed a long deprecated function from the Blender module (release dict).

Matt (broken) mentioned the UpdateMenus function a couple weeks ago.  I also updated the Save Current Theme script to use it.  This is all related to his ideas to use scripts to save and restore themes and e.g. render presets.
2005-01-13 19:19:05 +00:00
Stephen Swaney
df1acca4c5 New methods: Curve.isCyclic(), CurNurb.isCyclic() for checking if curve is cyclic ( closed ). Both methods are boolean.
Patch contributed by Toni Alatalo.  Thanks.
2005-01-13 03:42:53 +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
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
370ab6b7af Requested by Stephane SOPPERA,
Made NMESH_SUBDIV_MIN 0 instead of 1 so NMesh is like the gui...

Kent
2005-01-04 14:34:28 +00:00
48bc598658 More warning cleanups...
added a casts to:
   blender/blenlib/intern/BLI_memarena.c
   gameengine/Rasterizer/RAS_TexVert.cpp

Removed unused vars from:
   blender/python/api2_2x/vector.c
   gameengine/Ketsji/KX_PyMath.cpp gameengine/Ketsji/KX_Scene.cpp
   gameengine/Physics/Sumo/Fuzzics/src/SM_Object.cpp
   gameengine/Rasterizer/RAS_FramingManager.cpp
   gameengine/Rasterizer/RAS_Polygon.cpp
   gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp

Kent
2005-01-03 18:05:24 +00:00
610cec55c7 Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
  Currently only works with alternating scanlines, but gives excellent
  performance. For both normal render as unified implemented.
  Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
  getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
  OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
  with chars or shorts.
- Made normal render and unified render use same code for sky and halo
  render, giving equal (and better) results for halo render. Old render
  now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
  after render. Using PostProcess menu you will note an immediate re-
  display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options

- Render module is still not having a "nice" API, but amount of dependencies
  went down a lot. Next todo: remove abusive "previewrender" code.
  The last main global in Render (struct Render) now can be re-used for fully
  controlling a render, to allow multiple "instances" of render to open.

- Renderwindow now displays a smal bar on top with the stats, and keeps the
  stats after render too. Including "spare" page support.
  Not only easier visible that way, but also to remove the awkward code that
  was drawing stats in the Info header (extreme slow on some ATIs too)

- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
  defines.

- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
Stephen Swaney
611f8093c1 bugfix: #2031 World setIpo() method checks for wrong IPO type
wrong constant name.
2004-12-21 01:34:23 +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
a368426d26 BPython, two bug fixes:
- #1911: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1911&group_id=9
    BOOL properties were returning True always, small mistake in logic.c's getData method.
- #1944: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1944&group_id=9
    G.vd was not being checked against NULL in Window.ViewLayer, causing a crash when this function was called from a command line script.  Now it returns an error in such cases.
- small doc updates, tiny minor change in Object.c.
2004-12-05 04:01:57 +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
Stephen Swaney
70c386cddf bugfix: #1930 Mathutils.Euler constructor fails to initialize class variables
Euler object was holding pointer to bad memory.
Euler now owns internal array memory and frees it in destructor.
2004-12-01 23:09:59 +00:00
6d9c02be4c Scripts:
- Fixes by Jean-Michel Soler: mod_ai2obj.py, mod_svg2obj.py;
- Fixes by Campbell Barton: obj_import.py;
- Small fix to mod_meshtools.py (fixes bug #1605: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1605&group_id=9);
- Updates by Jean-Baptiste (Jiba) to his blender2cal3d.py;
- Updates to all his import / export scripts (added doc data) by Anthony D'Agostino;
- Update to off_import: support for uv data, by Arne Schmitz.

BPython:
- Removed Object.get and .getSelected (deprecated long ago, we use .Get and .GetSelected) -- fixes #1861: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1861&group_id=9
- Applied patch by Michael Reimpell: quat.c - fix for wrong initialization with newQuaternionObject; Mathutils documentation improvements.
- Stani reported a wrong return msg in IpoCurve.Get (that is unimplemented).

Thanks to all coders mentioned above!
2004-11-30 02:27:46 +00:00
e3b7dfe6e2 BPython:
- fixed bug #1882: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1882&group_id=9
    Crash / hang when changing meshes that had edge data.  The mesh->totedge value was not being set to 0.  Reported by jms, thanks.
- fixed bug #1780: https://projects.blender.org/tracker/index.php?func=detail&aid=1780&group_id=9&atid=125.
    Deleting a Text that was being used as script link crashed Blender.  Added a check to unlink the Text from eventual script links when it gets removed.  Reported by kaito, thanks.
- doc updates (one related to bug #1807: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1807&group_id=9 , actually a little misleading word in the NMesh doc: you can get the subsurfed mesh with NMesh.GetRawFromObject, but it's the display subdivision level that counts).
2004-11-27 18:32:26 +00:00
Chris Want
a7d624b2c1 There were some variables that should have been declared extern,
but weren't ... no more bus error when exiting on irix!
2004-11-14 01:03:01 +00:00
ac866cad12 BPython:
- Stephan Gartner reported a crash with Scripts Help Browser script found while porting blender to Linux/x86_64, related to bugs in Blender.Window.Theme module:
    two object types were being defined with wrong sizes.  My mistake, when I wrote that code I copied/pasted those portions around and didn't check properly.  Should be fixed now.  Thanks Stephan.
2004-11-11 17:59:36 +00:00
c16e5dad1c BPython:
- Small doc update in a script;
- Fixed bug #1742:
http://projects.blender.org/tracker/?func=detail&atid=125&aid=1742&group_id=9

It was an internal error in bpython.  I was using G.main->script.last to find the currently running (if any) script, but this isn't reliable, we must check each open script to find out if one of them has the SCRIPT_RUNNING bitflag set.

Thanks intrr for reporting and blendix for pointing how to reproduce the bug.  From my tests it should be working fine now.
2004-11-09 14:07:25 +00:00
4a20c3d03d Nmesh module isn't edges aware yet; but can cause crashes replacing
existing ones that use edges (like when creases or fgons in use).

Added proper free and NULL for it to prevent crashing, rest is for py
team after release ;)
2004-11-08 19:58:04 +00:00
Stephen Swaney
17217648e5 less scary 'python not found' msg was too warm and fuzzy.
now msg is less less scary and invisible if python is available.
2004-11-07 17:28:15 +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
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