Commit Graph

677 Commits

Author SHA1 Message Date
Ken Hughes
a85ba68eb4 -- Added OB_RECALC_OB to Object_set* methods. 2005-11-15 16:34:25 +00:00
Ken Hughes
c6d22dd44e -- various fixes for Mesh.c:
* add some protection against accessing MVerts/MEdges/MFaces which have
   been deleted
   * correct cut-and-paste bug in faces.delete() method
   * correct some compiler warnings
2005-11-11 16:17:29 +00:00
Ken Hughes
564b629013 -- When storing a mesh, allow TFaces without defined UV coordinates to use
some default values instead of throwing an exception.  Also use only the
   first four UV coordinates supplied in the list.
2005-11-09 00:38:56 +00:00
Stephen Swaney
960a872431 Bugfix: #3377 Epy docs missing links
Link to sys was broken.  need to be  L{sys<Sys>} for name to match.
2005-11-08 22:11:19 +00:00
Ken Hughes
1ba15893bd -- changes and bugfixes from Cam:
-- calling mesh.getFromObject(obj) with mesh object now also
     copies material properties
  -- mesh.quadToTriangle() takes a parameter to duplicate both
     Ctrl-TKEY and Shift-Ctrl-TKEY actions
  -- assigning None to mesh.verts "clears" the memory allocated
     to the mesh (equivalent of Mesh.New(), but on an existing
     mesh)
  -- exception handler message for mesh.faces[i].uv = [..] more
     clear (uv attribute only accepts tuple, not list)
  -- fixed bug for meshs with deformed verts when deleting verts
     (deformed verts deleted and repacked correctly now, I think)
2005-11-08 21:50:30 +00:00
Ken Hughes
c217188a62 -- Previous commit using PyDict_Keys left new reference around. Change to use
PyDict_GetItem() instead, and clean up string manipulation.
2005-11-08 18:46:55 +00:00
33648819f7 BPython docs:
bug #3367 reported by Chris Want (thanks): ob.mat documentation was
wrong (was not updated); that attribute returns the world space matrix,
not the local one.
2005-11-08 17:23:20 +00:00
cd7ca03034 *work around for PyDict_Contains 2005-11-08 16:27:58 +00:00
f09a3611be *armature api for python
- don't get too excited
- allows you to get armatures from a scene
- makeEditable()/saveChanges() puts the armature into out of editmode (pythonically)
- Armature.bones is a dictionary that contains all the bones in the armature and can be iterated
- getters are available for:
name,
roll (dictionary) keys are BONESPACE, ARMATURESPACE
head (dictionary) keys are BONESPACE, ARMATURESPACE
tail (dictionary) keys are BONESPACE, ARMATURESPACE
matrix (dictionary) keys are BONESPACE, ARMATURESPACE
weight
deform_dist
subdivisions
options (list of constants)
parent
children

Setter work only in editmode. Some are not fully implemented.
Type class is embedded in the module. This means the construct is called as follows:
Blender.Armature.ArmatureType()

import Blender.Armature as Armature
arm = Armature.Get('myarm')
for name, bone in arm.bones.items():
...print name, bone, bone.matrix['ARMATURESPACE']

more documentation is forth coming. This is an alpha for this api.
2005-11-07 20:03:32 +00:00
a39559ea11 *change to the way constants are printed 2005-11-07 19:36:50 +00:00
cce655b5e7 - warning fixes
* various warnings the python api is putting out
2005-11-07 19:34:44 +00:00
Ken Hughes
979c28bf06 -- Clean-up of Effect and Particle modules; since particle was the only
remaining effect type, it didn't make much sense to leave things
   implemented in two separate files.  Changes include:
   * two bug fixes (the getChild() and getMat() methods were using floats
   instead of shorts)
   * performing clamping on input values
   * implementing attributes using tp_getset
   * merging Effect and Particle functions: the Particle module exists in
   name only, with the Particle.New() and Particle.Get() functions
   remaining for backward compatibility (they are in fact identical to
   Effect.New() and Effect.Get() functions)
   * update of doc/Effect.py (including remove all old references to wave
   and build effects)
2005-11-07 00:22:05 +00:00
Ken Hughes
0089c0bc53 -- Added Object.effects, a read-only attribute which returns a list of the
particle effects belonging to an object (based on patch from jms)
2005-11-06 22:29:49 +00:00
Ken Hughes
a602dcfe5f - JMS's patch which adds GetParticlesLoc() method. I've modified the code
so that it resides in the Effects module instead, with the intent of
  soon merging Effect.c and Particle.c into a single file (and somedat
  removing references to the Effects.Particle submodule)
