Commit Graph

31 Commits

Author SHA1 Message Date
59672145a9 Cleanup & goodies for rigging geeks! :)
- PoseMode: Wkey menu, "Flip Left/Right Names". On selected bones, it flips
  the L/R tags in names, and calls the proper code to rename everything
  that's related (constraint targets, bone-childs, etc).
- PoseMode: Shift+S snapmenu: snap cursor to selected now works
- Outliner: select bones now correctly sets 'active' flag for bones,
  updating the UI as well.
  Also made sure you cannot select hidden bones in outliner.
- 3DWindow: in PoseMode/EditMode draws name of active Bone too (with user
  option "Draw active object name" set.
- Added the new Armature/PoseMode options in View3D pulldowns.

Cleanup:

- moved Pose code from editaction.c to poseobject.c
- removed BSE_editaction.h and BSE_editaction_types.h, moved contents of
  it to BIF_editaction.h. One include per C file should be fine. :)
  I know the src/ structure would require more elaborated includes, but
  we don't have that now...
2005-07-27 10:37:20 +00:00
e60291d39c Header file clean up and warning fixes
- Mostly this cleans up the #includes and header files in the python project.
- Warning fixes are mostly casting issues and misc fixes. General warning clean up.
- #include Python.h MUST come as the first include to avoid the POSIX redefine warning in the unix makefiles
- fno-strict-aliasing flag added to makefile to fix a unavoidable type punning warning in types.c
2005-07-18 03:50:37 +00:00
b89035906d Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit

-rewrite and bugfixes
  ----------------------------------
  Here's my changelog:
  -fixed Rand() so that it doesn't seed everytime and should generate better random numbers
  - changed a few error return types to something more appropriate
  - clean up of uninitialized variables & removal of unneccessary objects
  - NMesh returns wrapped vectors now
  - World returns wrapped matrices now
  - Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
  - Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
  - Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
  - Removed memory allocation (unneeded) from all methods
  - Vector's resize methods are only applicable to new vectors not wrapped data.
  - Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
  - Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
  - Euler.rotate does internal rotation now
  - Slice assignment now works better for all types
  - Vector * Vector and Quat * Quat are defined and return the DOT product
  - Mat * Vec and Vec * Mat are defined now
  - Moved #includes to .c file from headers. Also fixed prototypes in mathutils
  - Added new helper functions for incref'ing to genutils
  - Major cleanup of header files includes - include Mathutils.h for access to math types
  - matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
  - Matrix() with no parameters now returns an identity matrix by default not a zero matrix
  - printf() now prints with 6 digits instead of 4
  - printf() now prints output with object descriptor
  - Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
  - Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence.  index cannot go above the row size of the matrix.
  - slice operations on matrices work with sequences now (rows of the matrix) example:  mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
  - slice assignment will no longer modify the data if the assignment operation fails
  - fixed error in matrix * scalar multiplication
  - euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
  - Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
  - Quats can be created with angle/axis, axis/angle
  - 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
  - vec *quat / quat * vec is now defined
  - vec.magnitude alias for vec.length
  - all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
  - these methods have been deprecated (still functioning but suggested to use the corrected functionality):
    * CopyVec() - replaced by Vector() functionality
    * CopyMat() - replaced by Matrix() functionality
    * CopyQuat() - replace by Quaternion() functionality
    * CopyEuler() - replaced by Euler() functionality
    * RotateEuler() - replaced by Euler.rotate() funtionality
    * MatMultVec() - replaced by matrix * vector
    * VecMultMat() - replaced by vector * matrix
  -  New struct containers references to python object data or internally allocated blender data for wrapping
  * Explaination here:  math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
  *    otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
28a1e8277b Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs

A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;

- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes

Armatures;

Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!

Important to note is;

1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.

- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.

TODO NOW;

- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.

TODO LATER;

We now can do loadsa new nifty features as well; like:

- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...


Bugfixes;

- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change

-Ton-
2005-07-03 17:35:38 +00:00
Stephen Swaney
ece00ff04a Roll back changes from Big Mathutils Commit on 2005/05/20. 2005-05-22 17:40:00 +00:00
7586eb28a1 -rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence.  index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example:  mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
  * CopyVec() - replaced by Vector() functionality
  * CopyMat() - replaced by Matrix() functionality
  * CopyQuat() - replace by Quaternion() functionality
  * CopyEuler() - replaced by Euler() functionality
  * RotateEuler() - replaced by Euler.rotate() funtionality
  * MatMultVec() - replaced by matrix * vector
  * VecMultMat() - replaced by vector * matrix
