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:
-rw-r--r--release/scripts/ui/space_dopesheet.py2
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c78
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c3
-rw-r--r--source/blender/editors/animation/anim_filter.c138
-rw-r--r--source/blender/editors/animation/keyframes_draw.c2
-rw-r--r--source/blender/editors/animation/keyframes_edit.c19
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c1
-rw-r--r--source/blender/editors/space_nla/nla_channels.c1
-rw-r--r--source/blender/makesdna/DNA_action_types.h1
-rw-r--r--source/blender/makesdna/DNA_linestyle_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_action.c6
12 files changed, 253 insertions, 5 deletions
diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py
index 19f64268481..e1b92ab4d32 100644
--- a/release/scripts/ui/space_dopesheet.py
+++ b/release/scripts/ui/space_dopesheet.py
@@ -60,6 +60,8 @@ def dopesheet_filter(layout, context):
row.prop(dopesheet, "show_armatures", text="")
if bpy.data.particles:
row.prop(dopesheet, "show_particles", text="")
+ if bpy.data.linestyles:
+ row.prop(dopesheet, "show_linestyles", text="")
if bpy.data.groups:
row = layout.row(align=True)
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 3fb8e441d6f..dbd13e9188f 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -42,6 +42,7 @@
#include "DNA_space_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
@@ -2157,6 +2158,82 @@ static bAnimChannelType ACF_DSNTREE=
acf_dsntree_setting_ptr /* pointer for setting */
};
+/* LineStyle Expander ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dslinestyle_icon(bAnimListElem *ale)
+{
+ return ICON_BRUSH_DATA; /* FIXME */
+}
+
+/* get the appropriate flag(s) for the setting when it is valid */
+static int acf_dslinestyle_setting_flag(bAnimContext *ac, int setting, short *neg)
+{
+ /* clear extra return data first */
+ *neg= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ return LS_DS_EXPAND;
+
+ case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+ return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ return ADT_UI_SELECTED;
+
+ default: /* unsupported */
+ return 0;
+ }
+}
+
+/* get pointer to the setting */
+static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+ FreestyleLineStyle *linestyle= (FreestyleLineStyle *)ale->data;
+
+ /* clear extra return data first */
+ *type= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ GET_ACF_FLAG_PTR(linestyle->flag);
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+ if (linestyle->adt)
+ GET_ACF_FLAG_PTR(linestyle->adt->flag)
+ else
+ return NULL;
+
+ default: /* unsupported */
+ return NULL;
+ }
+}
+
+/* node tree expander type define */
+static bAnimChannelType ACF_DSLINESTYLE=
+{
+ "Line Style Expander", /* type name */
+
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop,/* backdrop */
+ acf_generic_indention_1, /* indent level */
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_dslinestyle_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dslinestyle_setting_flag, /* flag for setting */
+ acf_dslinestyle_setting_ptr /* pointer for setting */
+};
+
/* Mesh Expander ------------------------------------------- */
// TODO: just get this from RNA?
@@ -2489,6 +2566,7 @@ void ANIM_init_channel_typeinfo_data (void)
animchannelTypeInfo[type++]= &ACF_DSARM; /* Armature Channel */
animchannelTypeInfo[type++]= &ACF_DSMESH; /* Mesh Channel */
animchannelTypeInfo[type++]= &ACF_DSTEX; /* Texture Channel */
+ animchannelTypeInfo[type++]= &ACF_DSLINESTYLE; /* LineStyle Channel */
animchannelTypeInfo[type++]= &ACF_SHAPEKEY; /* ShapeKey */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index e229de42006..496d41ae4dc 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -229,6 +229,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLINESTYLE:
{
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
sel= ACHANNEL_SETFLAG_CLEAR;
@@ -312,6 +313,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLINESTYLE:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@@ -1733,6 +1735,7 @@ static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, sh
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLINESTYLE:
{
/* sanity checking... */
if (ale->adt) {
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 0ff75c1cded..2a16e27df29 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -52,6 +52,7 @@
#include "DNA_camera_types.h"
#include "DNA_lamp_types.h"
#include "DNA_lattice_types.h"
+#include "DNA_linestyle_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
@@ -681,6 +682,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->adt= BKE_animdata_from_id(data);
}
break;
+ case ANIMTYPE_DSLINESTYLE:
+ {
+ FreestyleLineStyle *linestyle= (FreestyleLineStyle *)data;
+ AnimData *adt= linestyle->adt;
+
+ ale->flag= FILTER_LS_SCED(linestyle);
+
+ ale->key_data= (adt) ? adt->action : NULL;
+ ale->datatype= ALE_ACT;
+
+ ale->adt= BKE_animdata_from_id(data);
+ }
+ break;
case ANIMTYPE_DSPART:
{
ParticleSettings *part= (ParticleSettings*)ale->data;
@@ -2010,7 +2024,99 @@ static int animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_dat
)
}
-
+ /* line styles */
+ if (!(ads->filterflag & ADS_FILTER_NOLINESTYLE)) {
+ ListBase linestyles = {NULL, NULL};
+ LinkData *link;
+ SceneRenderLayer *srl;
+ FreestyleLineSet *lineset;
+ FreestyleLineStyle *linestyle;
+
+ for (srl = (SceneRenderLayer *)sce->r.layers.first; srl; srl = srl->next) {
+ if (!(srl->layflag & SCE_LAY_FRS))
+ continue;
+ for (lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+ short ok = 0;
+
+ linestyle = lineset->linestyle;
+ if (!linestyle->adt)
+ continue;
+
+ ANIMDATA_FILTER_CASES(linestyle,
+ { /* AnimData blocks - do nothing... */ },
+ ok=1;,
+ ok=1;,
+ ok=1;)
+ if (ok == 0) continue;
+
+ /* check if the same linestyle is already in the list */
+ for (link = (LinkData *)linestyles.first; link; link = link->next) {
+ if (link->data == linestyle) {
+ ok = 0;
+ break;
+ }
+ }
+ if (ok == 0) continue;
+
+ /* add this linestyle to the list */
+ link= MEM_callocN(sizeof(LinkData), "DopeSheet LineStyle cache");
+ link->data= linestyle;
+ BLI_addtail(&linestyles, link);
+ }
+ }
+
+ if (linestyles.first) {
+
+ for (link = (LinkData *)linestyles.first; link; link = link->next) {
+ linestyle = (FreestyleLineStyle *)link->data;
+
+ /* Action, Drivers, or NLA for line styles */
+ adt= linestyle->adt;
+ ANIMDATA_FILTER_CASES(linestyle,
+ { /* AnimData blocks - do nothing... */ },
+ { /* nla */
+ /* add NLA tracks */
+ items += animdata_filter_nla(ac, anim_data, ads, adt, filter_mode, linestyle, ANIMTYPE_DSLINESTYLE, (ID *)linestyle);
+ },
+ { /* drivers */
+ /* include linestyle-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(linestyle, ANIMTYPE_DSLINESTYLE, sce, ANIMTYPE_SCENE, (ID *)linestyle);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add F-Curve channels (drivers are F-Curves) */
+ if (FILTER_LS_SCED(linestyle)/*EXPANDED_DRVD(adt)*/ || !(filter_mode & ANIMFILTER_CHANNELS)) {
+ // XXX owner info is messed up now...
+ items += animdata_filter_fcurves(anim_data, ads, adt->drivers.first, NULL, linestyle, ANIMTYPE_DSLINESTYLE, filter_mode, (ID *)linestyle);
+ }
+ },
+ { /* action */
+ /* include nodetree-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(linestyle, ANIMTYPE_DSLINESTYLE, sce, ANIMTYPE_SCENE, (ID *)sce);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add channels */
+ if (FILTER_LS_SCED(linestyle) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+ items += animdata_filter_action(ac, anim_data, ads, adt->action, filter_mode, linestyle, ANIMTYPE_DSLINESTYLE, (ID *)linestyle);
+ }
+ }
+ )
+ }
+
+ /* free cache */
+ BLI_freelistN(&linestyles);
+ }
+ }
+
// TODO: scene compositing nodes (these aren't standard node-trees)
/* return the number of items added to the list */
@@ -2044,7 +2150,7 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
/* scene-linked animation */
// TODO: sequencer, composite nodes - are we to include those here too?
{
- short sceOk= 0, worOk= 0, nodeOk=0;
+ short sceOk= 0, worOk= 0, nodeOk=0, lsOk = 0;
/* check filtering-flags if ok */
ANIMDATA_FILTER_CASES(sce,
@@ -2084,17 +2190,41 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
nodeOk= !(ads->filterflag & ADS_FILTER_NONTREE);,
nodeOk= !(ads->filterflag & ADS_FILTER_NONTREE);)
}
+
+ /* line styles */
+ {
+ SceneRenderLayer *srl;
+ FreestyleLineSet *lineset;
+
+ for (srl = (SceneRenderLayer *)sce->r.layers.first; srl; srl = srl->next) {
+ if (srl->layflag & SCE_LAY_FRS) {
+ for (lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+ ANIMDATA_FILTER_CASES(lineset->linestyle,
+ {
+ /* for the special AnimData blocks only case, we only need to add
+ * the block if it is valid... then other cases just get skipped (hence ok=0)
+ */
+ ANIMDATA_ADD_ANIMDATA(lineset->linestyle);
+ lsOk=0;
+ },
+ lsOk= !(ads->filterflag & ADS_FILTER_NOLINESTYLE);,
+ lsOk= !(ads->filterflag & ADS_FILTER_NOLINESTYLE);,
+ lsOk= !(ads->filterflag & ADS_FILTER_NOLINESTYLE);)
+ }
+ }
+ }
+ }
/* if only F-Curves with visible flags set can be shown, check that
* datablocks haven't been set to invisible
*/
if (filter_mode & ANIMFILTER_CURVEVISIBLE) {
if ((sce->adt) && (sce->adt->flag & ADT_CURVES_NOT_VISIBLE))
- sceOk= worOk= nodeOk= 0;
+ sceOk= worOk= nodeOk= lsOk= 0;
}
/* check if not all bad (i.e. so there is something to show) */
- if ( !(!sceOk && !worOk && !nodeOk) ) {
+ if ( !(!sceOk && !worOk && !nodeOk && !lsOk) ) {
/* add scene data to the list of filtered channels */
items += animdata_filter_dopesheet_scene(ac, anim_data, ads, sce, filter_mode);
}
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 55bada5ba4e..545b8462d4c 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -723,7 +723,7 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
}
/* linestyle animdata */
- if (sce->r.mode & R_EDGE_FRS) {
+ if (sce->r.mode & R_EDGE_FRS && !(filterflag & ADS_FILTER_NOLINESTYLE)) {
SceneRenderLayer *srl;
FreestyleLineSet *lineset;
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 17d674784f8..03bb8da529f 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -39,6 +39,7 @@
#include "DNA_camera_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
@@ -364,6 +365,24 @@ static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEdi
return 1;
}
+ /* Line styles */
+ {
+ SceneRenderLayer *srl;
+ FreestyleLineSet *lineset;
+ FreestyleLineStyle *linestyle;
+
+ for (srl = (SceneRenderLayer *)sce->r.layers.first; srl; srl = srl->next) {
+ if (srl->layflag & SCE_LAY_FRS) {
+ for (lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+ linestyle = lineset->linestyle;
+ if (linestyle->adt) {
+ if (adt_keyframes_loop(ked, linestyle->adt, key_ok, key_cb, fcu_cb, filterflag))
+ return 1;
+ }
+ }
+ }
+ }
+ }
return 0;
}
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 5fb7fa41752..cf2b32653c8 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -151,6 +151,7 @@ typedef enum eAnim_ChannelType {
ANIMTYPE_DSARM,
ANIMTYPE_DSMESH,
ANIMTYPE_DSTEX,
+ ANIMTYPE_DSLINESTYLE,
ANIMTYPE_SHAPEKEY,
@@ -212,6 +213,7 @@ typedef enum eAnimFilter_Flags {
/* 'Sub-Scene' channels (flags stored in Data block) */
#define FILTER_WOR_SCED(wo) ((wo->flag & WO_DS_EXPAND))
#define FILTER_NTREE_SCED(ntree) ((ntree->flag & NTREE_DS_EXPAND))
+#define FILTER_LS_SCED(linestyle) ((linestyle->flag & LS_DS_EXPAND))
/* 'Object' channels */
#define SEL_OBJC(base) ((base->flag & SELECT))
#define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index a728cc900c2..2b394405155 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -138,6 +138,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
case ANIMTYPE_DSPART:
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
+ case ANIMTYPE_DSLINESTYLE:
{
/* for these channels, we only do AnimData */
if (ale->id && ale->adt) {
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index b00cba676d0..d60551dac2e 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -173,6 +173,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLINESTYLE:
{
/* sanity checking... */
if (ale->adt) {
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index f7bbf9235ab..d9f0f20ad52 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -545,6 +545,7 @@ typedef enum eDopeSheet_FilterFlag {
ADS_FILTER_NOARM = (1<<18),
ADS_FILTER_NONTREE = (1<<19),
ADS_FILTER_NOTEX = (1<<20),
+ ADS_FILTER_NOLINESTYLE = (1<<21),
/* NLA-specific filters */
ADS_FILTER_NLA_NOACT = (1<<25), /* if the AnimData block has no NLA data, don't include to just show Action-line */
diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h
index a19bbdf1bf9..a04cbb8c79d 100644
--- a/source/blender/makesdna/DNA_linestyle_types.h
+++ b/source/blender/makesdna/DNA_linestyle_types.h
@@ -178,13 +178,18 @@ typedef struct LineStyleThicknessModifier_DistanceFromObject {
#define LS_PANEL_DISTORT 5
#define LS_PANEL_MISC 6
+/* FreestyleLineStyle::flag */
+#define LS_DS_EXPAND 1 /* for animation editors */
+
typedef struct FreestyleLineStyle {
ID id;
struct AnimData *adt;
float r, g, b, alpha;
float thickness;
+ int flag;
int panel; /* for UI */
+ int pad1;
ListBase color_modifiers;
ListBase alpha_modifiers;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 42ddf340f12..d5f494ebbfb 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -253,6 +253,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_LAMP_DATA, 0);
RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+ prop= RNA_def_property(srna, "show_linestyles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLINESTYLE);
+ RNA_def_property_ui_text(prop, "Display Line Style", "Include visualization of Line Style related Animation data");
+ RNA_def_property_ui_icon(prop, ICON_BRUSH_DATA, 0); /* FIXME */
+ RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
+
prop= RNA_def_property(srna, "show_textures", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX);
RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of Texture related Animation data");