Commit Graph

102 Commits

Author SHA1 Message Date
a3783d32e0 Added some shortcuts to Mesh
MFace.area
 MFace.cent
 MEdge.length

Updated some scripts that used these.
2006-05-11 10:06:15 +00:00
8f84542c23 Modified mesh to allow writing to normals.
renamed meshPrettyNormals to meshCalcNormals, and it now writes to normals rather then returning a list of vecs.
updated vertexpaint_selfshadow_ao to be a bit more efficient and make use of the above changes.
2006-05-10 12:12:21 +00:00
f81206228c Fixed typo 2006-05-10 03:59:16 +00:00
41623cbdb9 made mesh's getFromObject pick the materials from object or obdata as set by the objects colbits.
its crufty that None of the exports currently export materials correctly, hopefully this will help.
2006-05-10 01:38:02 +00:00
Ken Hughes
4de7589720 Bugfix: mesh.removeVertsFromGroup() caused segfault due to NULL pointer. 2006-05-09 14:17:34 +00:00
Ken Hughes
5f6a5f1b17 ===Python API===
Bugfix: replaced calls to enter_editmode() and exit_editmode(), which would
cause segfaults on scripts run in background mode (discovered by NichG).
2006-05-08 05:37:00 +00:00
Ken Hughes
9874d5c76f ===Python API===
Added activeGroup attribute to Mesh API, to get/set active vertex group for
meshes.
2006-05-02 17:44:44 +00:00
87949e5c67 warnings cleanup for the python project on windows 2006-04-24 15:09:07 +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
Ken Hughes
5f550b4ceb ===Python API===
A bug fix and an enhancement:
   * fixed bug when adding or deleting faces from a mesh which has
     vertexColors; mesh->mcol was not being updated
   * changed edges.extend() and faces.extend() to accept integer vertex
     indices in addition to MVerts; this should make scripts simpler and
     in general make things run faster
2006-03-11 16:00:07 +00:00
Ken Hughes
69d00bccaa ===Python API===
Bugfix: make face and edge .extend() methods check that input vertices are
from the same mesh.  Fixes a bug found by Cam.
2006-02-17 17:50:54 +00:00
ee4c7ef22a Added ability to render Zbuffer to an image.
Just use SHIFT-F3 and save an image.

	Basically all this does is copy the zbuffer to a new Image buffer
	and pass that to the save image function.

Sample output:
	http://www.cs.umn.edu/~mein/blender/kungfu_zbuf255.jpg

	Also thanks to Jesterking for helping me debug dumbness... ;)
	and the nice screenshot.

Kent
2006-02-10 21:10:58 +00:00
Ken Hughes
83ea72de1a ===Python API===
Three more changes for the Mesh module:
(1) Bug fix for UV vertices ("sticky").  me->msticky was not being updated
   when vertices were added or deleted from the mesh.
(2) Vertex, edge and face .extend() methods accept zero-length sequences
   instead of throwing an exception.  (Note that not giving any argument
   is still an error).
(3) Edge and face .extend() methods ignore "invalid" edges or faces which
   have the same vertex twice instead of throwing an exception.  Cam and I
   argued about this for a while... :-)

Ken
2006-02-10 00:08:06 +00:00
Ken Hughes
ccedf6d833 ==Python API==
Bugfix #3849: "break" instead of "continue" caused memory corruption in
faces.extend() if an edge was given in the middle of parameter list.
2006-02-05 19:15:58 +00:00
Ken Hughes
8c333c63a4 Previous commit broke faces.extend() and edges.extend() for single edges
and faces.
2006-02-05 15:43:47 +00:00
Ken Hughes
eb185d7032 ==Python API==
A couple of bug fixes and enhancements:
(1) Setting the UV attributes of a mesh face will create texture faces if
    they are not already defined.  Previously this threw an exception.
(2) Setting the image attribute of a mesh face will also set the TEX bit
    of the face.mode flag
(3) When "sticky" vertices are created with mesh.vertexUV, the color is
    set to white instead of black.
(4) Bugfix #3872: copying the mode attribute of one mesh to another would
    sometimes result in an exception due to unexpected bits being set. I
    still don't know how these other bits are being set, but this patch will
    stop the complaint if they are set.