2005-11-04 20:34:38 +00:00
3f8f0f7aac Silly error string correction 2005-11-03 20:22:29 +00:00
Ken Hughes
eafdcdd4ac -- Bugfix #3335: mesh.remDouble() accidentally performed a mesh fill also
(missing break statement): thanks, Cam!
2005-11-03 00:58:41 +00:00
Ken Hughes
e01e5a4cbf -- Bugfix 3333: BPy method ob.getEuler() was returning PyObject which wrapped
stack-allocated data (thanks, pontus).
2005-11-02 23:28:36 +00:00
15707394d1 Adding Key.ipo as access to ipo data both get and set 2005-10-31 15:53:21 +00:00
Ken Hughes
54659d4a7d -- further clean-up of mesh error handling for update and PutRaw(); add
specific messages for different types of exception errors
2005-10-31 15:08:01 +00:00
Ken Hughes
7040e6c157 -- patch submitted by Johnny Matthews which lets a user get an Ipo curve by
its adrcode in addition to its string name (shape keys don't have fixed
   or unique string names, and they are stored in the key, not the Ipo).
   This will make it easier to later use constants from dictionaries to
   access a curve.
2005-10-31 14:05:47 +00:00
4181b6ec74 Removed key.getChannelIpo() doc. 2005-10-31 02:52:17 +00:00
43ec1ee71a Removed key.getChannelIpo() since it is not proper implementation anymore. 2005-10-31 02:52:14 +00:00
Ken Hughes
227e6b08b2 -- testing a patch which lets Python initialize the site path for Blender
(old code is just "#ifdef"-ed out for now.)

Please give this a try on all platforms and give us feedback on what you
see for your sys.path setting in Blender (run these two lines in text window)

	import sys
	print sys.path
2005-10-30 18:27:24 +00:00
Ken Hughes
4d2de0293e -- fix compiler warning about return "from incompatible pointer type" when
returning Python exceptions.  EXPP_ReturnPyObjError() always returns a
   NULL because Python expects error conditions to return a NULL pointer
   instead of an object.  Since the pointer is cast to a PyObject *, it's
   ugly to use for propagating the errors back in this case, so this fix just
   uses PyErr_SetString() to set the error and return NULL (see the body
   of EXPP_ReturnPyObjError() ).
2005-10-30 14:34:48 +00:00
Ken Hughes
cb9988332a - fix issues in with Mesh_fromNMesh pointed out by Ton earlier; errors from
Python routines should properly be propagated back to give an error as
  intended.
2005-10-30 03:05:54 +00:00
926d5ebdab Error in creating Python dict for new Mesh API.
It was calling PyModule_AddObject() with unassigned pointer. Crashed on
exit here (python 2.3.2). Weird thing was that python 2.3.5 didnt complain

CVSr ----------------------------------------------------------------------
2005-10-28 13:51:08 +00:00
4069604736 Fixed gcc warnings for unused var and unitialiazed vars.
NOTE: I had to fix NMesh.c, Mesh_fromNMesh(), that is a real bad
function... it was returning a Py object as a Mesh (on error).
This is still not really solved (NULL return is not handled).
2005-10-28 10:09:46 +00:00
Ken Hughes
b729020276 - change description of AssignModes from "blah blah" to something meaningful. 2005-10-27 22:07:43 +00:00
Ken Hughes
a9a545d784 Lots of BPy Mesh additions:
- added faces.uvSel attribute: can get/set selection status of UV vertices in
  UV Editor window
- make mesh.faceUV, mesh.vertexUV and mesh.vertexColor writable: users
  can now enable/disable UV faces, vertex colors, "sticky" vertices
- fixed bug with mesh tool methods: before it would only work if an object
  linked to the mesh was selected
- added mesh.quadToTriangle() and mesh.triangleToQuad() methods
- added selected() method to verts, edges, faces; returns list of indices
  of selected items
- mesh.getFromObject() now gets derived mesh data
- ported vertex group methods from NMesh (required change to Object.c)
- ported module dictionaries from NMesh
2005-10-27 19:37:37 +00:00
Ken Hughes
3dbe0f0074 - Bugfix #3271: saveRenderedImage() was corrupting memory while trying to
build the filename (thanks for good bug report, Pablo)
2005-10-27 17:09:20 +00:00
94915fde5f Python API Additions
New
Ipo Drivers access in IpoCurve
key.getChannelIpo(index) returns the ipocurve of a given shape index

Docs included for usage :)
2005-10-26 16:30:50 +00:00
557f951ebc getMarked return change to dict
.
2005-10-25 18:12:27 +00:00
Ken Hughes
edd998c042 -Bugfix #3254: Ipo.addCurve() didn't check if curve already existed before
creating (reported by Toni)
2005-10-25 04:46:49 +00:00
Ken Hughes
233ee5adb7 - documentation updates:
-- add Key module to index page
  -- include cross references for Object.colbits in material descriptions
     within Object, NMesh and Mesh modules
