Commit Graph

613 Commits

Author SHA1 Message Date
9459f7c1be added getting names of shapes/KeyBlocks to bpy api so mikasaari can continue with his lipsync script (where names of phonemes are as names of shapes/keyblocks). 2005-10-03 14:28:08 +00:00
cdb8700ddc - add support for Python Buffer()s of type DOUBLE 2005-10-02 17:09:11 +00:00
Mika Saari
a6bd07d10f Text3d.c NULL pointer check added to get rid of MEM_freeN warning. 2005-09-29 19:25:12 +00:00
Mika Saari
83b2d267b5 cu->strinfo reallocation added to Text3d.c, so when setText is executed
the strinfo is reallocated to include strlen(cu->str) amount of free memory
2005-09-29 19:03:53 +00:00
Alexander Ewering
76a57eb82f Fix Python API to correctly create Text3D objects. This is just a
temporary fix (duplicating code again), the *real* fix would be to once
make one central function to create and init a text object for all
places...

I also tried to introduce compatibility code to be able to load old files
with broken text objects (cu->tb == NULL due to missing init code).

Hope it works :)
2005-09-29 15:46:06 +00:00
Stephen Swaney
c4b8a431bc fix Curve.update() method to use new DAG features. 2005-09-29 07:05:00 +00:00
96253376e7 Recommitted this commit yesterday, was apparently done in the wrong
directory... so the slowdown was still evident!

Maintenance commit;

  - *Giant* speedup for LMB frame-dragging in ipo/action/nla windows. It was
    calling a routine that accessed frontbuffer drawing.... a very old patch
    for SGIs even! :)
  - Prepared code for support of unlimited Shape keys
  - Curve objects didnt draw correct for selection-outline option
2005-09-27 21:52:04 +00:00
Stephen Swaney
224e4d747f set object->recalc flag when we change object's loc, rot, etc.
fix for problems with frame change scene scriptlinks.
2005-09-27 20:56:39 +00:00
af431c5a68 -fix for angleBetweenVecs
* adds a test to check for zero-length vectors
2005-09-27 18:41:39 +00:00
39a243f8d2 Refcount fixes
* fixes posible reference count issues with mathutils
* mathutils classes should no longer memory leak
2005-09-27 17:03:28 +00:00
85d295f106 added the method saveRenderedImage to the RenderData object
- should allow users to render a filename.extension to the render path
Example:

import Blender

s = Blender.Scene.GetCurrent()
r = s.getRenderingContext()
r.setRenderPath('C:\\')
r.render()
r.saveRenderedImage('myRender.jpg')
Blender.Scene.Render.CloseRenderWindow()
2005-09-26 22:00:39 +00:00
f1ddb77a48 - added some equivalency testing for vector classes
>, >=, <, <= test vector magnitude
==, != test vector values 'within epsilon' :)
- inspired by ideasman
2005-09-26 20:11:13 +00:00
43d2904037 Cleanup and new features for vertex keys.
User doc: http://www.blender3d.org/cms/Shape_Keys.678.0.html

- The mixed use of "Vertex Key","Key" or "RVK" in Blender was a bit
confusing. Also a 'vertex key' assumes keys per vertex, which actually is
only a single key for the entire shape. The discussions on blender.org
forums all mentioned "Shape" or "Blend Shapes", which I think is an OK
name for a "Vertex Key" in the UI. :)

- Most work was code spaghetti cleanup. Doing shape-keys now nicely goes
via the depgraph and DerivedMesh. That then allows to have different
shapes per object, with the new "Pin" feature.
Objects now define what Shape is shown (ob->shapenr)

- Added a Shape Panel in the Edit buttons with the various options

- Fixed a lot of issues in the IpoWindow, with drawing the channels.
For example, deleting a key-line there caused the entire Relative option to
go wrong, same for moving the lines up/down.
Changing key-line order now reflects in order of channels. The active
Shape is drawn more clear now too.

