* Outliner 'select' (i.e. blue/grey highlights for tree items) works again in both normal Outliner + RNA views.

* Fixed bugs/MSVC warnings in animation code
This commit is contained in:
Joshua Leung
2009-02-04 09:09:31 +00:00
parent 9c84d2a424
commit 00c9745720
4 changed files with 51 additions and 61 deletions

View File

@@ -511,7 +511,7 @@ static float get_actionstrip_frame(bActionStrip *strip, float cframe, int invert
repeat = (strip->flag & ACTSTRIP_USESTRIDE) ? (1.0f) : (strip->repeat);
if (strip->scale == 0.0f) strip->scale= 1.0f;
scale = fabs(strip->scale); /* scale must be positive (for now) */
scale = (float)fabs(strip->scale); /* scale must be positive (for now) */
actlength = strip->actend-strip->actstart;
if (actlength == 0.0f) actlength = 1.0f;

View File

@@ -936,7 +936,7 @@ static void icu_to_fcurves (ListBase *list, IpoCurve *icu, char *actname, char *
fcurve= fcu;
/* set path */
fcurve->rna_path= adrcode_bitmap_path_copy(abp->path);
fcurve->rna_path= BLI_strdupn(abp->path, strlen(abp->path));
fcurve->array_index= abp->array_index;
/* convert keyframes

View File

@@ -2249,8 +2249,17 @@ static int outliner_activate_click(bContext *C, wmOperator *op, wmEvent *event)
if(te) {
BIF_undo_push("Outliner click event");
}
else
outliner_select(ar, soops);
else {
short selecting= -1;
int row;
/* get row number - 100 here is just a dummy value since we don't need the column */
UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, 0.0f,
fmval[0], fmval[1], NULL, &row);
/* select relevant row */
outliner_select(soops, &soops->tree, &row, &selecting);
}
ED_region_tag_redraw(ar);
@@ -2553,64 +2562,46 @@ void outliner_show_hierarchy(Scene *scene, SpaceOops *soops)
BIF_undo_push("Outliner show hierarchy");
}
#if 0
static void do_outliner_select(SpaceOops *soops, ListBase *lb, float y1, float y2, short *selecting)
void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
{
TreeElement *te;
TreeStoreElem *tselem;
if(y1>y2) SWAP(float, y1, y2);
for(te= lb->first; te; te= te->next) {
for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) {
tselem= TREESTORE(te);
if(te->ys + OL_H < y1) return;
if(te->ys < y2) {
if((te->flag & TE_ICONROW)==0) {
if(*selecting == -1) {
if( tselem->flag & TSE_SELECTED) *selecting= 0;
else *selecting= 1;
/* if we've encountered the right item, set its 'Outliner' selection status */
if (*index == 0) {
/* this should be the last one, so no need to do anything with index */
if ((te->flag & TE_ICONROW)==0) {
/* -1 value means toggle testing for now... */
if (*selecting == -1) {
if (tselem->flag & TSE_SELECTED)
*selecting= 0;
else
*selecting= 1;
}
if(*selecting) tselem->flag |= TSE_SELECTED;
else tselem->flag &= ~TSE_SELECTED;
/* set selection */
if (*selecting)
tselem->flag |= TSE_SELECTED;
else
tselem->flag &= ~TSE_SELECTED;
}
}
if((tselem->flag & TSE_CLOSED)==0) do_outliner_select(soops, &te->subtree, y1, y2, selecting);
}
}
#endif
/* its own redraw loop... urm */
void outliner_select(ARegion *ar, SpaceOops *so)
{
#if 0
XXX
float fmval[2], y1, y2;
short yo=-1, selecting= -1;
UI_view2d_region_to_view(&ar->v2d, event->x, event->y, fmval, fmval+1);
y1= fmval[1];
while (get_mbut() & (L_MOUSE|R_MOUSE)) {
UI_view2d_region_to_view(&ar->v2d, event->x, event->y, fmval, fmval+1);
y2= fmval[1];
if(yo!=mval[1]) {
/* select the 'ouliner row' */
do_outliner_select(so, &so->tree, y1, y2, &selecting);
yo= mval[1];
so->storeflag |= SO_TREESTORE_REDRAW;
// XXX screen_swapbuffers();
y1= y2;
else if ((tselem->flag & TSE_CLOSED)==0) {
/* Only try selecting sub-elements if we haven't hit the right element yet
*
* Hack warning:
* Index must be reduced before supplying it to the sub-tree to try to do
* selection, however, we need to increment it again for the next loop to
* function correctly
*/
(*index)--;
outliner_select(soops, &te->subtree, index, selecting);
(*index)++;
}
else PIL_sleep_ms(30);
}
BIF_undo_push("Outliner selection");
#endif
}
/* ************ SELECTION OPERATIONS ********* */
@@ -3704,20 +3695,19 @@ static void outliner_draw_tree(Scene *scene, ARegion *ar, SpaceOops *soops)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // only once
if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
// struct marks
if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* struct marks */
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
//UI_ThemeColorShade(TH_BACK, -20);
starty= (int)ar->v2d.tot.ymax-OL_H;
outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
}
else {
// selection first
UI_GetThemeColor3fv(TH_BACK, col);
glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f);
starty= (int)ar->v2d.tot.ymax-OL_H;
outliner_draw_selection(ar, soops, &soops->tree, &starty);
}
/* always draw selection fill before hierarchy */
UI_GetThemeColor3fv(TH_BACK, col);
glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f);
starty= (int)ar->v2d.tot.ymax-OL_H;
outliner_draw_selection(ar, soops, &soops->tree, &starty);
// grey hierarchy lines
UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f);

View File

@@ -115,7 +115,7 @@ void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
/* outliner.c */
void outliner_free_tree(struct ListBase *lb);
void outliner_operation_menu(struct Scene *scene, struct ARegion *ar, struct SpaceOops *soops);
void outliner_select(struct ARegion *ar, struct SpaceOops *so);
void outliner_select(struct SpaceOops *soops, struct ListBase *lb, int *index, short *selecting);
void draw_outliner(const struct bContext *C);
void OUTLINER_OT_activate_click(struct wmOperatorType *ot);