2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version. The Blender
|
|
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
|
|
* about this.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2003-12-24 11:44:57 +00:00
|
|
|
#include <math.h>
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#include "nla.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_arithb.h"
|
|
|
|
|
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_action_types.h"
|
|
|
|
#include "DNA_curve_types.h"
|
2004-01-27 06:08:37 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
#include "BKE_action.h"
|
2003-10-21 13:22:07 +00:00
|
|
|
#include "BKE_anim.h" // for the curve calculation part
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_armature.h"
|
|
|
|
#include "BKE_blender.h"
|
|
|
|
#include "BKE_constraint.h"
|
|
|
|
#include "BKE_object.h"
|
|
|
|
#include "BKE_ipo.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_library.h"
|
|
|
|
|
|
|
|
#include "blendef.h"
|
|
|
|
|
2002-11-25 12:02:15 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
#endif
|
2005-03-09 19:45:59 +00:00
|
|
|
|
|
|
|
/* used by object.c */
|
|
|
|
void Mat4BlendMat4(float [][4], float [][4], float [][4], float );
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Local function prototypes */
|
|
|
|
|
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
|
|
|
/* ********************* Data level ****************** */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
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
|
|
|
void free_constraint_data (bConstraint *con)
|
|
|
|
{
|
|
|
|
if (con->data){
|
|
|
|
switch (con->type){
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
|
|
|
MEM_freeN (con->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_constraints (ListBase *conlist)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
|
|
|
|
|
|
|
/* Do any specific freeing */
|
|
|
|
for (con=conlist->first; con; con=con->next)
|
|
|
|
{
|
|
|
|
free_constraint_data (con);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Free the whole list */
|
|
|
|
BLI_freelistN(conlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_constraint_channels (ListBase *chanbase)
|
|
|
|
{
|
|
|
|
bConstraintChannel *chan;
|
|
|
|
|
|
|
|
for (chan=chanbase->first; chan; chan=chan->next)
|
|
|
|
{
|
|
|
|
if (chan->ipo){
|
|
|
|
chan->ipo->id.us--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_freelistN(chanbase);
|
|
|
|
}
|
|
|
|
|
|
|
|
void relink_constraints (struct ListBase *list)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
|
|
|
|
|
|
|
for (con = list->first; con; con=con->next){
|
|
|
|
switch (con->type){
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_NULL:
|
|
|
|
{
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
bActionConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data;
|
|
|
|
data = con->data;
|
|
|
|
|
|
|
|
ID_NEW(data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void *copy_constraint_channels (ListBase *dst, ListBase *src)
|
|
|
|
{
|
|
|
|
bConstraintChannel *dchan, *schan;
|
|
|
|
bConstraintChannel *newact=NULL;
|
|
|
|
|
|
|
|
dst->first=dst->last=NULL;
|
|
|
|
duplicatelist(dst, src);
|
|
|
|
|
|
|
|
for (dchan=dst->first, schan=src->first; dchan; dchan=dchan->next, schan=schan->next){
|
|
|
|
dchan->ipo = copy_ipo(schan->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return newact;
|
|
|
|
}
|
|
|
|
|
|
|
|
bConstraintChannel *clone_constraint_channels (ListBase *dst, ListBase *src, bConstraintChannel *oldact)
|
|
|
|
{
|
|
|
|
bConstraintChannel *dchan, *schan;
|
|
|
|
bConstraintChannel *newact=NULL;
|
|
|
|
|
|
|
|
dst->first=dst->last=NULL;
|
|
|
|
duplicatelist(dst, src);
|
|
|
|
|
|
|
|
for (dchan=dst->first, schan=src->first; dchan; dchan=dchan->next, schan=schan->next){
|
|
|
|
id_us_plus((ID *)dchan->ipo);
|
|
|
|
if (schan==oldact)
|
|
|
|
newact=dchan;
|
|
|
|
}
|
|
|
|
|
|
|
|
return newact;
|
|
|
|
}
|
|
|
|
|
|
|
|
void copy_constraints (ListBase *dst, ListBase *src)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
|
|
|
|
|
|
|
dst->first= dst->last= NULL;
|
|
|
|
|
|
|
|
duplicatelist (dst, src);
|
|
|
|
|
|
|
|
for (con = dst->first; con; con=con->next) {
|
|
|
|
con->data = MEM_dupallocN (con->data);
|
|
|
|
/* removed a whole lot of useless code here (ton) */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* **************** Editor Functions **************** */
|
|
|
|
|
|
|
|
char constraint_has_target (bConstraint *con)
|
|
|
|
{
|
2003-11-23 20:28:35 +00:00
|
|
|
switch (con->type){
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
bActionConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data = con->data;
|
|
|
|
if (data->tar)
|
|
|
|
return 1;
|
|
|
|
}
|
2003-11-23 20:28:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-16 01:14:18 +00:00
|
|
|
// Unknown types or CONSTRAINT_TYPE_NULL or no target
|
2003-11-23 20:28:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
Object *get_constraint_target(bConstraint *con, char **subtarget)
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
2004-09-05 20:21:16 +00:00
|
|
|
/*
|
|
|
|
* If the target for this constraint is target, return a pointer
|
|
|
|
* to the name for this constraints subtarget ... NULL otherwise
|
|
|
|
*/
|
2004-08-16 01:14:18 +00:00
|
|
|
switch (con->type) {
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bActionConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bKinematicConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bTrackToConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bLockTrackConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
2004-08-16 01:14:18 +00:00
|
|
|
{
|
|
|
|
bFollowPathConstraint *data = con->data;
|
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
|
|
|
*subtarget= NULL;
|
2004-08-16 01:14:18 +00:00
|
|
|
return data->tar;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data = con->data;
|
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
|
|
|
*subtarget= data->subtarget;
|
2004-09-05 20:21:16 +00:00
|
|
|
return (data->tar);
|
|
|
|
}
|
|
|
|
break;
|
2004-08-16 01:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void set_constraint_target(bConstraint *con, Object *ob)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Set the target for this constraint
|
|
|
|
*/
|
|
|
|
switch (con->type) {
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
bActionConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data = con->data;
|
|
|
|
data->tar= ob;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void unique_constraint_name (bConstraint *con, ListBase *list)
|
|
|
|
{
|
2003-10-21 13:22:07 +00:00
|
|
|
char tempname[64];
|
|
|
|
int number;
|
|
|
|
char *dot;
|
|
|
|
int exists = 0;
|
|
|
|
bConstraint *curcon;
|
|
|
|
|
|
|
|
/* See if we even need to do this */
|
|
|
|
for (curcon = list->first; curcon; curcon=curcon->next){
|
|
|
|
if (curcon!=con){
|
|
|
|
if (!strcmp(curcon->name, con->name)){
|
|
|
|
exists = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!exists)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Strip off the suffix */
|
|
|
|
dot=strchr(con->name, '.');
|
|
|
|
if (dot)
|
|
|
|
*dot=0;
|
|
|
|
|
|
|
|
for (number = 1; number <=999; number++){
|
|
|
|
sprintf (tempname, "%s.%03d", con->name, number);
|
|
|
|
|
|
|
|
exists = 0;
|
|
|
|
for (curcon=list->first; curcon; curcon=curcon->next){
|
|
|
|
if (con!=curcon){
|
|
|
|
if (!strcmp (curcon->name, tempname)){
|
|
|
|
exists = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!exists){
|
|
|
|
strcpy (con->name, tempname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void *new_constraint_data (short type)
|
2003-10-21 13:22:07 +00:00
|
|
|
{
|
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
|
|
|
void *result;
|
2003-10-21 13:22:07 +00:00
|
|
|
|
|
|
|
switch (type){
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bKinematicConstraint), "kinematicConstraint");
|
|
|
|
|
|
|
|
data->tolerance = (float)0.001;
|
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
|
|
|
data->iterations = 50;
|
2003-10-21 13:22:07 +00:00
|
|
|
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_NULL:
|
|
|
|
{
|
|
|
|
result = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bTrackToConstraint), "tracktoConstraint");
|
|
|
|
|
|
|
|
|
|
|
|
data->reserved1 = TRACK_Y;
|
|
|
|
data->reserved2 = UP_Z;
|
|
|
|
|
|
|
|
result = data;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bRotateLikeConstraint), "rotlikeConstraint");
|
|
|
|
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bLocateLikeConstraint), "loclikeConstraint");
|
|
|
|
|
|
|
|
data->flag |= LOCLIKE_X|LOCLIKE_Y|LOCLIKE_Z;
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
bActionConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bActionConstraint), "actionConstraint");
|
|
|
|
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bLockTrackConstraint), "locktrackConstraint");
|
|
|
|
|
|
|
|
data->trackflag = TRACK_Y;
|
|
|
|
data->lockflag = LOCK_Z;
|
|
|
|
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bFollowPathConstraint), "followpathConstraint");
|
|
|
|
|
|
|
|
data->trackflag = TRACK_Y;
|
|
|
|
data->upflag = UP_Z;
|
|
|
|
data->offset = 0;
|
|
|
|
data->followflag = 0;
|
|
|
|
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data;
|
|
|
|
data = MEM_callocN(sizeof(bStretchToConstraint), "StretchToConstraint");
|
|
|
|
|
|
|
|
data->volmode = 0;
|
|
|
|
data->plane = 0;
|
|
|
|
data->orglength = 0.0;
|
|
|
|
data->bulge = 1.0;
|
|
|
|
result = data;
|
|
|
|
}
|
|
|
|
break;
|
2003-10-21 13:22:07 +00:00
|
|
|
default:
|
|
|
|
result = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
bConstraintChannel *find_constraint_channel (ListBase *list, const char *name)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
bConstraintChannel *chan;
|
|
|
|
|
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
|
|
|
for (chan = list->first; chan; chan=chan->next) {
|
|
|
|
if (!strcmp(name, chan->name)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
return chan;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* ***************** Evaluating ********************* */
|
|
|
|
|
|
|
|
/* does ipos only */
|
2002-10-12 11:37:38 +00:00
|
|
|
void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
|
|
|
bConstraintChannel *chan;
|
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
|
|
|
IpoCurve *icu=NULL;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (con=conbase->first; con; con=con->next){
|
|
|
|
chan = find_constraint_channel(chanbase, con->name);
|
|
|
|
if (chan && chan->ipo){
|
|
|
|
calc_ipo(chan->ipo, ctime);
|
|
|
|
for (icu=chan->ipo->curve.first; icu; icu=icu->next){
|
|
|
|
switch (icu->adrcode){
|
|
|
|
case CO_ENFORCE:
|
|
|
|
con->enforce = icu->curval;
|
|
|
|
if (con->enforce<0) con->enforce=0;
|
|
|
|
else if (con->enforce>1) con->enforce=1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Mat4BlendMat4(float out[][4], float dst[][4], float src[][4], float srcweight)
|
|
|
|
{
|
|
|
|
float squat[4], dquat[4], fquat[4];
|
|
|
|
float ssize[3], dsize[3], fsize[4];
|
|
|
|
float sloc[3], dloc[3], floc[3];
|
|
|
|
float mat3[3][3], dstweight;
|
|
|
|
float qmat[3][3], smat[3][3];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
dstweight = 1.0F-srcweight;
|
|
|
|
|
|
|
|
Mat3CpyMat4(mat3, dst);
|
|
|
|
Mat3ToQuat(mat3, dquat);
|
|
|
|
Mat3ToSize(mat3, dsize);
|
|
|
|
VECCOPY (dloc, dst[3]);
|
|
|
|
|
|
|
|
Mat3CpyMat4(mat3, src);
|
|
|
|
Mat3ToQuat(mat3, squat);
|
|
|
|
Mat3ToSize(mat3, ssize);
|
|
|
|
VECCOPY (sloc, src[3]);
|
|
|
|
|
|
|
|
/* Do the actual blend */
|
|
|
|
for (i=0; i<3; i++){
|
|
|
|
floc[i] = (dloc[i]*dstweight) + (sloc[i]*srcweight);
|
|
|
|
fsize[i] = 1.0f + ((dsize[i]-1.0f)*dstweight) + ((ssize[i]-1.0f)*srcweight);
|
|
|
|
fquat[i+1] = (dquat[i+1]*dstweight) + (squat[i+1]*srcweight);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do one more iteration for the quaternions only and normalize the quaternion if needed */
|
|
|
|
fquat[0] = 1.0f + ((dquat[0]-1.0f)*dstweight) + ((squat[0]-1.0f)*srcweight);
|
|
|
|
NormalQuat (fquat);
|
|
|
|
|
|
|
|
QuatToMat3(fquat, qmat);
|
|
|
|
SizeToMat3(fsize, smat);
|
|
|
|
|
|
|
|
Mat3MulMat3(mat3, qmat, smat);
|
|
|
|
Mat4CpyMat3(out, mat3);
|
|
|
|
VECCOPY (out[3], floc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void constraint_target_to_mat4 (Object *ob, const char *substring, float mat[][4], float size[3], float ctime)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Case OBJECT */
|
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
|
|
|
if (!strlen(substring)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
Mat4CpyMat4 (mat, ob->obmat);
|
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
|
|
|
VECCOPY (size, ob->size); // whats this for, hack! (ton)
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
/* Case BONE */
|
|
|
|
else {
|
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
|
|
|
bPoseChannel *pchan;
|
2002-10-12 11:37:38 +00:00
|
|
|
float bsize[3]={1, 1, 1};
|
|
|
|
|
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
|
|
|
pchan = get_pose_channel(ob->pose, substring);
|
|
|
|
if (pchan){
|
|
|
|
/**
|
|
|
|
* Multiply the objectspace bonematrix by the skeletons's global
|
|
|
|
* transform to obtain the worldspace transformation of the target
|
|
|
|
*/
|
|
|
|
Mat4MulMat4 (mat, pchan->pose_mat, ob->obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else
|
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
|
|
|
Mat4CpyMat4 (mat, ob->obmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
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
|
|
|
VECCOPY(size, bsize); // whats this for, hack! (ton)
|
2004-01-27 06:08:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* called during solve_constraints */
|
|
|
|
/* also for make_parent, to find correct inverse of "follow path" */
|
2005-07-04 20:09:32 +00:00
|
|
|
/* warning, ownerdata is void... is not Bone anymore, but posechannel */
|
2004-08-16 01:14:18 +00:00
|
|
|
short get_constraint_target_matrix (bConstraint *con, short ownertype, void* ownerdata, float mat[][4], float size[3], float ctime)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
short valid=0;
|
|
|
|
|
|
|
|
switch (con->type){
|
|
|
|
case CONSTRAINT_TYPE_NULL:
|
|
|
|
{
|
|
|
|
Mat4One(mat);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
2005-07-04 20:09:32 +00:00
|
|
|
if (ownertype == TARGET_BONE) {
|
|
|
|
extern void chan_calc_mat(bPoseChannel *chan);
|
2002-10-12 11:37:38 +00:00
|
|
|
bActionConstraint *data = (bActionConstraint*)con->data;
|
2005-07-09 13:41:01 +00:00
|
|
|
bPose *pose;
|
2005-07-04 20:09:32 +00:00
|
|
|
bPoseChannel *pchan, *tchan;
|
2002-10-12 11:37:38 +00:00
|
|
|
float tempmat3[3][3];
|
2005-07-04 20:09:32 +00:00
|
|
|
float eul[3];
|
2002-10-12 11:37:38 +00:00
|
|
|
float s,t;
|
|
|
|
|
2005-07-09 13:41:01 +00:00
|
|
|
Mat4One(mat); // return mat
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-04 20:09:32 +00:00
|
|
|
if (data->tar==NULL) return 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-09 13:41:01 +00:00
|
|
|
/* need proper check for bone... */
|
2005-07-04 20:09:32 +00:00
|
|
|
if(data->subtarget[0]) {
|
2005-07-09 13:41:01 +00:00
|
|
|
pchan = get_pose_channel(data->tar->pose, data->subtarget);
|
|
|
|
if (pchan) {
|
|
|
|
float diff_mat[3][3], arm_mat[3][3], pose_mat[3][3], par_mat[3][3], ipar_mat[3][3];
|
|
|
|
/* we need the local rotation = current rotation - (parent rotation + restpos) */
|
|
|
|
|
|
|
|
Mat3CpyMat4(arm_mat, pchan->bone->arm_mat);
|
|
|
|
|
|
|
|
if (pchan->parent) {
|
|
|
|
Mat3CpyMat4(par_mat, pchan->parent->pose_mat);
|
|
|
|
Mat3MulMat3(diff_mat, par_mat, arm_mat);
|
|
|
|
|
|
|
|
Mat3Inv(ipar_mat, diff_mat);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Mat3Inv(ipar_mat, arm_mat);
|
|
|
|
}
|
|
|
|
|
|
|
|
Mat3CpyMat4(pose_mat, pchan->pose_mat);
|
|
|
|
Mat3MulMat3(tempmat3, ipar_mat, pose_mat);
|
|
|
|
}
|
|
|
|
else Mat3One(tempmat3);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
float ans[4][4];
|
|
|
|
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, ans, size, ctime);
|
|
|
|
/* extract rotation, is in global world coordinates */
|
|
|
|
Mat3CpyMat4(tempmat3, ans);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Mat3ToEul(tempmat3, eul);
|
|
|
|
|
|
|
|
eul[0]*=(float)(180.0/M_PI);
|
|
|
|
eul[1]*=(float)(180.0/M_PI);
|
|
|
|
eul[2]*=(float)(180.0/M_PI);
|
2005-07-09 13:41:01 +00:00
|
|
|
|
2005-07-04 20:09:32 +00:00
|
|
|
/* Target defines the animation */
|
2002-10-12 11:37:38 +00:00
|
|
|
s = (eul[data->type]-data->min)/(data->max-data->min);
|
|
|
|
if (s<0)
|
|
|
|
s=0;
|
|
|
|
if (s>1)
|
|
|
|
s=1;
|
|
|
|
|
|
|
|
t = ( s * (data->end-data->start)) + data->start;
|
2005-07-04 20:09:32 +00:00
|
|
|
|
|
|
|
/* Get the appropriate information from the action, we make temp pose */
|
2002-10-12 11:37:38 +00:00
|
|
|
pose = MEM_callocN(sizeof(bPose), "pose");
|
|
|
|
|
2005-07-04 20:09:32 +00:00
|
|
|
pchan = ownerdata;
|
|
|
|
tchan= verify_pose_channel(pose, pchan->name);
|
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
|
|
|
extract_pose_from_action (pose, data->act, t);
|
2005-07-04 20:09:32 +00:00
|
|
|
|
|
|
|
chan_calc_mat(tchan);
|
|
|
|
|
|
|
|
Mat4CpyMat4(mat, tchan->chan_mat);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/* Clean up */
|
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
|
|
|
free_pose_channels(pose);
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(pose);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data = (bLocateLikeConstraint*)con->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
|
|
|
|
valid=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data;
|
|
|
|
data = (bRotateLikeConstraint*)con->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
|
|
|
|
valid=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data;
|
|
|
|
data = (bTrackToConstraint*)con->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
|
|
|
|
valid=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
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
|
|
|
bKinematicConstraint *data;
|
|
|
|
data = (bKinematicConstraint*)con->data;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
|
|
|
|
valid=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
2003-10-21 13:22:07 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data;
|
|
|
|
data = (bLockTrackConstraint*)con->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
|
|
|
|
valid=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data;
|
|
|
|
data = (bFollowPathConstraint*)con->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
Curve *cu;
|
|
|
|
float q[4], vec[4], dir[3], *quat, x1, totmat[4][4];
|
|
|
|
float curvetime;
|
|
|
|
|
|
|
|
Mat4One (totmat);
|
2004-10-14 09:18:26 +00:00
|
|
|
Mat4One (mat);
|
2003-10-21 13:22:07 +00:00
|
|
|
|
|
|
|
cu= data->tar->data;
|
2005-06-22 05:45:23 +00:00
|
|
|
|
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
|
|
|
/* note; when creating constraints that follow path, the curve gets the CU_PATH set now,
|
|
|
|
currently for paths to work it needs to go through the bevlist/displist system (ton) */
|
2004-10-14 09:18:26 +00:00
|
|
|
if(cu->path && cu->path->data) {
|
|
|
|
curvetime= bsystem_time(data->tar, data->tar->parent, (float)ctime, 0.0) - data->offset;
|
2003-10-21 13:22:07 +00:00
|
|
|
|
2004-10-14 09:18:26 +00:00
|
|
|
if(calc_ipo_spec(cu->ipo, CU_SPEED, &curvetime)==0) {
|
|
|
|
curvetime /= cu->pathlen;
|
|
|
|
CLAMP(curvetime, 0.0, 1.0);
|
|
|
|
}
|
2003-10-21 13:22:07 +00:00
|
|
|
|
2004-10-14 09:18:26 +00:00
|
|
|
if(where_on_path(data->tar, curvetime, vec, dir) ) {
|
2003-10-21 13:22:07 +00:00
|
|
|
|
2004-10-14 09:18:26 +00:00
|
|
|
if(data->followflag){
|
|
|
|
quat= vectoquat(dir, (short) data->trackflag, (short) data->upflag);
|
2003-10-21 13:22:07 +00:00
|
|
|
|
2004-10-14 09:18:26 +00:00
|
|
|
Normalise(dir);
|
|
|
|
q[0]= (float)cos(0.5*vec[3]);
|
|
|
|
x1= (float)sin(0.5*vec[3]);
|
|
|
|
q[1]= -x1*dir[0];
|
|
|
|
q[2]= -x1*dir[1];
|
|
|
|
q[3]= -x1*dir[2];
|
|
|
|
QuatMul(quat, q, quat);
|
|
|
|
|
2003-10-21 13:22:07 +00:00
|
|
|
|
2004-10-14 09:18:26 +00:00
|
|
|
QuatToMat4(quat, totmat);
|
|
|
|
}
|
|
|
|
VECCOPY(totmat[3], vec);
|
2003-10-21 13:22:07 +00:00
|
|
|
|
2004-10-14 09:18:26 +00:00
|
|
|
Mat4MulSerie(mat, data->tar->obmat, totmat, NULL, NULL, NULL, NULL, NULL, NULL);
|
2003-10-21 13:22:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
valid=1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data;
|
|
|
|
data = (bStretchToConstraint*)con->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
constraint_target_to_mat4(data->tar, data->subtarget, mat, size, ctime);
|
|
|
|
valid = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Mat4One (mat);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
default:
|
|
|
|
Mat4One(mat);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
/* only called during solve_constraints */
|
|
|
|
/* bone constraints create a fake object to work on, then ob is a workob */
|
2002-10-12 11:37:38 +00:00
|
|
|
void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype, void *ownerdata, float targetmat[][4])
|
|
|
|
{
|
|
|
|
float M_oldmat[4][4];
|
|
|
|
float M_identity[4][4];
|
|
|
|
|
|
|
|
if (!constraint || !ob)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Mat4One (M_identity);
|
|
|
|
|
|
|
|
switch (constraint->type){
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
float temp[4][4];
|
|
|
|
bActionConstraint *data;
|
|
|
|
|
|
|
|
data = constraint->data;
|
|
|
|
Mat4CpyMat4 (temp, ob->obmat);
|
|
|
|
|
|
|
|
Mat4MulMat4(ob->obmat, targetmat, temp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data;
|
|
|
|
|
|
|
|
data = constraint->data;
|
|
|
|
|
|
|
|
if (data->flag & LOCLIKE_X)
|
|
|
|
ob->obmat[3][0] = targetmat[3][0];
|
|
|
|
if (data->flag & LOCLIKE_Y)
|
|
|
|
ob->obmat[3][1] = targetmat[3][1];
|
|
|
|
if (data->flag & LOCLIKE_Z)
|
|
|
|
ob->obmat[3][2] = targetmat[3][2];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
float tmat[4][4];
|
|
|
|
float size[3];
|
|
|
|
|
|
|
|
Mat4ToSize(ob->obmat, size);
|
|
|
|
|
|
|
|
Mat4CpyMat4 (tmat, targetmat);
|
|
|
|
Mat4Ortho(tmat);
|
|
|
|
|
|
|
|
ob->obmat[0][0] = tmat[0][0]*size[0];
|
|
|
|
ob->obmat[0][1] = tmat[0][1]*size[1];
|
|
|
|
ob->obmat[0][2] = tmat[0][2]*size[2];
|
|
|
|
|
|
|
|
ob->obmat[1][0] = tmat[1][0]*size[0];
|
|
|
|
ob->obmat[1][1] = tmat[1][1]*size[1];
|
|
|
|
ob->obmat[1][2] = tmat[1][2]*size[2];
|
|
|
|
|
|
|
|
ob->obmat[2][0] = tmat[2][0]*size[0];
|
|
|
|
ob->obmat[2][1] = tmat[2][1]*size[1];
|
|
|
|
ob->obmat[2][2] = tmat[2][2]*size[2];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_NULL:
|
|
|
|
{
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data;
|
2004-09-08 12:12:52 +00:00
|
|
|
float size[3];
|
2003-10-21 13:22:07 +00:00
|
|
|
float *quat;
|
|
|
|
float vec[3];
|
|
|
|
float totmat[3][3];
|
|
|
|
float tmat[4][4];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
data=(bTrackToConstraint*)constraint->data;
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
|
2004-09-08 12:12:52 +00:00
|
|
|
/* Get size property, since ob->size is only the object's own relative size, not its global one */
|
2002-10-12 11:37:38 +00:00
|
|
|
Mat4ToSize (ob->obmat, size);
|
|
|
|
|
|
|
|
Mat4CpyMat4 (M_oldmat, ob->obmat);
|
|
|
|
|
|
|
|
// Clear the object's rotation
|
2004-09-08 12:12:52 +00:00
|
|
|
ob->obmat[0][0]=size[0];
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->obmat[0][1]=0;
|
|
|
|
ob->obmat[0][2]=0;
|
|
|
|
ob->obmat[1][0]=0;
|
2004-09-08 12:12:52 +00:00
|
|
|
ob->obmat[1][1]=size[1];
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->obmat[1][2]=0;
|
|
|
|
ob->obmat[2][0]=0;
|
|
|
|
ob->obmat[2][1]=0;
|
2004-09-08 12:12:52 +00:00
|
|
|
ob->obmat[2][2]=size[2];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-10-21 13:22:07 +00:00
|
|
|
|
|
|
|
VecSubf(vec, ob->obmat[3], targetmat[3]);
|
|
|
|
quat= vectoquat(vec, (short)data->reserved1, (short)data->reserved2);
|
|
|
|
QuatToMat3(quat, totmat);
|
|
|
|
|
|
|
|
Mat4CpyMat4(tmat, ob->obmat);
|
|
|
|
|
|
|
|
Mat4MulMat34(ob->obmat, totmat, tmat);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
2005-07-04 20:09:32 +00:00
|
|
|
/* removed */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-10-21 13:22:07 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data;
|
|
|
|
float vec[3],vec2[3];
|
|
|
|
float totmat[3][3];
|
|
|
|
float tmpmat[3][3];
|
|
|
|
float invmat[3][3];
|
|
|
|
float tmat[4][4];
|
|
|
|
float mdet;
|
|
|
|
|
|
|
|
|
|
|
|
data=(bLockTrackConstraint*)constraint->data;
|
|
|
|
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
|
|
|
|
Mat4CpyMat4 (M_oldmat, ob->obmat);
|
|
|
|
|
|
|
|
/* Vector object -> target */
|
|
|
|
VecSubf(vec, targetmat[3], ob->obmat[3]);
|
|
|
|
switch (data->lockflag){
|
|
|
|
case LOCK_X: /* LOCK X */
|
|
|
|
{
|
|
|
|
switch (data->trackflag){
|
|
|
|
case TRACK_Y: /* LOCK X TRACK Y */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[0]);
|
|
|
|
VecSubf(totmat[1], vec, vec2);
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
|
|
|
|
/* the x axis is fixed*/
|
|
|
|
totmat[0][0] = ob->obmat[0][0];
|
|
|
|
totmat[0][1] = ob->obmat[0][1];
|
|
|
|
totmat[0][2] = ob->obmat[0][2];
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[2], totmat[0], totmat[1]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_Z: /* LOCK X TRACK Z */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[0]);
|
|
|
|
VecSubf(totmat[2], vec, vec2);
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
|
|
|
|
/* the x axis is fixed*/
|
|
|
|
totmat[0][0] = ob->obmat[0][0];
|
|
|
|
totmat[0][1] = ob->obmat[0][1];
|
|
|
|
totmat[0][2] = ob->obmat[0][2];
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[1], totmat[2], totmat[0]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_nY: /* LOCK X TRACK -Y */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[0]);
|
|
|
|
VecSubf(totmat[1], vec, vec2);
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
VecMulf(totmat[1],-1);
|
|
|
|
|
|
|
|
/* the x axis is fixed*/
|
|
|
|
totmat[0][0] = ob->obmat[0][0];
|
|
|
|
totmat[0][1] = ob->obmat[0][1];
|
|
|
|
totmat[0][2] = ob->obmat[0][2];
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[2], totmat[0], totmat[1]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_nZ: /* LOCK X TRACK -Z */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[0]);
|
|
|
|
VecSubf(totmat[2], vec, vec2);
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
VecMulf(totmat[2],-1);
|
|
|
|
|
|
|
|
/* the x axis is fixed*/
|
|
|
|
totmat[0][0] = ob->obmat[0][0];
|
|
|
|
totmat[0][1] = ob->obmat[0][1];
|
|
|
|
totmat[0][2] = ob->obmat[0][2];
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[1], totmat[2], totmat[0]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0;
|
|
|
|
totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0;
|
|
|
|
totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LOCK_Y: /* LOCK Y */
|
|
|
|
{
|
|
|
|
switch (data->trackflag){
|
|
|
|
case TRACK_X: /* LOCK Y TRACK X */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[1]);
|
|
|
|
VecSubf(totmat[0], vec, vec2);
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
|
|
|
|
/* the y axis is fixed*/
|
|
|
|
totmat[1][0] = ob->obmat[1][0];
|
|
|
|
totmat[1][1] = ob->obmat[1][1];
|
|
|
|
totmat[1][2] = ob->obmat[1][2];
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[2], totmat[0], totmat[1]);
|
|
|
|
}
|
|
|
|
break;
|
2004-08-16 01:14:18 +00:00
|
|
|
case TRACK_Z: /* LOCK Y TRACK Z */
|
2003-10-21 13:22:07 +00:00
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[1]);
|
|
|
|
VecSubf(totmat[2], vec, vec2);
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
|
|
|
|
/* the y axis is fixed*/
|
|
|
|
totmat[1][0] = ob->obmat[1][0];
|
|
|
|
totmat[1][1] = ob->obmat[1][1];
|
|
|
|
totmat[1][2] = ob->obmat[1][2];
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[0], totmat[1], totmat[2]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_nX: /* LOCK Y TRACK -X */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[1]);
|
|
|
|
VecSubf(totmat[0], vec, vec2);
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
VecMulf(totmat[0],-1);
|
|
|
|
|
|
|
|
/* the y axis is fixed*/
|
|
|
|
totmat[1][0] = ob->obmat[1][0];
|
|
|
|
totmat[1][1] = ob->obmat[1][1];
|
|
|
|
totmat[1][2] = ob->obmat[1][2];
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[2], totmat[0], totmat[1]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_nZ: /* LOCK Y TRACK -Z */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[1]);
|
|
|
|
VecSubf(totmat[2], vec, vec2);
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
VecMulf(totmat[2],-1);
|
|
|
|
|
|
|
|
/* the y axis is fixed*/
|
|
|
|
totmat[1][0] = ob->obmat[1][0];
|
|
|
|
totmat[1][1] = ob->obmat[1][1];
|
|
|
|
totmat[1][2] = ob->obmat[1][2];
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
|
|
|
|
/* the z axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[0], totmat[1], totmat[2]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0;
|
|
|
|
totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0;
|
|
|
|
totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LOCK_Z: /* LOCK Z */
|
|
|
|
{
|
|
|
|
switch (data->trackflag){
|
|
|
|
case TRACK_X: /* LOCK Z TRACK X */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[2]);
|
|
|
|
VecSubf(totmat[0], vec, vec2);
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
|
|
|
|
/* the z axis is fixed*/
|
|
|
|
totmat[2][0] = ob->obmat[2][0];
|
|
|
|
totmat[2][1] = ob->obmat[2][1];
|
|
|
|
totmat[2][2] = ob->obmat[2][2];
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
|
|
|
|
/* the x axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[1], totmat[2], totmat[0]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_Y: /* LOCK Z TRACK Y */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[2]);
|
|
|
|
VecSubf(totmat[1], vec, vec2);
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
|
|
|
|
/* the z axis is fixed*/
|
|
|
|
totmat[2][0] = ob->obmat[2][0];
|
|
|
|
totmat[2][1] = ob->obmat[2][1];
|
|
|
|
totmat[2][2] = ob->obmat[2][2];
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
|
|
|
|
/* the x axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[0], totmat[1], totmat[2]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_nX: /* LOCK Z TRACK -X */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[2]);
|
|
|
|
VecSubf(totmat[0], vec, vec2);
|
|
|
|
Normalise(totmat[0]);
|
|
|
|
VecMulf(totmat[0],-1);
|
|
|
|
|
|
|
|
/* the z axis is fixed*/
|
|
|
|
totmat[2][0] = ob->obmat[2][0];
|
|
|
|
totmat[2][1] = ob->obmat[2][1];
|
|
|
|
totmat[2][2] = ob->obmat[2][2];
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
|
|
|
|
/* the x axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[1], totmat[2], totmat[0]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TRACK_nY: /* LOCK Z TRACK -Y */
|
|
|
|
{
|
|
|
|
/* Projection of Vector on the plane */
|
|
|
|
Projf(vec2, vec, ob->obmat[2]);
|
|
|
|
VecSubf(totmat[1], vec, vec2);
|
|
|
|
Normalise(totmat[1]);
|
|
|
|
VecMulf(totmat[1],-1);
|
|
|
|
|
|
|
|
/* the z axis is fixed*/
|
|
|
|
totmat[2][0] = ob->obmat[2][0];
|
|
|
|
totmat[2][1] = ob->obmat[2][1];
|
|
|
|
totmat[2][2] = ob->obmat[2][2];
|
|
|
|
Normalise(totmat[2]);
|
|
|
|
|
|
|
|
/* the x axis gets mapped onto
|
|
|
|
a third orthogonal vector */
|
|
|
|
Crossf(totmat[0], totmat[1], totmat[2]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0;
|
|
|
|
totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0;
|
|
|
|
totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0;
|
|
|
|
totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0;
|
|
|
|
totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Block to keep matrix heading */
|
|
|
|
tmpmat[0][0] = ob->obmat[0][0];tmpmat[0][1] = ob->obmat[0][1];tmpmat[0][2] = ob->obmat[0][2];
|
|
|
|
tmpmat[1][0] = ob->obmat[1][0];tmpmat[1][1] = ob->obmat[1][1];tmpmat[1][2] = ob->obmat[1][2];
|
|
|
|
tmpmat[2][0] = ob->obmat[2][0];tmpmat[2][1] = ob->obmat[2][1];tmpmat[2][2] = ob->obmat[2][2];
|
|
|
|
Normalise(tmpmat[0]);
|
|
|
|
Normalise(tmpmat[1]);
|
|
|
|
Normalise(tmpmat[2]);
|
|
|
|
Mat3Inv(invmat,tmpmat);
|
|
|
|
Mat3MulMat3(tmpmat,totmat,invmat);
|
|
|
|
totmat[0][0] = tmpmat[0][0];totmat[0][1] = tmpmat[0][1];totmat[0][2] = tmpmat[0][2];
|
|
|
|
totmat[1][0] = tmpmat[1][0];totmat[1][1] = tmpmat[1][1];totmat[1][2] = tmpmat[1][2];
|
|
|
|
totmat[2][0] = tmpmat[2][0];totmat[2][1] = tmpmat[2][1];totmat[2][2] = tmpmat[2][2];
|
|
|
|
|
|
|
|
Mat4CpyMat4(tmat, ob->obmat);
|
|
|
|
|
|
|
|
mdet = Det3x3( totmat[0][0],totmat[0][1],totmat[0][2],
|
|
|
|
totmat[1][0],totmat[1][1],totmat[1][2],
|
|
|
|
totmat[2][0],totmat[2][1],totmat[2][2]);
|
|
|
|
if (mdet==0)
|
|
|
|
{
|
|
|
|
totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0;
|
|
|
|
totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0;
|
|
|
|
totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* apply out transformaton to the object */
|
|
|
|
Mat4MulMat34(ob->obmat, totmat, tmat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
2003-10-21 13:22:07 +00:00
|
|
|
{
|
|
|
|
bFollowPathConstraint *data;
|
|
|
|
float obmat[4][4];
|
|
|
|
|
|
|
|
data=(bFollowPathConstraint*)constraint->data;
|
|
|
|
|
|
|
|
if (data->tar) {
|
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
|
|
|
// weird, this is needed? doesnt work for workob (ton)
|
2003-10-21 13:22:07 +00:00
|
|
|
object_to_mat4(ob, obmat);
|
|
|
|
|
|
|
|
Mat4MulSerie(ob->obmat, targetmat, obmat, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
2004-09-19 15:07:16 +00:00
|
|
|
{
|
|
|
|
bStretchToConstraint *data;
|
|
|
|
float size[3],scale[3],vec[3],xx[3],zz[3],orth[3];
|
|
|
|
float totmat[3][3];
|
|
|
|
float tmat[4][4];
|
|
|
|
float dist;
|
|
|
|
data=(bStretchToConstraint*)constraint->data;
|
|
|
|
Mat4ToSize (ob->obmat, size);
|
|
|
|
|
|
|
|
|
|
|
|
if (data->tar){
|
|
|
|
|
|
|
|
/* store X orientation before destroying obmat */
|
|
|
|
xx[0] = ob->obmat[0][0];
|
|
|
|
xx[1] = ob->obmat[0][1];
|
|
|
|
xx[2] = ob->obmat[0][2];
|
|
|
|
Normalise(xx);
|
|
|
|
|
|
|
|
/* store Z orientation before destroying obmat */
|
|
|
|
zz[0] = ob->obmat[2][0];
|
|
|
|
zz[1] = ob->obmat[2][1];
|
|
|
|
zz[2] = ob->obmat[2][2];
|
|
|
|
Normalise(zz);
|
2004-09-05 20:21:16 +00:00
|
|
|
|
|
|
|
VecSubf(vec, ob->obmat[3], targetmat[3]);
|
2004-09-19 15:07:16 +00:00
|
|
|
vec[0] /= size[0];
|
|
|
|
vec[1] /= size[1];
|
|
|
|
vec[2] /= size[2];
|
|
|
|
|
|
|
|
dist = Normalise(vec);
|
|
|
|
//dist = VecLenf( ob->obmat[3], targetmat[3]);
|
|
|
|
|
|
|
|
if (data->orglength == 0) data->orglength = dist;
|
|
|
|
if (data->bulge ==0) data->bulge = 1.0;
|
|
|
|
|
|
|
|
scale[1] = dist/data->orglength;
|
|
|
|
switch (data->volmode){
|
|
|
|
/* volume preserving scaling */
|
|
|
|
case VOLUME_XZ :
|
|
|
|
scale[0] = 1.0f - (float)sqrt(data->bulge) + (float)sqrt(data->bulge*(data->orglength/dist));
|
|
|
|
scale[2] = scale[0];
|
|
|
|
break;
|
|
|
|
case VOLUME_X:
|
|
|
|
scale[0] = 1.0f + data->bulge * (data->orglength /dist - 1);
|
|
|
|
scale[2] = 1.0;
|
|
|
|
break;
|
|
|
|
case VOLUME_Z:
|
|
|
|
scale[0] = 1.0;
|
|
|
|
scale[2] = 1.0f + data->bulge * (data->orglength /dist - 1);
|
|
|
|
break;
|
|
|
|
/* don't care for volume */
|
|
|
|
case NO_VOLUME:
|
|
|
|
scale[0] = 1.0;
|
|
|
|
scale[2] = 1.0;
|
|
|
|
break;
|
|
|
|
default: /* should not happen, but in case*/
|
|
|
|
return;
|
|
|
|
} /* switch (data->volmode) */
|
|
|
|
|
|
|
|
/* Clear the object's rotation and scale */
|
|
|
|
ob->obmat[0][0]=size[0]*scale[0];
|
|
|
|
ob->obmat[0][1]=0;
|
|
|
|
ob->obmat[0][2]=0;
|
|
|
|
ob->obmat[1][0]=0;
|
|
|
|
ob->obmat[1][1]=size[1]*scale[1];
|
|
|
|
ob->obmat[1][2]=0;
|
|
|
|
ob->obmat[2][0]=0;
|
|
|
|
ob->obmat[2][1]=0;
|
|
|
|
ob->obmat[2][2]=size[2]*scale[2];
|
|
|
|
|
|
|
|
VecSubf(vec, ob->obmat[3], targetmat[3]);
|
|
|
|
Normalise(vec);
|
|
|
|
/* new Y aligns object target connection*/
|
|
|
|
totmat[1][0] = -vec[0];
|
|
|
|
totmat[1][1] = -vec[1];
|
|
|
|
totmat[1][2] = -vec[2];
|
|
|
|
switch (data->plane){
|
|
|
|
case PLANE_X:
|
|
|
|
/* build new Z vector */
|
|
|
|
/* othogonal to "new Y" "old X! plane */
|
|
|
|
Crossf(orth, vec, xx);
|
|
|
|
Normalise(orth);
|
|
|
|
|
|
|
|
/* new Z*/
|
|
|
|
totmat[2][0] = orth[0];
|
|
|
|
totmat[2][1] = orth[1];
|
|
|
|
totmat[2][2] = orth[2];
|
|
|
|
|
|
|
|
/* we decided to keep X plane*/
|
|
|
|
Crossf(xx,orth, vec);
|
|
|
|
Normalise(xx);
|
|
|
|
totmat[0][0] = xx[0];
|
|
|
|
totmat[0][1] = xx[1];
|
|
|
|
totmat[0][2] = xx[2];
|
|
|
|
break;
|
|
|
|
case PLANE_Z:
|
|
|
|
/* build new X vector */
|
|
|
|
/* othogonal to "new Y" "old Z! plane */
|
|
|
|
Crossf(orth, vec, zz);
|
|
|
|
Normalise(orth);
|
|
|
|
|
|
|
|
/* new X*/
|
|
|
|
totmat[0][0] = -orth[0];
|
|
|
|
totmat[0][1] = -orth[1];
|
|
|
|
totmat[0][2] = -orth[2];
|
|
|
|
|
|
|
|
/* we decided to keep Z */
|
|
|
|
Crossf(zz,orth, vec);
|
|
|
|
Normalise(zz);
|
|
|
|
totmat[2][0] = zz[0];
|
|
|
|
totmat[2][1] = zz[1];
|
|
|
|
totmat[2][2] = zz[2];
|
|
|
|
break;
|
|
|
|
} /* switch (data->plane) */
|
|
|
|
|
|
|
|
|
|
|
|
Mat4CpyMat4(tmat, ob->obmat);
|
|
|
|
|
|
|
|
Mat4MulMat34(ob->obmat, totmat, tmat);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
default:
|
|
|
|
printf ("Error: Unknown constraint type\n");
|
|
|
|
break;
|
|
|
|
}
|
2002-11-25 12:02:15 +00:00
|
|
|
}
|