diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-01-05 03:38:17 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-01-05 03:38:17 +0300 |
commit | 91be2ba9b556a88877c4fa2f3c6ecd339f7e626a (patch) | |
tree | 7a85bfbb90222db1e6c389c7787d0189b479f143 /source/blender | |
parent | 33dd818310c9a43edc59bb28df9fb4803a20c5e7 (diff) |
2.5 - Various Cleanups/Fixes
* Animation channels - cleaned up the code for selecting channels (removed various TODO stuff that's going to be replaced by something better later). Also, added back the ctrl-shift select feature for groups, which should be extended for other channels too at some stage.
* Outliner - added missing flags to do-versions, and replaced the width calculations with the rna-width version for now, as that uses constant width of 100 with OL_X*indention
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 3 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels.c | 361 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_select.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 24 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 16 |
8 files changed, 258 insertions, 165 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 205e80ece7a..821da5a09f8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5215,6 +5215,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y); ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT); ar->v2d.keeptot = V2D_KEEPTOT_STRICT; + ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f; //ar->v2d.flag |= V2D_IS_INITIALISED; soops->type= SO_OUTLINER; @@ -5268,8 +5269,6 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) } case SPACE_ACTION: { - SpaceAction *saction= (SpaceAction *)sl; - /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */ ar->v2d.tot.xmin= -20.0f; ar->v2d.tot.ymin= (float)(-sa->winy); diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c index 65c9a6b2a63..15dffe24ff2 100644 --- a/source/blender/editors/animation/anim_channels.c +++ b/source/blender/editors/animation/anim_channels.c @@ -102,11 +102,69 @@ /* -------------------------- Internal Tools -------------------------------- */ +/* set the given Action Channel to be the 'active' one in its Action */ +static void action_set_active_achan (bAction *act, bActionChannel *achan) +{ + bActionChannel *chan; + + /* sanity check */ + if (act == NULL) + return; + + /* clear active flag on all others */ + for (chan= act->chanbase.first; chan; chan= chan->next) + chan->flag &= ~ACHAN_HILIGHTED; + + /* set the given Action Channel to be the active one */ + if (achan) + achan->flag |= ACHAN_HILIGHTED; +} + +/* set the given Action Group to be the 'active' one in its Action */ +static void action_set_active_agrp (bAction *act, bActionGroup *agrp) +{ + bActionGroup *grp; + + /* sanity check */ + if (act == NULL) + return; + + /* clear active flag on all others */ + for (grp= act->groups.first; grp; grp= grp->next) + grp->flag &= ~AGRP_ACTIVE; + + /* set the given group to be the active one */ + if (agrp) + agrp->flag |= AGRP_ACTIVE; +} + /* -------------------------- Exposed API ----------------------------------- */ +/* Set the given ActionChannel or ActionGroup as the active one in the given action + * - data: should be bAction... + * - datatype: should be ANIMCONT_ACTION + * - channel_data: bActionChannel or bActionGroup + * - channel_type: eAnim_ChannelType + */ +void ANIM_action_set_active_channel (void *data, short datatype, void *channel_data, short channel_type) +{ + /* sanity checks */ + if ((data == NULL) || (datatype != ANIMCONT_ACTION)) + return; + + switch (channel_type) { + case ANIMTYPE_ACHAN: + action_set_active_achan((bAction *)data, (bActionChannel *)channel_data); + break; + case ANIMTYPE_GROUP: + action_set_active_agrp((bAction *)data, (bActionGroup *)channel_data); + break; + } +} + /* Deselect all animation channels * - data: pointer to datatype, as contained in bAnimContext - * - datatype: the type of data that 'data' represents (eAnim_ChannelType) + * - datatype: the type of data that 'data' represents (eAnimCont_Types) * - test: check if deselecting instead of selecting * - sel: eAnimChannels_SetFlag; */ @@ -217,6 +275,10 @@ void ANIM_deselect_anim_channels (void *data, short datatype, short test, short /* ************************************************************************** */ /* OPERATORS */ +/* ****************** Rearrange Channels Operator ******************* */ + + + /* ********************** Set Flags Operator *********************** */ enum { @@ -492,7 +554,6 @@ void ANIM_OT_channels_deselectall (wmOperatorType *ot) /* ******************** Borderselect Operator *********************** */ -// XXX do we need to set some extra thingsfor each channel selected? static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short selectmode) { ListBase anim_data = {NULL, NULL}; @@ -533,6 +594,7 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele bActionGroup *agrp= (bActionGroup *)ale->data; ACHANNEL_SET_FLAG(agrp, selectmode, AGRP_SELECTED); + agrp->flag &= ~AGRP_ACTIVE; } break; case ANIMTYPE_ACHAN: /* action channel */ @@ -542,9 +604,7 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele bActionChannel *achan= (bActionChannel *)ale->data; ACHANNEL_SET_FLAG(achan, selectmode, ACHAN_SELECTED); - - /* messy... set active bone */ - //select_poseelement_by_name(achan->name, selectmode); + achan->flag &= ~ACHAN_HILIGHTED; } break; case ANIMTYPE_CONCHAN: /* constraint channel */ @@ -572,10 +632,10 @@ static void borderselect_anim_channels (bAnimContext *ac, rcti *rect, short sele /* select action-channel 'owner' */ if ((ale->owner) && (ale->ownertype == ANIMTYPE_ACHAN)) { - //bActionChannel *achano= (bActionChannel *)ale->owner; + bActionChannel *achano= (bActionChannel *)ale->owner; - /* messy... set active bone */ - //select_poseelement_by_name(achano->name, selectmode); + ACHANNEL_SET_FLAG(achano, selectmode, ACHAN_SELECTED); + achano->flag &= ~ACHAN_HILIGHTED; } } @@ -632,7 +692,6 @@ void ANIM_OT_channels_borderselect(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* flags */ - // XXX er... ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* rna */ @@ -665,144 +724,159 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s ale= BLI_findlink(&anim_data, channel_index); if (ale == NULL) { /* channel not found */ - printf("Error: animation channel not found in mouse_anim_channels() \n"); - // XXX remove me.. - printf("\t channel index = %d, channels = %d\n", channel_index, filter); + printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index); BLI_freelistN(&anim_data); return; } + /* selectmode -1 is a special case for ActionGroups only, which selects all of the channels underneath it only... */ + // TODO: should this feature be extended to work with other channel types too? + if ((selectmode == -1) && (ale->type != ANIMTYPE_GROUP)) { + /* normal channels should not behave normally in this case */ + BLI_freelistN(&anim_data); + return; + } + /* action to take depends on what channel we've got */ switch (ale->type) { case ANIMTYPE_OBJECT: - { - bDopeSheet *ads= (bDopeSheet *)ac->data; - Scene *sce= (Scene *)ads->source; - Base *base= (Base *)ale->data; - Object *ob= base->object; - - if (x < 16) { - /* toggle expand */ - ob->nlaflag ^= OB_ADS_COLLAPSED; + { + bDopeSheet *ads= (bDopeSheet *)ac->data; + Scene *sce= (Scene *)ads->source; + Base *base= (Base *)ale->data; + Object *ob= base->object; + + if (x < 16) { + /* toggle expand */ + ob->nlaflag ^= OB_ADS_COLLAPSED; + } + else { + /* set selection status */ + if (selectmode == SELECT_INVERT) { + /* swap select */ + base->flag ^= SELECT; + ob->flag= base->flag; } else { - /* set selection status */ - // FIXME: this needs to use the new stuff... - if (selectmode == SELECT_INVERT) { - /* swap select */ - base->flag ^= SELECT; - ob->flag= base->flag; - } - else { - Base *b; - - /* deleselect all */ - for (b= sce->base.first; b; b= b->next) { - b->flag &= ~SELECT; - b->object->flag= b->flag; - } - - /* select object now */ - base->flag |= SELECT; - ob->flag |= SELECT; + Base *b; + + /* deleselect all */ + for (b= sce->base.first; b; b= b->next) { + b->flag &= ~SELECT; + b->object->flag= b->flag; } - //set_active_base(base); /* editview.c */ + /* select object now */ + base->flag |= SELECT; + ob->flag |= SELECT; } + + /* xxx should be ED_base_object_activate(), but we need context pointer for that... */ + //set_active_base(base); } - break; + } + break; case ANIMTYPE_FILLIPOD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWIPO; - } - break; + { + Object *ob= (Object *)ale->data; + ob->nlaflag ^= OB_ADS_SHOWIPO; + } + break; case ANIMTYPE_FILLACTD: - { - bAction *act= (bAction *)ale->data; - act->flag ^= ACTC_EXPANDED; - } - break; + { + bAction *act= (bAction *)ale->data; + act->flag ^= ACTC_EXPANDED; + } + break; case ANIMTYPE_FILLCOND: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWCONS; - } - break; + { + Object *ob= (Object *)ale->data; + ob->nlaflag ^= OB_ADS_SHOWCONS; + } + break; case ANIMTYPE_FILLMATD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWMATS; - } - break; + { + Object *ob= (Object *)ale->data; + ob->nlaflag ^= OB_ADS_SHOWMATS; + } + break; case ANIMTYPE_DSMAT: - { - Material *ma= (Material *)ale->data; - ma->flag ^= MA_DS_EXPAND; - } - break; + { + Material *ma= (Material *)ale->data; + ma->flag ^= MA_DS_EXPAND; + } + break; case ANIMTYPE_DSLAM: - { - Lamp *la= (Lamp *)ale->data; - la->flag ^= LA_DS_EXPAND; - } - break; + { + Lamp *la= (Lamp *)ale->data; + la->flag ^= LA_DS_EXPAND; + } + break; case ANIMTYPE_DSCAM: - { - Camera *ca= (Camera *)ale->data; - ca->flag ^= CAM_DS_EXPAND; - } - break; + { + Camera *ca= (Camera *)ale->data; + ca->flag ^= CAM_DS_EXPAND; + } + break; case ANIMTYPE_DSCUR: - { - Curve *cu= (Curve *)ale->data; - cu->flag ^= CU_DS_EXPAND; - } - break; + { + Curve *cu= (Curve *)ale->data; + cu->flag ^= CU_DS_EXPAND; + } + break; case ANIMTYPE_DSSKEY: - { - Key *key= (Key *)ale->data; - key->flag ^= KEYBLOCK_DS_EXPAND; - } - break; + { + Key *key= (Key *)ale->data; + key->flag ^= KEYBLOCK_DS_EXPAND; + } + break; case ANIMTYPE_GROUP: - { - bActionGroup *agrp= (bActionGroup *)ale->data; - short offset= (ac->datatype == ANIMCONT_DOPESHEET)? 21 : 0; - - if ((x < (offset+17)) && (agrp->channels.first)) { - /* toggle expand */ - agrp->flag ^= AGRP_EXPANDED; + { + bActionGroup *agrp= (bActionGroup *)ale->data; + short offset= (ac->datatype == ANIMCONT_DOPESHEET)? 21 : 0; + + if ((x < (offset+17)) && (agrp->channels.first)) { + /* toggle expand */ + agrp->flag ^= AGRP_EXPANDED; + } + else if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { + /* toggle protection/locking */ + agrp->flag ^= AGRP_PROTECTED; + } + else { + /* select/deselect group */ + if (selectmode == SELECT_INVERT) { + /* inverse selection status of this group only */ + agrp->flag ^= AGRP_SELECTED; } - else if (x >= (ACHANNEL_NAMEWIDTH-ACHANNEL_BUTTON_WIDTH)) { - /* toggle protection/locking */ - agrp->flag ^= AGRP_PROTECTED; - } - else { - /* select/deselect group */ - if (selectmode == SELECT_INVERT) { - /* inverse selection status of group */ - //select_action_group(act, agrp, SELECT_INVERT); - } - else if (/*G.qual == (LR_CTRLKEY|LR_SHIFTKEY)*/selectmode == -1) { - // FIXME: need a special case for this! - /* select all in group (and deselect everthing else) */ - //select_action_group_channels(act, agrp); - //select_action_group(act, agrp, SELECT_ADD); - } - else { - /* select group by itself */ - ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - //select_action_group(act, agrp, SELECT_ADD); - } + else if (selectmode == -1) { + /* select all in group (and deselect everthing else) */ + bActionChannel *achan; - // XXX - agrp->flag ^= AGRP_SELECTED; - } + /* deselect all other channels */ + ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + + /* only select channels in group and group itself */ + for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) + achan->flag |= ACHAN_SELECTED; + agrp->flag |= AGRP_SELECTED; + } + else { + /* select group by itself */ + ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); + agrp->flag |= AGRP_SELECTED; + } + + /* if group is selected now, and we're in Action Editor mode (so that we have pointer to active action), + * we can make this group the 'active' one in that action + */ + if ((agrp->flag & AGRP_SELECTED) && (ac->datatype == ANIMCONT_ACTION)) + action_set_active_agrp((bAction *)ac->data, agrp); } + } break; case ANIMTYPE_ACHAN: { @@ -824,18 +898,20 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s else { /* select/deselect achan */ if (selectmode == SELECT_INVERT) { - //select_channel(act, achan, SELECT_INVERT); + /* invert selection of this channel only */ + achan->flag ^= ACHAN_SELECTED; } else { + /* replace, so make sure only this channel is selected after everything has happened) */ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - //select_channel(act, achan, SELECT_ADD); + achan->flag |= ACHAN_SELECTED; } - /* messy... set active bone */ - //select_poseelement_by_name(achan->name, 2); - - // XXX for now only - achan->flag ^= ACHAN_SELECTED; + /* if channel is selected now, and we're in Action Editor mode (so that we have pointer to active action), + * we can make this channel the 'active' one in that action + */ + if ((achan->flag & ACHAN_SELECTED) && (ac->datatype == ANIMCONT_ACTION)) + action_set_active_achan((bAction *)ac->data, achan); } } break; @@ -848,13 +924,13 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s if ((x > 24) && (achan->flag & ACHAN_SHOWIPO)) { /* select+make active achan */ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - //select_channel(act, achan, SELECT_ADD); - - /* messy... set active bone */ - //select_poseelement_by_name(achan->name, 2); + achan->flag |= ACHAN_SELECTED; - // XXX for now only - achan->flag ^= ACHAN_SELECTED; + /* if channel is selected now, and we're in Action Editor mode (so that we have pointer to active action), + * we can make this channel the 'active' one in that action + */ + if (ac->datatype == ANIMCONT_ACTION) + action_set_active_achan((bAction *)ac->data, achan); } } break; @@ -867,13 +943,13 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s if ((x > 24) && (achan->flag & ACHAN_SHOWCONS)) { /* select+make active achan */ ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); - //select_channel(act, achan, SELECT_ADD); + achan->flag |= ACHAN_SELECTED; - /* messy... set active bone */ - //select_poseelement_by_name(achan->name, 2); - - // XXX for now only - achan->flag ^= ACHAN_SELECTED; + /* if channel is selected now, and we're in Action Editor mode (so that we have pointer to active action), + * we can make this channel the 'active' one in that action + */ + if (ac->datatype == ANIMCONT_ACTION) + action_set_active_achan((bAction *)ac->data, achan); } } break; @@ -891,9 +967,6 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s } else { /* select/deselect */ - //select_icu_channel(act, icu, SELECT_INVERT); - - // XXX for now only icu->flag ^= IPO_SELECT; } } @@ -912,9 +985,6 @@ static void mouse_anim_channels (bAnimContext *ac, float x, int channel_index, s } else { /* select/deselect */ - //select_constraint_channel(act, conchan, SELECT_INVERT); - - // XXX for now only conchan->flag ^= CONSTRAINT_CHANNEL_SELECT; } } @@ -995,6 +1065,8 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent * /* select mode is either replace (deselect all, then add) or add/extend */ if (RNA_boolean_get(op->ptr, "extend_select")) selectmode= SELECT_INVERT; + else if (RNA_boolean_get(op->ptr, "select_children_only")) + selectmode= -1; /* this is a bit of a special case for ActionGroups only... should it be removed or extended to all instead? */ else selectmode= SELECT_REPLACE; @@ -1011,6 +1083,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent * /* set notifier tha things have changed */ ED_area_tag_redraw(CTX_wm_area(C)); // FIXME... should be updating 'keyframes' data context or so instead! + // FIXME: add tags which will cause 3d-view to do a flush of data... return OPERATOR_FINISHED; } @@ -1027,6 +1100,7 @@ void ANIM_OT_channels_mouseclick (wmOperatorType *ot) /* id-props */ RNA_def_property(ot->srna, "extend_select", PROP_BOOLEAN, PROP_NONE); // SHIFTKEY + RNA_def_property(ot->srna, "select_children_only", PROP_BOOLEAN, PROP_NONE); // CTRLKEY|SHIFTKEY } /* ************************************************************************** */ @@ -1052,6 +1126,7 @@ void ED_keymap_animchannels(wmWindowManager *wm) // XXX for now, only leftmouse.... WM_keymap_add_item(keymap, "ANIM_OT_channels_mouseclick", LEFTMOUSE, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_mouseclick", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend_select", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "ANIM_OT_channels_mouseclick", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "select_children_only", 1); /* deselect all */ WM_keymap_add_item(keymap, "ANIM_OT_channels_deselectall", AKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index b8f1e72bd3f..6f1f454b907 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -188,13 +188,15 @@ short ANIM_animchannel_keys_bezier_loop(BeztEditData *bed, bAnimListElem *ale, B /* method to use depends on the type of keyframe data */ switch (ale->datatype) { - /* direct keyframe data (these loops are exposed) */ + /* direct keyframe data (these loops are exposed) */ case ALE_ICU: /* ipo-curve */ return ANIM_icu_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, icu_cb); case ALE_IPO: /* ipo */ return ANIM_ipo_keys_bezier_loop(bed, ale->key_data, bezt_ok, bezt_cb, icu_cb); - /* indirect 'summaries' (these are not exposed) */ + /* indirect 'summaries' (these are not exposed directly) + * NOTE: must keep this code in sync with the drawing code and also the filtering code! + */ case ALE_GROUP: /* action group */ return agrp_keys_bezier_loop(bed, (bActionGroup *)ale->data, bezt_ok, bezt_cb, icu_cb); case ALE_ACT: /* action */ diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 2489aed66b5..410bd77e483 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -251,6 +251,9 @@ short ANIM_animdata_context_getdata(bAnimContext *ac); /* Deselect all animation channels */ void ANIM_deselect_anim_channels(void *data, short datatype, short test, short sel); +/* Set the 'active' channel of type channel_type, in the given action */ +void ANIM_action_set_active_channel(void *data, short datatype, void *channel_data, short channel_type); + /* --------------- Settings and/or Defines -------------- */ /* flag-setting behaviour */ diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index e92b2d031b6..b412641284d 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -177,6 +177,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) else if (v2d->scroll & V2D_SCROLL_RIGHT) { /* on right-hand edge of region */ v2d->vert= v2d->mask; + v2d->vert.xmax++; /* one pixel extra... was having leaving a minor gap... */ v2d->vert.xmin= v2d->vert.xmax - V2D_SCROLL_WIDTH; v2d->mask.xmax= v2d->vert.xmin - 1; } @@ -675,7 +676,7 @@ void UI_view2d_totRect_set (View2D *v2d, int width, int height) height= abs(height); if (ELEM3(0, v2d, width, height)) { - printf("Error: View2D totRect set exiting: %p %d %d \n", v2d, width, height); // XXX temp debug string + printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d \n", v2d, width, height); // XXX temp debug info return; } diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 039a5038027..832246897e0 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -856,13 +856,12 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short selectmode) /* Highlight either an Action-Channel or Action-Group */ if (achan) { achan->flag |= ACHAN_SELECTED; - //hilight_channel(act, achan, 1); - //select_poseelement_by_name(achan->name, 2); /* 2 is activate */ + ANIM_action_set_active_channel(ac->data, ac->datatype, achan, ANIMTYPE_ACHAN); } else if (agrp) { agrp->flag |= AGRP_SELECTED; - //set_active_actiongroup(act, agrp, 1); - } + ANIM_action_set_active_channel(ac->data, ac->datatype, agrp, ANIMTYPE_GROUP); + } } else if (ac->datatype == ANIMCONT_GPENCIL) { ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index cfae1b127cf..3e8fc31977a 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -268,6 +268,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h) } } +#if 0 // XXX this is currently disabled until te->xend is set correctly static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) { TreeElement *te= lb->first; @@ -275,19 +276,15 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w) // TreeStoreElem *tselem= TREESTORE(te); // XXX fixme... te->xend is not set yet -/* if(tselem->flag & TSE_CLOSED) { if (te->xend > *w) *w = te->xend; } -*/ outliner_width(soops, &te->subtree, w); te= te->next; } - - // XXX for now, use constant width for this level (until te->xend is set) - *w += 100; } +#endif static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx) { @@ -1125,6 +1122,7 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb) TreeStoreElem *tselem; /* build hierarchy */ + // XXX also, set extents here... te= lb->first; while(te) { ten= te->next; @@ -1240,7 +1238,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) ten= nten; } /* restore newid pointers */ - for(lib= G.main->library.first; lib; lib= lib->id.next) + for(lib= mainvar->library.first; lib; lib= lib->id.next) lib->id.newid= NULL; } @@ -1282,7 +1280,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) Group *group; GroupObject *go; - for(group= G.main->group.first; group; group= group->id.next) { + for(group= mainvar->group.first; group; group= group->id.next) { if(group->id.us) { te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0); tselem= TREESTORE(te); @@ -4313,8 +4311,16 @@ void draw_outliner(const bContext *C) /* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */ sizex= sizex_rna + OL_RNA_COL_SIZEX + 50; } - else - outliner_width(soops, &soops->tree, &sizex); + else { + /* width must take into account restriction columns (if visible) so that entries will still be visible */ + //outliner_width(soops, &soops->tree, &sizex); + outliner_rna_width(soops, &soops->tree, &sizex, 0); // XXX should use outliner_width instead when te->xend will be set correctly... + + /* constant offset for restriction columns */ + // XXX this isn't that great yet... + if ((soops->flag & SO_HIDE_RESTRICTCOLS)==0) + sizex += OL_TOGW*3; + } /* update size of tot-rect (extents of data/viewable area) */ UI_view2d_totRect_set(v2d, sizex, sizey); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 4d800e36887..d5865bab424 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -33,6 +33,17 @@ #ifdef RNA_RUNTIME +static StructRNA* rna_Constraint_refine(struct PointerRNA *ptr) +{ + bConstraint *con= (bConstraint*)ptr->data; + + switch(con->type) { + // FIXME: add constraint types + default: + return &RNA_Constraint; + } +} + #else /* base struct for constraints */ @@ -73,6 +84,7 @@ void rna_def_constraint_basedata(BlenderRNA *brna) /* data */ srna= RNA_def_struct(brna, "Constraint", NULL ); RNA_def_struct_ui_text(srna, "Constraint", "alter the transformation of 'Objects' or 'Bones' from a number of predefined constraints"); + //RNA_def_struct_refine_func(srna, "rna_Constraint_refine"); // XXX or should this go down below with the data? RNA_def_struct_sdna(srna, "bConstraint"); /* strings */ @@ -114,10 +126,6 @@ void rna_def_constraint_basedata(BlenderRNA *brna) /* pointers */ - // err... how to enable this to work, since data pointer can be of various types? - //prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); - //RNA_def_property_ui_text(prop, "Settings", "Settings specific to this constraint type."); - prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "IPO", "Local IPO data."); } |