Commit Graph

128 Commits

Author SHA1 Message Date
bc7b18131b Running scripts with Blender.Run() would crash when reloading. 2008-03-17 19:58:11 +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
62584d78eb Py API - rename UndoPush to SaveUndoState 2008-03-02 15:57:19 +00:00
a30b582300 Removed warning from py-api code 2008-03-01 03:42:09 +00:00
a577bb9fc8 Wrap UndoPush with python, needed for apricot, so changes made be scripts can have undo's as well, otherwise users undo and loose changes the script made. 2008-02-29 20:45:57 +00:00
4c0b33ef80 Python Bugfix
A new file could have its Blender.Get("filename") return "<memory>" after undo'ing on an open file.
Fix for own error with python sys.path, messed up game engine.
2008-02-20 18:56:07 +00:00
b58274abef == BPython API ==
Fixing mistake in Blender_ShowHelp() function: argument to Blender_Run() should be passed directly as a string, not encapsulated in a tuple (aka "s", not "(s)").
2008-02-13 20:42:36 +00:00
bc9848f7e6 Added a global string to be used for the tempdir. since the user preference is not loaded in background mode and the user preference is not validated and has no fallback.
'btempdir' is set with BLI_where_is_temp() - This tries to use U.tempdir but falls back to $TEMP or /tmp/
2008-02-13 13:55:22 +00:00
Nathan Letwory
16514e3ddb * Merge of PyNodes to trunk. Finally!
See http://wiki.blender.org/index.php/BlenderDev/PyNodes and
  http://wiki.blender.org/index.php/BlenderDev/PyNodes/API
  For current documentation.

  Very very big thanks go to William Germano for fixing the memory issues left
  and for improving on the code.

  In the coming time documentation will be finalised and further stabilising
  of PyNodes is to be expected.