2006-02-05 07:19:37 +00:00
Ken Hughes
6e1db67cc0 ===Python API===
Bugfix: Hos discovered that recent fixes broke mesh.verts.extend(); it now
accepts three floats again.  Sorry....
2006-01-21 06:21:03 +00:00
Ken Hughes
0fcfd5bd40 ===Python API===
Bugfix #3660:  NMesh.getVertexInfluences() was broken following the changes
to the armature system.  Tron Thomas (kudos) came up with a fix that seems
to perform identically to the old method.  I'm also adding it to the Mesh
module for compatibility.
2006-01-19 15:48:56 +00:00
Ken Hughes
a8cb639f0b ==Python API==
Bugfix #3761: Attempting to set mesh.faceUV=1 when a mesh has no faces
now throws a RuntimeError exception.  Previous behavior was to do nothing.
2006-01-18 06:15:17 +00:00
75aa68e821 ==python api==
clarification of Blender.Mesh.Mode() tip
2006-01-17 09:20:37 +00:00
Ken Hughes
aeffb121c8 ==Python API==
Added Mesh.Modes() function, which allows scripts to get/set the selection
mode settings for meshes.  This was necessary in order for the mesh tools
such as triangulate, remove doubles, etc., to work properly.
2006-01-17 06:18:43 +00:00
Stephen Swaney
14cc1192a3 clean up some warnings in bpy code 2006-01-16 17:55:03 +00:00
Ken Hughes
c18db96f56 Cam Barton discovered the setter for me.faces[i].col was missing. 2006-01-13 17:22:53 +00:00
Ken Hughes
5951b4dda7 Another bug fix for reference counting in extend methods. 2006-01-13 07:11:30 +00:00
Ken Hughes
6ded7d67d1 Clean-up of some reference counting issues with delete() methods. Also
further relax the input types for edge.extend() and face.extend() so that
single lists or tuples are accepted without errors.
2006-01-12 07:51:19 +00:00
Ken Hughes
0ee5c131dc A few Mesh fixes:
* edge and face extend() methods now add edges and faces in the order given
  by their parameters.  Note that if duplicate edges or faces are specified,
  the order is preserved but the dups are removed, so indices won't match.
* allow extend(), findEdges() and faces.uv to accept lists or tuples
* fix bug in mesh.verts.extend() which didn't correctly check argument types
2006-01-11 18:37:47 +00:00
5233f73589 *warnings fixes
- fixes a number of warnings in bpy project
2006-01-03 16:27:34 +00:00
Ken Hughes
3634128841 Two bug fixes for mesh.faces.extend() method; fix a error checking for
duplicate faces in the input list, and also extend texture faces if they are
enabled.
2006-01-01 15:43:34 +00:00
0565d86952 for Mesh_getFromObject made Mesh and Surf types copy the material list to the new mesh.
Still need to do Mball and Text.
Ken- this is fairly straight fwd but if you dont like it - its line 4867 of Mesh.c and 1 block that can be removed.
I tested for memory leaks and correct material user adjustment.
This is realy needed for using getFromObject to export to external rendering engines.
- Hope its ok.
Cam
2005-12-30 09:56:02 +00:00
Ken Hughes
d3338620b7 -- More of Bugfix #3580: Mesh_getFromObject() was not updating key->from
when it duplicated mesh data.

   I'm not thrilled with how I implemented this code, but currently don't
   know a better way.  If someone more familiar with how blender duplicates
   objects and converts things to meshes wants to have a look, it would be
   appreciated.
2005-12-13 18:39:50 +00:00
Ken Hughes
4085cc06a6 -- Calling mesh.verts.extend() on a mesh with vertex groups was not updating
mesh->dvert, eventuallu causing a crash.
2005-12-13 15:36:32 +00:00
Ken Hughes
e67360cb97 Made Mesh verts/edges/faces hashable (as they were in NMesh); this will
make it easier for some scripts to be converted.
2005-12-07 21:12:33 +00:00
Ken Hughes
ea1df5652d -- bugfix: me.subdivide() was declared NOARGS but was expecting an arg,
causing a segfault.  Thanks to Cam for catching it.
2005-11-27 23:15:39 +00:00
Ken Hughes
a86b0af575 -- added an optional "cage" parameter to mesh.getFromObject() to allow
getting cage vertices from geometry objects
2005-11-20 01:07:54 +00:00
Ken Hughes
58edf6b40d -- fix printing of constant dicts
-- remove "TF_" from constant names in M_Mesh_FaceTranspModesDict()
2005-11-19 15:44:43 +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
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
cce655b5e7 - warning fixes
* various warnings the python api is putting out
2005-11-07 19:34:44 +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
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
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
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
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
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
Ken Hughes
5f6dbf846b remove non-standard __FUNCTION__ use 2005-10-04 20:27:25 +00:00
Ken Hughes
ac668ea561 Added Mesh.New() method; can now create new meshes within the module
Changed Object.link() to allow link objects with both BPython-type meshes
Changed Object.getData() to allow retrieving both types of BPython-type meshes

Added new mesh types to Types module
2005-10-04 15:17:27 +00:00
6cb422b886 Update for thin mesh
*warnings fixes
*projectfile update
2005-10-03 20:48:43 +00:00