Blender V2.61 - r43446
Enumerations | Functions | Variables

drawarmature.c File Reference

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dlrbTree.h"
#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_global.h"
#include "BKE_modifier.h"
#include "BKE_nla.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "ED_armature.h"
#include "ED_keyframes_draw.h"
#include "BLF_api.h"
#include "UI_resources.h"
#include "view3d_intern.h"

Go to the source code of this file.

Enumerations

enum  {
  PCHAN_COLOR_NORMAL = 0, PCHAN_COLOR_SOLID, PCHAN_COLOR_CONSTS, PCHAN_COLOR_SPHEREBONE_BASE,
  PCHAN_COLOR_SPHEREBONE_END, PCHAN_COLOR_LINEBONE
}

Functions

static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
static void cp_shade_color3ub (unsigned char cp[3], const int offset)
static short set_pchan_glColor (short colCode, int boneflag, short constflag)
static void set_ebone_glColor (const unsigned int boneflag)
static void drawsolidcube_size (float xsize, float ysize, float zsize)
static void drawcube_size (float xsize, float ysize, float zsize)
static void draw_bonevert (void)
static void draw_bonevert_solid (void)
static void draw_bone_octahedral (void)
static void draw_bone_solid_octahedral (void)
static void draw_bone_points (int dt, int armflag, unsigned int boneflag, int id)
static void draw_sphere_bone_dist (float smat[][4], float imat[][4], bPoseChannel *pchan, EditBone *ebone)
static void draw_sphere_bone_wire (float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
static void draw_sphere_bone (int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
static void draw_line_bone (int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
static void draw_b_bone_boxes (int dt, bPoseChannel *pchan, float xwidth, float length, float zwidth)
static void draw_b_bone (int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
static void draw_wire_bone_segments (bPoseChannel *pchan, Mat4 *bbones, float length, int segments)
static void draw_wire_bone (int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
static void draw_bone (int dt, int armflag, int boneflag, short constflag, unsigned int id, float length)
static void draw_custom_bone (Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int armflag, int boneflag, unsigned int id, float length)
static void pchan_draw_IK_root_lines (bPoseChannel *pchan, short only_temp)
static void bgl_sphere_project (float ax, float az)
static void draw_dof_ellipse (float ax, float az)
static void draw_pose_dofs (Object *ob)
static void bone_matrix_translate_y (float mat[][4], float y)
static void draw_pose_bones (Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, const short is_ghost, const short is_outline)
static void get_matrix_editbone (EditBone *eBone, float bmat[][4])
static void draw_ebones (View3D *v3d, ARegion *ar, Object *ob, int dt)
static void draw_pose_paths (Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
static void ghost_poses_tag_unselected (Object *ob, short unset)
static void draw_ghost_poses_range (Scene *scene, View3D *v3d, ARegion *ar, Base *base)
static void draw_ghost_poses_keys (Scene *scene, View3D *v3d, ARegion *ar, Base *base)
static void draw_ghost_poses (Scene *scene, View3D *v3d, ARegion *ar, Base *base)
int draw_armature (Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline)

Variables

static ThemeWireColorbcolor = NULL
static float cube [8][3]
static float bone_octahedral_verts [6][3]
static unsigned int bone_octahedral_wire_sides [8] = {0, 1, 5, 3, 0, 4, 5, 2}
static unsigned int bone_octahedral_wire_square [8] = {1, 2, 3, 4, 1}
static unsigned int bone_octahedral_solid_tris [8][3]
static float bone_octahedral_solid_normals [8][3]
static float si [16]
static float co [16]
static GLubyte bm_dot6 [] = {0x0, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x0}
static GLubyte bm_dot8 [] = {0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C}
static GLubyte bm_dot5 [] = {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0}
static GLubyte bm_dot7 [] = {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}

Detailed Description

Definition in file drawarmature.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
PCHAN_COLOR_NORMAL 
PCHAN_COLOR_SOLID 
PCHAN_COLOR_CONSTS 
PCHAN_COLOR_SPHEREBONE_BASE 
PCHAN_COLOR_SPHEREBONE_END 
PCHAN_COLOR_LINEBONE 

Definition at line 78 of file drawarmature.c.


Function Documentation

static void bgl_sphere_project ( float  ax,
float  az 
) [static]

Definition at line 1434 of file drawarmature.c.

References sqrt().

Referenced by draw_dof_ellipse().

static void bone_matrix_translate_y ( float  mat[][4],
float  y 
) [static]

Definition at line 1623 of file drawarmature.c.

References add_v3_v3(), copy_v3_v3(), and mul_v3_fl().

Referenced by draw_ebones(), and draw_pose_bones().

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

Definition at line 130 of file drawarmature.c.

References CLAMP(), and g.

Referenced by set_pchan_glColor().

int draw_armature ( Scene scene,
View3D v3d,
ARegion ar,
Base base,
int  dt,
int  flag,
const short  is_outline 
)
static void draw_b_bone ( int  dt,
int  armflag,
int  boneflag,
short  constflag,
unsigned int  id,
bPoseChannel pchan,
EditBone ebone 
) [static]
static void draw_b_bone_boxes ( int  dt,
bPoseChannel pchan,
float  xwidth,
float  length,
float  zwidth 
) [static]
static void draw_bone ( int  dt,
int  armflag,
int  boneflag,
short  constflag,
unsigned int  id,
float  length 
) [static]
static void draw_bone_octahedral ( void  ) [static]

Definition at line 474 of file drawarmature.c.

References bone_octahedral_verts, bone_octahedral_wire_sides, and bone_octahedral_wire_square.

Referenced by draw_bone().

static void draw_bone_points ( int  dt,
int  armflag,
unsigned int  boneflag,
int  id 
) [static]
static void draw_bone_solid_octahedral ( void  ) [static]

Definition at line 503 of file drawarmature.c.

References bone_octahedral_solid_normals, bone_octahedral_solid_tris, bone_octahedral_verts, and i.

Referenced by draw_bone().

static void draw_bonevert ( void  ) [static]

Definition at line 384 of file drawarmature.c.

Referenced by draw_bone_points().

static void draw_bonevert_solid ( void  ) [static]

Definition at line 415 of file drawarmature.c.

Referenced by draw_bone_points().

static void draw_custom_bone ( Scene scene,
View3D v3d,
RegionView3D rv3d,
Object ob,
int  dt,
int  armflag,
int  boneflag,
unsigned int  id,
float  length 
) [static]
static void draw_dof_ellipse ( float  ax,
float  az 
) [static]

Definition at line 1448 of file drawarmature.c.

References bgl_sphere_project(), and i.

Referenced by draw_pose_dofs().

static void draw_ebones ( View3D v3d,
ARegion ar,
Object ob,
int  dt 
) [static]
static void draw_ghost_poses ( Scene scene,
View3D v3d,
ARegion ar,
Base base 
) [static]
static void draw_ghost_poses_keys ( Scene scene,
View3D v3d,
ARegion ar,
Base base 
) [static]
static void draw_ghost_poses_range ( Scene scene,
View3D v3d,
ARegion ar,
Base base 
) [static]
static void draw_line_bone ( int  armflag,
int  boneflag,
short  constflag,
unsigned int  id,
bPoseChannel pchan,
EditBone ebone 
) [static]
static void draw_pose_bones ( Scene scene,
View3D v3d,
ARegion ar,
Base base,
int  dt,
const short  is_ghost,
const short  is_outline 
) [static]

Definition at line 1633 of file drawarmature.c.

References bArmature::act_bone, ARM_B_BONE, ARM_DRAWAXES, ARM_DRAWNAMES, ARM_EDITMODE, ARM_ENVELOPE, ARM_LINE, ARM_NO_CUSTOM, ARM_POSEMODE, ARM_WIRE, BA_WAS_SEL, Scene::basact, bglPolygonOffset(), bPoseChannel::bone, BONE_CONNECTED, BONE_DRAW_ACTIVE, BONE_DRAWWIRE, BONE_HIDDEN_P, BONE_HIDDEN_PG, bone_matrix_translate_y(), BONE_NO_DEFORM, BONE_SELECTED, BONE_UNSELECTABLE, bPose::chanbase, bPoseChannel::constflag, copy_m4_m4(), bPoseChannel::custom, bPoseChannel::custom_tx, Object::data, RegionView3D::dist, draw_b_bone(), draw_bone(), draw_custom_bone(), draw_line_bone(), draw_pose_dofs(), draw_sphere_bone(), draw_sphere_bone_dist(), draw_sphere_bone_wire(), draw_wire_bone(), drawaxes(), bArmature::drawtype, ELEM, ListBase::first, Base::flag, View3D::flag, bArmature::flag, Bone::flag, G, G_PICKSEL, glMultMatrixf, invert_m4_m4(), Bone::layer, bArmature::layer, bArmature::layer_used, len_v3(), Bone::length, mid_v3_v3v3(), mul_mat3_m4_fl(), bPoseChannel::name, bPoseChannel::next, NULL, OB_ARROWS, OB_SOLID, OB_WIRE, Base::object, Object::obmat, Bone::parent, bPoseChannel::parent, pchan_draw_IK_root_lines(), PCHAN_HAS_IK, PCHAN_HAS_SPLINEIK, PCHAN_HAS_TARGET, Object::pose, bPoseChannel::pose_head, bPoseChannel::pose_mat, bPoseChannel::pose_tail, ARegion::regiondata, rgb_float_to_byte(), Base::selcol, SELECT, set_pchan_colorset(), setlinestyle(), TH_ACTIVE, TH_SELECT, TH_TEXT, TH_TEXT_HI, TH_WIRE, UI_GetThemeColor3ubv(), UI_ThemeColor(), V3D_HIDE_HELPLINES, view3d_cached_text_draw_add(), RegionView3D::viewmatob, and View3D::zbuf.

Referenced by draw_armature(), draw_ghost_poses(), draw_ghost_poses_keys(), and draw_ghost_poses_range().

static void draw_pose_dofs ( Object ob) [static]
static void draw_pose_paths ( Scene scene,
View3D v3d,
ARegion ar,
Object ob 
) [static]
static void draw_sphere_bone ( int  dt,
int  armflag,
int  boneflag,
short  constflag,
unsigned int  id,
bPoseChannel pchan,
EditBone ebone 
) [static]
static void draw_sphere_bone_dist ( float  smat[][4],
float  imat[][4],
bPoseChannel pchan,
EditBone ebone 
) [static]
static void draw_sphere_bone_wire ( float  smat[][4],
float  imat[][4],
int  armflag,
int  boneflag,
short  constflag,
unsigned int  id,
bPoseChannel pchan,
EditBone ebone 
) [static]
static void draw_wire_bone ( int  dt,
int  armflag,
int  boneflag,
short  constflag,
unsigned int  id,
bPoseChannel pchan,
EditBone ebone 
) [static]
static void draw_wire_bone_segments ( bPoseChannel pchan,
Mat4 bbones,
float  length,
int  segments 
) [static]

Definition at line 1192 of file drawarmature.c.

References glMultMatrixf, and Mat4::mat.

Referenced by draw_wire_bone().

static void drawcube_size ( float  xsize,
float  ysize,
float  zsize 
) [static]

Definition at line 355 of file drawarmature.c.

Referenced by draw_b_bone_boxes().

static void drawsolidcube_size ( float  xsize,
float  ysize,
float  zsize 
) [static]

Definition at line 313 of file drawarmature.c.

Referenced by draw_b_bone_boxes().

static void get_matrix_editbone ( EditBone eBone,
float  bmat[][4] 
) [static]
static void ghost_poses_tag_unselected ( Object ob,
short  unset 
) [static]
static void pchan_draw_IK_root_lines ( bPoseChannel pchan,
short  only_temp 
) [static]
static void set_ebone_glColor ( const unsigned int  boneflag) [static]
static void set_pchan_colorset ( Object ob,
bPoseChannel pchan 
) [static]
static short set_pchan_glColor ( short  colCode,
int  boneflag,
short  constflag 
) [static]

Variable Documentation

ThemeWireColor* bcolor = NULL [static]

Definition at line 75 of file drawarmature.c.

GLubyte bm_dot5[] = {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0} [static]

Definition at line 972 of file drawarmature.c.

Referenced by draw_line_bone().

GLubyte bm_dot6[] = {0x0, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x0} [static]

Definition at line 969 of file drawarmature.c.

Referenced by draw_line_bone().

GLubyte bm_dot7[] = {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38} [static]

Definition at line 973 of file drawarmature.c.

Referenced by draw_line_bone().

GLubyte bm_dot8[] = {0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C} [static]

Definition at line 970 of file drawarmature.c.

Referenced by draw_line_bone().

float bone_octahedral_solid_normals[8][3] [static]
Initial value:
 {
    { 0.70710683f, -0.70710683f,  0.00000000f},
    {-0.00000000f, -0.70710683f, -0.70710683f},
    {-0.70710683f, -0.70710683f,  0.00000000f},
    { 0.00000000f, -0.70710683f,  0.70710683f},
    { 0.99388373f,  0.11043154f, -0.00000000f},
    { 0.00000000f,  0.11043154f, -0.99388373f},
    {-0.99388373f,  0.11043154f,  0.00000000f},
    { 0.00000000f,  0.11043154f,  0.99388373f}
}

Definition at line 463 of file drawarmature.c.

Referenced by draw_bone_solid_octahedral().

unsigned int bone_octahedral_solid_tris[8][3] [static]
Initial value:
 {
    {2, 1, 0}, 
    {3, 2, 0},
    {4, 3, 0},
    {1, 4, 0},

    {5, 1, 2}, 
    {5, 2, 3},
    {5, 3, 4},
    {5, 4, 1}
}

Definition at line 450 of file drawarmature.c.

Referenced by draw_bone_solid_octahedral().

float bone_octahedral_verts[6][3] [static]
Initial value:
 {
    { 0.0f, 0.0f,  0.0f},
    { 0.1f, 0.1f,  0.1f},
    { 0.1f, 0.1f, -0.1f},
    {-0.1f, 0.1f, -0.1f},
    {-0.1f, 0.1f,  0.1f},
    { 0.0f, 1.0f,  0.0f}
}

Definition at line 438 of file drawarmature.c.

Referenced by draw_bone_octahedral(), and draw_bone_solid_octahedral().

unsigned int bone_octahedral_wire_sides[8] = {0, 1, 5, 3, 0, 4, 5, 2} [static]

Definition at line 447 of file drawarmature.c.

Referenced by draw_bone_octahedral().

unsigned int bone_octahedral_wire_square[8] = {1, 2, 3, 4, 1} [static]

Definition at line 448 of file drawarmature.c.

Referenced by draw_bone_octahedral().

float co[16] [static]
Initial value:
{
    1.00000000f,
    0.97952994f, 0.91895781f,
    0.82076344f, 0.68896691f,
    0.52896401f, 0.34730525f,
    0.15142777f, -0.05064916f,
    -0.25065253f, -0.44039415f,
    -0.61210598f, -0.75875812f,
    -0.87434661f, -0.95413925f,
    -0.99486932f
}

Definition at line 608 of file drawarmature.c.

Referenced by add_marker_invoke(), add_orco_dm(), SubdMesh::add_vert(), addedgeface_mesh(), applyModifier(), armature_deform_verts(), arrayModifier_doArray(), ATTRIBUTE_ALIGNED16(), axis_angle_to_mat3(), BL_SkinDeformer::BGEDeformVerts(), BKE_object_foreach_display_point(), BKE_text_to_curve(), blend_from_shape_exec(), BLI_bvhtree_find_nearest(), BLI_bvhtree_range_query(), BLI_pbvh_build_grids(), BLI_pbvh_get_vertCos(), BLI_pbvh_node_raycast(), brush_add(), brush_gen_texture_cache(), brush_puff(), brush_sample_tex(), buildchar(), bvhselftree_build_from_cloth(), bvhselftree_update_from_cloth(), bvhtree_build_from_cloth(), bvhtree_build_from_mvert(), bvhtree_from_mesh_edges(), bvhtree_from_mesh_faces(), bvhtree_from_mesh_verts(), bvhtree_update_from_cloth(), bvhtree_update_from_mvert(), cache_strand_surface(), CalcSnapGeometry(), ccgDM_copyFinalVertArray(), ccgDM_drawEdges(), ccgDM_drawFacesColored(), ccgDM_drawFacesSolid(), ccgDM_drawFacesTex_common(), ccgDM_drawLooseEdges(), ccgDM_drawMappedEdges(), ccgDM_drawMappedEdgesInterp(), ccgDM_drawMappedFaces(), ccgDM_drawMappedFacesGLSL(), ccgDM_drawMappedFacesMat(), ccgDM_foreachMappedEdge(), ccgDM_getMinMax(), ccgSubSurf__calcSubdivLevel(), ccgSubSurf__sync(), cddm_draw_attrib_vertex(), cloth_to_object(), collision_response(), colorfn(), connect_hair(), construct_param_handle(), contarget_get_lattice_mat(), contarget_get_mesh_mat(), create_octree_node(), createArc(), createFacepa(), createRepresentation(), createSlideVerts(), GeometryExporter::createVertsSource(), createVertsTrisData(), curve_applyVertexCos(), curve_getKeyVertexCos(), curve_getVertexCos(), deformVerts_do(), LightManager::device_update_points(), dfs_range_query(), distribute_threads_init_data(), do_bake_shade(), do_lamp_tex(), do_material_tex(), do_multires_smooth_brush(), do_path_effectors(), do_projectpaint_thread(), do_sky_tex(), do_volume_tex(), doMirrorOnAxis(), draw_filled_lasso(), draw_motion_path_instance(), draw_sphere_bone_dist(), drawcursor(), dynamicPaint_brushMeshCalculateVelocity(), dynamicPaint_generateBakeData(), dynamicPaint_Modifier_apply(), dynamicPaint_paintMesh(), dynamicPaint_paintSinglePoint(), edgering_sel(), em_snap_to_cursor(), exec_strandsurface_sample(), face_duplilist(), fill_quad_double_adj_inner(), find_nearest_tracking_knot_cb(), find_nearest_tracking_segment_cb(), flushTransParticles(), get_texture_coords(), GetPosition(), getSingleCoordinate(), give_parvert(), global_bounds_obi(), gp_draw_stroke_point(), gp_stroke_simplify(), GPU_buffer_copy_vertex(), GPU_draw_buffers(), GPU_update_grid_buffers(), grid_tangent(), SubdFaceRing::has_vert(), imapaint_pick_uv(), init_camera_inside_volumes(), init_latt_deform(), initElbeemMesh(), integrate_particle(), interp_bilinear_grid(), InterpCSGFace(), intersect_dm_quad_weights(), btMatrix3x3::inverse(), RAS_MeshSlot::Join(), kdtree_balance(), key_block_get_data(), key_to_vertcos(), laplacian_add_vertex(), lattice_draw_verts(), lattice_foreachScreenVert(), layerInterp_msticky(), layerInterp_shapekey(), make_editMesh(), mat3_to_quat_is_ok(), meshdeform_dynamic_bind(), meshdeform_intersect(), meshdeformModifier_do(), mul_fac_qt_fl(), multires_apply_smat(), multires_copy_dm_grid(), multires_load_old_dm(), multiresModifier_disp_run(), multiresModifier_update(), my_boundbox_mesh(), node_circle_draw(), normal_projection_project_vertex(), normalfn(), ntreeTexExecTree(), occ_compute_bounces(), occ_compute_passes(), occ_lookup(), offset_to_key(), p_vert_add(), paint_get_tex_pixel(), pe_deflect_emitter(), pe_iterate_lengths(), PE_lasso_select(), PE_minmax(), PE_update_mirror_cache(), pointdensity_cache_object(), pointdensitytex(), project_paint_uvpixel_init(), psys_find_parents(), psys_get_particle_on_path(), psys_get_texture(), psys_interpolate_particle(), psys_origspace_to_w(), psys_render_projected_area(), psys_thread_create_path(), psys_uv_to_w(), ptcache_cloth_interpolate(), ptcache_particle_interpolate(), ptcache_softbody_interpolate(), ray_shadow_qmc(), RE_sample_material_color(), remove_doubles_exec(), render_new_particle_system(), resizelattice(), rule_fight(), sb_detect_face_pointCached(), scatter_tree_new(), sculpt_undo_restore(), select_exec(), select_invoke(), select_linked_internal(), select_loop_exec(), select_loop_invoke(), shadeHaloFloat(), shadow_halo(), shrinkwrap_calc_nearest_surface_point(), shrinkwrap_calc_nearest_vertex(), shrinkwrap_calc_normal_projection(), shrinkwrap_get_tarmat(), SimpleDeformModifier_do(), slide_marker_customdata(), sph_force_cb(), spotvolume(), sss_add_points(), sss_create_tree_mat(), subdivide_edge_addvert(), subsurf_calculate_limit_positions(), surfaceGenerateGrid(), svm_node_tex_checker(), svm_node_tex_environment(), svm_node_tex_gradient(), svm_node_tex_image(), svm_node_tex_magic(), svm_node_tex_musgrave(), svm_node_tex_noise(), svm_node_tex_voronoi(), svm_node_tex_wave(), transform_mesh_orco_verts(), tri_to_quat(), ui_draw_but_HSVCIRCLE(), UI_view2d_mouse_in_scrollers(), update_velocities(), uvprojectModifier_do(), vec_rot_to_mat3(), vec_to_quat(), vertcos_to_key(), view_zoom_inout_invoke(), vol_precache_part(), voxeldatatex(), vpaint_blend(), Warp(), warpModifier_do(), waveModifier_do(), weight_sample_invoke(), ArmatureImporter::write_controller(), zbuffer_strands_abuf(), and zbufshade_sss_tile().

float cube[8][3] [static]
Initial value:
 {
{-1.0,  0.0, -1.0},
{-1.0,  0.0,  1.0},
{-1.0,  1.0,  1.0},
{-1.0,  1.0, -1.0},
{ 1.0,  0.0, -1.0},
{ 1.0,  0.0,  1.0},
{ 1.0,  1.0,  1.0},
{ 1.0,  1.0, -1.0},
}

Definition at line 302 of file drawarmature.c.

float si[16] [static]