-  New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here:  math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
*    otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-05-20 19:28:04 +00:00
c78e44cdc5 big warning hunt commit
lot of casts, added prototypes, missing includes and some true errors
2005-03-09 19:45:59 +00:00
34977b8937 BPython:
- applied Campbell Barton's patch for access to Oops location and selection of materials, mesh data and objects, slightly modified. Thanks, Campbell;
- got rid of warnings in many files, hopefully not introducing any other during the process.  Mostly this was done: 1) new EXPP_incr_ret_True/False functions were added and used instead of "Py_INCREF(Py_True/False); return Py_True/False;".  Currently at least the functions use the fact that PyTrue/False == 1/0 and use 1 and 0 to avoid the warnings. 2) Filling of certain types structs got 0's added for all not defined data and methods.  This is surely Python version specific, since these structs can change size and content at each major version number Python update.
2005-02-09 15:53:35 +00:00
Stephen Swaney
c153a593ac bugfix: #2117 Overflow in Armature.Bone.setName()
contributed by Joilnen B. Leite (pidhash).
2005-01-25 06:05:17 +00:00
Stephen Swaney
0fdc0ce297 Another step in the Big Bpy Cleanup.
- move static declarations and data definitions out of headers.
  the BGL module still need cleaning.

- move declarations out of modules.h and into appropriate .h files.
  modules.h still exists as a container for the few modules that
  need to #include almost everything.

- all files now have a $Id tag and have been formatted by indent

there are no changes to executable code.

pre-commit versions are tagged with bpy-cleanup-pre-20041007
for the sake of paranoia.
2004-10-07 19:25:40 +00:00
Stephen Swaney
a509b8adc9 Another round in the Great BPy Cleanup:
Run everything thru indent to cleanup spaces vs tabs.
Clean up some of the comments by hand.
BGL.c was not touched due to all that macro wackyness.

There are no functional changes to the code.
Pre-indent versions of source are tagged with
tag bpy-cleanup-20040925 , just in case.
2004-09-25 20:30:40 +00:00
Stephen Swaney
a2ea84903e One small part of the Great Bpy Code Cleanup.
Add cvs $Id tag to files
2004-09-18 18:47:03 +00:00
1308786974 - added Boneclass support
- ability to get a bonespace/worldspace bone matrix
- get ik flag
- some tweaking to matrix updates for addBone()
2004-05-25 02:48:02 +00:00
f141aed9dc - bugfix #1197 (New Bone.parent/child Access Destructive)
- a major redo of the Bone module
- BPy_Bone structs are separated into Bone data and python vars. This is necessary for the correct memory allocation of bone data between python and the global armature list.
2004-05-11 08:26:44 +00:00
f54160ca2f - PyInt_AsLong() was called on a possibly NULL object, this may be
a checked error but is no good anyway
 - Bone_dealloc free'd Blender's actual copy of the Bone! AGH!!!!
 - On syntax errors the python global dictionary was being free'd
    twice. AGH!!! again!

Can someone from the Python team please audit this.
2004-05-05 03:22:22 +00:00
a6a32cf504 -NLA module added
-ability to set poses for the armatures - allows for keyframing armatures
-adds support for actions/actionchannels
-additional checking for addBone and clear parenting
-moved getActionIpos from object module to NLA module
2004-04-19 06:57:41 +00:00
e2bed35011 - parenting checks for bone additions to armature
- update to addBone parenting transform code
- hide/unhide bones
- draw axes/draw names
- clear parenting and clear children from bones - removes childbase links from bone and set as root or remove parenting and set as root
2004-04-14 23:42:58 +00:00
2410de683f - quaternion support for bone type
- get/set bone weighting
2004-04-06 01:01:11 +00:00
136b66c19f - getBones() fixed - returns all armature bones including children 2004-04-05 04:17:01 +00:00
32b0677d96 - added support for adding/parenting bones to armatures
- fixed getArmatureIpo compiling error
2004-04-04 08:34:43 +00:00
Stephen Swaney
79ecc08b89 more housekeeping. move static declarations and definititions out of .h files.
tidy up initializers and  c++ style comments.
2004-03-31 07:40:08 +00:00
5d8c7e4537 BPython:
- local tentative fix for BLI_gethome(), which returns '.blender' appended only
    on some Windows systems.  Created bpymenu_gethome() to check and
    add '.blender' if needed.
