Commit Graph

922 Commits

Author SHA1 Message Date
b69db8f090 Made space handelers check that G_DOSCRIPTLINKS is enabled before running.
Its scary to think that a redraw space handeler could run
  import os
  os.system('rm -rf ~/')
removing all user files, Just by opening the blend file!

This means at least you can opt not to run any python scripts you dont want to..
2006-04-26 08:22:39 +00:00
16a816c38d - initialize some globals to 0 explicitly 2006-04-26 00:51:58 +00:00
Ken Hughes
74acf8224d ===Python API===
Fix some small typos in Pose epydocs.
2006-04-25 22:00:18 +00:00
ab5c87cbf4 Re arranged how modifiers are used.
All settings through Blender.Modifier.Settings
see the epydocs
Also added some error checking to fix some possible segfaults.
Added more epydocs

Modifiers API should be stable enough to use now, though give it a bit of time for testing.
2006-04-25 13:01:19 +00:00
Ken Hughes
5fa5ea352e ===Bugfix===
matrix.resize4x4() was incorrectly allocating a array of pointers using
the wrong cast -- sizeof(float) instead of sizeof(float *).  Worked fine
on 32-bit systems but caused a crash on AMD64.  Discovered by a student
in one of my classes (kudos, Joe).
2006-04-24 23:00:03 +00:00
26c8d8f983 For some reason the render docs didn't mention the fact that you the RenderData stuct has the 'currentFrame' method for proper frame access. 2006-04-24 16:17:03 +00:00
87949e5c67 warnings cleanup for the python project on windows 2006-04-24 15:09:07 +00:00
Ken Hughes
94ebee891c Some Ipo getseters calling setter methods; added the necessary wrapper
functions to make this work correctly.
2006-04-24 05:24:58 +00:00
Ken Hughes
e6db82ec04 ===Python API===
Fix for Cygwin/GCC compile errors: doesn't like PyObject_Del() in the
PyTypeObject declarations :-P
2006-04-23 17:15:20 +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
Ken Hughes
fe1495cf24 Little bit of code clean-up and commenting. 2006-04-23 14:17:14 +00:00
Stephen Swaney
e8b2d0d211 fix compiler warnings.
The 'excess elements in struct initializer' is fatal on some platforms.
2006-04-23 12:56:58 +00:00
b3bd7c869a added remove to the modifier seq (when pymodifier->md is NULL then its been removed)
added name to the docs
2006-04-23 08:01:02 +00:00
Ken Hughes
8001a8b409 ===Python API===
Initial commit for new Modifier API.  Probably does about 70-75% of what it
should, but it's a start.
2006-04-23 02:34:50 +00:00
Ken Hughes
1e1e908816 Miscellaneous fixes to documentation. 2006-04-21 20:31:27 +00:00
Ken Hughes
4aa28f13f4 ===Python API===
New Ipo and IpoCurve API.  Ipo and IpoCurve objects support the [] operator,
for accessing the curves of a particular Ipo and for accessing the value
of an IpoCurve at a specific time.  Both modules were also "tp_getset"-ified.
Also, code for an alternative method (Antont wanted this) of accessing curves
via Ipo attributes is included for now, for people to try and see if it's
actually preferable to the Ipo [] operator.

These are all new additions; nothing was intentionally removed from the API.
If you find the something in the existing API has changed, let me know.
2006-04-21 20:27:52 +00:00
237030a6ca Error in the header, was still refering to mesh type rather then group, didnt seem to break anything. 2006-04-21 00:00:42 +00:00
Ken Hughes
355486c83d Replaced constant_getAttr() with constant_getAttro(), and added extra
code so that the .keys(), .items() and .values() methods worked.
2006-04-20 17:51:58 +00:00
1632a2f888 Added Group to Blender.Types, tested and working.
Added Group Epydocs, with 2 examples.
also added http://en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python
  to the blender links main page.