- Noticed it doesnt work yet for curves/lattice. Need modifier advise!
2005-09-26 15:34:21 +00:00
9656e8be02 Theeth's mathutils patch
- adds intersections for lines
- triangle area
- tracking quaternion from vector
- some helpful normal calculators
2005-09-26 15:06:28 +00:00
b6ecdb8c35 Project file update for elbeem
Warning clean up of python project
2005-09-26 14:46:14 +00:00
8b7c690a0b - assorted warning fixes (signedness, float->double)
- added decimate,boolean modifier copydata methods
2005-09-24 16:02:56 +00:00
Stephen Swaney
94aa843626 Patch #3099 - bugfix for #3097.
a little tweak for arg parsing.

Contributed by Ken Hughes.  Thanks!
2005-09-24 15:28:59 +00:00
d9fa984f35 More properly coded version for adding edges... now only do_versions()
reads from the old mface->edcode flag to set edge drawing.

ALso; added a pointer check in draw_mesh_object(), here the derivedmesh
gives NULL on reading regression file lostride.blend. Zr needs to check!
2005-09-22 17:52:41 +00:00
Stephen Swaney
5bac916e83 Part of Bpy Cleanup: change attribute access to use tp_getset.
for these modules.  Adds some new convenience funcs to gen_utils.

This is internal change only and presents little change to the
BPy  API except for cleanup of some inconsistencies.

A big contribution from Ken Hughes.  Thanks!
2005-09-21 19:48:40 +00:00
2cb24cefb2 =bpy beztriple: finally got the mem. management right with the help of khughes. 2005-09-14 13:59:43 +00:00
4d79ac3193 Just a little addition to docs based on a discussion on irc. 2005-09-14 11:04:13 +00:00
290ae52d81 Memory management flag to behave better, as hinted by Ken Hughes.
Still not good, i.e. getting these when quitting: Error Totblock: 4
new bpytriple len: 60 0x8889bdc ... 'cause nothing frees them..

Changed the loop that parsed input args to PyArg_ParseTuple to have
support for passing ints from Python too as the floats that are the
coordinates. Didn't find PyInt_AsFloat and figured that this is an ok
way anyhow.

Changed the default handle mode from AUTO to ALIGN, which is the same
as in UI and more useful at least for me.

