Blender V5.0
overlay_armature.cc File Reference
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DRW_render.hh"
#include "BLI_listbase_wrapper.hh"
#include "BLI_math_color.h"
#include "BLI_math_matrix.h"
#include "BLI_math_matrix_types.hh"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BKE_action.hh"
#include "BKE_armature.hh"
#include "BKE_deform.hh"
#include "BKE_object.hh"
#include "DEG_depsgraph_query.hh"
#include "ED_armature.hh"
#include "ED_view3d.hh"
#include "ANIM_armature.hh"
#include "ANIM_bonecolor.hh"
#include "UI_resources.hh"
#include "draw_cache.hh"
#include "draw_context_private.hh"
#include "draw_manager_text.hh"
#include "overlay_armature.hh"
#include "draw_cache_impl.hh"

Go to the source code of this file.

Classes

class  UnifiedBonePtr

Macros

#define PT_DEFAULT_RAD   0.05f /* radius of the point batch. */

Functions

Shading Groups
static void drw_shgroup_bone_stick (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float col_wire[4], const float col_bone[4], const float col_head[4], const float col_tail[4], const int select_id)
static void drw_shgroup_bone_envelope_distance (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float *radius_head, const float *radius_tail, const float *distance)
static void drw_shgroup_bone_envelope (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float bone_col[4], const float hint_col[4], const float outline_col[4], const float *radius_head, const float *radius_tail, const int select_id)
static void drw_shgroup_bone_custom_solid_mesh (const Armatures::DrawContext *ctx, Mesh &mesh, const float(*bone_mat)[4], const float bone_color[4], const float hint_color[4], const float outline_color[4], const float wire_width, const draw::select::ID select_id, Object &custom)
static void drw_shgroup_bone_custom_mesh_wire (const Armatures::DrawContext *ctx, Mesh &mesh, const float(*bone_mat)[4], const float color[4], const float wire_width, const draw::select::ID select_id, Object &custom)
static void drw_shgroup_custom_bone_curve (const Armatures::DrawContext *ctx, Curve *curve, const float(*bone_mat)[4], const float outline_color[4], const float wire_width, const draw::select::ID select_id, Object *custom)
static void drw_shgroup_bone_custom_solid (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float bone_color[4], const float hint_color[4], const float outline_color[4], const float wire_width, const draw::select::ID select_id, Object *custom)
static void drw_shgroup_bone_custom_wire (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float color[4], const float wire_width, const draw::select::ID select_id, Object *custom)
static void drw_shgroup_bone_custom_empty (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float color[4], const float wire_width, const draw::select::ID select_id, Object *custom)
static void drw_shgroup_bone_sphere (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float bone_color[4], const float hint_color[4], const float outline_color[4], const int select_id)
static void drw_shgroup_bone_axes (const Armatures::DrawContext *ctx, const float(*bone_mat)[4], const float color[4])
static void drw_shgroup_bone_relationship_lines_ex (const Armatures::DrawContext *ctx, const float start[3], const float end[3], const float color[4])
static void drw_shgroup_bone_relationship_lines (const Armatures::DrawContext *ctx, const float start[3], const float end[3])
static void drw_shgroup_bone_ik_lines (const Armatures::DrawContext *ctx, const float start[3], const float end[3])
static void drw_shgroup_bone_ik_no_target_lines (const Armatures::DrawContext *ctx, const float start[3], const float end[3])
static void drw_shgroup_bone_ik_spline_lines (const Armatures::DrawContext *ctx, const float start[3], const float end[3])
Drawing Theme Helpers
Note
this section is duplicate of code in 'drawarmature.c'.
static void set_ctx_bcolor (Armatures::DrawContext *ctx, const UnifiedBonePtr bone)
static void cp_shade_color3ub (uchar cp[3], const int offset)
static void use_bone_color (float *r_color, const uint8_t *color_from_theme, const int shade_offset)
static void get_pchan_color_wire (const UniformData &theme, const ThemeWireColor *bcolor, const eArmatureDrawMode draw_mode, const eBone_Flag boneflag, float r_color[4])
static void get_pchan_color_solid (const UniformData &theme, const ThemeWireColor *bcolor, float r_color[4])
static void get_pchan_color_constraint (const UniformData &theme, const ThemeWireColor *bcolor, const UnifiedBonePtr bone, float r_color[4])
Drawing Color Helpers
static void bone_locked_color_shade (const UniformData &theme, float color[4])
static const floatget_bone_solid_color (const Armatures::DrawContext *ctx, const eBone_Flag boneflag)
static const floatget_bone_solid_with_consts_color (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag)
static float get_bone_wire_thickness (const Armatures::DrawContext *ctx, int boneflag)
static const floatget_bone_wire_color (const Armatures::DrawContext *ctx, const eBone_Flag boneflag)
static void bone_hint_color_shade (float hint_color[4], const float color[4])
static const floatget_bone_hint_color (const Armatures::DrawContext *ctx, const eBone_Flag boneflag)
Helper Utils
static void pchan_draw_data_init (bPoseChannel *pchan)
static void draw_bone_update_disp_matrix_default (UnifiedBonePtr bone)
static void draw_bone_update_disp_matrix_custom_shape (UnifiedBonePtr bone)
static void edbo_compute_bbone_child (bArmature *arm)
static void ebone_spline_preview (EditBone *ebone, const float result_array[MAX_BBONE_SUBDIV][4][4])
static void draw_bone_update_disp_matrix_bbone (UnifiedBonePtr bone)
static void draw_axes (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const bArmature &arm)
static void draw_points (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const float col_solid[4], const int select_id)
static void bone_draw_custom_shape (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
static void bone_draw_octa (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
static void bone_draw_line (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
static void bone_draw_b_bone (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
static void bone_draw_envelope (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
static void bone_draw_wire (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
static void bone_draw (const eArmature_Drawtype drawtype, const bool use_custom_shape, const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag, const int select_id)
Draw Degrees of Freedom
static void draw_bone_degrees_of_freedom (const Armatures::DrawContext *ctx, const bPoseChannel *pchan)
Draw Relationships
static bool should_draw_relation_to_parent (const UnifiedBonePtr bone, const eBone_Flag boneflag)
static void pchan_draw_ik_lines (const Armatures::DrawContext *ctx, const bPoseChannel *pchan, const bool only_temp)
static void draw_bone_bone_relationship_line (const Armatures::DrawContext *ctx, const float bone_head[3], const float parent_head[3], const float parent_tail[3])
static void draw_bone_relations (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone, const eBone_Flag boneflag)
static void draw_bone_name (const Armatures::DrawContext *ctx, const UnifiedBonePtr bone)
Main Draw Loops
static void bone_draw_update_display_matrix (const eArmature_Drawtype drawtype, const bool use_custom_shape, UnifiedBonePtr bone)

Macro Definition Documentation

◆ PT_DEFAULT_RAD

#define PT_DEFAULT_RAD   0.05f /* radius of the point batch. */

Definition at line 52 of file overlay_armature.cc.

Referenced by drw_shgroup_bone_envelope().

Function Documentation

◆ bone_draw()

◆ bone_draw_b_bone()

◆ bone_draw_custom_shape()

◆ bone_draw_envelope()

◆ bone_draw_line()

◆ bone_draw_octa()

◆ bone_draw_update_display_matrix()

◆ bone_draw_wire()

◆ bone_hint_color_shade()

void bone_hint_color_shade ( float hint_color[4],
const float color[4] )
static

Definition at line 902 of file overlay_armature.cc.

References mul_v3_fl(), and mul_v3_v3v3().

Referenced by draw_points(), and get_bone_hint_color().

◆ bone_locked_color_shade()

void bone_locked_color_shade ( const UniformData & theme,
float color[4] )
static

◆ cp_shade_color3ub()

void cp_shade_color3ub ( uchar cp[3],
const int offset )
static

Definition at line 681 of file overlay_armature.cc.

References b, and CLAMP.

Referenced by use_bone_color().

◆ draw_axes()

◆ draw_bone_bone_relationship_line()

void draw_bone_bone_relationship_line ( const Armatures::DrawContext * ctx,
const float bone_head[3],
const float parent_head[3],
const float parent_tail[3] )
static

◆ draw_bone_degrees_of_freedom()

◆ draw_bone_name()

◆ draw_bone_relations()

◆ draw_bone_update_disp_matrix_bbone()

◆ draw_bone_update_disp_matrix_custom_shape()

◆ draw_bone_update_disp_matrix_default()

◆ draw_points()

◆ drw_shgroup_bone_axes()

◆ drw_shgroup_bone_custom_empty()

◆ drw_shgroup_bone_custom_mesh_wire()

◆ drw_shgroup_bone_custom_solid()

void drw_shgroup_bone_custom_solid ( const Armatures::DrawContext * ctx,
const float(*) bone_mat[4],
const float bone_color[4],
const float hint_color[4],
const float outline_color[4],
const float wire_width,
const draw::select::ID select_id,
Object * custom )
static

◆ drw_shgroup_bone_custom_solid_mesh()

◆ drw_shgroup_bone_custom_wire()

void drw_shgroup_bone_custom_wire ( const Armatures::DrawContext * ctx,
const float(*) bone_mat[4],
const float color[4],
const float wire_width,
const draw::select::ID select_id,
Object * custom )
static

◆ drw_shgroup_bone_envelope()

◆ drw_shgroup_bone_envelope_distance()

◆ drw_shgroup_bone_ik_lines()

◆ drw_shgroup_bone_ik_no_target_lines()

◆ drw_shgroup_bone_ik_spline_lines()

◆ drw_shgroup_bone_relationship_lines()

void drw_shgroup_bone_relationship_lines ( const Armatures::DrawContext * ctx,
const float start[3],
const float end[3] )
static

◆ drw_shgroup_bone_relationship_lines_ex()

◆ drw_shgroup_bone_sphere()

◆ drw_shgroup_bone_stick()

◆ drw_shgroup_custom_bone_curve()

◆ ebone_spline_preview()

void ebone_spline_preview ( EditBone * ebone,
const float result_array[MAX_BBONE_SUBDIV][4][4] )
static

Definition at line 1026 of file overlay_armature.cc.

References add_v3_v3v3(), BBONE_ADD_PARENT_END_ROLL, EditBone::bbone_child, EditBone::bbone_flag, BBONE_HANDLE_AUTO, BBONE_HANDLE_RELATIVE, BBONE_HANDLE_TANGENT, EditBone::bbone_next, EditBone::bbone_next_type, EditBone::bbone_prev, EditBone::bbone_prev_type, BBONE_SCALE_EASING, BKE_pchan_bbone_spline_compute(), BONE_CONNECTED, copy_v3_fl3(), copy_v3_v3(), BBoneSplineParameters::curve_in_x, EditBone::curve_in_x, BBoneSplineParameters::curve_in_z, EditBone::curve_in_z, BBoneSplineParameters::curve_out_x, EditBone::curve_out_x, BBoneSplineParameters::curve_out_z, EditBone::curve_out_z, BBoneSplineParameters::ease1, EditBone::ease1, BBoneSplineParameters::ease2, EditBone::ease2, ED_armature_ebone_to_mat4(), EditBone::flag, EditBone::head, invert_m4(), BBoneSplineParameters::length, EditBone::length, MAX_BBONE_SUBDIV, mul_m4_m4m4(), mul_v3_m4v3(), next, BBoneSplineParameters::next_bbone, BBoneSplineParameters::next_h, BBoneSplineParameters::next_mat, EditBone::parent, BBoneSplineParameters::prev_bbone, BBoneSplineParameters::prev_h, BBoneSplineParameters::prev_mat, BBoneSplineParameters::roll1, EditBone::roll1, BBoneSplineParameters::roll2, EditBone::roll2, BBoneSplineParameters::scale_in, EditBone::scale_in, BBoneSplineParameters::scale_out, EditBone::scale_out, BBoneSplineParameters::segments, EditBone::segments, sub_v3_v3v3(), EditBone::tail, BBoneSplineParameters::use_next, BBoneSplineParameters::use_prev, and zero_v3().

Referenced by draw_bone_update_disp_matrix_bbone().

◆ edbo_compute_bbone_child()

void edbo_compute_bbone_child ( bArmature * arm)
static

◆ get_bone_hint_color()

◆ get_bone_solid_color()

◆ get_bone_solid_with_consts_color()

◆ get_bone_wire_color()

◆ get_bone_wire_thickness()

◆ get_pchan_color_constraint()

◆ get_pchan_color_solid()

void get_pchan_color_solid ( const UniformData & theme,
const ThemeWireColor * bcolor,
float r_color[4] )
static

◆ get_pchan_color_wire()

◆ pchan_draw_data_init()

◆ pchan_draw_ik_lines()

◆ set_ctx_bcolor()

◆ should_draw_relation_to_parent()

bool should_draw_relation_to_parent ( const UnifiedBonePtr bone,
const eBone_Flag boneflag )
static

Should the relationship line between this bone and its parent be drawn?

Definition at line 1677 of file overlay_armature.cc.

References UnifiedBonePtr::as_posebone(), BONE_CONNECTED, bPoseChannel::flag, UnifiedBonePtr::has_parent(), UnifiedBonePtr::is_editbone(), UnifiedBonePtr::is_posebone(), bPoseChannel::parent, and POSE_SELECTED.

Referenced by draw_bone_relations().

◆ use_bone_color()

void use_bone_color ( float * r_color,
const uint8_t * color_from_theme,
const int shade_offset )
static

Utility function to use a shaded version of one of the colors in 'bcolor'.

The r_color parameter is put first for consistency with copy_v4_v4(dest, src).

Definition at line 702 of file overlay_armature.cc.

References copy_v3_v3_uchar(), cp_shade_color3ub(), rgba_uchar_to_float(), and srgb_to_linearrgb_v4().

Referenced by get_pchan_color_solid(), and get_pchan_color_wire().