2006-04-20 14:26:24 +00:00
19345ba9ac CVS: ----------------------------------------------------------------------
ob.DupObjects was working but giving a warning. Fixed the warning and it also works in all test cases.
2006-04-20 12:22:00 +00:00
Ken Hughes
b22ebe667a Bugfix #3889: action.setActive() was not adjusting id.us count correctly when
a new action was set to active.
2006-04-20 02:42:53 +00:00
d4cef18e38 Previous commit broke pythons ob.DupObjects.
Though access was incorrect, fixing it made the linked list return a different length.
tested with all dupli types and it works properly now.
2006-04-19 10:38:20 +00:00
2b46b624f8 Error in accessing the listbase needed to use BLI_countlist(&lb) rather then BLI_countlist(lb)
fixed, thanks jms for the hint.
2006-04-18 15:37:32 +00:00
Stephen Swaney
342bb99a19 a little spring cleaning to remove some compiler warnings for
implicit declarations, redundant redeclarations, missing initializers,
nested externs and other cruft.

Cleaned up includes and moved extern _Type decls from Types.h into
Types.c since that is the only place where they are needed now.

Did not touch Ipo.[ch] since work is on-going there.
2006-04-16 15:28:50 +00:00
Stephen Swaney
619d313f01 Fix typo in doc. CurNurb.setType() was getType() which hid the
real getType() definition and made getType() into the setter.   All that
confusion from a single character!
2006-04-13 01:41:42 +00:00
Stephen Swaney
371008fe1e last release we lost our reassuring msg when no local python install
was found.  Restore warm fuzzy msg.  Text is now

  Looking for installed Python version XXX

followed by either

  Got it!
or
  'import site' failed; use -v for traceback
  No installed Python found.
  Only built-in modules are available.  Some scripts may not run.
  Continuing happily.


And while we are at it, clean up a couple of compiler warnings.
2006-04-11 19:05:58 +00:00
Ken Hughes
7fd0e22f1e Bugfix #4055: the "sel" attributes for faces/edges/verts were basically
oblivious of each other, so setting/clearing the face edit mode select status
did not set/clear the corresponding vertex select statuses.  This patch makes
a change of any select status recalculate the selection state of all edges an
faces.  One unresolved issue is what effect this should have on the recent
edge mesh's stored selection.  Currently changing the selection state will
delete store selection info, but it may be desirable to emulate the stored
selection (but I need to discuss how this should work in more depth with
Geoffrey Bantle).

As an added bonus (while I was messing with this), I added a "sel" attribute
to edges so they are the same as faces and vert.
2006-04-07 02:49:15 +00:00
35f1059887 ==misc spelling and typos ==
a patch from Ed Halley to fix assorted typos in tooltips
2006-04-05 00:53:07 +00:00
9d30a3a5ec Added matt's empty drawsize property to python. 2006-03-31 09:50:39 +00:00
Chris Want
10adb211fc ==Nothing to see here, move along==
A header (BKE_Scene.h) was not included.
2006-03-29 23:16:09 +00:00
9053425e72 removed 2 warnings from Image.py epydocs 2006-03-27 08:34:06 +00:00
915cd5b80b Added python image pack/unpack per image. 2006-03-26 09:25:30 +00:00
Ken Hughes
927be3725a Bugfix #3818: nmesh.insertKey() was not letting Ipo space know to
recalculate, causing a segfault when the curve was selected in the Ipo
window.  lattice.insertKey() has similar code.  Added calls to
allspace(REMAKEIPO,0) to correct this.
2006-03-24 21:56:29 +00:00
21c9ee54ca blender -P xxx -b crashed sometimes, still will crash in some cases if the python functions access screen data. but at least Blender.sys.expandpath wont segfault anymore. 2006-03-24 16:04:55 +00:00
d29503cc6d Made blender python work in background mode without a blend file loading.
Blender.c python initialization creates a scene when in background mode and when there is no scene.
Needed to skip redrawing when in background mode because it depended on screen data that wasnt there.
2006-03-24 15:46:26 +00:00
7417d07482 Attempted to unify and document Dupli* stuff.
DupGroup
DupObjects
enableDupVerts
enableDupFrames
enableDupGroup
enableDupRot
enableDupNoSpeed

