diff options
author | Ton Roosendaal <ton@blender.org> | 2005-12-17 23:25:41 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-12-17 23:25:41 +0300 |
commit | 510403277be6c5b34d01b386bfbf66871348f555 (patch) | |
tree | cb7a57d6f52fa6fc733993aa58e5b76fe34cf23e /source/blender/src/outliner.c | |
parent | 6d9cda7aaaf117d8043dc850289254dbf1da01b4 (diff) | |
parent | 66d0d7e2dbd327988b7418f5ce1bd1cd4beb5927 (diff) |
Saturday merger of bf-blender in orange branch.
Diffstat (limited to 'source/blender/src/outliner.c')
-rw-r--r-- | source/blender/src/outliner.c | 149 |
1 files changed, 70 insertions, 79 deletions
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 4316c4837cf..b659362d60a 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -2472,93 +2472,84 @@ static void outliner_back(SpaceOops *soops) } } -static void namebutton_cb(void *soopsp, void *oldnamep) +static void namebutton_cb(void *tep, void *oldnamep) { - SpaceOops *soops= soopsp; + SpaceOops *soops= curarea->spacedata.first; TreeStore *ts= soops->treestore; - TreeStoreElem *tselem; - int a; + TreeElement *te= tep; - if(ts) { - /* only one namebutton can exist */ - for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) { - if(tselem->flag & TSE_TEXTBUT) { - if(tselem->type==0) { - test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort - } - else { - TreeElement *te= outliner_find_tree_element(&soops->tree, a); + if(ts && te) { + TreeStoreElem *tselem= TREESTORE(te); + + if(tselem->type==0) { + test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort + } + else { + switch(tselem->type) { + case TSE_DEFGROUP: + unique_vertexgroup_name(te->directdata, (Object *)tselem->id); // id = object + break; + case TSE_NLA_ACTION: + test_idbutton(tselem->id->name+2); + break; + case TSE_EBONE: + if(G.obedit && G.obedit->data==(ID *)tselem->id) { + EditBone *ebone= te->directdata; + char newname[32]; - if(te) { - switch(tselem->type) { - case TSE_DEFGROUP: - unique_vertexgroup_name(te->directdata, (Object *)tselem->id); // id = object - break; - case TSE_NLA_ACTION: - test_idbutton(tselem->id->name+2); - break; - case TSE_EBONE: - if(G.obedit && G.obedit->data==(ID *)tselem->id) { - EditBone *ebone= te->directdata; - char newname[32]; - - /* restore bone name */ - BLI_strncpy(newname, ebone->name, 32); - BLI_strncpy(ebone->name, oldnamep, 32); - armature_bone_rename(G.obedit->data, oldnamep, newname); - } - allqueue(REDRAWOOPS, 0); - allqueue(REDRAWVIEW3D, 1); - allqueue(REDRAWBUTSEDIT, 0); - break; + /* restore bone name */ + BLI_strncpy(newname, ebone->name, 32); + BLI_strncpy(ebone->name, oldnamep, 32); + armature_bone_rename(G.obedit->data, oldnamep, newname); + } + allqueue(REDRAWOOPS, 0); + allqueue(REDRAWVIEW3D, 1); + allqueue(REDRAWBUTSEDIT, 0); + break; - case TSE_BONE: - { - Bone *bone= te->directdata; - Object *ob; - char newname[32]; - - // always make current object active - tree_element_active_object(soops, te); - ob= OBACT; - - /* restore bone name */ - BLI_strncpy(newname, bone->name, 32); - BLI_strncpy(bone->name, oldnamep, 32); - armature_bone_rename(ob->data, oldnamep, newname); - } - allqueue(REDRAWOOPS, 0); - allqueue(REDRAWVIEW3D, 1); - allqueue(REDRAWBUTSEDIT, 0); - break; - case TSE_POSE_CHANNEL: - { - bPoseChannel *pchan= te->directdata; - Object *ob; - char newname[32]; - - // always make current object active - tree_element_active_object(soops, te); - ob= OBACT; - - /* restore bone name */ - BLI_strncpy(newname, pchan->name, 32); - BLI_strncpy(pchan->name, oldnamep, 32); - armature_bone_rename(ob->data, oldnamep, newname); - } - allqueue(REDRAWOOPS, 0); - allqueue(REDRAWVIEW3D, 1); - allqueue(REDRAWBUTSEDIT, 0); - break; - - } - } + case TSE_BONE: + { + Bone *bone= te->directdata; + Object *ob; + char newname[32]; + + // always make current object active + tree_element_active_object(soops, te); + ob= OBACT; + + /* restore bone name */ + BLI_strncpy(newname, bone->name, 32); + BLI_strncpy(bone->name, oldnamep, 32); + armature_bone_rename(ob->data, oldnamep, newname); + } + allqueue(REDRAWOOPS, 0); + allqueue(REDRAWVIEW3D, 1); + allqueue(REDRAWBUTSEDIT, 0); + break; + case TSE_POSE_CHANNEL: + { + bPoseChannel *pchan= te->directdata; + Object *ob; + char newname[32]; + + // always make current object active + tree_element_active_object(soops, te); + ob= OBACT; + + /* restore bone name */ + BLI_strncpy(newname, pchan->name, 32); + BLI_strncpy(pchan->name, oldnamep, 32); + armature_bone_rename(ob->data, oldnamep, newname); } - tselem->flag &= ~TSE_TEXTBUT; + allqueue(REDRAWOOPS, 0); + allqueue(REDRAWVIEW3D, 1); + allqueue(REDRAWBUTSEDIT, 0); + break; + } } - scrarea_queue_redraw(curarea); } + scrarea_queue_redraw(curarea); } static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb) @@ -2580,7 +2571,7 @@ static void outliner_buttons(uiBlock *block, SpaceOops *soops, ListBase *lb) if(dx<50) dx= 50; bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", te->xs+2*OL_X-4, te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, ""); - uiButSetFunc(bt, namebutton_cb, soops, NULL); + uiButSetFunc(bt, namebutton_cb, te, NULL); // signal for button to open addqueue(curarea->win, BUT_ACTIVATE, OL_NAMEBUTTON); |