Revision: 38189
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38189
Author: aligorith
Date: 2011-07-07 11:29:36 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
Grease Pencil ActEdit Mode: Filtering Cleanup
* Ported filtering code for Grease Pencil frames editing to the newer-
style refactored stuff
* Decoupled active status of layers from selection status, bringing
this into line with everything else again
Modified Paths:
--------------
branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c
branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
Modified:
branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c
2011-07-07 11:01:36 UTC (rev 38188)
+++ branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c
2011-07-07 11:29:36 UTC (rev 38189)
@@ -1236,42 +1236,65 @@
return items;
}
+static size_t animdata_filter_gpencil_data (ListBase *anim_data, bGPdata *gpd,
int filter_mode)
+{
+ bGPDlayer *gpl;
+ size_t items = 0;
+
+ /* loop over layers as the conditions are acceptable */
+ for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
+ /* only if selected */
+ if ( ANIMCHANNEL_SELOK(SEL_GPL(gpl)) ) {
+ /* only if editable */
+ if (!(filter_mode & ANIMFILTER_FOREDIT) ||
EDITABLE_GPL(gpl)) {
+ /* active... */
+ if (!(filter_mode & ANIMFILTER_ACTIVE) ||
(gpl->flag & GP_LAYER_ACTIVE)) {
+ /* add to list */
+ ANIMCHANNEL_NEW_CHANNEL(gpl,
ANIMTYPE_GPLAYER, gpd);
+ }
+ }
+ }
+ }
+
+ return items;
+}
+
/* Grab all Grase Pencil datablocks in file */
// TODO: should this be amalgamated with the dopesheet filtering code?
static size_t animdata_filter_gpencil (ListBase *anim_data, void
*UNUSED(data), int filter_mode)
{
bGPdata *gpd;
- bGPDlayer *gpl;
size_t items = 0;
- /* check if filtering types are appropriate */
- {
- /* for now, grab grease pencil datablocks directly from main*/
- for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
- /* only show if gpd is used by something... */
- if (ID_REAL_USERS(gpd) < 1)
- continue;
+ /* for now, grab grease pencil datablocks directly from main */
+ // XXX: this is not good...
+ for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
+ ListBase tmp_data = {NULL, NULL};
+ size_t tmp_items = 0;
+
+ /* only show if gpd is used by something... */
+ if (ID_REAL_USERS(gpd) < 1)
+ continue;
- /* add gpd as channel too (if for drawing, and it has
layers) */
- if ((filter_mode & ANIMFILTER_LIST_CHANNELS) &&
(gpd->layers.first)) {
- /* add to list */
+ /* add gpencil animation channels */
+ BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_GPD(gpd))
+ {
+ tmp_items += animdata_filter_gpencil_data(&tmp_data,
gpd, filter_mode);
+ }
+ END_ANIMFILTER_SUBCHANNELS;
+
+ /* did we find anything? */
+ if (tmp_items) {
+ /* include data-expand widget first */
+ if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
+ /* add gpd as channel too (if for drawing, and
it has layers) */
ANIMCHANNEL_NEW_CHANNEL(gpd,
ANIMTYPE_GPDATABLOCK, NULL);
}
- /* only add layers if they will be visible (if drawing
channels) */
- if ( !(filter_mode & ANIMFILTER_LIST_VISIBLE) ||
(EXPANDED_GPD(gpd)) ) {
- /* loop over layers as the conditions are
acceptable */
- for (gpl= gpd->layers.first; gpl; gpl=
gpl->next) {
- /* only if selected */
- if ( ANIMCHANNEL_SELOK(SEL_GPL(gpl)) ) {
- /* only if editable */
- if (!(filter_mode &
ANIMFILTER_FOREDIT) || EDITABLE_GPL(gpl)) {
- /* add to list */
-
ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd);
- }
- }
- }
- }
+ /* now add the list of collected channels */
+ BLI_movelisttolist(anim_data, &tmp_data);
+ BLI_assert((tmp_data.first == tmp_data.last) &&
(tmp_data.first == NULL));
+ items += tmp_items;
}
}
Modified: branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
2011-07-07 11:01:36 UTC (rev 38188)
+++ branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
2011-07-07 11:29:36 UTC (rev 38189)
@@ -274,7 +274,7 @@
#define EXPANDED_GPD(gpd) (gpd->flag & GP_DATA_EXPAND)
/* Grease Pencil Layer settings */
#define EDITABLE_GPL(gpl) ((gpl->flag & GP_LAYER_LOCKED)==0)
-#define SEL_GPL(gpl) ((gpl->flag & GP_LAYER_ACTIVE) || (gpl->flag &
GP_LAYER_SELECT))
+#define SEL_GPL(gpl) (gpl->flag & GP_LAYER_SELECT)
/* NLA only */
#define SEL_NLT(nlt) (nlt->flag & NLATRACK_SELECTED)
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs