[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18329] branches/blender2.5/blender/source /blender: 2.5 - Various Cleanups/Fixes
Joshua Leung
aligorith at gmail.com
Mon Jan 5 01:38:17 CET 2009
Revision: 18329
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18329
Author: aligorith
Date: 2009-01-05 01:38:17 +0100 (Mon, 05 Jan 2009)
Log Message:
-----------
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
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c
branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
branches/blender2.5/blender/source/blender/editors/interface/view2d.c
branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_constraint.c
Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2009-01-05 00:05:56 UTC (rev 18328)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c 2009-01-05 00:38:17 UTC (rev 18329)
@@ -5215,6 +5215,7 @@
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 @@
}
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);
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c 2009-01-05 00:05:56 UTC (rev 18328)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c 2009-01-05 00:38:17 UTC (rev 18329)
@@ -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 @@
/* ************************************************************************** */
/* OPERATORS */
+/* ****************** Rearrange Channels Operator ******************* */
+
+
+
/* ********************** Set Flags Operator *********************** */
enum {
@@ -492,7 +554,6 @@
/* ******************** 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 @@
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 @@
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 @@
/* 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 @@
ot->poll= ED_operator_areaactive;
/* flags */
- // XXX er...
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* rna */
@@ -665,144 +724,159 @@
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;
+ Base *b;
+
+ /* deleselect all */
+ for (b= sce->base.first; b; b= b->next) {
+ b->flag &= ~SELECT;
+ b->object->flag= b->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;
- }
- //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) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list