Commit Graph

788 Commits

Author SHA1 Message Date
ef520a8cc9 Scene.c - Removed redraw when in non UI mode.
Lamp.py - Example indent
Object.py - Improved join documentation.
2006-01-06 01:53:26 +00:00
2901da3c29 I added {}'s around an if block of code to prevent gcc from saying
this else is ambiguous...
code was
if (blah) if (blah2) stuff; else stuff2;
its now
if (blah) { if (blah2) stuff; else stuff2; }

Kent
2006-01-05 20:52:51 +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
1377e65531 Changed so all errors raise an excepton. - As per Toni's suggestions.
TypeError for pythonCoder error.
RuntimeError for blender not being able to be joined. (Sorry stivs, no BadJuJu yet)

Documented this in the epydocs also.
2006-01-05 15:53:07 +00:00
9e36d4bc8e [ #3661 ] resize4x4 in Matrix class doesn't set ones on the diagonal
* resizing a matrix now puts 1's back on the diagonals.
2006-01-04 16:02:02 +00:00
4af91dae79 Added some notes regarding Object.GetSelected() - it uses the last localview. 2006-01-04 15:11:35 +00:00
de37b11e56 [ #3712 ] Calling makeEditable() and update() on an armature twice duplicates bones
* fixes bug where editbones are not freed on calling update()
2006-01-04 15:07:15 +00:00
ff7ca4b1a2 Gave an example of changing lamp modes in epydocs. - answers a q on elysuin. 2006-01-04 01:55:39 +00:00
9f8348a22a *bpy fix
- include file capitialized wrong
2006-01-03 17:24:24 +00:00
5233f73589 *warnings fixes
- fixes a number of warnings in bpy project
2006-01-03 16:27:34 +00:00
d14f6c9cbc replaced more M_Object_Get for the faster Object_CreatePyObject.
Object.GetSelected now dosnt return None if there is no 3d view. - wasnt documented and likely would mess up scripts that always expected a list. - Just return an empty list instead.
2006-01-03 06:14:53 +00:00
fc079f8482 made scene.getChildren() a heap faster. 983.3 times faster in my test.
getting 7200 objects did take: 1.18 sec,  now 0.0012 sec

It was doing a full object list lookup for every object in the scenes base using the name to compare.
now it just gets the object directly from the base and converts it to a python object, adding it to the list.
- Cam
2006-01-03 05:38:39 +00:00
5f48930a75 Moved Object.Join() into a function of an object.
eg.
ret_val = ob.join(objects)
Now it dosent depend on the current selection, or change the selection context.

Made respective join_* functions return 0 if the join was not mode, 1 when it workes.
2006-01-03 02:35:45 +00:00
80f903ed73 Small commit, hopefully the last Duplicate change.
Made pythons duplicate not redraw, documented adduplicate()
2006-01-02 23:26:54 +00:00
8b0c3de7d9 Changed adduplicate() to take the dupflags as an argument. so faking the Alt Key isnt needed anymore in Blender or python.
Changed Pythons Object.Duplicate() to take keyword parms to enable duplication of spesific data.
Eg- Object.Duplicate(mesh=1) # to duplicate mesh data also.
2006-01-02 10:40:13 +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
aa8c1a016b Created local function check_NMeshLists(), which performs checking on
NMesh lists before trying to build a new mesh (used by mesh.PutRaw() and
mesh.update()).  It was possible to put junk into the NMesh lists, resulting
in some messed-up meshes.
2006-01-01 15:54:30 +00:00
Ken Hughes
5029a4444a Bug fix #3671: Blender.Beztriple.New() did not accept sequences as parameters,
even though its error messages suggested it did.  Thanks to Yann for the
patch (I also added the ability to accept parameters without requiring
them to be in a tuple).  Also documented the New() function.
2006-01-01 15:50:53 +00:00
Ken Hughes
3634128841 Two bug fixes for mesh.faces.extend() method; fix a error checking for
duplicate faces in the input list, and also extend texture faces if they are
enabled.
2006-01-01 15:43:34 +00:00
625c553e20 Added a python hook to Joining objects
Object.Join()

Seperated the join calls from space.c and view3dmenu into join_menu() in space.c, like the select_group_menu(),
okee's from join_curve, join_mesh.. etc are in join_menu() so python can call them without UI menu's in the way.
this is also a bit neater since there were 2 places that were doing what join_menu() does now.

- Cam
2005-12-30 14:17:15 +00:00
73dc1ff4af Ooops 2 tipos in the epydocs... 2005-12-30 11:56:44 +00:00
f310f296b2 Added the function Duplicate to the object module.
Object.Duplicate(linked=1)

Basicly a wrapper for adduplicate();

There was previously no easy way to copy objects in python. even the ways that do exist dont take modifiers, particles etc into account.
Uses the current selection.. epydocs included also.

- Cam
2005-12-30 11:54:53 +00:00
0565d86952 for Mesh_getFromObject made Mesh and Surf types copy the material list to the new mesh.
Still need to do Mball and Text.
Ken- this is fairly straight fwd but if you dont like it - its line 4867 of Mesh.c and 1 block that can be removed.
I tested for memory leaks and correct material user adjustment.
This is realy needed for using getFromObject to export to external rendering engines.
- Hope its ok.
Cam
2005-12-30 09:56:02 +00:00
8bc7d0bdf0 *crash fix
- previous fix crashes win32 and creates an unreachable code block
2005-12-29 19:27:52 +00:00
ccf117376d Fixed a python segfault when linking a new object to a scene that had no data and was a Surf. the data wasnt created and blender died. Now an error is raised instead. 2005-12-29 12:06:42 +00:00
b73748bdd0 Just added some comments about face material incides and the material list. 2005-12-29 11:08:55 +00:00
69746f3b83 Added some details to the Object documentation, some parts were a big vague.. 2005-12-29 10:33:00 +00:00
Yann Vernier
a61871360f Fix crash in EXPP_(int|obj)Error. These functions are redundant;
they only differ by return type, so it's easier to just call
PyErr_Format and return appropriately.
2005-12-27 15:28:09 +00:00
Alexander Ewering
6f10660f0c Fixing a bit of horrible code in Armature.c (BonesDict_repr).
There is a lot of very dangerous (and slow) string manipulation code in
there. I do not want to appear arrogant, but a bit of basic code QA in this
module certainly can't hurt.

Please see the diff for further explanation ;-)
2005-12-23 22:16:33 +00:00
Ken Hughes
ea16c447c3 Fix typo in epydocs for Mesh example 2005-12-21 18:12:28 +00:00
73fa63751f Added missing mode rayShadow and updated docs, "NoSpecular" was also missing from the docs too. 2005-12-20 06:50:13 +00:00
2b7919a9f2 fixed returning true/false, thanks Willian. as well as removed the image space spesific image changed call. 2005-12-18 08:47:55 +00:00
e47f918e5e Added get/set/attr for area lamp settings - needed to exporting arealamps to povray.
areaSizeX, areaSizeY
raySamplesX, raySamplesY
epydocs updated also,
2005-12-18 07:45:45 +00:00
Ken Hughes
f73f226ed7 -- Bugfix #3617; addBezier() was not initializing all the attributes for
a the beztriple, so things like the hidden and handle select states were
   set to random values.  Added a beztriple.hide attribute so that the
   hide attribute can be set/cleared from the BPy API.
2005-12-17 04:57:48 +00:00
e76e78e78a typo, thanks letterrip. 2005-12-16 22:40:20 +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
6e7e6d2357 -- removed redundant initialization for Mesh_Type (thanks LetterRip) 2005-12-15 19:12:31 +00:00
4a8087db76 Fixed some warnings from GetCurrent, remaining warnings seem to have no obvious solution
attr = Py_True; // Image.c:1107: warning: dereferencing type-punned pointer will break strict-aliasing rules
2005-12-15 02:06:37 +00:00
8304b73a08 BPython:
- malformed nmeshes could crash Blender with a sigsegv. Related to old
behavior that accepted "faces" with one or two verts.
- removing unused var (store_edges) + doc update.
2005-12-14 18:01:42 +00:00
d527b0e585 Added
Image.New(name, w,h,depth)
Image.start- for animtex
Image.end - for animtex
Image.speed - for animtex
Image.packed - read only bool

See the pydocs for details.
2005-12-14 03:27:35 +00:00
Ken Hughes
d3338620b7 -- More of Bugfix #3580: Mesh_getFromObject() was not updating key->from
when it duplicated mesh data.

   I'm not thrilled with how I implemented this code, but currently don't
   know a better way.  If someone more familiar with how blender duplicates
   objects and converts things to meshes wants to have a look, it would be
   appreciated.
2005-12-13 18:39:50 +00:00
Ken Hughes
4085cc06a6 -- Calling mesh.verts.extend() on a mesh with vertex groups was not updating
mesh->dvert, eventuallu causing a crash.
2005-12-13 15:36:32 +00:00
7bba26d24b *warnings fixes 2005-12-13 14:29:56 +00:00
fadaa2fbe9 From kh_pylon:
You have to put Py_RETURN_NONE; inside { }; it's a two-line macro
Aparently breaks MacOS.
2005-12-13 00:27:10 +00:00
d73e312f88 Added Image.GetCurrent()
Previously the only way to get the current image was flaky and relyd on the image being assigned to a mesh.

try:
  me = Scene.GetCurrent().getAttiveObject().getData(mesh=1)
  image = me.faces[me.activeFace].image
except:
  image = None

...Can new be replaced by the following, and works even when there is no mesh.
image = Image.GetCurrent()

epydocs:
  Get the currently displayed Image from Blenders UV/Image window.
  When multiple images are displayed, the last active UV/Image windows image is used.
2005-12-13 00:00:11 +00:00
540e5bb77d *Armature api documentation 2005-12-12 20:12:50 +00:00
9ae9527c51 - Armature/Bone API for python
* this resolves a number of outstanding issues with the armature api and gets this ready for release
- add/remove bones possible
- rolls work correctly now!
- ik'ing to parent should work
- flags for tip/root/bone selection
- etc.
2005-12-12 18:46:26 +00:00
c452e8672c Rewrote TimeLine_getFramesMarked func with better coding
.
2005-12-12 11:57:58 +00:00
e0d20e00ce Added some details in the Mathutils documentation. 2005-12-11 04:20:37 +00:00
Ken Hughes
76e7905736 -- Bugfix #3573: Deleting a scriptlink when some other scriptlinks were no
longer linked to a script would cause a crash.  We now delete all
   scriptlinks which are not linked.
2005-12-10 19:36:05 +00:00