2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2009-01-05 15:19:31 +00: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
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 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 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-01-05 15:19:31 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
2011-02-21 07:25:24 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
2011-02-21 07:25:24 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_ARMATURE_H__
|
|
|
|
|
#define __ED_ARMATURE_H__
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-11-09 15:44:56 -02:00
|
|
|
struct Base;
|
2009-01-05 15:19:31 +00:00
|
|
|
struct Bone;
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2009-12-08 19:27:19 +00:00
|
|
|
struct IDProperty;
|
2009-01-05 15:19:31 +00:00
|
|
|
struct ListBase;
|
2018-06-06 15:50:24 +02:00
|
|
|
struct Main;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Main;
|
2018-05-08 11:33:31 +02:00
|
|
|
struct Mesh;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct MeshDeformModifierData;
|
2009-12-08 19:27:19 +00:00
|
|
|
struct Object;
|
2010-10-11 00:15:49 +00:00
|
|
|
struct ReportList;
|
2009-12-08 19:27:19 +00:00
|
|
|
struct Scene;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct UndoType;
|
2018-11-25 09:50:34 -02:00
|
|
|
struct View3D;
|
2009-12-08 19:27:19 +00:00
|
|
|
struct ViewContext;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ViewLayer;
|
|
|
|
|
struct bArmature;
|
|
|
|
|
struct bContext;
|
|
|
|
|
struct bPoseChannel;
|
2009-12-08 19:27:19 +00:00
|
|
|
struct wmKeyConfig;
|
|
|
|
|
struct wmOperator;
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
typedef struct EditBone {
|
2009-01-05 15:19:31 +00:00
|
|
|
struct EditBone *next, *prev;
|
2019-01-15 23:24:20 +11:00
|
|
|
/** User-Defined Properties on this Bone */
|
|
|
|
|
struct IDProperty *prop;
|
|
|
|
|
/** Editbones have a one-way link (i.e. children refer
|
|
|
|
|
* to parents. This is converted to a two-way link for
|
|
|
|
|
* normal bones when leaving editmode. */
|
|
|
|
|
struct EditBone *parent;
|
|
|
|
|
/** (64 == MAXBONENAME) */
|
|
|
|
|
char name[64];
|
|
|
|
|
/** Roll along axis. We'll ultimately use the axis/angle method
|
|
|
|
|
* for determining the transformation matrix of the bone. The axis
|
|
|
|
|
* is tail-head while roll provides the angle. Refer to Graphics
|
|
|
|
|
* Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
|
|
|
|
|
float roll;
|
|
|
|
|
|
|
|
|
|
/** Orientation and length is implicit during editing */
|
|
|
|
|
float head[3];
|
2012-05-12 20:39:39 +00:00
|
|
|
float tail[3];
|
2019-01-15 23:24:20 +11:00
|
|
|
/** All joints are considered to have zero rotation with respect to
|
2018-11-14 12:53:15 +11:00
|
|
|
* their parents. Therefore any rotations specified during the
|
2012-05-12 20:39:39 +00:00
|
|
|
* animation are automatically relative to the bones' rest positions*/
|
|
|
|
|
int flag;
|
|
|
|
|
int layer;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-01-05 15:19:31 +00:00
|
|
|
float dist, weight;
|
2019-01-15 23:24:20 +11:00
|
|
|
/** put them in order! transform uses this as scale */
|
|
|
|
|
float xwidth, length, zwidth;
|
2009-01-05 15:19:31 +00:00
|
|
|
float rad_head, rad_tail;
|
2017-11-01 13:38:51 +13:00
|
|
|
|
|
|
|
|
/* Bendy-Bone parameters */
|
2016-05-18 03:19:06 +12:00
|
|
|
float roll1, roll2;
|
|
|
|
|
float curveOutX, curveOutY;
|
|
|
|
|
float curveInX, curveInY;
|
2017-11-01 13:38:51 +13:00
|
|
|
float ease1, ease2;
|
2016-05-18 03:19:06 +12:00
|
|
|
float scaleIn, scaleOut;
|
2017-11-01 13:38:51 +13:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** for envelope scaling */
|
|
|
|
|
float oldlength;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-11-28 03:49:45 +00:00
|
|
|
short segments;
|
2015-03-28 04:34:28 +11:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/** Type of next/prev bone handles */
|
|
|
|
|
char bbone_prev_type;
|
2018-08-05 18:48:05 +03:00
|
|
|
char bbone_next_type;
|
2019-01-15 23:24:20 +11:00
|
|
|
/** Next/prev bones to use as handle references when calculating bbones (optional) */
|
|
|
|
|
struct EditBone *bbone_prev;
|
2018-08-05 18:48:05 +03:00
|
|
|
struct EditBone *bbone_next;
|
|
|
|
|
|
2017-02-22 12:46:27 +01:00
|
|
|
/* Used for display */
|
2019-01-15 23:24:20 +11:00
|
|
|
/** in Armature space, rest pos matrix */
|
|
|
|
|
float disp_mat[4][4];
|
|
|
|
|
/** in Armature space, rest pos matrix */
|
|
|
|
|
float disp_tail_mat[4][4];
|
|
|
|
|
/** in Armature space, rest pos matrix (32 == MAX_BBONE_SUBDIV) */
|
|
|
|
|
float disp_bbone_mat[32][4][4];
|
|
|
|
|
|
|
|
|
|
/** connected child temporary during drawing */
|
|
|
|
|
struct EditBone *bbone_child;
|
2018-08-07 21:08:16 +03:00
|
|
|
|
2015-03-28 04:34:28 +11:00
|
|
|
/* Used to store temporary data */
|
|
|
|
|
union {
|
|
|
|
|
struct EditBone *ebone;
|
|
|
|
|
struct Bone *bone;
|
|
|
|
|
void *p;
|
|
|
|
|
int i;
|
|
|
|
|
} temp;
|
2009-01-05 15:19:31 +00:00
|
|
|
} EditBone;
|
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
#define BONESEL_ROOT (1 << 28)
|
|
|
|
|
#define BONESEL_TIP (1 << 29)
|
|
|
|
|
#define BONESEL_BONE (1 << 30)
|
|
|
|
|
#define BONESEL_ANY (BONESEL_TIP | BONESEL_ROOT | BONESEL_BONE)
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2014-04-28 02:22:03 +10:00
|
|
|
#define BONESEL_NOSEL (1u << 31u)
|
2009-01-05 15:19:31 +00:00
|
|
|
|
|
|
|
|
/* useful macros */
|
2012-10-07 07:27:09 +00:00
|
|
|
#define EBONE_VISIBLE(arm, ebone) ( \
|
2013-08-17 04:48:34 +00:00
|
|
|
CHECK_TYPE_INLINE(arm, bArmature *), \
|
|
|
|
|
CHECK_TYPE_INLINE(ebone, EditBone *), \
|
2012-10-07 07:27:09 +00:00
|
|
|
(((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A)) \
|
|
|
|
|
)
|
|
|
|
|
|
2012-10-05 05:27:51 +00:00
|
|
|
#define EBONE_SELECTABLE(arm, ebone) (EBONE_VISIBLE(arm, ebone) && !(ebone->flag & BONE_UNSELECTABLE))
|
2012-10-07 07:27:09 +00:00
|
|
|
|
|
|
|
|
#define EBONE_EDITABLE(ebone) ( \
|
2013-08-17 04:48:34 +00:00
|
|
|
CHECK_TYPE_INLINE(ebone, EditBone *), \
|
2012-10-07 07:27:09 +00:00
|
|
|
(((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED)) \
|
|
|
|
|
)
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2013-11-05 21:59:30 +00:00
|
|
|
/* used in armature_select_hierarchy_exec() */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define BONE_SELECT_PARENT 0
|
|
|
|
|
#define BONE_SELECT_CHILD 1
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2009-02-01 17:33:10 +00:00
|
|
|
/* armature_ops.c */
|
|
|
|
|
void ED_operatortypes_armature(void);
|
2009-10-27 11:10:30 +00:00
|
|
|
void ED_operatormacros_armature(void);
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void ED_keymap_armature(struct wmKeyConfig *keyconf);
|
2009-02-01 17:33:10 +00:00
|
|
|
|
2009-01-05 16:15:23 +00:00
|
|
|
/* editarmature.c */
|
2018-06-06 15:50:24 +02:00
|
|
|
void ED_armature_from_edit(struct Main *bmain, struct bArmature *arm);
|
2013-12-17 22:13:15 +11:00
|
|
|
void ED_armature_to_edit(struct bArmature *arm);
|
|
|
|
|
void ED_armature_edit_free(struct bArmature *arm);
|
2015-03-28 04:34:28 +11:00
|
|
|
|
2019-03-26 18:47:55 +11:00
|
|
|
bool ED_armature_edit_deselect_all(struct Object *obedit);
|
|
|
|
|
bool ED_armature_edit_deselect_all_visible(struct Object *obedit);
|
2009-07-25 13:40:59 +00:00
|
|
|
|
2019-03-26 18:47:55 +11:00
|
|
|
bool ED_armature_edit_deselect_all_multi_ex(struct Base **bases, uint bases_len);
|
|
|
|
|
bool ED_armature_edit_deselect_all_visible_multi_ex(struct Base **bases, uint bases_len);
|
|
|
|
|
bool ED_armature_edit_deselect_all_visible_multi(struct bContext *C);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-15 11:45:51 +02:00
|
|
|
bool ED_armature_pose_select_pick_with_buffer(
|
2018-11-25 09:50:34 -02:00
|
|
|
struct ViewLayer *view_layer, struct View3D *v3d, struct Base *base, const unsigned int *buffer, short hits,
|
2017-03-02 02:14:02 +11:00
|
|
|
bool extend, bool deselect, bool toggle, bool do_nearest);
|
2018-04-15 11:45:51 +02:00
|
|
|
bool ED_armature_edit_select_pick(
|
|
|
|
|
struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
|
2018-12-13 19:05:11 +11:00
|
|
|
|
|
|
|
|
bool ED_armature_edit_select_op_from_tagged(
|
|
|
|
|
struct bArmature *arm, const int sel_op);
|
|
|
|
|
|
2009-07-13 00:40:20 +00:00
|
|
|
int join_armature_exec(struct bContext *C, struct wmOperator *op);
|
2018-04-15 11:57:49 +02:00
|
|
|
float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float new_up_axis[3], const bool axis_only);
|
2018-04-15 11:45:51 +02:00
|
|
|
EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name);
|
|
|
|
|
EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, EditBone *ebo);
|
|
|
|
|
void ED_armature_edit_sync_selection(struct ListBase *edbo);
|
|
|
|
|
void ED_armature_edit_validate_active(struct bArmature *arm);
|
2009-01-08 17:12:50 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
struct Base *ED_armature_base_and_ebone_from_select_buffer(
|
|
|
|
|
struct Base **bases, uint bases_len, int hit, struct EditBone **r_ebone);
|
|
|
|
|
struct Object *ED_armature_object_and_ebone_from_select_buffer(
|
|
|
|
|
struct Object **objects, uint objects_len, int hit, struct EditBone **r_ebone);
|
|
|
|
|
|
|
|
|
|
struct Base *ED_armature_base_and_bone_from_select_buffer(
|
|
|
|
|
struct Base **bases, uint bases_len, int hit, struct Bone **r_bone);
|
|
|
|
|
|
2018-04-15 11:45:51 +02:00
|
|
|
EditBone *ED_armature_ebone_add_primitive(struct Object *obedit_arm, float length, bool view_aligned);
|
|
|
|
|
EditBone *ED_armature_ebone_add(struct bArmature *arm, const char *name);
|
2018-03-22 07:50:58 +01:00
|
|
|
|
2018-04-15 11:45:51 +02:00
|
|
|
void ED_armature_ebone_remove_ex(struct bArmature *arm, EditBone *exBone, bool clear_connected);
|
|
|
|
|
void ED_armature_ebone_remove(struct bArmature *arm, EditBone *exBone);
|
2013-07-25 12:07:55 +00:00
|
|
|
|
2013-03-11 16:23:33 +00:00
|
|
|
bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child);
|
2018-04-15 11:45:51 +02:00
|
|
|
EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot);
|
2009-02-25 14:50:40 +00:00
|
|
|
|
2013-07-25 12:07:55 +00:00
|
|
|
void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]);
|
|
|
|
|
void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]);
|
|
|
|
|
|
2014-05-05 20:56:38 +02:00
|
|
|
void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
|
|
|
|
|
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
|
|
|
|
|
|
2018-04-15 11:45:51 +02:00
|
|
|
void ED_armature_edit_transform_mirror_update(struct Object *obedit);
|
2019-01-16 19:57:58 +11:00
|
|
|
void ED_armature_origin_set(struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around);
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2017-08-11 22:16:44 +10:00
|
|
|
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
|
2018-06-06 15:50:24 +02:00
|
|
|
void ED_armature_transform_apply(struct Main *bmain, struct Object *ob, float mat[4][4], const bool do_props);
|
|
|
|
|
void ED_armature_transform(struct Main *bmain, struct bArmature *arm, float mat[4][4], const bool do_props);
|
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
#define ARM_GROUPS_NAME 1
|
|
|
|
|
#define ARM_GROUPS_ENVELOPE 2
|
|
|
|
|
#define ARM_GROUPS_AUTO 3
|
2009-07-24 16:41:12 +00:00
|
|
|
|
2018-04-15 12:03:09 +02:00
|
|
|
void ED_object_vgroup_calc_from_armature(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene,
|
2017-09-28 07:30:05 +10:00
|
|
|
struct Object *ob, struct Object *par, const int mode, const bool mirror);
|
2009-07-24 16:41:12 +00:00
|
|
|
|
2014-10-10 18:26:46 +02:00
|
|
|
/* if bone is already in list, pass it as param to ignore it */
|
2018-04-15 11:45:51 +02:00
|
|
|
void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, EditBone *bone);
|
2018-06-07 12:47:00 +02:00
|
|
|
void ED_armature_bone_rename(struct Main *bmain, struct bArmature *arm, const char *oldnamep, const char *newnamep);
|
|
|
|
|
void ED_armature_bones_flip_names(struct Main *bmain, struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers);
|
2009-01-14 16:13:50 +00:00
|
|
|
|
2013-07-16 01:49:20 +00:00
|
|
|
/* low level selection functions which handle */
|
|
|
|
|
int ED_armature_ebone_selectflag_get(const EditBone *ebone);
|
2013-07-16 11:42:07 +00:00
|
|
|
void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag);
|
2013-07-16 01:49:20 +00:00
|
|
|
void ED_armature_ebone_select_set(EditBone *ebone, bool select);
|
|
|
|
|
void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag);
|
|
|
|
|
void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag);
|
|
|
|
|
|
2018-03-19 14:17:59 +01:00
|
|
|
/* editarmature_undo.c */
|
|
|
|
|
void ED_armature_undosys_type(struct UndoType *ut);
|
|
|
|
|
|
2018-03-19 17:10:07 +01:00
|
|
|
/* armature_utils.c */
|
|
|
|
|
void ED_armature_ebone_listbase_temp_clear(struct ListBase *lb);
|
|
|
|
|
void ED_armature_ebone_listbase_free(struct ListBase *lb);
|
|
|
|
|
void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src);
|
|
|
|
|
|
2009-01-05 16:15:23 +00:00
|
|
|
/* poseobject.c */
|
2018-04-11 09:41:49 +02:00
|
|
|
bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
|
2018-04-11 09:20:29 +02:00
|
|
|
bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
|
2018-04-11 09:41:49 +02:00
|
|
|
bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob);
|
2018-04-11 09:20:29 +02:00
|
|
|
bool ED_object_posemode_enter(struct bContext *C, struct Object *ob);
|
2019-03-26 18:47:55 +11:00
|
|
|
bool ED_pose_deselect_all_multi_ex(struct Base **bases, uint bases_len, int select_mode, const bool ignore_visibility);
|
|
|
|
|
bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, const bool ignore_visibility);
|
2018-08-28 16:17:37 +10:00
|
|
|
bool ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility);
|
|
|
|
|
void ED_pose_bone_select_tag_update(struct Object *ob);
|
2013-10-17 14:19:03 +00:00
|
|
|
void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
|
2018-09-14 14:03:31 +02:00
|
|
|
void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob, bool current_frame_only);
|
2012-09-23 02:31:30 +00:00
|
|
|
struct Object *ED_pose_object_from_context(struct bContext *C);
|
2009-01-05 16:15:23 +00:00
|
|
|
|
2009-11-05 18:05:55 +00:00
|
|
|
/* meshlaplacian.c */
|
2018-04-15 12:03:09 +02:00
|
|
|
void ED_mesh_deform_bind_callback(
|
|
|
|
|
struct MeshDeformModifierData *mmd,
|
2018-05-08 11:33:31 +02:00
|
|
|
struct Mesh *cagemesh,
|
2018-04-15 12:03:09 +02:00
|
|
|
float *vertexcos, int totvert, float cagemat[4][4]);
|
|
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2009-11-05 18:05:55 +00:00
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __ED_ARMATURE_H__ */
|