Blender
V3.3
|
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_string_utils.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "DEG_depsgraph.h"
#include "armature_intern.h"
Go to the source code of this file.
Operators and API's for creating bones.
Definition in file armature_add.c.
Adds an EditBone between the nominated locations (should be in the right space).
Definition at line 262 of file armature_add.c.
References copy_v3_v3(), Object::data, ED_armature_ebone_add(), EditBone::head, and EditBone::tail.
Referenced by armature_fill_bones_exec().
|
static |
Definition at line 1559 of file armature_add.c.
References add_v3_v3v3(), C, copy_m3_m4(), copy_v3_v3(), CTX_data_edit_object(), CTX_data_scene(), CTX_wm_region_view3d(), Object::data, DEG_id_tag_update(), ED_armature_ebone_add(), ED_armature_edit_deselect_all(), ED_armature_edit_refresh_layer_used(), ED_outliner_select_sync_from_edit_bone_tag(), EditBone::head, Object::id, ID_RECALC_SELECT, Object::imat, invert_m3_m3(), invert_m4_m4(), MAXBONENAME, mul_m3_m3m3(), mul_m4_v3(), NC_OBJECT, ND_BONE_SELECT, Object::obmat, OPERATOR_FINISHED, wmOperator::ptr, RNA_string_get(), EditBone::tail, unit_m3(), USER_ADD_VIEWALIGNED, RegionView3D::viewmat, and WM_event_add_notifier().
Referenced by ARMATURE_OT_bone_primitive_add().
|
static |
Note this is already ported to multi-objects as it is. Since only the active bone is extruded even for single objects, it makes sense to stick to the active object here.
If we want the support to be expanded we should something like the offset we do for mesh click extrude.
Definition at line 114 of file armature_add.c.
References Freestyle::a, bArmature::act_edbone, ARM_MIRROR_EDIT, BONE_CONNECTED, BONE_ROOTSEL, BONE_TIPSEL, C, copy_m3_m4(), copy_v3_v3(), CTX_data_edit_object(), CTX_data_scene(), Scene::cursor, Object::data, DEG_id_tag_update(), EditBone::dist, EBONE_VISIBLE, ED_armature_ebone_add(), ED_armature_ebone_get_mirrored(), ED_armature_edit_deselect_all(), ED_armature_edit_sync_selection(), ED_outliner_select_sync_from_edit_bone_tag(), bArmature::edbo, ListBase::first, EditBone::flag, bArmature::flag, EditBone::head, Object::id, ID_RECALC_SELECT, invert_m3_m3(), len_v3v3(), EditBone::length, View3DCursor::location, mul_m3_v3(), EditBone::name, NC_OBJECT, ND_BONE_SELECT, EditBone::next, NULL, Object::obmat, OPERATOR_CANCELLED, OPERATOR_FINISHED, EditBone::parent, EditBone::rad_head, EditBone::rad_tail, scene, sub_v3_v3v3(), SWAP, EditBone::tail, and WM_event_add_notifier().
Referenced by armature_click_extrude_invoke(), and ARMATURE_OT_click_extrude().
|
static |
Definition at line 208 of file armature_add.c.
References armature_click_extrude_exec(), C, copy_v2fl_v2i(), copy_v3_v3(), CTX_data_scene(), CTX_wm_region(), CTX_wm_view3d(), Scene::cursor, ED_view3d_win_to_3d(), View3DCursor::location, wmEvent::mval, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, scene, and WM_operator_flag_only_pass_through_on_press().
Referenced by ARMATURE_OT_click_extrude().
|
static |
Definition at line 924 of file armature_add.c.
References bArmature::act_edbone, ARM_MIRROR_EDIT, EditBone::bbone_next, EditBone::bbone_prev, BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_string_flip_side_name(), BONE_CONNECTED, BONE_ROOTSEL, BONE_SELECTED, BONE_TIPSEL, C, CTX_DATA_COUNT, CTX_data_view_layer(), CTX_wm_view3d(), Object::data, DEG_id_tag_update(), duplicateEditBone(), EditBone::ebone, EBONE_VISIBLE, ED_armature_ebone_find_name(), ED_armature_ebone_get_mirrored(), ED_armature_edit_sync_selection(), ED_armature_edit_validate_active(), ED_outliner_select_sync_from_edit_bone_tag(), bArmature::edbo, ListBase::first, EditBone::flag, bArmature::flag, Object::id, ID_RECALC_SELECT, MAXBONENAME, MEM_freeN, EditBone::name, NC_OBJECT, ND_BONE_SELECT, EditBone::next, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, EditBone::parent, postEditBoneDuplicate(), preEditBoneDuplicate(), wmOperator::ptr, RNA_boolean_get(), EditBone::temp, updateDuplicateSubtarget(), and WM_event_add_notifier().
Referenced by ARMATURE_OT_duplicate().
|
static |
Definition at line 1353 of file armature_add.c.
References Freestyle::a, bArmature::act_edbone, ARM_MIRROR_EDIT, BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_addtail(), BLI_strncpy(), BONE_CONNECTED, BONE_RELATIVE_PARENTING, BONE_ROOTSEL, BONE_SELECTED, BONE_TIPSEL, C, copy_v3_v3(), CTX_data_view_layer(), CTX_wm_view3d(), EditBone::curve_in_x, EditBone::curve_in_z, EditBone::curve_out_x, EditBone::curve_out_z, Object::data, DEG_id_tag_update(), EditBone::dist, EditBone::ease1, EditBone::ease2, EBONE_VISIBLE, ED_armature_ebone_get_mirrored(), ED_armature_ebone_unique_name(), ED_armature_edit_sync_selection(), ED_outliner_select_sync_from_edit_bone_tag(), bArmature::edbo, ListBase::first, EditBone::flag, bArmature::flag, EditBone::head, Object::id, ID_RECALC_SELECT, EditBone::layer, MAXBONENAME, MEM_callocN, MEM_freeN, EditBone::name, NC_OBJECT, ND_BONE_SELECT, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, EditBone::parent, wmOperator::ptr, EditBone::rad_head, EditBone::rad_tail, RNA_boolean_get(), EditBone::roll1, EditBone::roll2, EditBone::scale_in, EditBone::scale_out, EditBone::segments, SWAP, EditBone::tail, EditBone::weight, WM_event_add_notifier(), EditBone::xwidth, and EditBone::zwidth.
Referenced by ARMATURE_OT_extrude().
void ARMATURE_OT_bone_primitive_add | ( | wmOperatorType * | ot | ) |
Definition at line 1610 of file armature_add.c.
References armature_bone_primitive_add_exec(), wmOperatorType::description, ED_operator_editarmature(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, MAXBONENAME, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_string(), and wmOperatorType::srna.
Referenced by ED_operatortypes_armature().
void ARMATURE_OT_click_extrude | ( | wmOperatorType * | ot | ) |
Definition at line 244 of file armature_add.c.
References armature_click_extrude_exec(), armature_click_extrude_invoke(), wmOperatorType::description, ED_operator_editarmature(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_DEPENDS_ON_CURSOR, OPTYPE_REGISTER, OPTYPE_UNDO, ot, and wmOperatorType::poll.
Referenced by ED_operatortypes_armature().
void ARMATURE_OT_duplicate | ( | wmOperatorType * | ot | ) |
Definition at line 1058 of file armature_add.c.
References armature_duplicate_selected_exec(), wmOperatorType::description, ED_operator_editarmature(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_armature().
void ARMATURE_OT_extrude | ( | wmOperatorType * | ot | ) |
Definition at line 1537 of file armature_add.c.
References armature_extrude_exec(), wmOperatorType::description, ED_operator_editarmature(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_armature().
void ARMATURE_OT_subdivide | ( | wmOperatorType * | ot | ) |
Definition at line 1701 of file armature_add.c.
References armature_subdivide_exec(), wmOperatorType::description, ED_operator_editarmature(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, PROP_SKIP_SAVE, RNA_def_int(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ED_operatortypes_armature().
void ARMATURE_OT_symmetrize | ( | wmOperatorType * | ot | ) |
Definition at line 1317 of file armature_add.c.
References armature_symmetrize_exec(), wmOperatorType::description, ED_operator_editarmature(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, NULL, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, wmOperatorType::prop, RNA_def_enum(), and wmOperatorType::srna.
Referenced by ED_operatortypes_armature().
|
static |
Definition at line 1635 of file armature_add.c.
References BLI_addtail(), BONE_CONNECTED, C, copy_v3_v3(), CTX_DATA_BEGIN_WITH_ID, CTX_data_edit_object(), CTX_DATA_END, DEG_id_tag_update(), ED_armature_ebone_unique_name(), ED_outliner_select_sync_from_edit_bone_tag(), EditBone::flag, float(), EditBone::head, Object::id, ID_RECALC_SELECT, MEM_mallocN, EditBone::name, NC_OBJECT, ND_BONE_SELECT, EditBone::next, NULL, OPERATOR_FINISHED, EditBone::parent, EditBone::prop, wmOperator::ptr, EditBone::rad_head, RNA_int_get(), EditBone::tail, and WM_event_add_notifier().
Referenced by ARMATURE_OT_subdivide().
|
static |
near duplicate of armature_duplicate_selected_exec, except for parenting part (keep in sync)
Definition at line 1098 of file armature_add.c.
References bArmature::act_edbone, EditBone::bbone_flag, EditBone::bbone_next, EditBone::bbone_next_flag, EditBone::bbone_next_type, EditBone::bbone_prev, EditBone::bbone_prev_flag, EditBone::bbone_prev_type, BKE_pose_channel_ensure(), BKE_pose_channel_free(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_string_flip_side_name(), BONE_CONNECTED, BONE_ROOTSEL, BONE_SELECTED, BONE_TIPSEL, C, copy_pchan(), CTX_DATA_COUNT, CTX_data_view_layer(), CTX_wm_view3d(), Object::data, DEG_id_tag_update(), duplicateEditBone(), EditBone::ebone, EBONE_SELECTABLE, EBONE_VISIBLE, ED_armature_ebone_find_name(), ED_armature_ebone_select_set(), ED_armature_edit_sync_selection(), ED_armature_edit_transform_mirror_update(), ED_armature_edit_validate_active(), bArmature::edbo, ListBase::first, EditBone::flag, get_symmetrized_bone(), EditBone::head, Object::id, ID_RECALC_SELECT, EditBone::inherit_scale_mode, MAXBONENAME, MEM_freeN, EditBone::name, NC_OBJECT, ND_BONE_SELECT, EditBone::next, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, EditBone::parent, Object::pose, postEditBoneDuplicate(), preEditBoneDuplicate(), wmOperator::ptr, RNA_enum_get(), STREQ, EditBone::tail, EditBone::temp, updateDuplicateConstraintSettings(), updateDuplicateCustomBoneShapes(), updateDuplicateSubtarget(), and WM_event_add_notifier().
Referenced by ARMATURE_OT_symmetrize().
|
static |
Definition at line 869 of file armature_add.c.
References BKE_pose_channel_copy_data(), BKE_pose_channel_ensure(), IDP_CopyProperty(), EditBone::name, Object::pose, and EditBone::prop.
Referenced by armature_symmetrize_exec(), and duplicateEditBoneObjects().
EditBone* duplicateEditBone | ( | EditBone * | cur_bone, |
const char * | name, | ||
ListBase * | editbones, | ||
Object * | ob | ||
) |
Definition at line 919 of file armature_add.c.
References duplicateEditBoneObjects().
Referenced by armature_duplicate_selected_exec(), and armature_symmetrize_exec().
EditBone* duplicateEditBoneObjects | ( | struct EditBone * | cur_bone, |
const char * | name, | ||
struct ListBase * | editbones, | ||
struct Object * | src_ob, | ||
struct Object * | dst_ob | ||
) |
editbones | The target list. |
Definition at line 896 of file armature_add.c.
References BLI_addtail(), BLI_strncpy(), copy_pchan(), EditBone::ebone, ED_armature_ebone_unique_name(), MEM_mallocN, EditBone::name, NULL, and EditBone::temp.
Referenced by duplicateEditBone().
Default bone add, returns it selected, but without tail set.
Definition at line 51 of file armature_add.c.
References BLI_addtail(), BLI_strncpy(), BONE_TIPSEL, copy_v3_fl(), EditBone::curve_in_x, EditBone::curve_in_z, EditBone::curve_out_x, EditBone::curve_out_z, EditBone::dist, EditBone::ease1, EditBone::ease2, ED_armature_ebone_unique_name(), bArmature::edbo, EditBone::flag, EditBone::layer, bArmature::layer, MEM_callocN, EditBone::name, NULL, EditBone::rad_head, EditBone::rad_tail, EditBone::roll1, EditBone::roll2, EditBone::scale_in, EditBone::scale_out, EditBone::segments, EditBone::weight, EditBone::xwidth, and EditBone::zwidth.
Referenced by add_points_bone(), armature_bone_primitive_add_exec(), armature_click_extrude_exec(), ED_armature_ebone_add_primitive(), modifier_skin_armature_create(), and skin_armature_bone_create().
Definition at line 86 of file armature_add.c.
References bArmature::act_edbone, Object::data, ED_armature_ebone_add(), ED_armature_edit_deselect_all(), EditBone::head, blender::math::length(), EditBone::tail, and zero_v3().
Referenced by object_armature_add_exec().
Definition at line 274 of file armature_add.c.
References ListBase::first, EditBone::name, EditBone::next, NULL, and STREQ.
Referenced by updateDuplicateSubtarget().
Definition at line 1081 of file armature_add.c.
References EditBone::ebone, ED_armature_ebone_get_mirrored(), bArmature::edbo, NULL, and EditBone::temp.
Referenced by armature_symmetrize_exec().
|
static |
Helper function for postEditBoneDuplicate, return the destination pchan from the original.
Definition at line 299 of file armature_add.c.
References BKE_pose_channel_find_name(), BLI_ghash_lookup(), bPoseChannel::name, and NULL.
Referenced by postEditBoneDuplicate().
Definition at line 317 of file armature_add.c.
References bPoseChannel::bbone_next, bPoseChannel::bbone_prev, BKE_pose_channel_find_name(), BKE_pose_channels_hash_ensure(), BKE_pose_channels_hash_free(), BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_str_new(), bPoseChannel::custom_tx, EditBone::ebone, ED_armature_ebone_get_mirrored(), LISTBASE_FOREACH, EditBone::name, NULL, pchan_duplicate_map(), Object::pose, and EditBone::temp.
Referenced by armature_duplicate_selected_exec(), and armature_symmetrize_exec().
Call this before doing any duplications.
Definition at line 289 of file armature_add.c.
References ED_armature_ebone_listbase_temp_clear().
Referenced by armature_duplicate_selected_exec(), and armature_symmetrize_exec().
|
static |
Definition at line 419 of file armature_add.c.
References bActionConstraint::act, action_groups_add_channel(), action_groups_add_new(), FCurve::array_index, FCurve::bezt, BKE_action_group_find_name(), BKE_constraint_custom_object_space_init(), BKE_constraint_mat_convertspace(), BKE_fcurve_copy(), BKE_fcurves_filter(), BKE_pose_channel_find_name(), BLI_assert, BLI_freelistN(), BLI_listbase_clear(), BLI_str_replaceN(), BLI_strn_endswith(), CONSTRAINT_SPACE_LOCAL, bConstraint::data, DEG_id_tag_update(), bConstraintOb::depsgraph, ELEM, fabsf, ListBase::first, ID_RECALC_ANIMATION_NO_FLUSH, invert_m4_m4(), bActionConstraint::max, MEM_freeN, bActionConstraint::min, mul_m4_v3(), EditBone::name, NULL, Object::pose, FCurve::rna_path, bActionConstraint::subtarget, bConstraint::tarspace, bActionConstraint::type, unit_m4(), BezTriple::vec, and zero_v3().
Referenced by updateDuplicateConstraintSettings().
|
static |
Definition at line 799 of file armature_add.c.
References BKE_pose_channel_ensure(), CONSTRAINT_TYPE_ACTION, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_LOCLIMIT, CONSTRAINT_TYPE_ROTLIMIT, CONSTRAINT_TYPE_TRANSFORM, bPoseChannel::constraints, ListBase::first, EditBone::name, bConstraint::next, NULL, Object::pose, bConstraint::type, updateDuplicateActionConstraintSettings(), updateDuplicateKinematicConstraintSettings(), updateDuplicateLocRotConstraintSettings(), and updateDuplicateTransformConstraintSettings().
Referenced by armature_symmetrize_exec().
|
static |
Definition at line 832 of file armature_add.c.
References BKE_libblock_find_name(), BKE_pose_channel_ensure(), BLI_string_flip_side_name(), C, CTX_data_main(), bPoseChannel::custom, bPoseChannel::custom_rotation_euler, bPoseChannel::custom_scale_xyz, bPoseChannel::custom_translation, Object::id, ID_OB, MAX_ID_NAME, EditBone::name, ID::name, NULL, and Object::pose.
Referenced by armature_symmetrize_exec().
|
static |
Definition at line 551 of file armature_add.c.
References angle_wrap_rad(), bConstraint::data, M_PI, and bKinematicConstraint::poleangle.
Referenced by updateDuplicateConstraintSettings().
|
static |
Definition at line 560 of file armature_add.c.
References BKE_constraint_custom_object_space_init(), BKE_constraint_mat_convertspace(), CONSTRAINT_SPACE_LOCAL, CONSTRAINT_TYPE_ROTLIMIT, copy_v3_v3(), bConstraint::data, bConstraintOb::depsgraph, invert_m4_m4(), mul_m4_v3(), NULL, bConstraint::ownspace, bConstraint::type, unit_m4(), bRotLimitConstraint::xmax, bRotLimitConstraint::xmin, bRotLimitConstraint::ymax, bRotLimitConstraint::ymin, bRotLimitConstraint::zmax, and bRotLimitConstraint::zmin.
Referenced by updateDuplicateConstraintSettings().
|
static |
Definition at line 362 of file armature_add.c.
References BKE_constraint_targets_flush(), BKE_constraint_targets_get(), BKE_pose_channel_ensure(), BLI_string_flip_side_name(), BLI_strncpy(), bPoseChannel::constraints, EditBone::ebone, ListBase::first, get_named_editbone(), MAXBONENAME, EditBone::name, bConstraint::next, bConstraintTarget::next, NULL, Object::pose, bConstraintTarget::subtarget, bConstraintTarget::tar, and EditBone::temp.
Referenced by armature_duplicate_selected_exec(), and armature_symmetrize_exec().
|
static |
Definition at line 628 of file armature_add.c.
References bConstraint::data, bConstraintOb::depsgraph, and NULL.
Referenced by updateDuplicateConstraintSettings().