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:
authorCampbell Barton <ideasman42@gmail.com>2009-11-25 14:05:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-25 14:05:11 +0300
commitb40307df1630e7bd51a181878bd61693b32dd817 (patch)
tree7c45568b31032a8bd2e7a709de9f77f0b2d21dc0 /source/blender/editors/armature
parent50e3bb7f5f34516718c9d0cd36c0ff1677bf2e55 (diff)
add access to bone add/remove from rna. eg.
bone = arm.edit_bones.new("SomeBone") arm.edit_bones.remove(bone) regify (WIP)
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/armature_intern.h1
-rw-r--r--source/blender/editors/armature/editarmature.c34
-rw-r--r--source/blender/editors/armature/editarmature_generate.c4
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c2
4 files changed, 16 insertions, 25 deletions
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 012610bfd25..f53b70120d5 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -137,7 +137,6 @@ struct EditBone;
struct ListBase;
EditBone *make_boneList(struct ListBase *edbo, struct ListBase *bones, struct EditBone *parent, struct Bone *actBone);
-struct EditBone *addEditBone(struct bArmature *arm, char *name);
void BIF_sk_selectStroke(struct bContext *C, short mval[2], short extend);
/* duplicate method */
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index ce3e4cc8f8d..ebb9848baf4 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -141,7 +141,7 @@ void ED_armature_validate_active(struct bArmature *arm)
}
}
-void free_edit_bone(bArmature *arm, EditBone *bone)
+void ED_armature_edit_bone_remove(bArmature *arm, EditBone *bone)
{
if(arm->act_edbone==bone)
arm->act_edbone= NULL;
@@ -305,7 +305,7 @@ void ED_armature_from_edit(Object *obedit)
fBone->parent= eBone->parent;
}
printf("Warning: removed zero sized bone: %s\n", eBone->name);
- free_edit_bone(arm, eBone);
+ ED_armature_edit_bone_remove(arm, eBone);
}
}
@@ -1035,7 +1035,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel)
free_pose_channel(pchan);
/* get rid of unneeded bone */
- free_edit_bone(arm, curbone);
+ ED_armature_edit_bone_remove(arm, curbone);
BLI_freelinkN(&ob->pose->chanbase, pchan);
}
}
@@ -1684,7 +1684,7 @@ static void delete_bone(bArmature *arm, EditBone* exBone)
}
}
- free_edit_bone(arm, exBone);
+ ED_armature_edit_bone_remove(arm, exBone);
}
/* context: editmode armature */
@@ -2245,7 +2245,7 @@ void undo_push_armature(bContext *C, char *name)
/* *************** Adding stuff in editmode *************** */
/* default bone add, returns it selected, but without tail set */
-EditBone *addEditBone(bArmature *arm, char *name)
+EditBone *ED_armature_edit_bone_add(bArmature *arm, char *name)
{
EditBone *bone= MEM_callocN(sizeof(EditBone), "eBone");
@@ -2269,14 +2269,6 @@ EditBone *addEditBone(bArmature *arm, char *name)
return bone;
}
-/* default bone add, returns it selected, but without tail set */
-static EditBone *add_editbone(Object *obedit, char *name)
-{
- bArmature *arm= obedit->data;
-
- return addEditBone(arm, name);
-}
-
/* v3d and rv3d are allowed to be NULL */
void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
{
@@ -2301,7 +2293,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
ED_armature_deselectall(obedit, 0, 0);
/* Create a bone */
- bone= add_editbone(obedit, "Bone");
+ bone= ED_armature_edit_bone_add(obedit->data, "Bone");
VECCOPY(bone->head, curs);
@@ -2367,7 +2359,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *op)
}
}
- newbone= add_editbone(obedit, ebone->name);
+ newbone= ED_armature_edit_bone_add(arm, ebone->name);
arm->act_edbone= newbone;
if (to_root) {
@@ -2484,7 +2476,7 @@ static EditBone *add_points_bone (Object *obedit, float head[], float tail[])
{
EditBone *ebo;
- ebo= add_editbone(obedit, "Bone");
+ ebo= ED_armature_edit_bone_add(obedit->data, "Bone");
VECCOPY(ebo->head, head);
VECCOPY(ebo->tail, tail);
@@ -3110,7 +3102,7 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
/* step 3: delete all bones between and including start and end */
for (ebo= end; ebo; ebo= ebone) {
ebone= (ebo == start) ? (NULL) : (ebo->parent);
- free_edit_bone(arm, ebo);
+ ED_armature_edit_bone_remove(arm, ebo);
}
}
@@ -3465,7 +3457,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
ED_armature_deselectall(obedit, 0, 0);
/* Create a bone */
- bone= add_editbone(obedit, name);
+ bone= ED_armature_edit_bone_add(obedit->data, name);
VECCOPY(bone->head, curs);
@@ -5623,7 +5615,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
EditBone *root = NULL;
float angleLimit = (float)cos(scene->toolsettings->skgen_angle_limit * M_PI / 180.0f);
- parent = add_editbone(obedit, "Bone");
+ parent = ED_armature_edit_bone_add(arm, "Bone");
parent->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
VECCOPY(parent->head, head->p);
@@ -5652,7 +5644,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
{
VECCOPY(parent->tail, previous);
- child = add_editbone(obedit, "Bone");
+ child = ED_armature_edit_bone_add(arm, "Bone");
VECCOPY(child->head, parent->tail);
child->parent = parent;
child->flag |= BONE_CONNECTED|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
@@ -5858,7 +5850,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
if (lastBone == NULL)
{
EditBone *bone;
- bone = add_editbone(obedit, "Bone");
+ bone = ED_armature_edit_bone_add(obedit->data, "Bone");
bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
VECCOPY(bone->head, head->p);
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 124528811c7..41907cf06a3 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -294,7 +294,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
IT_head(iter);
- parent = addEditBone(arm, "Bone");
+ parent = ED_armature_edit_bone_add(arm, "Bone");
VECCOPY(parent->head, iter->p);
if (iter->size > 0)
@@ -309,7 +309,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
{
IT_peek(iter, index);
- child = addEditBone(arm, "Bone");
+ child = ED_armature_edit_bone_add(arm, "Bone");
VECCOPY(child->head, parent->tail);
child->parent = parent;
child->flag |= BONE_CONNECTED;
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 7bb2fa9009d..eee56070e91 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1538,7 +1538,7 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
if (bone == NULL)
{
- bone = addEditBone(arm, "Bone");
+ bone = ED_armature_edit_bone_add(arm, "Bone");
VECCOPY(bone->head, head->p);
VECCOPY(bone->tail, pt->p);