Commit Graph

1857 Commits

Author SHA1 Message Date
Campbell Barton 5c93e75682 non user visible changes and small optimizations to the game engine pyapi as well as fixing some bugs.
* 2 returning errors without exception set another return None instead of NULL.
* a missing check for parent relation
* BPY matrix length was incorrect in matrix.c, this change could break some scripts, however when a script expects a list of lists for a matrix, the len() function is incorrect and will give an error. This was the only thing stopping apricot game logic running in trunk.

Also added a function for GameObjects  -  getAxisVect(vec), multiplies the vector be the objects worldspace rotation matrix. Very useful if you want to know what the forward direction is for an object and dont want to use Blender.Mathutils which is tedious and not available in BlenderPlayer yet.
2008-07-04 00:05:50 +00:00
Willian Padovani Germano 424141f44d == Python, GE & Threads ==
Martin Sell (thanks!) reported that threading via scripts was not working in the game engine with Blender 2.46 and later. My fault, to make pynodes work properly with threads > 1 I disabled Python's "check interval", preventing threads created via scripts from receiving time to run.

Now only during rendering check interval is disabled (set to max int). Still experimental, I added the calls in BPY_do_all_scripts, since it's called in BIF_do_render, but will probably move the code to its own function after more testing & feedback.
2008-07-02 21:01:59 +00:00
Daniel Genrich 90c2c29058 Fix for python APi error - (Campbell: please check :) ) -- using myLamp.setType(Area) resulted in 'TypeError: expected int argument in [0,5]' (reported in IRC by Djoef) 2008-06-30 15:02:22 +00:00
Daniel Genrich 5b15a610ee Fix crash in python API (Campbell: please check :) ) -- using myLamp.setType(number) crashed blender (reported in IRC by Djoef) 2008-06-30 14:44:12 +00:00
Campbell Barton 7ba2389932 added r/w access to nurb curves orderU for migius 2008-06-25 13:21:38 +00:00
Martin Poirier b22d3e615d Moving Line to Line intersection into arithb 2008-06-22 23:07:42 +00:00
Campbell Barton a1e78a0cca * Documented that get/setOrientation use an inverted rotation matrix
* OB prefix is needed when specifying the object for the Message Actuator, this is very bad since other object fields in the BGE dont need this prefix - a real fix would need do_versions to keep old files running.
* RotationMatrix was all nans if the rotation vector axis was 0,0,0, Changed so in this case just return a matrix that doesn't rotate anything,

spent some angry hours to find these issues, maybe this will save others the hassle ;)
2008-06-20 20:54:29 +00:00
Campbell Barton 21a46a0155 bugfix
- duplicated script spaces would keep a pointer to the PyObject button list. (causing python errors with negative reference counts when freeing spaces)
- Exiting blender would crash when a UI was open because the ScriptSpaces button PyList was being free'd after python Py_Finalize was called.
2008-06-11 14:31:51 +00:00
Campbell Barton b62955cf3e bugfix, memory leaks when getting particles and particle system loc/size/rot/life (Just remember PyList_Append adds a reference! :) ) 2008-06-06 11:00:32 +00:00
Campbell Barton 14393c9ffb bugfix - Blender.GetPaths() was returning relative paths from libraries, but with no way to access the library path the the file is relative too. Check for these cases and make them absolute.
bpath also assigned one var it didnt need to.
2008-06-06 08:58:08 +00:00
Campbell Barton 49abcc980c Added shadow baking 2008-06-05 22:07:59 +00:00
Campbell Barton 6757b759ea added checks for zero length strings when checking for the last character 2008-06-05 13:12:17 +00:00
Campbell Barton 4f601b478c * python sys.cleanpath() used strstr incorrectly, resulting in paths containing a slash, always returning a path that ends with a slash.
* python Blender.GetPaths() - absolute=0 wasnt working
* BLI_cleanup_file and BLI_cleanup_file were treating the // prefix as a duplicate path, now ignores //
* BLI_convertstringcode was removing the trailing slash from a path
(tested these path functions didnt mess up with some of the peach files and with pointcache)
2008-06-05 13:02:00 +00:00
Campbell Barton c8e19a6b25 numbutton python expression evaluation used driver dictionary, when EnableScriptlinks was disabled number
button input didnt 
work. narrow down this test to the part of the pydriver module init that uses a blender textblock as a module. This should 
should reload the pydriver dict whenever the "EnableScriptlinks" state changes. but for now working numbuttons is priority.
2008-06-04 22:32:15 +00:00
Campbell Barton e26323bcdd Python API object.parentVertexIndex - access vertex parent indicies 2008-06-04 16:19:15 +00:00
Joshua Leung 8a2a91ddfe Added missing newline for error print in Py-button expressions 2008-06-02 02:54:33 +00:00
Campbell Barton 652ee1e31b functionality fix
Originally the only way to run scripts automatically was with scriptlinks, which could be disabled for loading untrusted blend files.
Since then PyDrivers and PyConstraints would run even when G.f&G_DOSCRIPTLINKS was disabled.
Gensher, Theeth and Ianwill agree its acceptable to reuse the flag for other areas python runs automatically.