2008-02-09 23:17:15 +00:00
f3ebe967dd added utility function Blender.GetPaths( absolute=0 )
returns a list of files this blend file uses, wraps bpath functions.
2008-01-02 17:40:53 +00:00
Ken Hughes
4260b054f4 Python API
----------
Fix warning about implicit declaration of function ‘set_mipmap’.
2007-12-30 16:47:38 +00:00
28805c626f ==Python API==
added mipmap as an option for Blender.Get/Set
2007-12-27 13:35:14 +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
bb77ea8df5 Patch [#7829] "compressfile" parameter for Blender.Set() from JMS 2007-11-27 23:15:51 +00:00
3a90b35db8 Undoing 'undo' fix 12365, it didn't work the same on mac's, Ton would like to fix the bug himself.
Tree From Curve,
- report error when nurbs or poly curves are used.
- don't throw errors when >4 branch's per segment are used. also try deal with this better. though no nice solution exists.
- default speed is 10x slower then before.
2007-11-11 15:18:53 +00:00
5b0a79c7c7 bug fix, when opening blender with a file (by double clicking or from the command line) - the initial undo state would be set to the default scene.
So holding Ctrl+Z would go back to the default .B.blend rather then the file that the user opened.
2007-10-23 21:31:59 +00:00
f707382e1e misc changes from stable 2007-08-01 18:04:44 +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
f0fe6833db when removing py_build value I removed this but shouldnt have, however theres no need to parse the value in Blender_Redraw since its done in the Window module. 2007-06-01 05:54:16 +00:00
30dd4fafd1 More memory leaks fixed - in IDProp, Bone.head, tail, matrix, ob.DupObjects (my fault) and in Effect module as well as a few others.
Also stopped using Py_BuildValue for strings, ints and floats.
2007-05-26 04:39:31 +00:00
Ken Hughes
873b83c131 Python API
----------
Replace extern declarations for IDProp types with header include.
2007-04-01 03:58:42 +00:00
2b8bed8598 py api
* stopped bpy from importing automaticaly as decieded in the meeting.
* removed Blender.Main, since we agree it will be called bpy, renamed files also.
* updated epydocs from this and last commit.
* updated scripts to use bpy.*, and bugfix's for widgetwizard
2007-03-26 19:44:44 +00:00
Stephen Swaney
145f474c5f fix compiler warning: implicit declaration of oldLibrary_Init() 2007-03-21 14:25:31 +00:00
Ken Hughes
3a834803ef Python API
----------
Support for new bpy.libraries module, which is being proposed to replace
the Blender.Library module.
2007-03-21 02:23:28 +00:00
a51477093b Geometry.c - rewrote my python box-packer algo in C,
packing 2400 rectanges is about 38x faster.

Use the C implimentation in uvcalc_lightmap and uvcalc_smart_project

Blender.c - filename returning None raises errors with existing scripts, just return "" so string functions on the filename dont raise an error.
2007-03-20 07:23:09 +00:00
8eb0544f08 [ #4227 ] Determine the "real" current filename via Python
applied. tested and this is how "filename" should work, so changed Blender.Get("filename") to return None instead of the last opened file.
2007-03-19 01:51:54 +00:00
df1df624ac added back videoscape for python 2007-03-13 11:54:53 +00:00
0745133528 removed videoscape support, a format from 1988 that nobody uses anymore. 2007-03-13 10:00:27 +00:00
Ken Hughes
e276a6f748 Python API
----------
Removed prototype for recently-removed Blender_RemoveFakeuser().
2007-03-05 03:38:41 +00:00
cf75e5b78c Interface:
Added option "Load Factory Settings" in the "File" menu.

With this, users don't have to remove .B.blend if they want to load the default data stored in Blender. Thanks Ton for ok'ing it and suggesting a better place in the menu (I had put it as "New (factory defaults)").
2007-03-02 18:15:41 +00:00
585edac6d2 various warnings fixes - mostly casting and initialization issues 2007-03-01 21:30:48 +00:00
a05f95f347 Image.c
* moved to getseters (use new generic ID funcs)
* added 'reflect' attribute

Text.c
* moved to getseters (new generic ID funcs too)

NLA.c
* moved to getseters (ditto)

Ipo.c
* bugfix, allow nested loops on an IPO's curves.

Blender.c
* removed undocumented function RemoveFakeuser, since actions now have the fakeUser attribute.
2007-02-25 12:41:50 +00:00
436e1697fd made attributes (name, property, users, fakeUser, lib) into functions all python types can use.
removed a lot of code duplication when moving to this.
Also removed unused functions GetMaterialByName(), same for Mesh, Object, World etc.
2007-02-25 07:36:50 +00:00
c540c8fa44 renamed Base to Main 2007-02-22 15:26:35 +00:00
1190b45263 Adding a new way of dealing with library data in blender, Blender.Base
Has a number of advantages over the existing method, described here.
http://wiki.blender.org/index.php/User:Ideasman42#Post_2.43_Update_to_the_Python_API

Only missing functionality is the ability to add new data through Base.scenes.new('name'), where scenes could be meshes, texts etc.

Other changes are minor,
Scene.h, bad var name in definition.
Text.c/h - moved the Python Struct into the header file, added BPy_Text_Check()
2007-02-22 14:37:30 +00:00
7a19fe19f6 =ID Property Script update and api bugfix=
Turned out somehow I managed to miss adding the proper
type refs in Blender.Types for IDGroupType and IDArrayType,
which made the script not work.  So, I've got it all fixed now.
Or at least hopefully :)
2007-01-15 07:54:08 +00:00
5af67129f8 * theme save script now saves iconThemes and supports string types.
* added .iconTheme variable
* bugfix. drawType was not being saved because Py_BuildValue and __members__ was missing an "s"
* added Blender.Get('icondir')
2006-12-30 07:32:58 +00:00
Ken Hughes
df2fd95faa Python API
----------
Bugfix for at least one annoying "DeprecationWarning: integer argument
expected, got float" followed by garbage printed to the console.  The message
happens when PyArg_Parse() is called to parse an integer but is passed a
float.  This happens in a few other places, bun unfortunately I can't fix
them all right now.
2006-12-26 19:13:13 +00:00
3a84791b53 =IDProperties Python update=
Updated id properties interface as per
discussed in python meeting.  Basically,
id properties are now entirely accessed
through the dict-like interface if IDGroupType.
Also, tp_getsetters are used throughout the code
now.

Using the dict interface allowed for a major cleanup
of the wrapping code.  The biggest change is that ID
properties are no longer wrapped in a structure with 
.type .name and .data members; instead when you get
properties from the group it returns the direct value.
Ints, strings and floats return simple python types,
while arrays and groups return special wrappers though.

This means to detect the type of an ID property, you
have to use type().  For string and int types this is
easy; for group and array types (which of course have
their own wrappers) you use type() with Blender.IDGroupType
or Blender.IDArrayType.

Update of epydocs plus a temporary gui script will be
forthcoming; the gui script will be removed before release
as of course by then we'll have a built-in gui for id
properties.
2006-12-16 23:54:45 +00:00
80f7ea96c8 =ID Properties Small Python Update=
This commit adds a new constant dict to the top Blender module
called PropertyTypes.  This dict represents all the ID Property
constants: STRING, INT, FLOAT, ARRAY and GROUP.

Further python work, including epydocs, are forthcoming.
2006-11-17 07:50:24 +00:00
c8b06bba9c mesh/animation exporters didnt work when there were no 3d views open, because the Blender.Set('curframe', i) called a update command that resulted in no viewable layers updating.
Made Blender.Set('curframe', i) do a
  scene_update_for_newframe(G.scene, (1<<20) - 1);

  removed 2 unused constants from Scene.c
2006-10-13 11:56:08 +00:00
b4e97c01ff -> Enter/Exit editmode wait cursor flags
The wait cursor was being called during editmode enter and exit for meshes.
This was a problem for several reasons. First of all, python modules like
Mesh now make use of editmode features. These methods that wrap editmode
tools may be called many times during the execution of a script
and lead to the wait cursor rapidly flickering on and off.

The other problem was that the wait cursor wasn't being called for editmode
enter and exit of all data types. This is unified now.

-New Arguments

enter_editmode() should be passed a nonzero integer or simply EM_WAITCURSOR
if the wait cursor is desired. Currently only the python API passes a '0'
to enter_editmode()

exit_editmode() has several options and they are passed in as the bitflags
EM_FREEDATA, EM_FREEUNDO and EM_WAITCURSOR. These flags are defined in
BDR_editobject.h.
2006-09-28 01:55:44 +00:00
d82f1f5f91 from looking at patch 4934 made all user preference paths settable with Blender.Set('val', data), also added exception errors which were on the todo.
image.filename was being limited to FILE_MAXDIR rather then FILE_MAXDIR + FILE_MAXFILE when setting.
2006-09-21 18:25:40 +00:00
Ken Hughes
81d7cd967d ===Python API===
New API for accessing surface data (SurbNurb type).  Right now it's hooked in
through the Curve API, since Curve.Get() doesn't differentiate between curves
and surfaces.  If the curve object is 2D (pntsv > 1), the SurfNurb object is
created.

It is similar to the CurNurb type but not identical.  There are only
attributes and no methods yet, and the only methods which will be added are
the non-getStuff/setStuff kind.  Read the documentation to see how it works
(sorry, no examples yet).

This is a work in progress.  Don't be surprised if the API changes some more.
2006-08-28 04:44:16 +00:00
6adf0e6543 finish adding Geometry module, removed polyfill from mathutils, updated epydoc links and updated BPyMesh NGon function 2006-07-02 15:28:28 +00:00
2ca99a5e09 Scripts:
- Jean-Michel Soler updated the svg to obj module used by Paths
Importer (thanks!)
- user request: added option to control whether user prefers per face
(uv face select "TwoSided" toggle) or per mesh ("Double Sided") single /
double face info in ac3d exporter.

BPY:
- Blender_ShowHelp() was now crashing Blender when called for the
second time, due to EXPP_dict_set_item_str decrementing the reference
count of an object passed as argument to Blender_ShowHelp() (so not
owned by that function).
2006-06-18 19:05:51 +00:00
Chris Want
a0fdbf1c18 Added Blender.Get('rt') so that the pythoner can access the value
of the rt button for setting debugging levels.
2006-05-17 16:42:04 +00:00
Ken Hughes
cd3af13a1b ===Python API===
New Constraint API.  Constraints are accessible through a "constraints"
attribute in poses and objects.  Would be REALLY NICE for armature users to
pound on this code.
2006-05-07 14:57:58 +00:00
e9718958ee Applied pack unpack from Pablo Martin (caedes),
http://projects.blender.org/tracker/?func=detail&atid=127&aid=3246&group_id=9
adds

Blender.c:
Blender.UnpackModes (dict with the unpack modes)
Blender.UnpackAll(mode)
Blender.PackAll()
Blender.CountPackedFiles()

Image.c:
image.packed (this was working)
image.pack()
image.unpack()

Sound.c:
sound.packed
sound.pack()
sound.unpack()
2006-05-06 06:17:46 +00:00
Ken Hughes
6f94c5ef5e ===Python API===
More Modifier API changes:
 * add Blender.Modifier.Settings dict with constants for modifier types
 * add mod.type attribute, which returns type of the Modifier
 * add some internal consistency checks in ModSeq_remove
2006-04-23 17:01:04 +00:00