Blender V2.61 - r43446
Defines | Functions | Variables

object_vgroup.c File Reference

#include <string.h>
#include <stddef.h>
#include <math.h>
#include <assert.h>
#include "MEM_guardedalloc.h"
#include "DNA_cloth_types.h"
#include "DNA_curve_types.h"
#include "DNA_lattice_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force.h"
#include "DNA_scene_types.h"
#include "DNA_particle_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_report.h"
#include "BKE_DerivedMesh.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_object.h"
#include "ED_mesh.h"
#include "UI_resources.h"
#include "object_intern.h"

Go to the source code of this file.

Defines

#define VGROUP_MIRR_OP

Functions

static void vgroup_remap_update_users (Object *ob, int *map)
static void vgroup_delete_edit_mode (Object *ob, bDeformGroup *defgroup)
static void vgroup_delete_object_mode (Object *ob, bDeformGroup *dg)
static void vgroup_delete_all (Object *ob)
static Latticevgroup_edit_lattice (Object *ob)
int ED_vgroup_object_is_edit_mode (Object *ob)
bDeformGroupED_vgroup_add_name (Object *ob, const char *name)
bDeformGroupED_vgroup_add (Object *ob)
void ED_vgroup_delete (Object *ob, bDeformGroup *defgroup)
void ED_vgroup_clear (Object *ob)
int ED_vgroup_data_create (ID *id)
static int ED_vgroup_give_parray (ID *id, MDeformVert ***dvert_arr, int *dvert_tot, const short use_vert_sel)
int ED_vgroup_give_array (ID *id, MDeformVert **dvert_arr, int *dvert_tot)
int ED_vgroup_copy_array (Object *ob, Object *ob_from)
static void ED_vgroup_nr_vert_add (Object *ob, const int def_nr, const int vertnum, const float weight, const int assignmode)
void ED_vgroup_vert_add (Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode)
void ED_vgroup_vert_remove (Object *ob, bDeformGroup *dg, int vertnum)
static float get_vert_def_nr (Object *ob, const int def_nr, const int vertnum)
float ED_vgroup_vert_weight (Object *ob, bDeformGroup *dg, int vertnum)
void ED_vgroup_select_by_name (Object *ob, const char *name)
static void vgroup_select_verts (Object *ob, int select)
static void vgroup_duplicate (Object *ob)
static void vgroup_normalize (Object *ob)
static int tryToAddVerts (int *verts, int length, int a, int b)
static int * getSurroundingVerts (Mesh *me, int vert, int *count)
static void getSingleCoordinate (MVert *points, int count, float coord[3])
static void getVerticalAndHorizontalChange (const float norm[3], float d, const float coord[3], const float start[3], float distToStart, float *end, float(*changes)[2], float *dists, int index)
static void dm_deform_clear (DerivedMesh *dm, Object *ob)
static DerivedMeshdm_deform_recalc (Scene *scene, Object *ob)
static void moveCloserToDistanceFromPlane (Scene *scene, Object *ob, Mesh *me, int index, float norm[3], float coord[3], float d, float distToBe, float strength, float cp)
static void vgroup_fix (Scene *scene, Object *ob, float distToBe, float strength, float cp)
static void vgroup_levels (Object *ob, float offset, float gain)
static void vgroup_normalize_all (Object *ob, int lock_active)
static void vgroup_lock_all (Object *ob, int action)
static void vgroup_invert (Object *ob, const short auto_assign, const short auto_remove)
static void vgroup_blend (Object *ob)
static void vgroup_clean (Object *ob, const float epsilon, int keep_single)
static void vgroup_clean_all (Object *ob, const float epsilon, const int keep_single)
static void dvert_mirror_op (MDeformVert *dvert, MDeformVert *dvert_mirr, const char sel, const char sel_mirr, const int *flip_map, const int flip_map_len, const short mirror_weights, const short flip_vgroups, const short all_vgroups, const int act_vgroup)
void ED_vgroup_mirror (Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups)
static void vgroup_delete_update_users (Object *ob, int id)
static void vgroup_active_remove_verts (Object *ob, const int allverts, bDeformGroup *dg)
static int vgroup_object_in_edit_mode (Object *ob)
static int vgroup_object_in_wpaint_vert_select (Object *ob)
static void vgroup_delete (Object *ob)
static void vgroup_assign_verts (Object *ob, const float weight)
static void vgroup_remove_verts (Object *ob, int allverts)
static int vertex_group_poll (bContext *C)
static int UNUSED_FUNCTION() vertex_group_poll_edit (bContext *C)
static int vertex_group_poll_edit_or_wpaint_vert_select (bContext *C)
static int vertex_group_add_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_add (wmOperatorType *ot)
static int vertex_group_remove_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_remove (wmOperatorType *ot)
static int vertex_group_assign_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_assign (wmOperatorType *ot)
static int vertex_group_remove_from_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_remove_from (wmOperatorType *ot)
static int vertex_group_select_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_select (wmOperatorType *ot)
static int vertex_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_deselect (wmOperatorType *ot)
static int vertex_group_copy_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_copy (wmOperatorType *ot)
static int vertex_group_levels_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_levels (wmOperatorType *ot)
static int vertex_group_normalize_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_normalize (wmOperatorType *ot)
static int vertex_group_normalize_all_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_normalize_all (wmOperatorType *ot)
static int vertex_group_fix_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_fix (wmOperatorType *ot)
static int vertex_group_lock_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_lock (wmOperatorType *ot)
static int vertex_group_invert_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_invert (wmOperatorType *ot)
static int vertex_group_blend_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_blend (wmOperatorType *ot)
static int vertex_group_clean_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_clean (wmOperatorType *ot)
static int vertex_group_mirror_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_mirror (wmOperatorType *ot)
static int vertex_group_copy_to_linked_exec (bContext *C, wmOperator *UNUSED(op))
void OBJECT_OT_vertex_group_copy_to_linked (wmOperatorType *ot)
static int vertex_group_copy_to_selected_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_copy_to_selected (wmOperatorType *ot)
static int set_active_group_exec (bContext *C, wmOperator *op)
static EnumPropertyItemvgroup_itemf (bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
void OBJECT_OT_vertex_group_set_active (wmOperatorType *ot)
static char * vgroup_init_remap (Object *ob)
static int vgroup_do_remap (Object *ob, char *name_array, wmOperator *op)
static int vgroup_sort (void *def_a_ptr, void *def_b_ptr)
static int vertex_group_sort_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_sort (wmOperatorType *ot)
static int vgroup_move_exec (bContext *C, wmOperator *op)
void OBJECT_OT_vertex_group_move (wmOperatorType *ot)

Variables

static EnumPropertyItem vgroup_items []

Detailed Description

Definition in file object_vgroup.c.


Define Documentation

#define VGROUP_MIRR_OP
Value:
dvert_mirror_op(dvert, dvert_mirr,                                    \
                        sel, sel_mirr,                                        \
                        flip_map, flip_map_len,                               \
                        mirror_weights, flip_vgroups,                         \
                        all_vgroups, def_nr                                   \
                        )

Referenced by ED_vgroup_mirror().


Function Documentation

static void dm_deform_clear ( DerivedMesh dm,
Object ob 
) [static]
static DerivedMesh* dm_deform_recalc ( Scene scene,
Object ob 
) [static]

Definition at line 896 of file object_vgroup.c.

References CD_MASK_BAREMESH, and mesh_get_derived_deform().

Referenced by moveCloserToDistanceFromPlane().

static void dvert_mirror_op ( MDeformVert dvert,
MDeformVert dvert_mirr,
const char  sel,
const char  sel_mirr,
const int *  flip_map,
const int  flip_map_len,
const short  mirror_weights,
const short  flip_vgroups,
const short  all_vgroups,
const int  act_vgroup 
) [static]
bDeformGroup* ED_vgroup_add ( Object ob) [read]
bDeformGroup* ED_vgroup_add_name ( Object ob,
const char *  name 
) [read]
void ED_vgroup_clear ( Object ob)
int ED_vgroup_copy_array ( Object ob,
Object ob_from 
)
int ED_vgroup_data_create ( ID id)
void ED_vgroup_delete ( Object ob,
bDeformGroup defgroup 
)
int ED_vgroup_give_array ( ID id,
MDeformVert **  dvert_arr,
int *  dvert_tot 
)
static int ED_vgroup_give_parray ( ID id,
MDeformVert ***  dvert_arr,
int *  dvert_tot,
const short  use_vert_sel 
) [static]
void ED_vgroup_mirror ( Object ob,
const short  mirror_weights,
const short  flip_vgroups,
const short  all_vgroups 
)
static void ED_vgroup_nr_vert_add ( Object ob,
const int  def_nr,
const int  vertnum,
const float  weight,
const int  assignmode 
) [static]
int ED_vgroup_object_is_edit_mode ( Object ob)

Definition at line 90 of file object_vgroup.c.

References Object::data, NULL, OB_LATTICE, OB_MESH, and Object::type.

Referenced by ED_vgroup_clear(), and ED_vgroup_delete().

void ED_vgroup_select_by_name ( Object ob,
const char *  name 
)
void ED_vgroup_vert_add ( Object ob,
bDeformGroup dg,
int  vertnum,
float  weight,
int  assignmode 
)
void ED_vgroup_vert_remove ( Object ob,
bDeformGroup dg,
int  vertnum 
)
float ED_vgroup_vert_weight ( Object ob,
bDeformGroup dg,
int  vertnum 
)

Definition at line 556 of file object_vgroup.c.

References BLI_findindex(), Object::defbase, and get_vert_def_nr().

Referenced by heat_bone_weighting().

static float get_vert_def_nr ( Object ob,
const int  def_nr,
const int  vertnum 
) [static]
static void getSingleCoordinate ( MVert points,
int  count,
float  coord[3] 
) [static]

Definition at line 847 of file object_vgroup.c.

References add_v3_v3(), co, i, mul_v3_fl(), and zero_v3().

Referenced by vgroup_fix().

static int* getSurroundingVerts ( Mesh me,
int  vert,
int *  count 
) [static]
static void getVerticalAndHorizontalChange ( const float  norm[3],
float  d,
const float  coord[3],
const float  start[3],
float  distToStart,
float *  end,
float(*)  changes[2],
float *  dists,
int  index 
) [static]

Definition at line 861 of file object_vgroup.c.

References closest_to_plane_v3(), simple_enum_gen::d, and len_v3v3().

Referenced by moveCloserToDistanceFromPlane().

static void moveCloserToDistanceFromPlane ( Scene scene,
Object ob,
Mesh me,
int  index,
float  norm[3],
float  coord[3],
float  d,
float  distToBe,
float  strength,
float  cp 
) [static]
void OBJECT_OT_vertex_group_add ( wmOperatorType ot)
void OBJECT_OT_vertex_group_assign ( wmOperatorType ot)
void OBJECT_OT_vertex_group_blend ( wmOperatorType ot)
void OBJECT_OT_vertex_group_clean ( wmOperatorType ot)
void OBJECT_OT_vertex_group_copy ( wmOperatorType ot)
void OBJECT_OT_vertex_group_copy_to_linked ( wmOperatorType ot)
void OBJECT_OT_vertex_group_copy_to_selected ( wmOperatorType ot)
void OBJECT_OT_vertex_group_deselect ( wmOperatorType ot)
void OBJECT_OT_vertex_group_fix ( wmOperatorType ot)
void OBJECT_OT_vertex_group_invert ( wmOperatorType ot)
void OBJECT_OT_vertex_group_levels ( wmOperatorType ot)
void OBJECT_OT_vertex_group_lock ( wmOperatorType ot)
void OBJECT_OT_vertex_group_mirror ( wmOperatorType ot)
void OBJECT_OT_vertex_group_move ( wmOperatorType ot)
void OBJECT_OT_vertex_group_normalize ( wmOperatorType ot)
void OBJECT_OT_vertex_group_normalize_all ( wmOperatorType ot)
void OBJECT_OT_vertex_group_remove ( wmOperatorType ot)
void OBJECT_OT_vertex_group_remove_from ( wmOperatorType ot)
void OBJECT_OT_vertex_group_select ( wmOperatorType ot)
void OBJECT_OT_vertex_group_set_active ( wmOperatorType ot)
void OBJECT_OT_vertex_group_sort ( wmOperatorType ot)
static int set_active_group_exec ( bContext C,
wmOperator op 
) [static]
static int tryToAddVerts ( int *  verts,
int  length,
int  a,
int  b 
) [static]

Definition at line 753 of file object_vgroup.c.

References FALSE, i, and TRUE.

Referenced by getSurroundingVerts().

static int vertex_group_add_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_assign_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_blend_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_clean_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_copy_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_copy_to_linked_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_copy_to_selected_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_deselect_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_fix_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_invert_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_levels_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_lock_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_mirror_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_normalize_all_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_normalize_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_poll ( bContext C) [static]
static int UNUSED_FUNCTION() vertex_group_poll_edit ( bContext C) [static]
static int vertex_group_poll_edit_or_wpaint_vert_select ( bContext C) [static]
static int vertex_group_remove_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_remove_from_exec ( bContext C,
wmOperator op 
) [static]
static int vertex_group_select_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int vertex_group_sort_exec ( bContext C,
wmOperator op 
) [static]
static void vgroup_active_remove_verts ( Object ob,
const int  allverts,
bDeformGroup dg 
) [static]
static void vgroup_assign_verts ( Object ob,
const float  weight 
) [static]
static void vgroup_blend ( Object ob) [static]
static void vgroup_clean ( Object ob,
const float  epsilon,
int  keep_single 
) [static]
static void vgroup_clean_all ( Object ob,
const float  epsilon,
const int  keep_single 
) [static]
static void vgroup_delete ( Object ob) [static]
static void vgroup_delete_all ( Object ob) [static]
static void vgroup_delete_edit_mode ( Object ob,
bDeformGroup defgroup 
) [static]
static void vgroup_delete_object_mode ( Object ob,
bDeformGroup dg 
) [static]
static void vgroup_delete_update_users ( Object ob,
int  id 
) [static]
static int vgroup_do_remap ( Object ob,
char *  name_array,
wmOperator op 
) [static]
static void vgroup_duplicate ( Object ob) [static]
static Lattice* vgroup_edit_lattice ( Object ob) [static]
static void vgroup_fix ( Scene scene,
Object ob,
float  distToBe,
float  strength,
float  cp 
) [static]
static char* vgroup_init_remap ( Object ob) [static]
static void vgroup_invert ( Object ob,
const short  auto_assign,
const short  auto_remove 
) [static]
static EnumPropertyItem* vgroup_itemf ( bContext C,
PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
int *  free 
) [static]
static void vgroup_levels ( Object ob,
float  offset,
float  gain 
) [static]
static void vgroup_lock_all ( Object ob,
int  action 
) [static]
static int vgroup_move_exec ( bContext C,
wmOperator op 
) [static]
static void vgroup_normalize ( Object ob) [static]
static void vgroup_normalize_all ( Object ob,
int  lock_active 
) [static]
static int vgroup_object_in_edit_mode ( Object ob) [static]
static int vgroup_object_in_wpaint_vert_select ( Object ob) [static]
static void vgroup_remap_update_users ( Object ob,
int *  map 
) [static]
static void vgroup_remove_verts ( Object ob,
int  allverts 
) [static]
static void vgroup_select_verts ( Object ob,
int  select 
) [static]
static int vgroup_sort ( void *  def_a_ptr,
void *  def_b_ptr 
) [static]

Definition at line 2842 of file object_vgroup.c.

References BLI_natstrcmp(), and bDeformGroup::name.

Referenced by vertex_group_sort_exec().


Variable Documentation

Initial value:
 {
    {0, NULL, 0, NULL, NULL}}

Definition at line 2692 of file object_vgroup.c.

Referenced by vgroup_itemf().