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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-06-30 22:00:23 +0400
committerTon Roosendaal <ton@blender.org>2006-06-30 22:00:23 +0400
commit08921033e553b7f3891aebd40a52cba6c67de75b (patch)
tree183db05597546d93e3206bf0d8699af6f9122f29 /source
parent8a6ead5f9550d7d0c9fb7580fc1351c816d57283 (diff)
Bugfix #4545
In Editmode armature, the autocomplete for bone names used the bones from the armature itself, not the edit data. While fixing, also found out autocomplete for vertexgroup didnt work even.
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/buttons_editing.c44
-rw-r--r--source/blender/src/buttons_object.c9
2 files changed, 46 insertions, 7 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index f5066402927..a52d6e30c9a 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -2942,6 +2942,44 @@ static void editing_panel_armature_type(Object *ob, bArmature *arm)
}
+/* autocomplete callback for editbones */
+static void autocomplete_editbone(char *str, void *arg_v)
+{
+ char truncate[40]= {0};
+
+ if(G.obedit==NULL) return;
+
+ /* search if str matches the beginning of an ID struct */
+ if(str[0]) {
+ EditBone *ebone;
+
+ for (ebone=G.edbo.first; ebone; ebone=ebone->next) {
+ int a;
+ if(ebone->name==str) continue;
+
+ for(a=0; a<31; a++) {
+ if(str[a]==0 || str[a]!=ebone->name[a])
+ break;
+ }
+ /* found a match */
+ if(str[a]==0) {
+ /* first match */
+ if(truncate[0]==0)
+ BLI_strncpy(truncate, ebone->name, 32);
+ else {
+ /* remove from truncate what is not in bone->name */
+ for(a=0; a<31; a++) {
+ if(truncate[a] && truncate[a]!=ebone->name[a])
+ truncate[a]= 0;
+ }
+ }
+ }
+ }
+ if(truncate[0])
+ BLI_strncpy(str, truncate, 32);
+ }
+}
+
static void editing_panel_armature_bones(Object *ob, bArmature *arm)
{
uiBlock *block;
@@ -2967,9 +3005,9 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm)
if ((curBone->flag & BONE_SELECTED) && (curBone->layer & arm->layer)) {
/* Bone naming button */
- but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,18, &curBone->name, 0, 24, 0, 0, "Change the bone name");
+ but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,18, curBone->name, 0, 24, 0, 0, "Change the bone name");
uiButSetFunc(but, validate_editbonebutton_cb, curBone, NULL);
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)OBACT);
+ uiButSetCompleteFunc(but, autocomplete_editbone, (void *)OBACT);
uiDefBut(block, LABEL, 0, "child of", 107,by,73,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
@@ -3054,7 +3092,7 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
/* Bone naming button */
uiBlockBeginAlign(block);
- but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,19, &curBone->name, 0, 24, 0, 0, "Change the bone name");
+ but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,19, curBone->name, 0, 24, 0, 0, "Change the bone name");
uiButSetFunc(but, validate_posebonebutton_cb, curBone, NULL);
uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 8d61e751d35..72a4a6289d2 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -437,7 +437,7 @@ static void constraint_moveDown(void *ob_v, void *con_v)
BIF_undo_push("Move constraint");
}
-/* autocomplete callback for ID buttons */
+/* autocomplete callback for buttons */
void autocomplete_bone(char *str, void *arg_v)
{
Object *ob= (Object *)arg_v;
@@ -445,7 +445,7 @@ void autocomplete_bone(char *str, void *arg_v)
if(ob==NULL || ob->pose==NULL) return;
- /* search if str matches the beginning of an ID struct */
+ /* search if str matches the beginning of name */
if(str[0]) {
bPoseChannel *pchan;
@@ -475,7 +475,7 @@ void autocomplete_bone(char *str, void *arg_v)
}
}
-/* autocomplete callback for ID buttons */
+/* autocomplete callback for buttons */
void autocomplete_vgroup(char *str, void *arg_v)
{
Object *ob= (Object *)arg_v;
@@ -483,12 +483,13 @@ void autocomplete_vgroup(char *str, void *arg_v)
if(ob==NULL) return;
- /* search if str matches the beginning of an ID struct */
+ /* search if str matches the beginning of a name */
if(str[0]) {
bDeformGroup *dg;
for(dg= ob->defbase.first; dg; dg= dg->next) {
int a;
+ if(dg->name==str) continue;
for(a=0; a<31; a++) {
if(str[a]==0 || str[a]!=dg->name[a])