2011-02-18 14:05:18 +01:00
|
|
|
/*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* 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
|
2008-04-17 00:40:48 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 13:37:38 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2008-04-17 00:40:48 +02:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02:00
|
|
|
*/
|
2012-02-17 19:59:41 +01:00
|
|
|
#ifndef __BKE_ARMATURE_H__
|
|
|
|
#define __BKE_ARMATURE_H__
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2011-02-18 14:05:18 +01:00
|
|
|
/** \file BKE_armature.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \since March 2001
|
|
|
|
* \author nzc
|
|
|
|
*/
|
|
|
|
|
2017-06-07 15:50:34 +02:00
|
|
|
struct bPose;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct Bone;
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2016-01-08 23:12:06 +01:00
|
|
|
struct GHash;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct Main;
|
|
|
|
struct bArmature;
|
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 19:35:38 +02:00
|
|
|
struct bPoseChannel;
|
|
|
|
struct bConstraint;
|
2009-01-04 15:14:06 +01:00
|
|
|
struct Scene;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct Object;
|
2005-09-01 00:09:44 +02:00
|
|
|
struct PoseTree;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct ListBase;
|
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
typedef struct PoseTarget {
|
2005-08-27 14:48:45 +02:00
|
|
|
struct PoseTarget *next, *prev;
|
2005-09-01 00:09:44 +02:00
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
struct bConstraint *con; /* the constrait of this target */
|
|
|
|
int tip; /* index of tip pchan in PoseTree */
|
2005-08-27 14:48:45 +02:00
|
|
|
} PoseTarget;
|
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
typedef struct PoseTree {
|
2005-09-01 00:09:44 +02:00
|
|
|
struct PoseTree *next, *prev;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
int type; /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */
|
|
|
|
int totchannel; /* number of pose channels */
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
struct ListBase targets; /* list of targets of the tree */
|
|
|
|
struct bPoseChannel **pchan; /* array of pose channels */
|
|
|
|
int *parent; /* and their parents */
|
|
|
|
|
|
|
|
float (*basis_change)[3][3]; /* basis change result from solver */
|
|
|
|
int iterations; /* iterations from the constraint */
|
|
|
|
int stretch; /* disable stretching */
|
2005-09-01 00:09:44 +02:00
|
|
|
} PoseTree;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
|
|
|
/* Core armature functionality */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2009-01-10 20:34:23 +01:00
|
|
|
|
2013-02-05 13:46:15 +01:00
|
|
|
struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
|
2012-05-05 18:03:57 +02:00
|
|
|
struct bArmature *BKE_armature_from_object(struct Object *ob);
|
2016-01-08 23:12:06 +01:00
|
|
|
int BKE_armature_bonelist_count(struct ListBase *lb);
|
2012-05-12 22:39:39 +02:00
|
|
|
void BKE_armature_bonelist_free(struct ListBase *lb);
|
2012-05-05 16:03:12 +02:00
|
|
|
void BKE_armature_free(struct bArmature *arm);
|
2016-07-20 19:49:45 +02:00
|
|
|
void BKE_armature_make_local(struct Main *bmain, struct bArmature *arm, const bool lib_local);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_armature_copy_data(struct Main *bmain, struct bArmature *arm_dst, const struct bArmature *arm_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct bArmature *BKE_armature_copy(struct Main *bmain, const struct bArmature *arm);
|
2008-01-28 01:53:54 +01:00
|
|
|
|
2012-03-22 14:27:24 +01:00
|
|
|
/* Bounding box. */
|
2012-05-05 18:03:57 +02:00
|
|
|
struct BoundBox *BKE_armature_boundbox_get(struct Object *ob);
|
2012-03-22 14:27:24 +01:00
|
|
|
|
2015-09-03 20:18:49 +02:00
|
|
|
bool BKE_pose_minmax(struct Object *ob, float r_min[3], float r_max[3], bool use_hidden, bool use_select);
|
|
|
|
|
2012-05-12 22:39:39 +02:00
|
|
|
int bone_autoside_name(char name[64], int strip_number, short axis, float head, float tail);
|
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 19:35:38 +02:00
|
|
|
|
2016-01-08 23:12:06 +01:00
|
|
|
struct Bone *BKE_armature_find_bone_name(struct bArmature *arm, const char *name);
|
|
|
|
struct GHash *BKE_armature_bone_from_name_map(struct bArmature *arm);
|
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 19:35:38 +02:00
|
|
|
|
2015-03-04 04:38:16 +01:00
|
|
|
bool BKE_armature_bone_flag_test_recursive(const struct Bone *bone, int flag);
|
|
|
|
|
2012-04-23 22:09:59 +02:00
|
|
|
float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2012-05-05 18:03:57 +02:00
|
|
|
void BKE_armature_where_is(struct bArmature *arm);
|
2015-09-04 12:12:49 +02:00
|
|
|
void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone, const bool use_recursion);
|
2016-07-21 16:15:00 +02:00
|
|
|
void BKE_pose_clear_pointers(struct bPose *pose);
|
2018-05-03 16:10:37 +02:00
|
|
|
void BKE_pose_remap_bone_pointers(struct bArmature *armature, struct bPose *pose);
|
2012-05-05 18:03:57 +02:00
|
|
|
void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm);
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_pose_where_is(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
|
|
|
|
void BKE_pose_where_is_bone(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra);
|
2012-05-05 18:03:57 +02:00
|
|
|
void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan);
|
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 19:35:38 +02:00
|
|
|
|
2005-07-16 21:07:02 +02:00
|
|
|
/* get_objectspace_bone_matrix has to be removed still */
|
2012-12-11 15:29:01 +01:00
|
|
|
void get_objectspace_bone_matrix(struct Bone *bone, float M_accumulatedMatrix[4][4], int root, int posed);
|
|
|
|
void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3]);
|
2014-05-21 15:22:31 +02:00
|
|
|
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float mat[3][3]);
|
2012-12-11 15:29:01 +01:00
|
|
|
void mat3_to_vec_roll(float mat[3][3], float r_vec[3], float *r_roll);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2006-12-22 10:05:37 +01:00
|
|
|
/* Common Conversions Between Co-ordinate Spaces */
|
2012-12-11 15:29:01 +01:00
|
|
|
void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[4][4], float outmat[4][4]);
|
2012-05-05 18:03:57 +02:00
|
|
|
void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
|
2012-12-11 15:29:01 +01:00
|
|
|
void BKE_armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]);
|
2012-05-05 18:03:57 +02:00
|
|
|
void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]);
|
2012-12-11 15:29:01 +01:00
|
|
|
void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]);
|
|
|
|
void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4]);
|
2006-12-22 10:05:37 +01:00
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, struct Object *ob, struct bPoseChannel *pchan, float inmat[4][4], float outmat[4][4]);
|
2012-02-01 06:59:50 +01:00
|
|
|
|
2014-04-01 02:34:00 +02:00
|
|
|
void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[3][3], bool use_compat);
|
|
|
|
void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[4][4], bool use_comat);
|
2012-05-05 18:03:57 +02:00
|
|
|
void BKE_pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]);
|
|
|
|
void BKE_pchan_calc_mat(struct bPoseChannel *pchan);
|
2010-02-19 16:34:26 +01:00
|
|
|
|
2012-01-17 14:30:20 +01:00
|
|
|
/* Get the "pchan to pose" transform matrix. These matrices apply the effects of
|
|
|
|
* HINGE/NO_SCALE/NO_LOCAL_LOCATION options over the pchan loc/rot/scale transformations. */
|
2012-12-11 15:29:01 +01:00
|
|
|
void BKE_pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[4][4], float loc_mat[4][4]);
|
2012-01-17 14:30:20 +01:00
|
|
|
|
2009-09-28 12:19:20 +02:00
|
|
|
/* Rotation Mode Conversions - Used for PoseChannels + Objects... */
|
2009-10-08 02:57:00 +02:00
|
|
|
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode);
|
2009-09-28 12:19:20 +02:00
|
|
|
|
2005-07-16 21:07:02 +02:00
|
|
|
/* B-Bone support */
|
2013-08-19 12:14:22 +02:00
|
|
|
#define MAX_BBONE_SUBDIV 32
|
|
|
|
|
2005-07-16 21:07:02 +02:00
|
|
|
typedef struct Mat4 {
|
|
|
|
float mat[4][4];
|
|
|
|
} Mat4;
|
|
|
|
|
2016-05-17 17:19:06 +02:00
|
|
|
void equalize_bbone_bezier(float *data, int desired);
|
2013-08-19 12:14:22 +02:00
|
|
|
void b_bone_spline_setup(struct bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BBONE_SUBDIV]);
|
2005-07-16 21:07:02 +02:00
|
|
|
|
2010-11-03 02:56:02 +01:00
|
|
|
/* like EBONE_VISIBLE */
|
2012-10-07 09:27:09 +02:00
|
|
|
#define PBONE_VISIBLE(arm, bone) ( \
|
2013-08-17 06:48:34 +02:00
|
|
|
CHECK_TYPE_INLINE(arm, bArmature *), \
|
|
|
|
CHECK_TYPE_INLINE(bone, Bone *), \
|
2012-10-07 09:27:09 +02:00
|
|
|
(((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P)) \
|
|
|
|
)
|
|
|
|
|
|
|
|
#define PBONE_SELECTABLE(arm, bone) \
|
|
|
|
(PBONE_VISIBLE(arm, bone) && !((bone)->flag & BONE_UNSELECTABLE))
|
2010-11-03 02:56:02 +01:00
|
|
|
|
2018-04-30 18:46:52 +02:00
|
|
|
|
|
|
|
/* context.selected_pose_bones */
|
|
|
|
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan) \
|
|
|
|
for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \
|
|
|
|
if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone) && ((_pchan)->bone->flag & BONE_SELECTED)) {
|
|
|
|
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END \
|
|
|
|
} \
|
|
|
|
} ((void)0)
|
|
|
|
/* context.visible_pose_bones */
|
|
|
|
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN(_ob, _pchan) \
|
|
|
|
for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \
|
|
|
|
if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone)) {
|
|
|
|
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END \
|
|
|
|
} \
|
|
|
|
} ((void)0)
|
|
|
|
|
|
|
|
|
2015-05-12 09:50:24 +02:00
|
|
|
/* Evaluation helpers */
|
2015-05-12 10:57:11 +02:00
|
|
|
struct bKinematicConstraint;
|
|
|
|
struct bPose;
|
|
|
|
struct bSplineIKConstraint;
|
|
|
|
|
2015-05-12 22:10:49 +02:00
|
|
|
struct bPoseChannel *BKE_armature_ik_solver_find_root(
|
2018-05-08 16:57:07 +02:00
|
|
|
struct bPoseChannel *pchan,
|
|
|
|
struct bKinematicConstraint *data);
|
2015-05-12 22:10:49 +02:00
|
|
|
struct bPoseChannel *BKE_armature_splineik_solver_find_root(
|
2018-05-08 16:57:07 +02:00
|
|
|
struct bPoseChannel *pchan,
|
|
|
|
struct bSplineIKConstraint *data);
|
2015-05-12 09:50:24 +02:00
|
|
|
|
|
|
|
void BKE_pose_splineik_init_tree(struct Scene *scene, struct Object *ob, float ctime);
|
2017-08-16 04:45:11 +02:00
|
|
|
void BKE_splineik_execute_tree(
|
2018-05-08 16:57:07 +02:00
|
|
|
struct Depsgraph *depsgraph, struct Scene *scene,
|
|
|
|
struct Object *ob, struct bPoseChannel *pchan_root, float ctime);
|
|
|
|
|
|
|
|
void BKE_pose_eval_init(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob);
|
|
|
|
|
|
|
|
void BKE_pose_eval_init_ik(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob);
|
|
|
|
|
|
|
|
void BKE_pose_eval_bone(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
int pchan_index);
|
|
|
|
|
|
|
|
void BKE_pose_constraints_evaluate(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
int pchan_index);
|
|
|
|
|
|
|
|
void BKE_pose_bone_done(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Object *ob,
|
|
|
|
int pchan_index);
|
|
|
|
|
|
|
|
void BKE_pose_iktree_evaluate(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
int rootchan_index);
|
|
|
|
|
|
|
|
void BKE_pose_splineik_evaluate(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
int rootchan_index);
|
|
|
|
|
|
|
|
void BKE_pose_eval_flush(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob);
|
|
|
|
|
|
|
|
void BKE_pose_eval_proxy_copy(
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Object *ob);
|
2015-05-12 10:57:11 +02:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2002-10-30 03:07:20 +01:00
|
|
|
|
2002-10-12 13:37:38 +02:00
|
|
|
#endif
|
2002-10-30 03:07:20 +01:00
|
|
|
|