see the epydocs for documentation at http://members.iinet.net.au/~cpbarton/ideasman/BPY_API/Object.Object-class.html - will update in a tick.
2006-03-24 08:36:39 +00:00
Ken Hughes
4b2f0225bf Fix problem with possibly random calls to MEM_freeN() due to uninitialized
variable in NMesh.c
2006-03-23 23:54:48 +00:00
a837e1e8c0 oops, typo 2006-03-21 23:59:52 +00:00
Ken Hughes
e57ce8489b ===Python API===
Two small bugfixes:
   * Image.New() resets id.us to 0; it is set to 1 by new_image()
   * allow ima.depth and ima.size getters to propagate their own error
     messages (missing image was returning MemoryError)

Also, seems to me there's something funny going on with image id.us
accounting.  In do_image_buttons(), id.us is set whenever an image is
accessed vi the datablock menu:

        if(idtest!=id) {
            G.sima->image= (Image *)idtest;
            if(idtest->us==0) idtest->us= 1;
            allqueue(REDRAWIMAGE, 0);
        }

This is independent of whether a UV face is selected or not (and it also
seems that the number of UV faces linked to an image is not maintained
either).
2006-03-21 23:30:25 +00:00
742ba52072 Fix for a bug where python could save a sceneless blend file.
https://projects.blender.org/tracker/index.php?func=detail&aid=3902&group_id=9&atid=125
2006-03-21 22:30:29 +00:00
9cf9ce75af Fix for bug,
https://projects.blender.org/tracker/index.php?func=detail&aid=4021&group_id=9&atid=125
Raise an error instead of crash when python expandpath runs and no scene is loaded.
2006-03-21 22:16:41 +00:00
Ken Hughes
4fcd19013b Fix various gcc warnings. 2006-03-19 20:45:50 +00:00
368cab399c === bugfix win32 - python ===
Fixed BLI_exist: In Windows stat doesn't recognize
a dirname ending is a slash, exept when it's
the root dir ("C:\\"), where it is required.
So trailing slashes are only removed when filename
is longer than 3 chars.
Also fixed Python Sys.c that now uses BLI_exist
instead of calling stat directly.
2006-03-19 13:28:01 +00:00
59ed566e86 Added support for group objects
grp.objects

To have an iterator assigned as well as a list. Since gp.objects is an ietartor this is expected.
grp.objects= someGroup.objects works now.

Some other small fixes made.

Made a wrapper for add_to_group() That handles the OB_FROMGROUP flag. Should be moved to group.c's add_to_group()

void add_to_group_wraper(Group *group, Object *ob) {
	Base *base;
	add_to_group(group, ob);

	if (!(ob->flag & OB_FROMGROUP)) { /* do this to avoid a listbase lookup */
		ob->flag |= OB_FROMGROUP;

		base= object_in_scene(ob, G.scene);
		if (base)
			base->flag |= OB_FROMGROUP;
	}
}
2006-03-19 04:45:58 +00:00
abab9fc3de Added object.dupliGroup so objects can access the groups they instance.
This is very confusing.
Since in object has
ob.setDupliGroup() # Enable/Disable Dupligroup
ob.getDupliGroup() # see if its enabled.
ob.dupliGroup # the group data this object is instancing.

Not yet added
ob.groups # Groups that use this object.
2006-03-18 17:24:59 +00:00
bfe42eea43 Moved declerations to the top of the skope so as to work with MSVC?
started removeing // from constant.h to shut GCC's -pedantic up. realized // are used everywhere.
2006-03-18 15:23:02 +00:00
7b37efb35f Added Blender.Group module
The plans for the new Python API are too far off to have this module conform.

Needs testing with MSVC 6
2006-03-18 14:47:26 +00:00
f913a53b0a A small alteration for C syntax, code before vars (MSVC complained about this). 2006-03-13 14:44:49 +00:00
Nathan Letwory
50b34df348 ==BPy==
* move declaration to start of function. Again I repeat: these *have* to
  be at the start. GCC users should check themselves always, as GCC allows
  this kind of atrocities :)

  /Nathan
2006-03-13 14:43:20 +00:00
3649c806a3 Scene unlinking didnt set the python objects scene to NULL,causing memory errors if accessing the data after the scene was unlinked.
Also a few functions segfulted if scene was unlinked, added more checking.

First commit from win32, hope line endings are ok.
2006-03-13 02:02:19 +00:00