2005-10-21 17:20:54 +00:00
Ken Hughes
9035f0cd25 - Bugfix #3227: throw exception in NMesh if face data doesn't contain 3 or
4 vertices
2005-10-21 13:52:44 +00:00
Ken Hughes
1f1eb8393d - fix bug calculating number of edges to create in mesh.edges.extend()
(thanks to guitargeek for catching)
2005-10-20 15:10:43 +00:00
Ken Hughes
7d325f1ed4 - New additions to Mesh module
- new methods from NMesh (transform, getFromObject, findEdges)
  - new methods for deleting groups of verts, edges and faces
  - new methods for accessing mesh editing tools: fill, flipNormals,
    recalcNormals, remDoubles, smooth, subdivide, toSphere
- Added PVertType to Types module (not my favorite name; any suggestions?)
2005-10-19 21:24:18 +00:00
Ken Hughes
5166a1ee92 - Bugfix #3202: ipo.addCurve() created curve but didn't add to the Ipo
(thanks, lguillaume).  I think we need much more testing of the Ipo
  module following Ton's refactoring.
2005-10-17 03:48:02 +00:00
Ken Hughes
0ea46ec202 - Bugfix #3194: calling curve.appendNurb() with any number of float param
other than 4 or 5 caused segfault (thanks for catching, Cam)
2005-10-16 16:39:11 +00:00
Ken Hughes
6418c07905 - Bugfix #3127: gives Python ability to do "reload()" on Blender Text scripts
(not really a bug, just adding a missing capability)
2005-10-14 17:26:57 +00:00
Ken Hughes
0bafc02ecc - perform typechecking before calling EXPP_check_sequence_consistency
- change experimental methods for Mesh Tools "Subdivide" and "Smooth" to
  object methods.  if compiled, you can use mesh.subdivide() and mesh.smooth()
2005-10-13 20:47:15 +00:00
Ken Hughes
3c568fd3bb - swapped MFace.flag and MFace.mode code; they were reversed (thanks, Cam)
- fixed bug in MFace_getFlags(): was accessing wrong field
2005-10-11 23:18:53 +00:00
5c31e9f2b5 Scripts updated:
- Discombobulator by Evan R and DirectX8 Exporter by Ben Omari.

BPython:
- Crashed Blender while testing discombobulator: obj.setMaterials() was not checking if the passed obj had valid obj->data. If the object had been created and not linked yet to a mesh, a crash would happen when trying to sync ob and me material lists. Now an error is returned. Also made obj.setMaterials accept an empty list, since obj.getMaterials can return that.

Thanks to the script authors for the updated versions and special thanks to Tom (LetterRip) for collecting info about updated and new scripts, sending me updates I had missed, etc.
2005-10-11 19:05:56 +00:00
Ken Hughes
3035625992 - force setResolu() to update all NURBS belonging to a curve 2005-10-11 15:51:27 +00:00
Stephen Swaney
cf620b95d5 Updates and corrections to the BPy doc. Patch #2975
A large chunk of documentation goodness from Campbell Barton (ideasman).
Thanks!

Note that any mispellings, errors, or inconsistencies are due to
my ham-fisted editing.
2005-10-11 15:11:39 +00:00
Ken Hughes
a84a75cfc3 -Bugfix #3174: incorrectly counting number of face vertices 2005-10-11 14:35:43 +00:00
Ken Hughes
0ff2691c5d - Fix compiler errors under MSVC free toolkit (thanks lguillaume) 2005-10-11 13:36:07 +00:00
Ken Hughes
5380db502e - added Mesh.MVert(); can now create 'thick' vertices which don't wrap mesh
- implemented slice operations (get/set) for vertex list; allows script
  writers to manipulate lists of vertices (using 'thick' vertices)
- fixed problem in mesh.faces.extend() which allowed the creation of
  "Eeekadoodle" faces
- added mesh.update() method; (possibly) temporary fix to allow updating DAG
2005-10-11 04:09:08 +00:00
b970eadedf Scripts:
- updating some bundled scripts, thanks to authors Jean-Michel Soler, Campbell Barton and Anthony D'Agostino.

BPython:
- removing wrong fix from BGL.c's glDrawPixels.

note: applied guitargeek's setName patch to Blender.Key, but saw that he updated it with more functionality and assigned to stivs, so I won't commit this old version.
2005-10-11 02:32:58 +00:00
28e585b058 -Another fix for mathutils.anglebetweenvecs()
* test dot before clamping
2005-10-10 19:50:53 +00:00