Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-07-03 21:35:38 +0400
committerTon Roosendaal <ton@blender.org>2005-07-03 21:35:38 +0400
commit28a1e8277be15fc455c816bed50e21423eb7e95a (patch)
treeaedb7afdda133681cd6b997947daeb92eb9a86cb /source/blender/makesdna
parent99a8747e8246f8eabc8c60a850f2e2651995f8a1 (diff)
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-
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_action_types.h62
-rw-r--r--source/blender/makesdna/DNA_armature_types.h140
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h3
-rw-r--r--source/blender/makesdna/DNA_ika_types.h93
-rw-r--r--source/blender/makesdna/DNA_ipo_types.h5
-rw-r--r--source/blender/makesdna/DNA_key_types.h6
-rw-r--r--source/blender/makesdna/DNA_object_types.h23
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
8 files changed, 137 insertions, 197 deletions
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 94c9bcf5d88..9e4480431e3 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -28,9 +28,7 @@
* 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.
+ * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -44,22 +42,40 @@
#include "DNA_view2d_types.h"
struct SpaceLink;
+struct ListBase;
+
+/* PoseChannel stores the results of Actions (ipos) and transform information
+ with respect to the restposition of Armature bones */
-typedef struct bPoseChannel{
+typedef struct bPoseChannel {
struct bPoseChannel *next, *prev;
ListBase constraints;
- int flag;
- float loc[3];
- float size[3];
- float quat[4];
- float obmat[4][4];
char name[32]; /* Channels need longer names than normal blender objects */
- int reserved1;
+ short flag; /* dynamic, for detecting transform changes */
+ short constflag; /* for quick detecting which constraints affect this channel */
+ int depth; /* dependency sorting help */
+
+ struct Bone *bone; /* set on read file or rebuild pose */
+ struct bPoseChannel *parent; /* set on read file or rebuild pose */
+ struct ListBase chain; /* only while evaluating pose */
+
+ float loc[3]; /* written in by actions or transform */
+ float size[3];
+ float quat[4];
+
+ float chan_mat[4][4]; /* matrix result of loc/quat/size , and where we put deform in, see next line */
+ float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat */
+ float ik_mat[3][3]; /* for itterative IK */
+
+ float pose_head[3]; /* actually pose_mat[3] */
+ float pose_tail[3]; /* also used for drawing help lines... */
+ int pad;
} bPoseChannel;
typedef struct bPose{
ListBase chanbase;
+ int flag, pad;
} bPose;
typedef struct bActionChannel {
@@ -100,5 +116,31 @@ typedef struct SpaceAction {
#define ACHAN_SELECTED 0x00000001
#define ACHAN_HILIGHTED 0x00000002
+/* Pose->flag */
+
+#define POSE_RECALC 1
+
+/* PoseChannel (transform) flags */
+enum {
+ POSE_LOC = 0x0001,
+ POSE_ROT = 0x0002,
+ POSE_SIZE = 0x0004,
+ POSE_IK_MAT = 0x0008,
+ POSE_UNUSED2 = 0x0010,
+ POSE_UNUSED3 = 0x0020,
+ POSE_UNUSED4 = 0x0040,
+ POSE_UNUSED5 = 0x0080,
+ POSE_OBMAT = 0x0100,
+ POSE_PARMAT = 0x0200,
+ POSE_DONE = 0x0400,
+ POSE_KEY = 0x1000
+};
+
+/* Pose Channel constflag (constraint) */
+#define PCHAN_HAS_IK 1
+#define PCHAN_HAS_TRACK 2
+#define PCHAN_HAS_CONST 4
+
+
#endif
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 5124716bc51..07633090902 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -23,9 +23,7 @@
* 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.
+ * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
@@ -36,35 +34,37 @@
#include "DNA_listBase.h"
#include "DNA_ID.h"
+/* this system works on different transformation space levels;
+
+1) Bone Space; with each Bone having own (0,0,0) origin
+2) Armature Space; the rest position, in Object space, Bones Spaces are applied hierarchical
+3) Pose Space; the animation position, in Object space
+4) World Space; Object matrix applied to Pose or Armature space
+
+*/
+
typedef struct Bone {
struct Bone *next, *prev; /* Next/prev elements within this list */
struct Bone *parent; /* Parent (ik parent if appropriate flag is set */
ListBase childbase; /* Children */
- char name[32]; /* Name of the bone - must be unique within the armature */
+ char name[32]; /* Name of the bone - must be unique within the armature */
- float roll;
- float head[3]; /* Orientation & length are implicit now */
- float tail[3]; /* head/tail represents rest state */
+ float roll, length; /* */
+ float head[3];
+ float tail[3]; /* head/tail and roll in Bone Space */
+ float bone_mat[3][3]; /* rotation derived from head/tail/roll */
+
int flag;
-
- /* Transformation data used for posing:
- The same information stored by other
- blenderObjects
- */
-
- float dist, weight;
- float loc[3], dloc[3];
- float size[3], dsize[3];
- float quat[4], dquat[4];
- float obmat[4][4];
- float parmat[4][4];
- float defmat[4][4];
- float irestmat[4][4]; /* Cached inverse of rest matrix (objectspace)*/
- float posemat[4][4]; /* Cached pose matrix (objectspace)*/
+
+ float arm_head[3];
+ float arm_tail[3]; /* head/tail and roll in Armature Space (rest pos) */
+ float arm_mat[4][4]; /* matrix: (bonemat(b)+head(b))*arm_mat(b-1), rest pos*/
+
+ float dist, weight; /* dist for non-deformgroup deforms */
+
+ float size[3]; /* patch for upward compat, UNUSED! */
short boneclass;
- short filler1;
- short filler2;
- short filler3;
+ short pad1;
}Bone;
typedef struct bArmature {
@@ -77,58 +77,46 @@ typedef struct bArmature {
int res3;
}bArmature;
-enum {
- ARM_RESTPOSBIT = 0,
- ARM_DRAWXRAYBIT,
- ARM_DRAWAXESBIT,
- ARM_DRAWNAMESBIT,
- ARM_POSEBIT,
- ARM_EDITBIT,
- ARM_DELAYBIT
-};
+/* armature->flag */
+#define ARM_RESTPOSBIT 0
+#define ARM_DRAWXRAYBIT 1
+#define ARM_DRAWAXESBIT 2
+#define ARM_DRAWNAMESBIT 3
+#define ARM_POSEBIT 4
+#define ARM_EDITBIT 5
+#define ARM_DELAYBIT 6
+/* dont use bit 7, was saved in files to disable stuff */
+#define ARM_NO_ACTIONBIT 8
+
+/* armature->flag */
+#define ARM_RESTPOS 0x0001
+#define ARM_DRAWXRAY 0x0002
+#define ARM_DRAWAXES 0x0004
+#define ARM_DRAWNAMES 0x0008
+#define ARM_POSEMODE 0x0010
+#define ARM_EDITMODE 0x0020
+#define ARM_DELAYDEFORM 0x0040
+#define ARM_DONT_USE 0x0080
+#define ARM_NO_ACTION 0x0100
+
+/* bone->flag */
+#define BONE_SELECTED 1
+#define BONE_ROOTSEL 2
+#define BONE_TIPSEL 4
+ /* Used instead of BONE_SELECTED during transform */
+#define BONE_TRANSFORM 8
+#define BONE_IK_TOPARENT 16
+ /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */
+#define BONE_HIDDEN 64
+ /* For detecting cyclic dependancies */
+#define BONE_DONE 128
+ /* active is on mouse clicks only */
+#define BONE_ACTIVE 256
+
+/* bone->flag bits */
+#define BONE_IK_TOPARENTBIT 4
+#define BONE_HIDDENBIT 6
-enum {
- ARM_RESTPOS = 0x00000001,
- ARM_DRAWXRAY = 0x00000002,
- ARM_DRAWAXES = 0x00000004,
- ARM_DRAWNAMES = 0x00000008,
- ARM_POSEMODE = 0x00000010,
- ARM_EDITMODE = 0x00000020,
- ARM_DELAYDEFORM = 0x00000040
-};
-
-enum {
- BONE_SELECTED = 0x00000001,
- BONE_ROOTSEL = 0x00000002,
- BONE_TIPSEL = 0x00000004,
-
- BONE_HILIGHTED = 0x00000008,
- BONE_IK_TOPARENT= 0x00000010,
- BONE_QUATROT = 0x00000020,
- BONE_HIDDEN = 0x00000040,
-
- BONE_DONE = 0x00000080, /* For detecting cyclic dependancies */
-
- BONE_ISEMPTY = 0x00000100,
- BONE_ISMUSCLE = 0x00000200,
- BONE_NOCALC = 0x00000400 /* Don't calculate bone
- * transformation, when flagged
- * (note: this is a temporary flag)
- */
-};
-
-enum {
- BONE_SELECTEDBIT = 0,
- BONE_HEADSELBIT,
- BONE_TAILSELBIT,
- BONE_HILIGHTEDBIT,
- BONE_IK_TOPARENTBIT,
- BONE_QUATROTBIT,
- BONE_HIDDENBIT,
- BONE_ISEMPTYBIT,
- BONE_ISMUSCLEBIT,
- BONE_NOCALCBIT
-};
enum {
BONE_SKINNABLE = 0,
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 06a7844b785..d7e4e97dce1 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -50,7 +50,6 @@ typedef struct bConstraintChannel{
typedef struct bConstraint{
struct bConstraint *next, *prev;
void *data; /* Constraint data (a valid constraint type) */
- Ipo *ipo; /* Constraint ipo */
char type; /* Constraint type */
char otype; /* Old type - for menu callbacks */
short flag; /* Flag */
@@ -179,7 +178,7 @@ typedef struct bStretchToConstraint{
#define CONSTRAINT_DONE 0x00000002
#define CONSTRAINT_DISABLE 0x00000004
#define CONSTRAINT_LOOPTESTED 0x00000008
-#define CONSTRAINT_NOREFRESH 0x00000010
+
#define CONSTRAINT_EXPAND_BIT 0
#define CONSTRAINT_DONE_BIT 1
diff --git a/source/blender/makesdna/DNA_ika_types.h b/source/blender/makesdna/DNA_ika_types.h
deleted file mode 100644
index 2ddbc4ed4a3..00000000000
--- a/source/blender/makesdna/DNA_ika_types.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * blenlib/DNA_ika_types.h (mar-2001 nzc)
- *
- * Old ika types. These have been superceded by Reevan's stuff
- * (armatures and bones)
- *
- * Can be removed! (ton)
- *
- * $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 *****
- */
-#ifndef DNA_IKA_TYPES_H
-#define DNA_IKA_TYPES_H
-
-#include "DNA_listBase.h"
-#include "DNA_ID.h"
-
-struct Object;
-struct Ipo;
-
-typedef struct Deform {
- struct Object *ob;
- short flag, partype;
- int par1, par2, par3; /* can be vertexnrs */
- float imat[4][4], premat[4][4], postmat[4][4];
- float vec[3]; /* when partype==LIMB, for distfunc */
- float fac, dist, pad;
-
-} Deform;
-
-typedef struct Limb {
- struct Limb *next, *prev;
-
- float len, leno, fac, alpha, alphao, pad;
- float eff[2];
-
-} Limb;
-
-typedef struct Ika {
- ID id;
-
- short partype, flag, iter, lastfra;
-
- ListBase limbbase;
- float eff[3], effg[3], effn[3];
- float mem, slow, toty, totx, xyconstraint;
-
- struct Ipo *ipo;
- struct Object *parent;
- int par1, par2, par3;
-
- int totdef;
- Deform *def;
-
- int def_scroll;
- int limb_scroll;
-} Ika;
-
-/* these defines are used for working with ikas*/
-
-/* ika.flag: */
-#define IK_GRABEFF 1
-#define IK_XYCONSTRAINT 2
-
-#endif
-
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index 5dccadb00ab..352a2589c14 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -59,7 +59,6 @@ typedef short IPO_Channel;
#define TOB_IPO 1
#define TOB_IPODROT 2
-#define TOB_IKA 4
/* disptype */
#define IPO_DISPDEGR 1
@@ -96,10 +95,6 @@ typedef short IPO_Channel;
#define OB_TIME 20
-#define OB_EFF_X 21
-#define OB_EFF_Y 22
-#define OB_EFF_Z 23
-
#define OB_COL_R 21
#define OB_COL_G 22
#define OB_COL_B 23
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index 9bdbc2fbeed..7f4d4125cb5 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -70,14 +70,18 @@ typedef struct Key {
short type, totkey;
short slurph, actkey;
+ short flag, pad1;
+ int pad2;
} Key;
/* **************** KEY ********************* */
-/* type */
+/* key->type */
#define KEY_NORMAL 0
#define KEY_RELATIVE 1
+/* key->flag */
+#define KEY_LOCKED 1
/* keyblock->type */
#define KEY_LINEAR 0
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index ea49d73cd04..92665f1804a 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -176,7 +176,8 @@ typedef struct Object {
* bit 15: Always ignore activity culling
*/
int gameflag2;
- short softflag, dummy; /* temporal stuff softbody experiment */
+ short softflag; /* softboday settings */
+ short recalc; /* dependency flag */
float anisotropicFriction[3];
ListBase constraints;
@@ -232,19 +233,18 @@ extern Object workob;
#define OB_LAMP 10
#define OB_CAMERA 11
-#define OB_IKA 20
#define OB_WAVE 21
#define OB_LATTICE 22
/* 23 and 24 are for life and sector (old file compat.) */
#define OB_ARMATURE 25
-/* partype: eerste 5 bits: type */
+/* partype: first 4 bits: type */
#define PARTYPE 15
#define PAROBJECT 0
#define PARCURVE 1
#define PARKEY 2
-#define PARLIMB 3
+
#define PARSKEL 4
#define PARVERT1 5
#define PARVERT3 6
@@ -313,12 +313,13 @@ extern Object workob;
/* also needed for base!!!!! or rather, thy interfere....*/
/* base->flag and ob->flag */
-#define BA_WASSEL 2
-#define BA_PARSEL 4
-#define BA_WHERE_UPDATE 8
-#define BA_DISP_UPDATE 16
+#define BA_WAS_SEL 2
+#define BA_HAS_RECALC_OB 4
+#define BA_HAS_RECALC_DATA 8
+
#define BA_DO_IPO 32
#define OB_GONNA_MOVE 32
+
#define BA_FROMSET 128
#define OB_DO_IMAT 256
#define OB_FROMDUPLI 512
@@ -327,6 +328,12 @@ extern Object workob;
#define OB_FROMGROUP 4096
#define OB_POSEMODE 8192
+/* ob->recalc (flag bits!) */
+#define OB_RECALC_OB 1
+#define OB_RECALC_DATA 2
+#define OB_RECALC 3
+
+
/* ob->gameflag */
#define OB_DYNAMIC 1
#define OB_CHILD 2
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index b550d18bdb2..200639cd402 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -110,7 +110,6 @@ char *includefiles[] = {
"DNA_fileglobal_types.h",
"DNA_sequence_types.h",
"DNA_effect_types.h",
- "DNA_ika_types.h",
"DNA_oops_types.h",
"DNA_property_types.h",
"DNA_sensor_types.h",
@@ -1123,7 +1122,6 @@ int main(int argc, char ** argv)
#include "DNA_fileglobal_types.h"
#include "DNA_sequence_types.h"
#include "DNA_effect_types.h"
-#include "DNA_ika_types.h"
#include "DNA_oops_types.h"
#include "DNA_property_types.h"
#include "DNA_sensor_types.h"