Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c111
-rw-r--r--source/blender/editors/animation/anim_deps.c4
-rw-r--r--source/blender/editors/animation/anim_filter.c41
-rw-r--r--source/blender/editors/animation/keyframing.c2
-rw-r--r--source/blender/editors/animation/keyingsets.c4
5 files changed, 105 insertions, 57 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index ebde475a075..24ffc60453b 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -71,6 +71,7 @@
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
+#include "UI_view2d.h"
#include "ED_anim_api.h"
#include "ED_keyframing.h"
@@ -916,7 +917,8 @@ static bool acf_group_setting_valid(bAnimContext *ac,
/* for now, all settings are supported, though some are only conditionally */
switch (setting) {
/* unsupported */
- case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
+ case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
+ case ACHANNEL_SETTING_PINNED: /* Only for NLA actions */
return false;
/* conditionally supported */
@@ -1963,6 +1965,25 @@ static int acf_dsskey_icon(bAnimListElem *UNUSED(ale))
return ICON_SHAPEKEY_DATA;
}
+/* check if some setting exists for this channel */
+static bool acf_dsskey_setting_valid(bAnimContext *ac,
+ bAnimListElem *UNUSED(ale),
+ eAnimChannel_Settings setting)
+{
+ switch (setting) {
+ case ACHANNEL_SETTING_SELECT:
+ case ACHANNEL_SETTING_EXPAND:
+ return true;
+
+ /* mute is only supported for NLA */
+ case ACHANNEL_SETTING_MUTE:
+ return ((ac) && (ac->spacetype == SPACE_NLA));
+
+ default:
+ return false;
+ }
+}
+
/* get the appropriate flag(s) for the setting when it is valid */
static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac),
eAnimChannel_Settings setting,
@@ -2029,9 +2050,9 @@ static bAnimChannelType ACF_DSSKEY = {
acf_generic_idblock_name_prop, /* name prop */
acf_dsskey_icon, /* icon */
- acf_generic_dataexpand_setting_valid, /* has setting */
- acf_dsskey_setting_flag, /* flag for setting */
- acf_dsskey_setting_ptr, /* pointer for setting */
+ acf_dsskey_setting_valid, /* has setting */
+ acf_dsskey_setting_flag, /* flag for setting */
+ acf_dsskey_setting_ptr, /* pointer for setting */
};
/* World Expander ------------------------------------------- */
@@ -3155,6 +3176,8 @@ static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac),
/* unsupported */
case ACHANNEL_SETTING_EXPAND: /* gpencil layers are more like F-Curves than groups */
case ACHANNEL_SETTING_SOLO: /* nla editor only */
+ case ACHANNEL_SETTING_MOD_OFF:
+ case ACHANNEL_SETTING_PINNED: /* nla actions only */
return false;
/* always available */
@@ -3335,6 +3358,9 @@ static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac),
case ACHANNEL_SETTING_EXPAND: /* mask layers are more like F-Curves than groups */
case ACHANNEL_SETTING_VISIBLE: /* graph editor only */
case ACHANNEL_SETTING_SOLO: /* nla editor only */
+ case ACHANNEL_SETTING_MOD_OFF:
+ case ACHANNEL_SETTING_PINNED: /* nla actions only */
+ case ACHANNEL_SETTING_MUTE:
return false;
/* always available */
@@ -4112,10 +4138,6 @@ void ANIM_channel_draw(
/* just skip - drawn as widget now */
offset += ICON_WIDTH;
}
- else if (ale->type == ANIMTYPE_GPLAYER) {
- /* just skip - drawn as a widget */
- offset += ICON_WIDTH;
- }
}
/* step 5) draw name ............................................... */
@@ -4163,8 +4185,16 @@ void ANIM_channel_draw(
}
/* step 6) draw backdrops behind mute+protection toggles + (sliders) ....................... */
- /* reset offset - now goes from RHS of panel */
- offset = 0;
+ /* - Reset offset - now goes from RHS of panel.
+ * - Exception for graph editor, which needs extra space for the scroll bar.
+ */
+ if (ac->spacetype == SPACE_GRAPH &&
+ ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE, ANIMTYPE_GROUP)) {
+ offset = V2D_SCROLL_WIDTH;
+ }
+ else {
+ offset = 0;
+ }
/* TODO: when drawing sliders, make those draw instead of these toggles if not enough space */
@@ -4207,10 +4237,17 @@ void ANIM_channel_draw(
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
offset += ICON_WIDTH;
}
+
+ /* grease pencil visibility... */
if (ale->type == ANIMTYPE_GPLAYER) {
offset += ICON_WIDTH;
}
+ /* modifiers toggle... */
+ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
+ offset += ICON_WIDTH;
+ }
+
/* pinned... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED)) {
offset += ICON_WIDTH;
@@ -4957,8 +4994,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
/* modifiers disable */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
- /* hack: extra spacing, to avoid touching the mute toggle */
- offset -= ICON_WIDTH * 1.2f;
+ offset -= ICON_WIDTH;
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_MOD_OFF);
}
@@ -5073,37 +5109,19 @@ void ANIM_channel_draw_widgets(const bContext *C,
else if (ale->type == ANIMTYPE_GPLAYER) {
bGPdata *gpd = (bGPdata *)ale->id;
if ((gpd != NULL) && ((gpd->flag & GP_DATA_ANNOTATIONS) == 0)) {
- /* Add some offset to make it more pleasing to the eye. */
- offset += SLIDER_WIDTH / 2.1f;
+ /* Reset slider offset, in order to add special gp icons. */
+ offset += SLIDER_WIDTH;
char *gp_rna_path = NULL;
bGPDlayer *gpl = (bGPDlayer *)ale->data;
- const short width = SLIDER_WIDTH / 5;
/* Create the RNA pointers. */
RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, &ptr);
RNA_id_pointer_create(ale->id, &id_ptr);
int icon;
- /* Layer opacity. */
- UI_block_emboss_set(block, UI_EMBOSS);
- prop = RNA_struct_find_property(&ptr, "opacity");
- gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
- if (RNA_path_resolve_property(&id_ptr, gp_rna_path, &ptr, &prop)) {
- uiDefAutoButR(block,
- &ptr,
- prop,
- array_index,
- "",
- ICON_NONE,
- offset,
- ymid,
- width * 3,
- channel_height);
- }
- MEM_freeN(gp_rna_path);
-
/* Mask Layer. */
+ offset -= ICON_WIDTH;
UI_block_emboss_set(block, UI_EMBOSS_NONE);
prop = RNA_struct_find_property(&ptr, "use_mask_layer");
gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
@@ -5121,14 +5139,15 @@ void ANIM_channel_draw_widgets(const bContext *C,
array_index,
"",
icon,
- offset + (width * 3),
+ offset,
ymid,
- width,
+ ICON_WIDTH,
channel_height);
}
MEM_freeN(gp_rna_path);
/* Layer onion skinning switch. */
+ offset -= ICON_WIDTH;
prop = RNA_struct_find_property(&ptr, "use_onion_skinning");
gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
if (RNA_path_resolve_property(&id_ptr, gp_rna_path, &ptr, &prop)) {
@@ -5140,7 +5159,27 @@ void ANIM_channel_draw_widgets(const bContext *C,
array_index,
"",
icon,
- offset + (width * 4),
+ offset,
+ ymid,
+ ICON_WIDTH,
+ channel_height);
+ }
+ MEM_freeN(gp_rna_path);
+
+ /* Layer opacity. */
+ const short width = SLIDER_WIDTH * 0.6;
+ offset -= width;
+ UI_block_emboss_set(block, UI_EMBOSS);
+ prop = RNA_struct_find_property(&ptr, "opacity");
+ gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
+ if (RNA_path_resolve_property(&id_ptr, gp_rna_path, &ptr, &prop)) {
+ uiDefAutoButR(block,
+ &ptr,
+ prop,
+ array_index,
+ "",
+ ICON_NONE,
+ offset,
ymid,
width,
channel_height);
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 98fcb9c5ce5..439b8071deb 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -368,9 +368,7 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
if (ale->update & ANIM_UPDATE_ORDER) {
ale->update &= ~ANIM_UPDATE_ORDER;
if (gpl) {
- /* While correct & we could enable it: 'posttrans_gpd_clean' currently
- * both sorts and removes doubles, so this is not necessary here. */
- // gpencil_sort_frames(gpl);
+ BKE_gpencil_layer_frames_sort(gpl, NULL);
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 4b0a4bcf46b..8dfc9cd8d1a 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1715,22 +1715,33 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data,
/* loop over layers as the conditions are acceptable (top-Down order) */
for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) {
/* 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)) {
- /* skip layer if the name doesn't match the filter string */
- if ((ads) && (ads->searchstr[0] != '\0')) {
- if (name_matches_dopesheet_filter(ads, gpl->info) == false) {
- continue;
- }
- }
- /* add to list */
- ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd, NULL);
- }
- }
+ if (!ANIMCHANNEL_SELOK(SEL_GPL(gpl))) {
+ continue;
+ }
+
+ /* only if editable */
+ if ((filter_mode & ANIMFILTER_FOREDIT) && !EDITABLE_GPL(gpl)) {
+ continue;
+ }
+
+ /* active... */
+ if ((filter_mode & ANIMFILTER_ACTIVE) && (gpl->flag & GP_LAYER_ACTIVE) == 0) {
+ continue;
}
+
+ /* skip layer if the name doesn't match the filter string */
+ if (ads != NULL && ads->searchstr[0] != '\0' &&
+ name_matches_dopesheet_filter(ads, gpl->info) == false) {
+ continue;
+ }
+
+ /* Skip empty layers. */
+ if (BLI_listbase_is_empty(&gpl->frames)) {
+ continue;
+ }
+
+ /* add to list */
+ ANIMCHANNEL_NEW_CHANNEL(gpl, ANIMTYPE_GPLAYER, gpd, NULL);
}
return items;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 22a42d56fcd..c290a2ac70a 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -2709,7 +2709,7 @@ void ANIM_OT_keyframe_clear_button(wmOperatorType *ot)
/* ******************************************* */
/* AUTO KEYFRAME */
-bool autokeyframe_cfra_can_key(Scene *scene, ID *id)
+bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
{
float cfra = (float)CFRA; // XXX for now, this will do
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 721953f41c8..6f9769f9785 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -673,7 +673,7 @@ bool ANIM_keyingset_find_id(KeyingSet *ks, ID *id)
/* Getters for Active/Indices ----------------------------- */
/* Get the active Keying Set for the Scene provided */
-KeyingSet *ANIM_scene_get_active_keyingset(Scene *scene)
+KeyingSet *ANIM_scene_get_active_keyingset(const Scene *scene)
{
/* if no scene, we've got no hope of finding the Keying Set */
if (scene == NULL) {
@@ -728,7 +728,7 @@ int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
}
/* Get Keying Set to use for Auto-Keyframing some transforms */
-KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *transformKSName)
+KeyingSet *ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
{
/* get KeyingSet to use
* - use the active KeyingSet if defined (and user wants to use it for all autokeying),