[Bf-blender-cvs] [8694b428c78] FixT87160_DSE_Channel_Selection: Fix T87160: DSE Keyframe Selection Now Selects Channels
Wayde Moss
noreply at git.blender.org
Thu May 20 02:05:39 CEST 2021
Commit: 8694b428c78edc3e2baaeb8b00420acd0d8681b8
Author: Wayde Moss
Date: Fri May 14 16:02:28 2021 -0400
Branches: FixT87160_DSE_Channel_Selection
https://developer.blender.org/rB8694b428c78edc3e2baaeb8b00420acd0d8681b8
Fix T87160: DSE Keyframe Selection Now Selects Channels
Select All/Box/Circle/Lasso/MouseClick of keyframes now add channels to selection if any keydata was added to the selection.
===================================================================
M source/blender/editors/animation/keyframes_edit.c
M source/blender/editors/gpencil/editaction_gpencil.c
M source/blender/editors/include/ED_gpencil.h
M source/blender/editors/include/ED_keyframes_edit.h
M source/blender/editors/include/ED_mask.h
M source/blender/editors/mask/mask_editaction.c
M source/blender/editors/space_action/action_select.c
===================================================================
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 636f0d3cbea..a610e040e05 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -745,6 +745,11 @@ static short ok_bezier_channel_circle(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
+static short ok_bezier_channel_all_are_valid(KeyframeEditData *ked, BezTriple *bezt)
+{
+ return KEYFRAME_OK_KEY;
+}
+
KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
{
/* eEditKeyframes_Validate */
@@ -779,6 +784,8 @@ KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
case BEZT_OK_CHANNEL_CIRCLE:
/* same as BEZT_OK_REGION_CIRCLE, but we're only using the x-value of the points */
return ok_bezier_channel_circle;
+ case BEZT_OK_ALL_ARE_VALID:
+ return ok_bezier_channel_all_are_valid;
default: /* nothing was ok */
return NULL;
}
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 166111c582c..f1d3a179ef9 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -146,17 +146,19 @@ static void gpencil_frame_select(bGPDframe *gpf, short select_mode)
}
/* set all/none/invert select (like above, but with SELECT_* modes) */
-void ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode)
+bool ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode)
{
/* error checking */
if (gpl == NULL) {
- return;
+ return false;
}
/* handle according to mode */
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
gpencil_frame_select(gpf, select_mode);
}
+
+ return !BLI_listbase_is_empty(&gpl->frames);
}
/* set all/none/invert select */
@@ -172,46 +174,56 @@ void ED_gpencil_layer_frame_select_set(bGPDlayer *gpl, short mode)
}
/* select the frame in this layer that occurs on this frame (there should only be one at most) */
-void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode)
+bool ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode)
{
bGPDframe *gpf;
if (gpl == NULL) {
- return;
+ return false;
}
gpf = BKE_gpencil_layer_frame_find(gpl, selx);
if (gpf) {
gpencil_frame_select(gpf, select_mode);
+ return true;
}
+
+ return false;
}
/* select the frames in this layer that occur within the bounds specified */
-void ED_gpencil_layer_frames_select_box(bGPDlayer *gpl, float min, float max, short select_mode)
+bool ED_gpencil_layer_frames_select_box(bGPDlayer *gpl, float min, float max, short select_mode)
{
if (gpl == NULL) {
- return;
+ return false;
}
+ bool any_in_region = false;
+
/* only select those frames which are in bounds */
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
if (IN_RANGE(gpf->framenum, min, max)) {
+ any_in_region = true;
gpencil_frame_select(gpf, select_mode);
}
}
+
+ return any_in_region;
}
/* select the frames in this layer that occur within the lasso/circle region specified */
-void ED_gpencil_layer_frames_select_region(KeyframeEditData *ked,
+bool ED_gpencil_layer_frames_select_region(KeyframeEditData *ked,
bGPDlayer *gpl,
short tool,
short select_mode)
{
if (gpl == NULL) {
- return;
+ return false;
}
+ bool any_in_region = false;
+
/* only select frames which are within the region */
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
/* construct a dummy point coordinate to do this testing with */
@@ -224,16 +236,36 @@ void ED_gpencil_layer_frames_select_region(KeyframeEditData *ked,
if (tool == BEZT_OK_CHANNEL_LASSO) {
/* Lasso */
if (keyframe_region_lasso_test(ked->data, pt)) {
+ any_in_region = true;
gpencil_frame_select(gpf, select_mode);
}
}
else if (tool == BEZT_OK_CHANNEL_CIRCLE) {
/* Circle */
if (keyframe_region_circle_test(ked->data, pt)) {
+ any_in_region = true;
gpencil_frame_select(gpf, select_mode);
}
}
}
+
+ return any_in_region;
+}
+
+bool ED_gpencil_select_layer_based_on_frames(bGPDlayer *layer)
+{
+ if (layer == NULL) {
+ return false;
+ }
+
+ if (ED_gpencil_layer_frame_select_check(layer)) {
+ layer->flag |= GP_LAYER_SELECT;
+ return true;
+ }
+ else {
+ layer->flag &= ~GP_LAYER_SELECT;
+ return false;
+ }
}
/* ***************************************** */
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index bad080e1609..871c2ff29a7 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -191,16 +191,17 @@ void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, boo
bool ED_gpencil_layer_frame_select_check(struct bGPDlayer *gpl);
void ED_gpencil_layer_frame_select_set(struct bGPDlayer *gpl, short mode);
-void ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl,
+bool ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl,
float min,
float max,
short select_mode);
-void ED_gpencil_layer_frames_select_region(struct KeyframeEditData *ked,
+bool ED_gpencil_layer_frames_select_region(struct KeyframeEditData *ked,
struct bGPDlayer *gpl,
short tool,
short select_mode);
-void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode);
-void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode);
+bool ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode);
+bool ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode);
+bool ED_gpencil_select_layer_based_on_frames(struct bGPDlayer *layer);
bool ED_gpencil_layer_frames_delete(struct bGPDlayer *gpl);
void ED_gpencil_layer_frames_duplicate(struct bGPDlayer *gpl);
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index cf90a21f799..60177228a6f 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -58,6 +58,7 @@ typedef enum eEditKeyframes_Validate {
/* Only for keyframes a certain Dopesheet channel */
BEZT_OK_CHANNEL_LASSO,
BEZT_OK_CHANNEL_CIRCLE,
+ BEZT_OK_ALL_ARE_VALID,
} eEditKeyframes_Validate;
/* ------------ */
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h
index 247911bdc55..62d40c0af4b 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -102,16 +102,17 @@ void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems,
bool ED_masklayer_frame_select_check(struct MaskLayer *mask_layer);
void ED_masklayer_frame_select_set(struct MaskLayer *mask_layer, short mode);
-void ED_masklayer_frames_select_box(struct MaskLayer *mask_layer,
+bool ED_masklayer_frames_select_box(struct MaskLayer *mask_layer,
float min,
float max,
short select_mode);
-void ED_masklayer_frames_select_region(struct KeyframeEditData *ked,
+bool ED_masklayer_frames_select_region(struct KeyframeEditData *ked,
struct MaskLayer *mask_layer,
short tool,
short select_mode);
-void ED_mask_select_frames(struct MaskLayer *mask_layer, short select_mode);
-void ED_mask_select_frame(struct MaskLayer *mask_layer, int selx, short select_mode);
+bool ED_mask_select_frames(struct MaskLayer *mask_layer, short select_mode);
+bool ED_mask_select_frame(struct MaskLayer *mask_layer, int selx, short select_mode);
+bool ED_mask_select_layer_based_on_frames(struct MaskLayer *mask_layer);
bool ED_masklayer_frames_delete(struct MaskLayer *mask_layer);
void ED_masklayer_frames_duplicate(struct MaskLayer *mask_layer);
diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c
index 1792f0e13bc..a7604597dc5 100644
--- a/source/blender/editors/mask/mask_editaction.c
+++ b/source/blender/editors/mask/mask_editaction.c
@@ -151,13 +151,13 @@ static void mask_layer_shape_select(MaskLayerShape *mask_layer_shape, short sele
}
/* set all/none/invert select (like above, but with SELECT_* modes) */
-void ED_mask_select_frames(MaskLayer *mask_layer, short select_mode)
+bool ED_mask_select_frames(MaskLayer *mask_layer, short select_mode)
{
MaskLayerShape *mask_layer_shape;
/* error checking */
if (mask_layer == NULL) {
- return;
+ return false;
}
/* handle according to mode */
@@ -165,6 +165,7 @@ void ED_mask_select_frames(MaskLayer *mask_layer, short select_mode)
mask_layer_shape = mask_layer_shape->next) {
mask_layer_shape_select(mask_layer_shape, select_mode);
}
+ return !BLI_listbase_is_empty(&mask_layer->splines_shapes);
}
/* set all/none/invert select */
@@ -180,41 +181,65 @@ void ED_masklayer_frame_select_set(MaskLayer *mask_layer, short mode)
}
/* select the frame in this layer that occurs on this frame (there should only be one at most) */
-void ED_mask_select_frame(MaskLayer *mask_layer, int selx, short select_mode)
+bool ED_mask_select_frame(MaskLayer *mask_layer, int selx, short select_mode)
{
MaskLayerShape *mask_layer_shape;
if (mask_layer == NULL) {
- return;
+ return false;
}
mask_layer_shape = BKE_mask_layer_shape_find_frame(mask_layer, selx);
if (mask_layer_shape) {
mask_layer_shape_select(mask_layer_shape, select_mode);
+ return true;
+ }
+
+ return false;
+}
+
+bool ED_mask_select_layer_based_on_frames(struct MaskLayer *mask_la
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list