Commit Graph

99 Commits

Author SHA1 Message Date
742ddade12 [#18654] different behaviour if script is called from (1) Menu (2) TextEditor (3) ScriptsWindow [including crash!]
bugfix, simple NULL check
2009-05-01 14:19:56 +00:00
efb7dd86ff Fix for own recent reference count error.
- The armature weakref list was  being incref'd twice then decrefed twice (incref and decref were used incorrectly), now only once. My 'fix' broke this.
- In bpy_pydriver_create_dict the 2 refs added from running PyDict_SetItemString twice were undone when clearing the dictionary (added comment)
- changed Py_XDECREF to Py_DECREF int BPY_pyconstraint_update and BPY_pyconstraint_target, Py_XDECREF checs for NULL value which would have crashed blender before it got to Py_XDECREF anyway.
- after every error is reported (PyErr_Print), remove sys.last_traceback and clear the error, I found this fixed certain crashes (usually when starting the game engine or exiting blender), so best do this all the time.

- header_text.c, CcdPhysicsEnvironment.cpp, KX_CameraActuator.cpp - remove some warnings.
2009-04-15 04:34:27 +00:00
541d49bc2c * blender doesn't need the -w anymore to start in a window
* NULL can be used instead of () args for calling python functions from C.
2009-02-28 09:25:42 +00:00
Nathan Letwory
d5ae032a60 * typo fix 2008-11-08 13:39:37 +00:00
Nathan Letwory
d1248ff6d8 === BPy API ===
* add two optional arguments to control click step and precision of Number buttons.
2008-11-08 13:38:21 +00:00
688cc11302 added an option for python Draw.UIBlock(func, mouse_exit) so moving the mouse outside the popup wont close it.
Stops FBX Export and OBJ I/O from flickering a lot.
2008-10-22 08:21:43 +00:00
2a331067cc resolve some compiler warnings with intel c/c++ compiler
* subsurf code had a lot of unused variables, removed these where they are obviously not needed. commented if they could be useful later.
* some variables declorations hide existing variables (many of these left), but fixed some that could cause confusion.
* removed unused vars
* obscure python memory leak with colorband.
* make_sample_tables had a loop running wasnt used.
* if 0'd functions in arithb.c that are not used yet.
* made many functions static
2008-09-29 17:08:11 +00:00
1a917f50a6 running scripts in background mode would crash in some cases. (tested all scripts, none segfault now) 2008-09-14 05:10:45 +00:00
7fd701ab58 == BPython API ==
Bug: Draw.Number wasn't properly checking that the initial, min and max values passed to it were numbers. On errors Python would set an error flag that would only be caught later on, masking where the real problem was. Pesky bug...

Reported by André (jaguarandi) on irc, thanks!

PS for bpy devs: PyInt_AsLong returns -1 on error and sets the error flag. With functions like that we need to take special care or not that obvious bugs appear.
2008-08-17 17:11:51 +00:00
57270125d8 bugfix for own error, introduced when running scripts were saved with the blend file.
a script error with a script that has an interface would not stop the interface from running again immediately, causing an annoying 
error message loop.
2008-05-31 12:12:03 +00:00
b306aaccb9 patch [#11491] Fix for bug 11362: Blender.Draw.Image() method does not clip properly
fixing [#11362] Blender.Draw.Image() method does not clip properly
also return silently on zero zoomlevel rather then raising an error, only raise an error on negative values.
2008-05-25 16:39:57 +00:00
Chris Want
5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
Stephen Swaney
d0004bed8c fix compiler warning: comparison between signed and unsigned 2008-04-05 14:49:41 +00:00
8fdfd4cc4c PyAPI - setting a buttons string value crashed. suspect this is a 64bit problem since replacing the string length of int, with Py_ssize_t or long prevented the crash. worked around the problem by removing the PyString_AsStringAndSize command.
wizard_curve2tree - removing id properties didnt work. exit button used a callback it didnt need to.
2008-04-04 23:12:20 +00:00
a5d31fc28e fix for [#8559] Python script that uses FIleSelector and has an error in it segfaults Blender 2008-03-15 18:53:42 +00:00
08f306c81c Made python scripts save and load in the blend file so you can have the same scripts running when you open a blend file.
Also scripts will re-run on undo rather then closing.

This is done by saving and loading the name of the script or textblock of the 'Script' datablock, connected to the ScriptSpace. This way when there is a name but the script dosnt run.
Blender runs the script or text block if available.
2008-03-06 21:25:15 +00:00
3023458aa7 Purge of compiler warnings (number 2):
* initial values I added in radialcontrol.c might need to be reviewed if they cause problems(I used 200, as it seems many tools were setting that)
* #pragma warnings are the only warnings I still get, so that means we have a clean slate again
2008-02-25 04:38:48 +00:00
18df3388a4 == BPython ==
[#8354] Blender or Python25.dll crash on... quit, reported by David B. (myvain)

The BPy_FreeButtonsList() function is also called after we call Py_Finalize(). Calling PyGILState_Ensure()/Release() there crashes Blender. Added a test to prevent this, but note that function still runs Python API code to free a buttons list. Doesn't seem to give problems, though. Thanks, David.
2008-02-25 01:35:50 +00:00
Nathan Letwory
012f0a336c === PyNodes ===
* Make PyNodes work with threaded renderer. This patch is by Willian. He has worked hard on getting this sorted out - now you should be able to render with PyNodes AND multiple threads.
2008-02-23 12:05:28 +00:00
0d80e08e8a python API: added support for screen font 12(fix-width) as "normalfix" 2008-02-19 10:47:29 +00:00
11c926b575 Python api addition PupTreeMenu() - for apricot 2008-02-15 16:08:41 +00:00
5dfef1ae35 Reverting to 2_2x BPY
I was careful in selectively rolling back revisions, but if you've committed changes unrelated to BPY mixed with BPY changes, I might have reverted those too, so please double check.
2007-12-17 20:21:06 +00:00
6dc52c893f for button popups, dont close unless you click or press escape, this would often close when dragging a button value (or when using a tablet I am told) 2007-12-11 23:05:10 +00:00
567e634253 obj export had the overwrite confirmation commented out from testing, UIBlock needed to clear the events so tooltips show. 2007-08-21 19:37:03 +00:00
3031f1f2bd =Draw Module Fixed=
This commit fixes the Draw module.  All buttons/widgets created via the Draw
module in a SpaceScript area are now inserted into a global list attached to
the SpaceScript data.  This list is cleared before each draw, when freeing
the space, and when the area is switched to another space.c

This is necessary to prevent Blender's internal UI code from getting invalid
pointers to python data.  In addition, it allows storing widget tooltips
inside the python Button objects, which solves that little bit of stupidity.

Note that this reverts the previous weaklist solution.  In fact, I had to go
over each previous commit by Campbell after this code originally branched
before the weaklist commit and re-add each commit.  So if anything is
missing, just tell me, or feel free to re-add it.
2007-07-27 06:14:25 +00:00
89792eb7ee fixed some bugs in Draw.c
* incorrect args to Draw.Create() would crash blender because it wasnt deallocating the value properly.
* deallocation of an uninitialized button could also try and free uninitialized memory if the type happened to be a STRING.
* removed the unused tooltip pointer from teh Draw.h's Button struct.
2007-07-21 23:24:08 +00:00
4f240c7982 Revision: 11257 from 2.44 stable 2007-07-12 20:49:36 +00:00
3d4a9c1c43 Silenced a few compiler warnings 2007-06-21 11:24:42 +00:00
d6330266f2 changed floating point values in python to display one more decimal place- BMAE script needed to display more (as it worked with 2.41) and it seems resionable to add. 2007-06-19 18:40:17 +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
f368b60baf OBJ smooting groups exported enabled for by default for the first smooth group (should have been disabled)
gen_library.c - Own error, hashing did not decref the tuple it created.
Draw.c - callback also missed a decref
2007-06-04 08:15:27 +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
Ken Hughes
705671ebaa Python API
----------
Draw.c: Fix some gcc warnings
Bone.c: Bone_getAllChildren() was calling EXPP_incr_ret() but not returning
	the value
2007-04-28 05:09:09 +00:00
3bd0d2e227 Draw.c - error setting the callback button values when using UIBlock (was not offset)
BPyMesh.py - own dumb error, was using dir as an arg (which is a py keyword)

object_drop.py - new script, the first to use UIBlock, it drops objects into terrain, either a group or the active object. on teh Z axis or view axis.
2007-04-27 23:54:30 +00:00
77f08ddc12 editface.c & buttons_logic.c & Draw.c & verse_session.c - added missing header
Bone.c - return an empty list rather then None for bone.children bone.getAllChildren()
Draw.c - per button callbacks are now have (event, value) passed
2007-04-24 17:28:40 +00:00
df33b2855c New UI popup block Blender.Draw.UIBlock(func) - similar to PupBlock but less restrictive since it uses user defined buttons.
Also added per button callbacks, so each button can have its own python functions.
2007-04-22 13:48:40 +00:00
66238eab7c PyAPI
curve - added curve_type() to return the curve type
BPyModule & gen_library - works with text3d now, can also make new text3d through bpy.curves.new
Added Draw.Label() so scripts can draw can using freetype.
widgetwizard - use Draw.Label
2007-03-27 11:37:54 +00:00
Ken Hughes
8e43b3f950 More fix various gcc warning, mainly related to signed/unsigned parameters
passed in general.
2007-03-17 14:43:52 +00:00
bc1fdcd858 type initialization updates, and refcount fix for lamp, reverted some changes to NMesh 2007-03-16 11:38:02 +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
585edac6d2 various warnings fixes - mostly casting and initialization issues 2007-03-01 21:30:48 +00:00
4787b97d09 made comparing buttons the same as comparing thir values.
bug 5612  (not a bug but this makes it work as scripters may expect)
2007-01-06 04:10:51 +00:00
4d74f07043 added Draw.Normal() for the normal rotating sphere button, mostly the same as the ColorPicker in code and syntax. 2006-12-27 11:58:03 +00:00
ea837b25e3 Added Draw.BeginAlign(), Draw.EndAlign()
added align to a few scripts where it looks nice.
2006-12-23 00:56:40 +00:00
253432bfc7 The Big Image refactor!
Please read:
http://www.blender3d.org/cms/Imaging.834.0.html

Or in short:

- adding MultiLayer Image support
- recoded entire Image API
- better integration of movie/sequence Images

Was a whole load of work... went down for a week to do this. So, will need
a lot of testing! Will be in irc all evening.
2006-12-20 17:57:56 +00:00
3c9a11f24e Sys.c was getting the path seperator out of the python dict and converting it to a char for all path functions.
made DIRSEP a constant and refer to that directly.
Draw.c's PupBlock limit was 24, made 120 to match blenders internal limit.
2006-12-16 03:36:54 +00:00
32b1e2383b 3rd attempt to commit, metaball fixes and small vector optimization 2006-09-30 14:14:49 +00:00
816ed68db5 BPython:
Bug #4484:

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

A recent update to Draw.c made the button attr setter function not exit
where it should for one of the cases, when new and old strings had
same length (code was missing a "return 0;" line in one of the if
cases). Should work fine now, I don't get the error under linux anymore.
Also saw in the same function that a py object could be created but
was not being decref'ed in two other 'if' cases.

Thanks elbarto for reporting the bug.
2006-06-27 17:51:11 +00:00
4d061263a9 Draw.c fixed error in exception I added with string max length.
Window.py added note about the view offset being flipped.
editview.c Fly mode timed redraws so motion is the same speed erespective of scene complexity.
2006-06-23 23:58:50 +00:00
447593d7b9 Enforced a limit of 399 (UI_MAX_DRAW_STR) for pythons button object. using larger strings would segfailt blender. 2006-06-20 18:31:05 +00:00