Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-09 15:52:56 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-09 15:52:56 +0400
commit3daa283604930167be0bc2dad5d1684a871ca254 (patch)
tree96ee0481d6a7124e38c327e919d74995fe332e3e /source/blender/editors/armature
parent8878c30b9b032f1a630c13c5ebb260cb9029ce3c (diff)
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...
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/editarmature.c46
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c4
-rw-r--r--source/blender/editors/armature/meshlaplacian.c24
-rw-r--r--source/blender/editors/armature/poseobject.c2
4 files changed, 37 insertions, 39 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 65051c384b3..4f5d8872384 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -239,7 +239,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist)
}
/* put EditMode back in Object */
-void ED_armature_from_edit(Scene *scene, Object *obedit)
+void ED_armature_from_edit(Object *obedit)
{
bArmature *arm= obedit->data;
EditBone *eBone, *neBone;
@@ -343,21 +343,19 @@ void ED_armature_from_edit(Scene *scene, Object *obedit)
DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
}
-
-
-void apply_rot_armature (Scene *scene, Object *ob, float mat[3][3])
+void ED_armature_apply_transform(Object *ob, float mat[4][4])
{
EditBone *ebone;
bArmature *arm= ob->data;
- float scale = Mat3ToScalef(mat); /* store the scale of the matrix here to use on envelopes */
+ float scale = Mat4ToScalef(mat); /* store the scale of the matrix here to use on envelopes */
/* Put the armature into editmode */
ED_armature_to_edit(ob);
/* Do the rotations */
for (ebone = arm->edbo->first; ebone; ebone=ebone->next){
- Mat3MulVecfl(mat, ebone->head);
- Mat3MulVecfl(mat, ebone->tail);
+ Mat4MulVecfl(mat, ebone->head);
+ Mat4MulVecfl(mat, ebone->tail);
ebone->rad_head *= scale;
ebone->rad_tail *= scale;
@@ -365,7 +363,7 @@ void apply_rot_armature (Scene *scene, Object *ob, float mat[3][3])
}
/* Turn the list into an armature */
- ED_armature_from_edit(scene, ob);
+ ED_armature_from_edit(ob);
ED_armature_edit_free(ob);
}
@@ -411,7 +409,7 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode)
}
/* Turn the list into an armature */
- ED_armature_from_edit(scene, ob);
+ ED_armature_from_edit(ob);
/* Adjust object location for new centerpoint */
if(centermode && obedit==NULL) {
@@ -557,7 +555,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
}
/* convert editbones back to bones */
- ED_armature_from_edit(scene, ob);
+ ED_armature_from_edit(ob);
/* flush positions of posebones */
where_is_pose(scene, ob);
@@ -791,7 +789,7 @@ int join_armature_exec(bContext *C, wmOperator *op)
DAG_scene_sort(scene); // because we removed object(s)
- ED_armature_from_edit(scene, ob);
+ ED_armature_from_edit(ob);
ED_armature_edit_free(ob);
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
@@ -994,7 +992,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel)
}
/* exit editmode (recalculates pchans too) */
- ED_armature_from_edit(scene, ob);
+ ED_armature_from_edit(ob);
ED_armature_edit_free(ob);
}
@@ -1037,7 +1035,7 @@ static int separate_armature_exec (bContext *C, wmOperator *op)
oldob->mode &= ~OB_MODE_POSE;
//oldbase->flag &= ~OB_POSEMODE;
- ED_armature_from_edit(scene, obedit);
+ ED_armature_from_edit(obedit);
ED_armature_edit_free(obedit);
/* 2) duplicate base */
@@ -4334,7 +4332,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
/* in weightpaint we select the associated vertex group too */
if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (nearBone->flag & BONE_ACTIVE) {
- vertexgroup_select_by_name(OBACT, nearBone->name);
+ ED_vgroup_select_by_name(OBACT, nearBone->name);
DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
}
}
@@ -4445,7 +4443,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap)
return 0;
}
-static int add_defgroup_unique_bone(Object *ob, Bone *bone, void *data)
+static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data)
{
/* This group creates a vertex group to ob that has the
* same name as bone (provided the bone is skinnable).
@@ -4453,7 +4451,7 @@ static int add_defgroup_unique_bone(Object *ob, Bone *bone, void *data)
*/
if (!(bone->flag & BONE_NO_DEFORM)) {
if (!get_named_vertexgroup(ob,bone->name)) {
- add_defgroup_name(ob, bone->name);
+ ED_vgroup_add_name(ob, bone->name);
return 1;
}
}
@@ -4497,7 +4495,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
segments = 1;
if (!(defgroup = get_named_vertexgroup(ob, bone->name)))
- defgroup = add_defgroup_name(ob, bone->name);
+ defgroup = ED_vgroup_add_name(ob, bone->name);
if (data->list != NULL) {
hgroup = (bDeformGroup ***) &data->list;
@@ -4548,17 +4546,17 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
/* add the vert to the deform group if weight!=0.0 */
if (distance!=0.0)
- add_vert_to_defgroup (ob, dgroup, i, distance, WEIGHT_REPLACE);
+ ED_vgroup_vert_add (ob, dgroup, i, distance, WEIGHT_REPLACE);
else
- remove_vert_defgroup (ob, dgroup, i);
+ ED_vgroup_vert_remove (ob, dgroup, i);
/* do same for mirror */
if (dgroupflip && dgroupflip[j] && iflip >= 0) {
if (distance!=0.0)
- add_vert_to_defgroup (ob, dgroupflip[j], iflip, distance,
+ ED_vgroup_vert_add (ob, dgroupflip[j], iflip, distance,
WEIGHT_REPLACE);
else
- remove_vert_defgroup (ob, dgroupflip[j], iflip);
+ ED_vgroup_vert_remove (ob, dgroupflip[j], iflip);
}
}
}
@@ -4748,10 +4746,10 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod
/* Traverse the bone list, trying to create empty vertex
* groups cooresponding to the bone.
*/
- bone_looper(ob, arm->bonebase.first, NULL, add_defgroup_unique_bone);
+ bone_looper(ob, arm->bonebase.first, NULL, ED_vgroup_add_unique_bone);
if (ob->type == OB_MESH)
- create_dverts(ob->data);
+ ED_vgroup_data_create(ob->data);
}
else if(mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
/* Traverse the bone list, trying to create vertex groups
@@ -5659,7 +5657,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
if (obedit != NULL)
{
- ED_armature_from_edit(scene, obedit);
+ ED_armature_from_edit(obedit);
ED_armature_edit_free(obedit);
}
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 1d87ca8a6df..16e78f7c8d1 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -2732,7 +2732,7 @@ static void adjustGraphs(bContext *C, RigGraph *rigg)
/* Turn the list into an armature */
arm->edbo = rigg->editbones;
- ED_armature_from_edit(scene, rigg->ob);
+ ED_armature_from_edit(rigg->ob);
ED_undo_push(C, "Retarget Skeleton");
}
@@ -2762,7 +2762,7 @@ static void retargetGraphs(bContext *C, RigGraph *rigg)
/* Turn the list into an armature */
arm->edbo = rigg->editbones;
- ED_armature_from_edit(scene, rigg->ob);
+ ED_armature_from_edit(rigg->ob);
}
char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index)
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 1b167518a5a..a6c94bee5b1 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -672,9 +672,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numbones,
/* clear weights */
if(bbone && firstsegment) {
for(a=0; a<me->totvert; a++) {
- remove_vert_defgroup(ob, dgrouplist[j], a);
+ ED_vgroup_vert_remove(ob, dgrouplist[j], a);
if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
- remove_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
+ ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
@@ -694,32 +694,32 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numbones,
if(bbone) {
if(solution > 0.0f)
- add_vert_to_defgroup(ob, dgrouplist[j], a, solution,
+ ED_vgroup_vert_add(ob, dgrouplist[j], a, solution,
WEIGHT_ADD);
}
else {
weight= heat_limit_weight(solution);
if(weight > 0.0f)
- add_vert_to_defgroup(ob, dgrouplist[j], a, weight,
+ ED_vgroup_vert_add(ob, dgrouplist[j], a, weight,
WEIGHT_REPLACE);
else
- remove_vert_defgroup(ob, dgrouplist[j], a);
+ ED_vgroup_vert_remove(ob, dgrouplist[j], a);
}
/* do same for mirror */
if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
if(bbone) {
if(solution > 0.0f)
- add_vert_to_defgroup(ob, dgroupflip[j], vertsflipped[a],
+ ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
solution, WEIGHT_ADD);
}
else {
weight= heat_limit_weight(solution);
if(weight > 0.0f)
- add_vert_to_defgroup(ob, dgroupflip[j], vertsflipped[a],
+ ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
weight, WEIGHT_REPLACE);
else
- remove_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
+ ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
}
@@ -734,16 +734,16 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numbones,
/* remove too small vertex weights */
if(bbone && lastsegment) {
for(a=0; a<me->totvert; a++) {
- weight= get_vert_defgroup(ob, dgrouplist[j], a);
+ weight= ED_vgroup_vert_weight(ob, dgrouplist[j], a);
weight= heat_limit_weight(weight);
if(weight <= 0.0f)
- remove_vert_defgroup(ob, dgrouplist[j], a);
+ ED_vgroup_vert_remove(ob, dgrouplist[j], a);
if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
- weight= get_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
+ weight= ED_vgroup_vert_weight(ob, dgroupflip[j], vertsflipped[a]);
weight= heat_limit_weight(weight);
if(weight <= 0.0f)
- remove_vert_defgroup(ob, dgroupflip[j], vertsflipped[a]);
+ ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
}
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index a4a518bc003..0ae92de4407 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1673,7 +1673,7 @@ void pose_activate_flipped_bone(Scene *scene)
/* in weightpaint we select the associated vertex group too */
if(ob->mode & OB_MODE_WEIGHT_PAINT) {
- vertexgroup_select_by_name(OBACT, name);
+ ED_vgroup_select_by_name(OBACT, name);
DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
}