Little sanifying in CurNurb (this was done with Ton).
2005-09-14 10:53:51 +00:00
Stephen Swaney
a4ca8267cf bugfix: [ #3009 ] possible memory leak in Mathutils
fixed by patch [ #3013 ] patch for memleak in vector
Submitted By: Ken Hughes (khughes)
2005-09-12 06:18:45 +00:00
Stephen Swaney
24ee7278b9 patch #3011 ] update to curnurb.setFlagU doc, added set and get for Taper
Contributed by Toni Alatalo (antont).

Support for Taper Objects for Curves.
Code for curnurb.setFlagU() method not changed as per discussion on
bf-python mail list.
2005-09-12 06:07:19 +00:00
f20f4e4307 Bug fix #3033
Using "make parent armature with creating vertex groups" option gave
corrupted memory when one or more bones had the "Deform" option not set.
Was caused by old boneclass SKINNABLE variable. To end this confusement,
removed this define from code.

Note for future Armature tool coders; don't use this bonelooper
functionality. Operations in Object mode for armatures should use the
Pose Channels, which is a simple ListBase to go over. I have to recode
the 'create vertexgroups' still...
2005-09-11 10:12:31 +00:00
039a8c95f3 BPython:
- Pontus Lidman contributed a new module: Blender.Key + access to key objects from NMesh, Lattice and Curve + docs (thanks and sorry for taking so long to check/commit the patch!)

- Allowing EVENT spacehandlers to call the file selector (scriptlinks in general are not allowed, but this special case should be able to). Requested by Paolo Colombo (thanks!)

- tiny doc update (Ken Hughes pointed an error in the space handlers example)

I didn't have time to update the Key module to follow the current bpython design, will do that later and also test it better than I did.
2005-09-09 01:31:10 +00:00
Chris Want
5dd3bfdb18 MEM_freeN() and MEM_mallocN() should not have been redeclared in this
file.
2005-08-29 02:47:55 +00:00
85efe767f0 Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...

Here's how IK works now;

- IK chains can go all the way to the furthest parent Bone. Disregarding
  the old option "IK to Parent" and disgregarding whether a Bone has an
  offset to its parent (offsets now work for IK, so you can also make
  T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
  whether a Bone is directly connected to a Parent Bone, or not.
  In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
  chain. This can be any Parent of the IK tip (where the IK constraint is).
  By default it goes all the way, unless you set a value for the new IK
  Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
  same Bone, and when there's a branched structure.
  Multiple IK's on a single chain (no branches) is still executed as usual,
  doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
  share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
  Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
  in case there's a Tree IK structure. These weights cannot be set to
  zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
  Of course, the new features won't show in older Blender binaries! :)

Other changes & notes;

- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
  to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
  name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
  connected (ALT+P had already "Disconnect").

On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
Stephen Swaney
adc1d7137a patch #2911 - tp_getset for Lamp module.
A nice juicy chunk of new style attribute handling from Ken Hughes.

Thanks, Ken.
2005-08-27 18:44:56 +00:00
Chris Want
bc3f228bc9 Variable was defined in a header file (constant_Type), resulting in
'multiply defined symbol' warning on IRIX for every file that
included that file. Moved to a C source file.
2005-08-23 22:12:06 +00:00
Stephen Swaney
24c8bcf884 bugfix: #2924 Bugs in api2_2x/Material.c
- BPy_Material_methods[] "setFilter" calls Material_setFresnelMirrFac()
 - Material_setSpecSmooth() should be setting param[3], not param[2]

Contributed by Ken Hughes.  Thanks!
2005-08-21 15:16:16 +00:00
Stephen Swaney
bb5ae49992 A large collection of fixes from Ken Hughes including:
- corrections to constants
 - parameter type checking
 - correct use of METH_VARARGS vs METH_NOARGS
 - return objects instead of strings in Scene.getChildren() as per doc.
 - correct logical operators

Thanks, Ken!
2005-08-21 15:00:17 +00:00
7804860cf6 - added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
 - change all Mesh's to have ->medge now. This is forced by make_edges
   on readfile, and in the various exotic important routines, and on
   conversion back in python.
 - make python NMesh structure always have medges now (needs testing)
 - with above two changes it is guarenteed that mf->v3 is never ==0
   in main blender code (i.e., all MFace's are actually triangles
   or quads) and so I went through and removed all the historic tests
   to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
 - removed MEdge edcode flag, no longer needed
 - added experimental replacement for edge flag system

Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.

NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.

To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
2005-08-21 07:19:20 +00:00
a30740c196 - convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
 - dropped convertToDispListMeshMapped (whew, glad of it too)
 - added DerivedMesh drawMappedFaces function
 - dropped EM suffix for DerivedMesh functions, it was neither
   particularly correct nor descriptive
 - converted test_index_mface to test_index_face that also corrects
   MCol and TFace. Good thing we had three versions of this routine,
   you never know when one might burn down.
 - removed flipnorm_mesh, not used anymore (and was incorrect to
   boot)

 - Getting face select to work with modifiers turned out to be much
   more complicated than expected. Reworked mapping architecture for
   modifiers - basically elements in a DispListMesh are now required
   to be stored in an order that corresponds exactly to original
   ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
   that is set on each element that is set on the first derived element
   of each original element. I can't say the code to follow these
   requirements for subsurf is particularly transparent, but on the
   upside it is a reasonably consistent and simple system that is memory
   efficient and allows keeping the DispListMesh structure.

 - rewrote mirror modifier to be simpler/conform to new requirements
   for mapped DispListMesh structure. This also means that mirror interacts
   much better with incremental subsurf calculation (it used to recalc
   one entire side on any topology change, now it generally avoids that).

 - added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
   functions to handle mapping indices back into appropriate EditMesh
   structures.
 - bug fix, make edges didn't recalc object data
 - bug fix, initial image assignment to TFace's didn't recalc object data

 - new feature, added circle select support for FACESELECT
 - bug fix, creating new faces in editmode duplicated the TFACE active
   flag - but there should only be one active tface
 - bug fix, possible crash when deleting all faces in faceselect mode
   on mesh with tfaces...

Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
c8a5887daa Forgot hidden flag update in this file... 2005-08-19 12:39:43 +00:00
8b060dd5ad - update to constant.c
- give it the key/items interface
  - creates some factory functions for const generation
- genutils methods
  - method for getting module constants
  - method for throwing errors with a print string
- updates to function names
- clean up interpreter launch a bit
2005-08-17 14:26:00 +00:00
2abd79b491 - readded DL_VERTS type to store lattice deformed verts
- new feature, twiddled with lattice resizing to try to maintain
   existing vertex changes... much nicer than just resetting the
   lattice if you decide you need more detail in the lattice.
 - modifiers work with lattices now. yes, that does mean you
   can make a chain of lattices effecting each other 8 miles
   long.
 - some cleanup of softbody code, was rather splintered and call
   path was twisted and confusing. reworked main object step
   routine to do things in a more obvious and consistent manner
   and without duplicate code
 - added ob->softflag OB_SB_RESET instead of sbObjectReset
   call
 - modifier changes reset softbody now
 - moved curve_getVertexCos/curve_applyVertexCos into curve.c
 - update curve modifier eval to work with virtual modifiers
 - update modifier apply to work with curves/surfs
 - update make parent to also recalc object data

NOTE: Although you can turn SB on for curve/font objects at the
moment it doesn't really work because they call deform in
multiple steps and this confuses SB. Not sure how to deal with
atm.
2005-08-15 10:30:53 +00:00
93aeb6b318 - added make_orco_curf, even does keys!
- removed {lattice,curve}_modifier functions
 - changed render code to use displist for curve rendering
   instead of making its own. required adding a bevelSplitFlag
   field to DispList. I also fixed the bevel face splitting
   which did not work correctly in many situations.
 - changed so all curve data creation happens in makeDispListCurveTypes,
   includes making bevel list and filling polys
 - changed render code to use displist for surface rendering
 - removed Curve.orco variable, built as needed now
 - removed stupid BLI_setScanFill* functions... why use a function
   argument when you can use a global and two functions! Why indeed.
   (this fixed crash when reloading a file with filled curves and
   toggling editmode)
 - bug fix, setting curve width!=1 disabled simple bevel for no
   apparent reason
 - cleaned up lots and lots of curve/displist code (fun example:
   "if(dl->type==DL_INDEX3 || dl->type==DL_INDEX3)"). Hmmm!
 - switched almost all lattice calls to go through lattice_deform_verts,
   only exception left is particles
 - added DBG_show_shared_render_faces function in render, just
   helps to visualize which verts are shared while testing (no
   user interface).
 - renamed some curve bevel buttons and rewrote tooltips to be
   more obvious
 - made CU_FAST work without dupfontbase hack

Also by the way I wrote down some notes on how curve code
works, nothing spiffy but it is at:

http://wiki.blender.org/bin/view.pl/Blenderdev/CurveNotes
2005-08-14 06:08:41 +00:00
Stephen Swaney
9e6ad3dffc bugfix #2931 crash if $HOME not set
unchecked pointer returned from BLI_gethome().
2005-08-13 17:20:46 +00:00
7b1dcf4c42 - readded Subsurf "optimal" edge drawing/rendering
- added ME_EDGERENDER flag, barely changes things atm except makes
   sure plain meshes with FasterDraw/etc set still render all edges.
   The edge drawing system needs a bit of a revamping - it is a cool
   feature but could use several improvements:
     (1) The algorithm could be better in choosing the best edges to
         draw.
     (2) The drawflags should interact well with modifiers. It is wierd
         to have a large grid with a deformer that draws no edges because
         flags are only calculated based on base mesh.
     (3) Drawflags should not be destroyed by editmode. Better design
         would be a "Draw % of edges" button.

   Of course, could also be the feature is not worth it and we
   should just drop. Feel free to comment if you have an opinion.
2005-08-12 21:55:50 +00:00
5afdfc6ac1 - remove some silly array copying code for nurb displist generation
- converted dl->flag to use consistent defines for cyclic U/V
2005-08-11 22:27:53 +00:00
841ddb4680 A couple of small fixes...
I removed config.h code from the files that had them.
effect.c had nested /* so cleaned that up...

added a newline to vector.c to shut gcc up ;)
buttons_editing.c had a possible unintalized var (height) so I gave
it a default value.

removed an unused var i in interface_draw.c
removed an unused var mti in outliner.c

in BL_SkinDeformer.cpp
commented out a call to bDeformGroup->data which no longer exists so it
compiles again.

Kent
2005-08-11 16:39:51 +00:00
76d2f0da9e - couldn't help myself, got distracted working on something else and
wondered what these silly data pointers in MDeformVert were for.
   Turns out they aren't even need! Just taking up extra memory and
   space and confusing the armature deform algorithm. Naturally I
   had to clean things up. Sorry Ton.

   Deform weights are still stored in a pretty expensive and unnecessary
   way, probably use about twice as much memory as needed, and do
   way too many memory allocs.
 - moved armature_deform_verts into armature.c
 - some python code accessed the MDeformWeight data pointers, but
   did so in a completely wrong way, I am positive this code could
   never have worked (or maybe things changed during tons refactor),
   regardless it wouldn't work now... will test later.
2005-08-11 06:44:32 +00:00
ac3ed0f92a - switch to using softbody modifier, controls enabling but does not have
variables, these are still in same place. enable button automatically
   makes/enables modifier.
 - changed hook to hook modifier conversion to happen on direct link,
   required to make sure we don't forget to free any memory for files
   saved with 2.38 that have hooks.
 - update modifier interface to enforce modifiers with the require-original-
   data flag to not move beyond deforming modifiers.
 - enforce only one softbody modifier allowed

NOTE: Once again, no modifier stack for lattice yet means softbody for
lattice does not work atm.
2005-08-11 02:23:52 +00:00
Stephen Swaney
eb64e304b4 Patch #2758 Update of image module.
New Image methods from Austin Benesh:
- getPixelI(x, y)
- getMinXY()
- setPixelF(x, y, [r, g, b, a])
- setPixelI(x, y, [r, g, b, a])
- save()

sorry for the delay.
Thanks.
2005-08-10 17:50:18 +00:00
1d08915f45 ideasman fix that epydoc compile for it
.
2005-08-10 13:36:40 +00:00
c192b80b17 Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.

 - added DerivedMesh foreach functions to iterate over mapped
   verts/edges/face centers. These replaced some of the drawing
   functions and are more general anyway. Special edge drawing
   functions remain for performance reasons.
 - removed EditFace xs, ys fields
 - added general functions to iterate over screen coordinates of
   mesh/curve/lattice objects
 - removed all calc_*verts* functions that were used for storing
   screen coordinates in objects. they were recalc'd on the fly
   for most situations anyway, so now we just always do that.
   calc_*verts_ext was one of those calls that did dirty things
   deep down in the callstack (changing curarea and poking at
   matrices)
 - rewrote all vertex level selection routines (circle, lasso, bbox)
   and closest vertex routines (rightmouse select) to use the new
   system. This cleaned up the selection code a lot and the structure
   of selection is much easier to see now. This is good for future
   work on allowing modifiers to completely override the selection
   system. It also points out some discrepancies in the way selection
   is handled that might be nice to resolve (mesh vertex selection has
   fancy stuff to try to help with selecting overlapping, but it only
   works w/o bbuf select, and curves/lattices don't have at all).
 - had to remove ton's code to move Manipulator to cage location, this
   is not reliable (can come up with a different method if requested)
 - as it happens BezTriple.s and BPoint.s are basically available to
   be removed, just need to rewrite editipo code that still does
   background calc of screen coordinates
 - MVert.{xs,ys} are still around because they are abused in some places
   for other info (not sure if this is safe actually, since they are
   short's and the mvert limit went up).

And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
ebd83b9bc4 _updates and warning fix_
* fixed a few warnings in the python project
* added timeline to py project
2005-08-07 12:09:50 +00:00
8da5df8887 - add allowShared argument to DerivedMesh.convertToDispListMesh to allow returned
DLM to share data from DerivedMesh (reduces some copying/memory allocation)
 - added displistmesh_copyShared function to copy a DLM but not duplicate any
   internal data
 - changed crease drawing to use DerivedMesh functions... this means varying
   edge width style of creases had to go, I replaced by using varying color to
   show crease weight instead. Don't think this is a big loss since the subsurf
   result gives you a much better indication of the crease weight anyway.
 - bug fix in mirror modifier, didn't copy edge creases from editmesh correctly
2005-08-07 02:30:29 +00:00
1b0cd9340d doc to bpy TimeLine support
.
2005-08-05 18:02:49 +00:00