- changed name: .Bpymenus to Bpymenus as suggested by GSR
- trivial additions:
    Object module: added methods .set/getSize
    Armature/Bone module: bone.set???() methods now accept both n
    floats or a list of n floats: fff or (fff).  All these additions were requested
    by user Carlos Lopez (Klopes).
- New doc: for module Registry.
2004-01-23 02:59:54 +00:00
d423c0828f Exppython:
- Added "Radio" to Material modes
- Fixed bug in bone.getParent (bug report on blender.org py forum)
- Added more types to object.shareFrom (method to share obdata)
- Added nmesh.get/setMaxSmoothAngle and nmesh.get/setSubDivLevels
- Updated NMesh doc
2003-10-26 06:03:18 +00:00
683c322b0e Exppython:
- Fixed bug #399:
    Old bug on NMesh: segfault on NMesh.Face(vertexlist).
- Fixed bug #433:
    "Typo" on Armature: bone's setQuat method was changing bone->head, not
    bone->quat.
2003-08-05 03:45:31 +00:00
fe07b232b7 * got rid of a warning in editipo.c:
changed "get_ipo(key, ..." to "get_ipo((ID *)key, ..." in line 107.
* changed insert_meshkey(Mesh *me) to insert_meshkey(Mesh *me, short offline):
   To call this function from a script, so that it doesn't pop the
   "relative / absolute" dialog window when the "offline" arg is non-zero.

Exppython:

* NMesh module:
   - Added method NMesh.addMaterial(mat) to the NMesh module:
   alternative safer (aka slower) way to add materials.
   - Added optional arg to NMesh_update():
   if given and equal to 1, the mesh normals are recalculated.
   - Fixed NMesh.getVertexInfluences: it was segfaulting when a NULL bone was
   linked to the vertex.  Thanks to Jiba on the bf-python mailing list for
   bug report and sample .blend file.  Also made this method give an IndexError
   when the vertex index is out of range.
* Material module:
   Added specR, specG, specB vars for compatibility with the 2.25 API.
   Pointed by Manuel Bastioni.
* Image module:
    Exposed image width, height and depth parameters.
    From a suggestion by jms.
* BPython Ref Doc:
  - Small updates to reflect the above additions.
  - Added info for the Bone type in the Armature doc.
2003-07-30 21:15:41 +00:00
aa820ec420 Exppython:
- Continued getting rid of print methods and updating repr ones:
    Needed to fix crashes on Windows >= 98 systems.
- Found and fixed a few small memory leaks in EXPP_interface, related to
  execution of script links.
2003-07-05 01:18:41 +00:00
eaf1cdd383 - More renaming all around to follow our conventions
- Implemented partially Blender.Sys
- Worked on issues related to sys, path
- Took away most "debug" printfs
2003-06-28 07:38:21 +00:00
6cc45538ef * Small changes in many files:
-  Trying to fix linking problems in OSX;
-  Making module .Get functions behave like the ones in Blender 2.25 - 2.27
   (Guignot pointed the incompatibility);
-  Included more types to Blender.Types;
-  Found by luck and corrected two bugs that were making Blender crash;
-  Added/updated some simple functions.
2003-06-12 04:51:50 +00:00
864e5640f7 * Applied a small fix to a bug reported by Guignot:
When a script that used setAttr for Camera Data objs (the bug also
    affected some other modules) was executed multiple times, Blender
    would crash after, let's say, the first 5 or 6 tries.  Problem, as
    Guignot pointed, was with reference counting.  Should be ok now, all
    affected modules were fixed.
* The Scene module is now "complete" (= 2.25).
* Made some necessary updates to Object and NMesh.
2003-06-09 04:01:48 +00:00
a127b38760 * Fix compilation errors on Windows hopefully. Implemented the suggestion done
by Aphex - thanks.
* Added the doc strings to the Object module.
* Added more functionality to the Object module.
2003-06-02 20:15:50 +00:00
b13c0705d3 * Module Curve updated:
Jacques Guignot (guignot) sent updated files for his Curve module.
* Module Armature (and its submodule Bone) added:
    Jordi Rovira i Bonet (bandoler) contributed both modules, which
    are NEW additions to Blender Python, not available in Blender 2.27.
* Added function to NMesh.c:
    Jordi again.  He added the function NMesh_getVertexInfluence().
2003-05-29 04:00:35 +00:00