Outliner now visualizes and allows selection and name editing of Armatures
in edit mode. Small extra fix; selection (mouse) on armature points goes easier now (larger accepted distance from mouse pointer)
This commit is contained in:
@@ -57,11 +57,12 @@ typedef struct TreeElement {
|
||||
#define TSE_DEFGROUP_BASE 3
|
||||
#define TSE_DEFGROUP 4
|
||||
#define TSE_BONE 5
|
||||
#define TSE_CONSTRAINT_BASE 6
|
||||
#define TSE_CONSTRAINT 7
|
||||
#define TSE_HOOKS_BASE 8
|
||||
#define TSE_HOOK 9
|
||||
#define TSE_SCRIPT_BASE 10
|
||||
#define TSE_EBONE 6
|
||||
#define TSE_CONSTRAINT_BASE 7
|
||||
#define TSE_CONSTRAINT 8
|
||||
#define TSE_HOOKS_BASE 9
|
||||
#define TSE_HOOK 10
|
||||
#define TSE_SCRIPT_BASE 11
|
||||
|
||||
/* button events */
|
||||
#define OL_NAMEBUTTON 1
|
||||
|
||||
@@ -1590,7 +1590,8 @@ static void constraint_ebone_name_fix(ListBase *conlist, EditBone *eBone)
|
||||
}
|
||||
}
|
||||
|
||||
static void validate_editbonebutton(EditBone *eBone)
|
||||
// called in outliner too...
|
||||
void validate_editbonebutton(EditBone *eBone)
|
||||
{
|
||||
EditBone *prev;
|
||||
bAction *act=NULL;
|
||||
|
||||
@@ -740,6 +740,7 @@ void remake_editArmature(void)
|
||||
|
||||
make_editArmature();
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
allqueue(REDRAWBUTSHEAD, 0);
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
@@ -1775,6 +1776,7 @@ void deselectall_armature(void)
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWBUTSHEAD, 0);
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
countall();
|
||||
}
|
||||
|
||||
@@ -1880,6 +1882,7 @@ void join_armature(void)
|
||||
}
|
||||
#endif
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -1972,6 +1975,7 @@ void extrude_armature(void)
|
||||
transform('g');
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
}
|
||||
|
||||
void addvert_armature(void)
|
||||
@@ -2135,6 +2139,7 @@ void adduplicate_armature(void)
|
||||
transform('g');
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2229,6 +2234,7 @@ void mousepose_armature(void)
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWIPO, 0); /* To force action ipo update */
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
|
||||
rightmouse_transform();
|
||||
|
||||
|
||||
@@ -576,12 +576,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
|
||||
case ID_AR:
|
||||
{
|
||||
bArmature *arm= (bArmature *)id;
|
||||
Bone *curBone;
|
||||
int a= 0;
|
||||
|
||||
if(G.obedit && G.obedit->data==arm) {
|
||||
EditBone *ebone;
|
||||
TreeElement *ten;
|
||||
for (ebone = G.edbo.first; ebone; ebone=ebone->next, a++) {
|
||||
ten= outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
|
||||
ten->directdata= ebone;
|
||||
ten->name= ebone->name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Bone *curBone;
|
||||
for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){
|
||||
outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1137,6 +1149,7 @@ static int tree_element_active_bone(TreeElement *te, TreeStoreElem *tselem, int
|
||||
if(G.qual & LR_SHIFTKEY);
|
||||
else deselectall_posearmature(0);
|
||||
bone->flag |= BONE_SELECTED;
|
||||
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
@@ -1151,6 +1164,32 @@ static int tree_element_active_bone(TreeElement *te, TreeStoreElem *tselem, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ebones only draw in editmode armature */
|
||||
static int tree_element_active_ebone(TreeElement *te, TreeStoreElem *tselem, int set)
|
||||
{
|
||||
EditBone *ebone= te->directdata;
|
||||
|
||||
if(set) {
|
||||
if(G.qual & LR_SHIFTKEY);
|
||||
else {
|
||||
ebone->flag |= BONE_SELECTED; // trick deselectall, it toggles... duhh
|
||||
deselectall_armature();
|
||||
}
|
||||
ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
|
||||
// flush to parent?
|
||||
if(ebone->parent && (ebone->flag & BONE_IK_TOPARENT)) ebone->parent->flag |= BONE_TIPSEL;
|
||||
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
}
|
||||
else {
|
||||
if (ebone->flag & BONE_SELECTED) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int tree_element_active_text(SpaceOops *soops, TreeElement *te, int set)
|
||||
{
|
||||
ScrArea *sa=NULL;
|
||||
@@ -1204,6 +1243,8 @@ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStore
|
||||
return tree_element_active_defgroup(te, tselem, set);
|
||||
case TSE_BONE:
|
||||
return tree_element_active_bone(te, tselem, set);
|
||||
case TSE_EBONE:
|
||||
return tree_element_active_ebone(te, tselem, set);
|
||||
case TSE_HOOK: // actually object
|
||||
if(set) tree_element_active_object(soops, te);
|
||||
else if(tselem->id==(ID *)OBACT) return 1;
|
||||
@@ -1738,6 +1779,7 @@ static void tselem_draw_icon(TreeStoreElem *tselem)
|
||||
case TSE_DEFGROUP_BASE:
|
||||
BIF_draw_icon(ICON_VERTEXSEL); break;
|
||||
case TSE_BONE:
|
||||
case TSE_EBONE:
|
||||
BIF_draw_icon(ICON_WPAINT_DEHLT); break;
|
||||
case TSE_CONSTRAINT_BASE:
|
||||
BIF_draw_icon(ICON_CONSTRAINT); break;
|
||||
@@ -2088,6 +2130,16 @@ static void namebutton_cb(void *voidp, void *arg2_unused)
|
||||
case TSE_NLA_ACTION:
|
||||
test_idbutton(tselem->id->name+2);
|
||||
break;
|
||||
case TSE_EBONE:
|
||||
if(G.obedit && G.obedit->data==(ID *)tselem->id) {
|
||||
extern void validate_editbonebutton(EditBone *);
|
||||
EditBone *ebone= te->directdata;
|
||||
validate_editbonebutton(ebone);
|
||||
}
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
break;
|
||||
case TSE_BONE:
|
||||
{
|
||||
Bone *bone= te->directdata;
|
||||
@@ -2096,6 +2148,7 @@ static void namebutton_cb(void *voidp, void *arg2_unused)
|
||||
|
||||
// dangerous call, it re-allocs the Armature bones, exits editmode too
|
||||
rename_bone_ext(bone->name, bone_newname);
|
||||
}
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
@@ -2103,7 +2156,6 @@ static void namebutton_cb(void *voidp, void *arg2_unused)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tselem->flag &= ~TSE_TEXTBUT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,10 +781,10 @@ short selectprojektie(unsigned int *buffer, short x1, short y1, short x2, short
|
||||
|
||||
if(x1==0 && x2==0 && y1==0 && y2==0) {
|
||||
getmouseco_areawin(mval);
|
||||
rect.xmin= mval[0]-7;
|
||||
rect.xmax= mval[0]+7;
|
||||
rect.ymin= mval[1]-7;
|
||||
rect.ymax= mval[1]+7;
|
||||
rect.xmin= mval[0]-12; // seems to be default value for bones only now
|
||||
rect.xmax= mval[0]+12;
|
||||
rect.ymin= mval[1]-12;
|
||||
rect.ymax= mval[1]+12;
|
||||
}
|
||||
else {
|
||||
rect.xmin= x1;
|
||||
|
||||
Reference in New Issue
Block a user