PyNodes still have no way to be disabled, (todo before 2.46a)
2008-06-01 16:13:04 +00:00
Campbell Barton c0199e192d bugfix (typo) [#13587] Python API Material.sssFront broken 2008-06-01 13:18:26 +00:00
Campbell Barton edd2b6ca73 bugfix for own error
[#13588] Python API Material.sssRadiusBlue broken
2008-06-01 01:49:11 +00:00
Campbell Barton 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
Willian Padovani Germano 5c1acc5ced == PyNodes ==
Bug #13277, reported by Juho (bebraw) Vepsalainen (thanks!) - a typo made pynodes w/o input socket definitions fail with an out of range error when accessing the output sockets in the script.
2008-05-30 20:04:52 +00:00
Campbell Barton da2d4904af bugfix
* scene.object.context and scene.object.selected had broken get_item 
funcs so scene.object.context[i]  returned the wrong object.
* aligning the view to an object (numpad*key), did not disable the 
ortho view grid.
* long standing problem where opening a relative image would fail with 
no message. BLI_convertstringcode was returning a path with /../../'s 
that need to be cleaned before the path could be read, the path was also 
invalid from unix shell so its not a blender path reading problem.
2008-05-30 01:59:15 +00:00
Campbell Barton b36a358c1b bugfix
* python api render() would clamp the endframe to a short.
* python api's render() and renderAnim() would not render compositing because the name they gave to RE_NewRender was NOT G.scene->id.name, added comments to 
G.scene->id.name
2008-05-28 00:44:41 +00:00
Martin Poirier c1874b3cee [#10223] a new object function to add vertex group from an armature
Patch from Jean-Michel Soler (with slight modifs)

Small BPy feature to help script writers deal with armatures and vertex groups (calls the bone heat method to create and assign groups)
2008-05-27 20:02:38 +00:00
Stephen Swaney a2298cb980 bugfix for crasher from Cedric Paille via bf-committers. 2008-05-26 15:12:20 +00:00
Campbell Barton 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
Campbell Barton 02f34de2b9 add missing flags for NLA strips 2008-05-21 19:24:35 +00:00
Campbell Barton e1b298cad8 scene frames scene.render.cFrame,sFrame and eFrame were being treated as shorts. (which clamped them to 37856) 2008-05-21 12:14:52 +00:00
Campbell Barton adbbc314ba testbreak was not working after the first use 2008-05-21 11:06:49 +00:00
Campbell Barton 195abc755b more updates to docs 2008-05-19 13:34:43 +00:00
Campbell Barton f32d99c322 some updates to epy docs 2008-05-19 09:54:38 +00:00
Willian Padovani Germano bbe32118ef == Nodes ==
- "Memoryblock free: attempt to free NULL pointer" messages related to the Material node (Add->Input->Material). Deleting it and quitting Blender would bring 2 or 3 of these warnings. Trivial fix (check if NULL) in blenkernel/intern/node.c, though Nodes devs may be interested. Found while testing to fix the following bug:

== PyNodes ==

- Bug #11715 reported by Alexanter Feterman:

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

Adding a Dynamic node and setting it to a pynode script would crash Blender if no Material Node (MatNode) was present.

Thanks Alexander for reporting and Brecht for assigning it to me.
2008-05-16 20:57:06 +00:00
Campbell Barton ac71783e8d last commit had a typo, also adjusted teh and colour instances 2008-05-12 21:12:10 +00:00
Joshua Leung 2d96d1189f Fix compiler warnings in particle.c and editface.c.
* unitialised/unused vars
2008-05-11 12:57:01 +00:00
Stephen Swaney aa471f6a80 fix compiler warnings.
tsk tsk - implicit declaration of functions.
2008-05-11 06:11:23 +00:00
Stephen Swaney a2c10ff1e7 Initial commit for BPy Particle patch #8557 from Cedric Paille
Thanks, Cedric!

*** WARNING ****   This is a Work In Progress   *** Warning ****
2008-05-11 04:15:21 +00:00
Campbell Barton f115a5f789 fix for [#6104] CR generates space at String Creation
replace windows line endings (\r\n) with \n rather then inserting spaces.
2008-05-09 17:37:01 +00:00
Campbell Barton cfcdf36cd8 fix for [#10330] Can't import packages or modules from a user defined script path in 2.46rc3, works in 2.45 (Windows) 2008-05-08 22:07:00 +00:00
Campbell Barton 18b20396bc this script isnt needed anymore thanks to stivs and gsr 2008-05-08 07:33:20 +00:00
Stephen Swaney 12715ec0fa more shell script tweaking.
Thanks to gsrb3d for hints.
2008-05-07 22:46:20 +00:00
Stephen Swaney 1c7c37deb7 modify script to use long opts; --name vs -n, for example.
This makes epy_docgen.sh compatible with epy_docgen-3.sh.

I am not sure why we would need both scripts.  Perhaps 
someone with epdoc version 3 can test.
2008-05-07 21:21:15 +00:00
Campbell Barton 5e493eeb19 Setting frame in python allowed negative numbers (was casting to a short with no clamping!)
disable capslock option isnt used anywhere.
2008-05-07 07:57:18 +00:00
Campbell Barton c0d981f6db patches
[#10529] -p command line option fix
[#8844] Glossy controls Python API
2008-05-06 18:57:24 +00:00
Campbell Barton 4255f3c7ab made python add mesh module respect blenders user settings for editmode and view align.
added sys.cleanpath() was a patch in the tracker but blender's internal path cleaning is now more general and can be used from 
python.
2008-05-06 17:54:55 +00:00
Campbell Barton 6c05a92fe1 missed out on some BLI_convertstringcode's, also found that playing relative quicktime paths from the python api never worked, was using the 'Scene' type cast to a char. 2008-05-04 15:02:48 +00:00
Campbell Barton 110f927c63 Changed frame numbering to only alter hashes if they are in the filename (not the directory name) to fix bug [#10566] File Open Dialog replaces '#' with '0' in directory names.
removed frame numbering from BLI_convertstringcode into its own function (BLI_convertstringframe), many uses of BLI_convertstringcode were passing dummy frames values anyway.
in cases where adding the current frame number to a filename is needed run BLI_convertstringframe(...) after BLI_convertstringcode(...)

There are some cases Im not sure BLI_convertstringframe is needed, these have been commented as todo, but at least have the same functionality they used to.
2008-05-04 09:41:15 +00:00
Willian Padovani Germano 9ea5788c37 == PyNodes ==
Bug #10104 reported by bebraw: missing check for how many node sockets were being created by a pynode script. Too many (more than MAX_SOCKET == 64) would crash Blender.

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

Notes: moved the MAX_SOCKET define from node.c to BKE_node.h so I could use it in Node.c. Also improved error reporting in pynodes when errors occur in the init stage.

Thanks Juho (bebraw), Tom (assigned the bug to me) and Brecht (mentioned the MAX_SOCKET define).
2008-05-01 22:28:18 +00:00
Ken Hughes a87d82023a Add library.name attribute, which returns the actual library name used by blender (this may be different from the library.filename attribute). 2008-05-01 18:52:26 +00:00
Nathan Letwory 0b3118980f * add missing int rel to BPy_Library and BPy_LibraryData 2008-05-01 08:11:08 +00:00
Ken Hughes 3d2758a3bd Add support to bpy.library module for relative paths. 2008-05-01 05:52:35 +00:00