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>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "BLI_arithb.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#include "DNA_action_types.h"
|
|
|
|
|
#include "DNA_armature_types.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
|
#include "DNA_curve_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
Another huge commit!!!
First, check on the new files, which are listed below.
The new butspace.h is a local include, only to be used for the buttons
drawn in the buttonswindow.
- editbuts, animbuts, gamebuts, displaybuts, paintbuts, work now
- i quite completely reorganized it, it's now nicely telling you what
context it is in
- sorting error in panel align fixed (tabs were flipping)
- align works correctly automatic when you click around in Blender
- editsca.c renamed to buttons_logic.h
- button names are truncated from the right for allmost all buttons
(except text buttons and number buttons)
- while dragging panels, you cannot move them outside window anymore
And of course fixed loads of little bugs I encountered while testing
it all. This is a version I really need good test & feedback for.
Next step: restoring material/lamp/texture/world
2003-10-10 17:29:01 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2007-06-18 07:41:21 +00:00
|
|
|
#include "DNA_text_types.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#include "BKE_action.h"
|
|
|
|
|
#include "BKE_armature.h"
|
|
|
|
|
#include "BKE_constraint.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
|
|
|
|
#include "BKE_global.h"
|
2007-06-18 07:41:21 +00:00
|
|
|
#include "BKE_main.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_ipo.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "BKE_object.h"
|
|
|
|
|
#include "BKE_utildefines.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-27 10:37:20 +00:00
|
|
|
#include "BIF_editaction.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_editarmature.h"
|
|
|
|
|
#include "BIF_editconstraint.h"
|
2005-08-24 20:18:03 +00:00
|
|
|
#include "BIF_poseobject.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_interface.h"
|
|
|
|
|
#include "BIF_screen.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "BIF_space.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_toolbox.h"
|
|
|
|
|
|
2007-06-18 07:41:21 +00:00
|
|
|
#include "BPY_extern.h"
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "blendef.h"
|
|
|
|
|
#include "nla.h"
|
2005-10-23 12:18:32 +00:00
|
|
|
#include "mydevice.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2002-11-25 12:02:15 +00:00
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
ListBase *get_active_constraint_channels (Object *ob, int forcevalid)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
char ipstr[64];
|
|
|
|
|
|
|
|
|
|
if (!ob)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* See if we are a bone constraint */
|
2005-07-23 18:52:31 +00:00
|
|
|
if (ob->flag & OB_POSEMODE) {
|
|
|
|
|
bActionChannel *achan;
|
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
pchan = get_active_posechannel(ob);
|
2005-07-23 18:52:31 +00:00
|
|
|
if (pchan) {
|
|
|
|
|
|
|
|
|
|
/* Make sure we have an action */
|
|
|
|
|
if (!ob->action){
|
|
|
|
|
if (!forcevalid)
|
|
|
|
|
return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-03-12 06:21:58 +00:00
|
|
|
ob->action=add_empty_action("Action");
|
2005-07-23 18:52:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make sure we have an actionchannel */
|
2005-10-10 17:42:48 +00:00
|
|
|
achan = get_action_channel(ob->action, pchan->name);
|
2005-07-23 18:52:31 +00:00
|
|
|
if (!achan){
|
|
|
|
|
if (!forcevalid)
|
|
|
|
|
return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-23 18:52:31 +00:00
|
|
|
achan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
|
|
|
|
|
|
|
|
|
|
strcpy (achan->name, pchan->name);
|
|
|
|
|
sprintf (ipstr, "%s.%s", ob->action->id.name+2, achan->name);
|
|
|
|
|
ipstr[23]=0;
|
|
|
|
|
achan->ipo= add_ipo(ipstr, ID_AC);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-23 18:52:31 +00:00
|
|
|
BLI_addtail (&ob->action->chanbase, achan);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-07-23 18:52:31 +00:00
|
|
|
|
|
|
|
|
return &achan->constraintChannels;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-08-22 21:58:55 +00:00
|
|
|
else return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-07-23 18:52:31 +00:00
|
|
|
/* else we return object constraints */
|
2005-10-10 17:42:48 +00:00
|
|
|
else {
|
|
|
|
|
if(ob->ipoflag & OB_ACTION_OB) {
|
|
|
|
|
bActionChannel *achan = get_action_channel(ob->action, "Object");
|
|
|
|
|
if(achan)
|
|
|
|
|
return &achan->constraintChannels;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return &ob->constraintChannels;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
|
|
|
|
|
/* if object in posemode, active bone constraints, else object constraints */
|
|
|
|
|
ListBase *get_active_constraints(Object *ob)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
if (!ob)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2005-07-23 18:52:31 +00:00
|
|
|
if (ob->flag & OB_POSEMODE) {
|
|
|
|
|
bPoseChannel *pchan;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
pchan = get_active_posechannel(ob);
|
|
|
|
|
if (pchan)
|
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
|
|
|
return &pchan->constraints;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
|
|
|
else
|
|
|
|
|
return &ob->constraints;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
|
|
|
return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
/* single constraint */
|
|
|
|
|
bConstraint *get_active_constraint(Object *ob)
|
|
|
|
|
{
|
|
|
|
|
ListBase *lb= get_active_constraints(ob);
|
|
|
|
|
|
|
|
|
|
if(lb) {
|
|
|
|
|
bConstraint *con;
|
|
|
|
|
for(con= lb->first; con; con=con->next)
|
|
|
|
|
if(con->flag & CONSTRAINT_ACTIVE)
|
|
|
|
|
return con;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* single channel, for ipo */
|
|
|
|
|
bConstraintChannel *get_active_constraint_channel(Object *ob)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con;
|
|
|
|
|
bConstraintChannel *chan;
|
|
|
|
|
|
|
|
|
|
if (ob->flag & OB_POSEMODE) {
|
|
|
|
|
if(ob->action) {
|
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
|
|
|
|
|
|
pchan = get_active_posechannel(ob);
|
|
|
|
|
if(pchan) {
|
|
|
|
|
for(con= pchan->constraints.first; con; con= con->next)
|
|
|
|
|
if(con->flag & CONSTRAINT_ACTIVE)
|
|
|
|
|
break;
|
|
|
|
|
if(con) {
|
2005-10-10 17:42:48 +00:00
|
|
|
bActionChannel *achan = get_action_channel(ob->action, pchan->name);
|
2005-08-24 20:18:03 +00:00
|
|
|
if(achan) {
|
|
|
|
|
for(chan= achan->constraintChannels.first; chan; chan= chan->next)
|
|
|
|
|
if(!strcmp(chan->name, con->name))
|
|
|
|
|
break;
|
|
|
|
|
return chan;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for(con= ob->constraints.first; con; con= con->next)
|
|
|
|
|
if(con->flag & CONSTRAINT_ACTIVE)
|
|
|
|
|
break;
|
|
|
|
|
if(con) {
|
2005-10-10 17:42:48 +00:00
|
|
|
ListBase *lb= get_active_constraint_channels(ob, 0);
|
|
|
|
|
|
|
|
|
|
if(lb) {
|
|
|
|
|
for(chan= lb->first; chan; chan= chan->next)
|
|
|
|
|
if(!strcmp(chan->name, con->name))
|
|
|
|
|
break;
|
|
|
|
|
return chan;
|
|
|
|
|
}
|
2005-08-24 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bConstraint *add_new_constraint(short type)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
bConstraint *con;
|
|
|
|
|
|
|
|
|
|
con = MEM_callocN(sizeof(bConstraint), "constraint");
|
|
|
|
|
|
|
|
|
|
/* Set up a generic constraint datablock */
|
2003-10-21 13:22:07 +00:00
|
|
|
con->type = type;
|
2002-10-12 11:37:38 +00:00
|
|
|
con->flag |= CONSTRAINT_EXPAND;
|
|
|
|
|
con->enforce=1.0F;
|
|
|
|
|
/* Load the data for it */
|
|
|
|
|
con->data = new_constraint_data(con->type);
|
|
|
|
|
strcpy (con->name, "Const");
|
|
|
|
|
return con;
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-21 13:22:07 +00:00
|
|
|
void add_constraint_to_object(bConstraint *con, Object *ob)
|
|
|
|
|
{
|
|
|
|
|
ListBase *list;
|
|
|
|
|
list = &ob->constraints;
|
2005-08-24 20:18:03 +00:00
|
|
|
|
|
|
|
|
if (list) {
|
2003-10-21 13:22:07 +00:00
|
|
|
unique_constraint_name(con, list);
|
|
|
|
|
BLI_addtail(list, con);
|
2005-08-24 20:18:03 +00:00
|
|
|
|
|
|
|
|
con->flag |= CONSTRAINT_ACTIVE;
|
|
|
|
|
for(con= con->prev; con; con= con->prev)
|
|
|
|
|
con->flag &= ~CONSTRAINT_ACTIVE;
|
2003-10-21 13:22:07 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-08-24 20:18:03 +00:00
|
|
|
char *get_con_subtarget_name(bConstraint *con, Object *target)
|
2004-01-03 03:53:18 +00:00
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* If the target for this constraint is target, return a pointer
|
|
|
|
|
* to the name for this constraints subtarget ... NULL otherwise
|
|
|
|
|
*/
|
2007-06-20 07:11:31 +00:00
|
|
|
|
|
|
|
|
if (constraint_has_target(con)) {
|
|
|
|
|
Object *tar;
|
|
|
|
|
char *subtarget;
|
|
|
|
|
|
|
|
|
|
tar = get_constraint_target(con, &subtarget);
|
|
|
|
|
if (tar==target) return subtarget;
|
2004-01-03 03:53:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
2004-09-03 14:31:06 +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
|
|
|
/* checks validity of object pointers, and NULLs,
|
|
|
|
|
if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag */
|
|
|
|
|
static void test_constraints (Object *owner, const char* substring)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
bConstraint *curcon;
|
|
|
|
|
ListBase *conlist= NULL;
|
|
|
|
|
int type;
|
|
|
|
|
|
|
|
|
|
if (owner==NULL) return;
|
|
|
|
|
|
|
|
|
|
/* Check parents */
|
|
|
|
|
/* Get the constraint list for this object */
|
|
|
|
|
|
2007-07-15 07:05:24 +00:00
|
|
|
if (strlen (substring)) {
|
|
|
|
|
switch (owner->type) {
|
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
|
|
|
case OB_ARMATURE:
|
|
|
|
|
type = TARGET_BONE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
type = TARGET_OBJECT;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
type = TARGET_OBJECT;
|
|
|
|
|
|
|
|
|
|
|
2007-07-15 07:05:24 +00:00
|
|
|
switch (type) {
|
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
|
|
|
case TARGET_OBJECT:
|
|
|
|
|
conlist = &owner->constraints;
|
|
|
|
|
break;
|
|
|
|
|
case TARGET_BONE:
|
|
|
|
|
{
|
|
|
|
|
Bone *bone;
|
|
|
|
|
bPoseChannel *chan;
|
|
|
|
|
|
|
|
|
|
bone = get_named_bone(((bArmature*)owner->data), substring);
|
|
|
|
|
chan = get_pose_channel (owner->pose, substring);
|
|
|
|
|
if (bone && chan){
|
|
|
|
|
conlist = &chan->constraints;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-15 07:05:24 +00:00
|
|
|
/* Check all constraints - is constraint valid? */
|
|
|
|
|
if (conlist) {
|
|
|
|
|
for (curcon = conlist->first; curcon; curcon=curcon->next) {
|
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
|
|
|
curcon->flag &= ~CONSTRAINT_DISABLE;
|
|
|
|
|
|
2007-07-15 07:05:24 +00:00
|
|
|
switch (curcon->type) {
|
2007-06-18 07:41:21 +00:00
|
|
|
case CONSTRAINT_TYPE_PYTHON:
|
|
|
|
|
{
|
|
|
|
|
bPythonConstraint *data = curcon->data;
|
|
|
|
|
float dummy_matrix[4][4];
|
|
|
|
|
|
|
|
|
|
/* is there are valid script? */
|
|
|
|
|
if (!data->text) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (!BPY_is_pyconstraint(data->text)) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
data->flag &= ~PYCON_SCRIPTERROR;
|
|
|
|
|
|
|
|
|
|
/* does the constraint require target input? */
|
|
|
|
|
if (BPY_pyconstraint_targets(data, dummy_matrix))
|
|
|
|
|
data->flag |= PYCON_USETARGETS;
|
|
|
|
|
else
|
|
|
|
|
data->flag &= ~PYCON_USETARGETS;
|
|
|
|
|
|
|
|
|
|
/* check whether we have a valid target */
|
|
|
|
|
if (data->flag & PYCON_USETARGETS) {
|
|
|
|
|
/* validate target */
|
|
|
|
|
if (!exist_object(data->tar)) {
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* don't hold onto target */
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
BLI_strncpy(data->subtarget, "", 32);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
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
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
|
{
|
|
|
|
|
bActionConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
|
{
|
|
|
|
|
bLocateLikeConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-07 00:11:39 +00:00
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_MINMAX:
|
|
|
|
|
{
|
|
|
|
|
bMinMaxConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
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 ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
|
{
|
|
|
|
|
bRotateLikeConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-19 17:42:20 +00:00
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_SIZELIKE:
|
|
|
|
|
{
|
|
|
|
|
bSizeLikeConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
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 ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
|
{
|
|
|
|
|
bKinematicConstraint *data = curcon->data;
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
|
{
|
|
|
|
|
bTrackToConstraint *data = curcon->data;
|
|
|
|
|
if (!exist_object(data->tar)) {
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (data->reserved2==data->reserved1){
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (data->reserved2+3==data->reserved1){
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
|
{
|
|
|
|
|
bLockTrackConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data->lockflag==data->trackflag){
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (data->lockflag+3==data->trackflag){
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
|
{
|
|
|
|
|
bStretchToConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
|
{
|
|
|
|
|
bFollowPathConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (data->tar->type != OB_CURVE){
|
|
|
|
|
data->tar = NULL;
|
2005-08-24 20:18:03 +00:00
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (data->upflag==data->trackflag){
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (data->upflag+3==data->trackflag){
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-04-07 03:32:57 +00:00
|
|
|
case CONSTRAINT_TYPE_CLAMPTO:
|
|
|
|
|
{
|
|
|
|
|
bClampToConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data->tar->type != OB_CURVE){
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Curve *cu= data->tar->data;
|
|
|
|
|
|
|
|
|
|
/* auto-set 'Path' setting on curve so this works */
|
|
|
|
|
cu->flag |= CU_PATH;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-07-21 07:26:15 +00:00
|
|
|
case CONSTRAINT_TYPE_TRANSFORM:
|
|
|
|
|
{
|
|
|
|
|
bTransformConstraint *data = curcon->data;
|
|
|
|
|
|
|
|
|
|
if (!exist_object(data->tar)){
|
|
|
|
|
data->tar = NULL;
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (data->tar == owner) &&
|
|
|
|
|
(!get_named_bone(get_armature(owner),
|
|
|
|
|
data->subtarget))) {
|
|
|
|
|
curcon->flag |= CONSTRAINT_DISABLE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void test_bonelist_constraints (Object *owner, ListBase *list)
|
|
|
|
|
{
|
|
|
|
|
Bone *bone;
|
|
|
|
|
|
|
|
|
|
for (bone = list->first; bone; bone=bone->next) {
|
|
|
|
|
|
|
|
|
|
test_constraints(owner, bone->name);
|
|
|
|
|
test_bonelist_constraints (owner, &bone->childbase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void object_test_constraints (Object *owner)
|
|
|
|
|
{
|
|
|
|
|
test_constraints(owner, "");
|
|
|
|
|
|
|
|
|
|
if(owner->type==OB_ARMATURE) {
|
|
|
|
|
bArmature *arm;
|
|
|
|
|
arm = get_armature(owner);
|
|
|
|
|
if (arm)
|
|
|
|
|
test_bonelist_constraints (owner, &arm->bonebase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-23 12:18:32 +00:00
|
|
|
/* context: active object in posemode, active channel, optional selected channel */
|
|
|
|
|
void add_constraint(int only_IK)
|
|
|
|
|
{
|
|
|
|
|
Object *ob= OBACT, *obsel=NULL;
|
|
|
|
|
bPoseChannel *pchanact=NULL, *pchansel=NULL;
|
|
|
|
|
bConstraint *con=NULL;
|
|
|
|
|
Base *base;
|
|
|
|
|
short nr;
|
|
|
|
|
|
|
|
|
|
/* paranoia checks */
|
|
|
|
|
if(ob==NULL || ob==G.obedit) return;
|
2005-12-08 15:05:14 +00:00
|
|
|
|
2005-10-23 12:18:32 +00:00
|
|
|
if(ob->pose && (ob->flag & OB_POSEMODE)) {
|
2005-12-08 15:05:14 +00:00
|
|
|
bArmature *arm= ob->data;
|
|
|
|
|
|
2005-10-23 12:18:32 +00:00
|
|
|
/* find active channel */
|
2005-12-08 15:05:14 +00:00
|
|
|
pchanact= get_active_posechannel(ob);
|
2005-10-23 12:18:32 +00:00
|
|
|
if(pchanact==NULL) return;
|
|
|
|
|
|
2006-11-16 10:24:26 +00:00
|
|
|
/* check protection */
|
2006-11-30 15:54:21 +00:00
|
|
|
if(ob->proxy && (pchanact->bone->layer & arm->layer_protected)) {
|
2006-11-16 10:24:26 +00:00
|
|
|
error("Bone is Proxy protected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-23 12:18:32 +00:00
|
|
|
/* find selected bone */
|
|
|
|
|
for(pchansel= ob->pose->chanbase.first; pchansel; pchansel= pchansel->next) {
|
|
|
|
|
if(pchansel!=pchanact)
|
2005-12-08 15:05:14 +00:00
|
|
|
if(pchansel->bone->flag & BONE_SELECTED)
|
|
|
|
|
if(pchansel->bone->layer & arm->layer)
|
|
|
|
|
break;
|
2005-10-23 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* find selected object */
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next)
|
|
|
|
|
if( TESTBASE(base) && base->object!=ob )
|
|
|
|
|
obsel= base->object;
|
|
|
|
|
|
|
|
|
|
/* the only_IK caller has checked for posemode! */
|
|
|
|
|
if(only_IK) {
|
|
|
|
|
for(con= pchanact->constraints.first; con; con= con->next) {
|
|
|
|
|
if(con->type==CONSTRAINT_TYPE_KINEMATIC) break;
|
|
|
|
|
}
|
|
|
|
|
if(con) {
|
|
|
|
|
error("Pose Channel already has IK");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(pchansel)
|
2005-12-18 18:05:14 +00:00
|
|
|
nr= pupmenu("Add IK Constraint%t|To Active Bone%x10");
|
2005-10-23 12:18:32 +00:00
|
|
|
else if(obsel)
|
2005-12-18 18:05:14 +00:00
|
|
|
nr= pupmenu("Add IK Constraint%t|To Active Object%x10");
|
2005-10-23 12:18:32 +00:00
|
|
|
else
|
2005-10-30 13:50:42 +00:00
|
|
|
nr= pupmenu("Add IK Constraint%t|To New Empty Object%x10|Without Target%x11");
|
2005-10-23 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if(pchanact) {
|
|
|
|
|
if(pchansel)
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to Active Bone%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
else if(obsel && obsel->type==OB_CURVE)
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Clamp To%x17|Stretch To%x7|%l|Action%x16|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
else if(obsel)
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Action%x16|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
else
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to New Empty Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Stretch To%x7|%l|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if(obsel && obsel->type==OB_CURVE)
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|Follow Path%x6|Clamp To%x17|%l|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
else if(obsel)
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to Active Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|%l|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
else
|
2007-07-21 07:26:15 +00:00
|
|
|
nr= pupmenu("Add Constraint to New Empty Object%t|Child Of%x19|Transformation%x20|%l|Copy Location%x1|Copy Rotation%x2|Copy Scale%x8|%l|Limit Location%x13|Limit Rotation%x14|Limit Scale%x15|%l|Track To%x3|Floor%x4|Locked Track%x5|%l|Script%x18");
|
2005-10-23 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(nr<1) return;
|
|
|
|
|
|
|
|
|
|
/* handle IK separate */
|
2005-10-30 13:50:42 +00:00
|
|
|
if(nr==10 || nr==11) {
|
2005-10-23 12:18:32 +00:00
|
|
|
|
|
|
|
|
/* prevent weird chains... */
|
|
|
|
|
if(pchansel) {
|
|
|
|
|
bPoseChannel *pchan= pchanact;
|
|
|
|
|
while(pchan) {
|
|
|
|
|
if(pchan==pchansel) break;
|
|
|
|
|
pchan= pchan->parent;
|
|
|
|
|
}
|
|
|
|
|
if(pchan) {
|
|
|
|
|
error("IK root cannot be linked to IK tip");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pchan= pchansel;
|
|
|
|
|
while(pchan) {
|
|
|
|
|
if(pchan==pchanact) break;
|
|
|
|
|
pchan= pchan->parent;
|
|
|
|
|
}
|
|
|
|
|
if(pchan) {
|
|
|
|
|
error("IK tip cannot be linked to IK root");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
|
|
|
|
|
BLI_addtail(&pchanact->constraints, con);
|
2005-12-14 14:45:24 +00:00
|
|
|
unique_constraint_name(con, &pchanact->constraints);
|
2005-10-23 12:18:32 +00:00
|
|
|
pchanact->constflag |= PCHAN_HAS_IK; // for draw, but also for detecting while pose solving
|
2005-10-30 13:50:42 +00:00
|
|
|
if(nr==11) pchanact->constflag |= PCHAN_HAS_TARGET;
|
2005-10-23 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (nr==1) con = add_new_constraint(CONSTRAINT_TYPE_LOCLIKE);
|
|
|
|
|
else if (nr==2) con = add_new_constraint(CONSTRAINT_TYPE_ROTLIKE);
|
|
|
|
|
else if (nr==3) con = add_new_constraint(CONSTRAINT_TYPE_TRACKTO);
|
|
|
|
|
else if (nr==4) con = add_new_constraint(CONSTRAINT_TYPE_MINMAX);
|
|
|
|
|
else if (nr==5) con = add_new_constraint(CONSTRAINT_TYPE_LOCKTRACK);
|
|
|
|
|
else if (nr==6) {
|
2006-04-09 18:31:20 +00:00
|
|
|
Curve *cu= obsel->data;
|
|
|
|
|
cu->flag |= CU_PATH;
|
|
|
|
|
con = add_new_constraint(CONSTRAINT_TYPE_FOLLOWPATH);
|
|
|
|
|
}
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
else if (nr==7) con = add_new_constraint(CONSTRAINT_TYPE_STRETCHTO);
|
|
|
|
|
else if (nr==8) con = add_new_constraint(CONSTRAINT_TYPE_SIZELIKE);
|
|
|
|
|
else if (nr==13) con = add_new_constraint(CONSTRAINT_TYPE_LOCLIMIT);
|
|
|
|
|
else if (nr==14) con = add_new_constraint(CONSTRAINT_TYPE_ROTLIMIT);
|
|
|
|
|
else if (nr==15) con = add_new_constraint(CONSTRAINT_TYPE_SIZELIMIT);
|
|
|
|
|
else if (nr==16) {
|
|
|
|
|
/* TODO: add a popup-menu to display list of available actions to use (like for pyconstraints) */
|
|
|
|
|
con = add_new_constraint(CONSTRAINT_TYPE_ACTION);
|
|
|
|
|
}
|
|
|
|
|
else if (nr==17) {
|
2007-04-07 03:32:57 +00:00
|
|
|
Curve *cu= obsel->data;
|
|
|
|
|
cu->flag |= CU_PATH;
|
2007-04-07 04:25:31 +00:00
|
|
|
con = add_new_constraint(CONSTRAINT_TYPE_CLAMPTO);
|
2007-04-07 03:32:57 +00:00
|
|
|
}
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
else if (nr==18) {
|
2007-06-18 07:41:21 +00:00
|
|
|
char *menustr;
|
2007-06-20 09:58:16 +00:00
|
|
|
int scriptint= 0, dummy_int=0;
|
|
|
|
|
float dummy_matrix[4][4];
|
2007-06-18 07:41:21 +00:00
|
|
|
|
|
|
|
|
/* popup a list of usable scripts */
|
2007-06-20 09:58:16 +00:00
|
|
|
menustr = buildmenu_pyconstraints(NULL, &dummy_int);
|
2007-06-18 07:41:21 +00:00
|
|
|
scriptint = pupmenu(menustr);
|
|
|
|
|
MEM_freeN(menustr);
|
|
|
|
|
|
|
|
|
|
/* only add constraint if a script was chosen */
|
|
|
|
|
if (scriptint) {
|
2007-06-20 09:58:16 +00:00
|
|
|
/* add constraint */
|
2007-06-18 07:41:21 +00:00
|
|
|
con = add_new_constraint(CONSTRAINT_TYPE_PYTHON);
|
|
|
|
|
validate_pyconstraint_cb(con->data, &scriptint);
|
2007-06-20 09:58:16 +00:00
|
|
|
|
|
|
|
|
/* make sure target allowance is set correctly */
|
|
|
|
|
dummy_int = BPY_pyconstraint_targets(con->data, dummy_matrix);
|
|
|
|
|
if (dummy_int) {
|
|
|
|
|
bPythonConstraint *pycon= (bPythonConstraint *)con->data;
|
|
|
|
|
pycon->flag |= PYCON_USETARGETS;
|
|
|
|
|
}
|
2007-06-18 07:41:21 +00:00
|
|
|
}
|
|
|
|
|
}
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
else if (nr==19) {
|
2007-07-21 07:26:15 +00:00
|
|
|
con = add_new_constraint(CONSTRAINT_TYPE_CHILDOF);
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
|
|
|
|
|
/* if this constraint is being added to a posechannel, make sure
|
|
|
|
|
* the constraint gets evaluated in pose-space
|
|
|
|
|
*/
|
|
|
|
|
if (pchanact) {
|
|
|
|
|
con->ownspace = CONSTRAINT_SPACE_POSE;
|
|
|
|
|
con->flag |= CONSTRAINT_SPACEONCE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-07-21 07:26:15 +00:00
|
|
|
else if (nr==20) con = add_new_constraint(CONSTRAINT_TYPE_TRANSFORM);
|
2005-10-23 12:18:32 +00:00
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (con==NULL) return; /* paranoia */
|
2005-10-23 12:18:32 +00:00
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (pchanact) {
|
2005-10-23 12:18:32 +00:00
|
|
|
BLI_addtail(&pchanact->constraints, con);
|
2005-12-14 14:45:24 +00:00
|
|
|
unique_constraint_name(con, &pchanact->constraints);
|
2005-10-23 12:18:32 +00:00
|
|
|
pchanact->constflag |= PCHAN_HAS_CONST; /* for draw */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_addtail(&ob->constraints, con);
|
2005-12-14 14:45:24 +00:00
|
|
|
unique_constraint_name(con, &ob->constraints);
|
2005-10-23 12:18:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set the target */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (pchansel) {
|
2005-10-23 12:18:32 +00:00
|
|
|
set_constraint_target(con, ob, pchansel->name);
|
|
|
|
|
}
|
|
|
|
|
else if(obsel) {
|
|
|
|
|
set_constraint_target(con, obsel, NULL);
|
|
|
|
|
}
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
else if (ELEM4(nr, 11, 13, 14, 15)==0) { /* add new empty as target */
|
2005-10-23 12:18:32 +00:00
|
|
|
Base *base= BASACT, *newbase;
|
|
|
|
|
Object *obt;
|
|
|
|
|
|
|
|
|
|
obt= add_object(OB_EMPTY);
|
|
|
|
|
/* set layers OK */
|
|
|
|
|
newbase= BASACT;
|
|
|
|
|
newbase->lay= base->lay;
|
|
|
|
|
obt->lay= newbase->lay;
|
|
|
|
|
|
|
|
|
|
/* transform cent to global coords for loc */
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (pchanact) {
|
2005-10-23 12:18:32 +00:00
|
|
|
if(only_IK)
|
|
|
|
|
VecMat4MulVecfl(obt->loc, ob->obmat, pchanact->pose_tail);
|
|
|
|
|
else
|
|
|
|
|
VecMat4MulVecfl(obt->loc, ob->obmat, pchanact->pose_head);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
VECCOPY(obt->loc, ob->obmat[3]);
|
|
|
|
|
|
|
|
|
|
set_constraint_target(con, obt, NULL);
|
|
|
|
|
|
|
|
|
|
/* restore, add_object sets active */
|
|
|
|
|
BASACT= base;
|
|
|
|
|
base->flag |= SELECT;
|
|
|
|
|
}
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
|
2005-10-23 12:18:32 +00:00
|
|
|
/* active flag */
|
|
|
|
|
con->flag |= CONSTRAINT_ACTIVE;
|
|
|
|
|
for(con= con->prev; con; con= con->prev)
|
|
|
|
|
con->flag &= ~CONSTRAINT_ACTIVE;
|
|
|
|
|
|
|
|
|
|
DAG_scene_sort(G.scene); // sort order of objects
|
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (pchanact) {
|
2005-10-23 12:18:32 +00:00
|
|
|
ob->pose->flag |= POSE_RECALC; // sort pose channels
|
|
|
|
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); // and all its relations
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); // and all its relations
|
|
|
|
|
|
|
|
|
|
allqueue (REDRAWVIEW3D, 0);
|
|
|
|
|
allqueue (REDRAWBUTSOBJECT, 0);
|
|
|
|
|
allqueue (REDRAWOOPS, 0);
|
|
|
|
|
|
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
|
|
|
if (only_IK)
|
2005-10-23 12:18:32 +00:00
|
|
|
BIF_undo_push("Add IK Constraint");
|
|
|
|
|
else
|
|
|
|
|
BIF_undo_push("Add Constraint");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-18 18:05:14 +00:00
|
|
|
void ob_clear_constraints(void)
|
|
|
|
|
{
|
|
|
|
|
Object *ob= OBACT;
|
|
|
|
|
|
|
|
|
|
/* paranoia checks */
|
|
|
|
|
if(!ob) return;
|
|
|
|
|
if(ob==G.obedit || (ob->flag & OB_POSEMODE)) return;
|
|
|
|
|
|
|
|
|
|
if(okee("Clear Constraints")==0) return;
|
|
|
|
|
|
|
|
|
|
free_constraints(&ob->constraints);
|
|
|
|
|
|
|
|
|
|
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
|
|
|
|
|
|
|
|
|
|
allqueue (REDRAWVIEW3D, 0);
|
|
|
|
|
allqueue (REDRAWBUTSOBJECT, 0);
|
|
|
|
|
allqueue (REDRAWOOPS, 0);
|
|
|
|
|
|
|
|
|
|
BIF_undo_push("Clear Constraint(s)");
|
|
|
|
|
|
2006-01-05 23:10:54 +00:00
|
|
|
}
|
|
|
|
|
|
2006-11-02 10:13:01 +00:00
|
|
|
/* con already has the new name */
|
|
|
|
|
void rename_constraint(Object *ob, bConstraint *con, char *oldname)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *tcon;
|
|
|
|
|
bConstraintChannel *conchan;
|
|
|
|
|
ListBase *conlist= NULL;
|
|
|
|
|
int from_object= 0;
|
2006-12-20 18:29:23 +00:00
|
|
|
char *channame="";
|
2006-11-02 10:13:01 +00:00
|
|
|
|
|
|
|
|
/* get context by searching for con (primitive...) */
|
|
|
|
|
for(tcon= ob->constraints.first; tcon; tcon= tcon->next)
|
|
|
|
|
if(tcon==con)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if(tcon) {
|
|
|
|
|
conlist= &ob->constraints;
|
|
|
|
|
channame= "Object";
|
|
|
|
|
from_object= 1;
|
|
|
|
|
}
|
|
|
|
|
else if(ob->pose) {
|
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
|
|
|
|
|
|
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
|
|
|
|
for(tcon= pchan->constraints.first; tcon; tcon= tcon->next) {
|
|
|
|
|
if(tcon==con)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(tcon)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(tcon) {
|
|
|
|
|
conlist= &pchan->constraints;
|
|
|
|
|
channame= pchan->name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(conlist==NULL) {
|
|
|
|
|
printf("rename constraint failed\n"); /* should not happen in UI */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* first make sure it's a unique name within context */
|
|
|
|
|
unique_constraint_name (con, conlist);
|
|
|
|
|
|
|
|
|
|
/* own channels */
|
|
|
|
|
if(from_object) {
|
|
|
|
|
for(conchan= ob->constraintChannels.first; conchan; conchan= conchan->next) {
|
|
|
|
|
if( strcmp(oldname, conchan->name)==0 )
|
|
|
|
|
BLI_strncpy(conchan->name, con->name, sizeof(conchan->name));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* own action */
|
|
|
|
|
if(ob->action) {
|
|
|
|
|
bActionChannel *achan= get_action_channel(ob->action, channame);
|
|
|
|
|
if(achan) {
|
|
|
|
|
conchan= get_constraint_channel(&achan->constraintChannels, oldname);
|
|
|
|
|
if(conchan)
|
|
|
|
|
BLI_strncpy(conchan->name, con->name, sizeof(conchan->name));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-18 07:41:21 +00:00
|
|
|
/* ********************** CONSTRAINT-SPECIFIC STUFF ********************* */
|
|
|
|
|
/* ------------- PyConstraints ------------------ */
|
|
|
|
|
|
|
|
|
|
/* this callback sets the text-file to be used for selected menu item */
|
|
|
|
|
void validate_pyconstraint_cb(void *arg1, void *arg2)
|
|
|
|
|
{
|
|
|
|
|
bPythonConstraint *data = arg1;
|
|
|
|
|
Text *text;
|
|
|
|
|
int index = *((int *)arg2);
|
|
|
|
|
int i;
|
|
|
|
|
|
2007-07-15 07:05:24 +00:00
|
|
|
/* innovative use of a for...loop to search */
|
2007-06-18 07:41:21 +00:00
|
|
|
for (text=G.main->text.first, i=1; text && index!=i; i++, text=text->id.next);
|
|
|
|
|
data->text = text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* this returns a string for the list of usable pyconstraint script names */
|
|
|
|
|
char *buildmenu_pyconstraints(Text *con_text, int *pyconindex)
|
|
|
|
|
{
|
|
|
|
|
Text *text;
|
|
|
|
|
char *menustr = MEM_callocN(128, "menustr pyconstraints");
|
|
|
|
|
char *name, stmp[128];
|
|
|
|
|
int buf = 128;
|
|
|
|
|
int used = strlen("Scripts: %t") + 1;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
sprintf(menustr, "%s", "Scripts: %t");
|
|
|
|
|
|
|
|
|
|
for (text=G.main->text.first, i=1; text; i++, text=text->id.next) {
|
|
|
|
|
/* this is important to ensure that right script is shown as active */
|
|
|
|
|
if (text == con_text) *pyconindex = i;
|
|
|
|
|
|
|
|
|
|
/* menu entry is length of name + 3(len(|%X)) + 6 characters for the int.*/
|
|
|
|
|
if (BPY_is_pyconstraint(text)) {
|
|
|
|
|
name= text->id.name;
|
|
|
|
|
if (strlen(name)+used+10 >= buf) {
|
|
|
|
|
char *newbuf = MEM_callocN(buf+128, "menustr pyconstraints 2");
|
|
|
|
|
memcpy(newbuf, menustr, used);
|
|
|
|
|
MEM_freeN(menustr);
|
|
|
|
|
menustr = newbuf;
|
|
|
|
|
buf += 128;
|
|
|
|
|
}
|
|
|
|
|
sprintf(stmp, "|%s%%x%d", name, i);
|
|
|
|
|
strcat(menustr, stmp);
|
|
|
|
|
used += strlen(name)+10;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return menustr;
|
|
|
|
|
}
|
2007-07-29 11:15:37 +00:00
|
|
|
|
|
|
|
|
/* ------------- Child-Of Constraint ------------------ */
|
|
|
|
|
|
|
|
|
|
/* ChildOf Constraint - set inverse callback */
|
|
|
|
|
void childof_const_setinv (void *conv, void *unused)
|
|
|
|
|
{
|
|
|
|
|
bChildOfConstraint *data= (bChildOfConstraint *)conv;
|
|
|
|
|
Object *ob= OBACT;
|
|
|
|
|
bPoseChannel *pchan= NULL;
|
|
|
|
|
|
|
|
|
|
/* try to find a pose channel */
|
|
|
|
|
if (ob && ob->pose)
|
|
|
|
|
pchan= get_active_posechannel(ob);
|
|
|
|
|
|
|
|
|
|
/* calculate/set inverse matrix */
|
|
|
|
|
if (pchan) {
|
2007-08-05 09:21:29 +00:00
|
|
|
bConstraintOb *cob;
|
|
|
|
|
float ctime= bsystem_time(ob, (float)G.scene->r.cfra, 0.0); /* not accurate... */
|
|
|
|
|
float pmat[4][4], chmat[4][4], cimat[4][4];
|
|
|
|
|
float vec0[3]={0,0,0}, vec1[3]={1,1,1};
|
|
|
|
|
|
2007-08-15 04:59:46 +00:00
|
|
|
/* make copies of pchan's original matrices (to be restored later) */
|
2007-08-05 09:21:29 +00:00
|
|
|
Mat4CpyMat4(pmat, pchan->pose_mat);
|
|
|
|
|
Mat4CpyMat4(chmat, pchan->chan_mat);
|
|
|
|
|
Mat4CpyMat4(cimat, pchan->constinv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* clear pchan's transform (for constraint solving) */
|
|
|
|
|
LocEulSizeToMat4(pchan->chan_mat, vec0, vec0, vec1);
|
|
|
|
|
Mat4MulMat4(pchan->pose_mat, pmat, cimat);
|
|
|
|
|
Mat4One(pchan->constinv);
|
|
|
|
|
Mat4One(data->invmat);
|
|
|
|
|
|
2007-08-15 04:59:46 +00:00
|
|
|
|
|
|
|
|
/* do constraint solving on pose-matrix containing no transforms
|
|
|
|
|
* N.B. code is copied from armature.c (where_is_pose_bone)
|
|
|
|
|
*/
|
2007-08-05 09:21:29 +00:00
|
|
|
cob= constraints_make_evalob(ob, pchan, TARGET_BONE);
|
|
|
|
|
solve_constraints(&pchan->constraints, cob, ctime);
|
|
|
|
|
constraints_clear_evalob(cob);
|
|
|
|
|
|
|
|
|
|
|
2007-08-15 04:59:46 +00:00
|
|
|
/* parent-inverse matrix for this constraint is given by taking the
|
|
|
|
|
* local-space (i.e. without any standard parents + restpose) pose_matrix
|
|
|
|
|
* (that was calulated with no transforms applied), and inverting it.
|
|
|
|
|
*/
|
|
|
|
|
Mat4CpyMat4(pchan->constinv, pchan->pose_mat);
|
|
|
|
|
|
|
|
|
|
constraint_mat_convertspace(ob, pchan, pchan->constinv,
|
|
|
|
|
CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
|
|
|
|
|
|
|
|
|
|
Mat4Invert(data->invmat, pchan->constinv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* restore original matrices of pchan */
|
2007-08-05 09:21:29 +00:00
|
|
|
Mat4CpyMat4(pchan->pose_mat, pmat);
|
|
|
|
|
Mat4CpyMat4(pchan->chan_mat, chmat);
|
|
|
|
|
Mat4CpyMat4(pchan->constinv, cimat);
|
2007-07-29 11:15:37 +00:00
|
|
|
}
|
|
|
|
|
else if (ob) {
|
|
|
|
|
/* use what_does_parent to find inverse - just like for normal parenting.
|
|
|
|
|
* NOTE: what_does_parent uses a static workob defined in object.c
|
|
|
|
|
*/
|
|
|
|
|
what_does_parent(ob);
|
|
|
|
|
Mat4Invert(data->invmat, workob.obmat);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Mat4One(data->invmat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ChildOf Constraint - clear inverse callback */
|
|
|
|
|
void childof_const_clearinv (void *conv, void *unused)
|
|
|
|
|
{
|
|
|
|
|
bChildOfConstraint *data= (bChildOfConstraint *)conv;
|
|
|
|
|
|
|
|
|
|
/* simply clear the matrix */
|
|
|
|
|
Mat4One(data->invmat);
|
|
|
|
|
}
|