Added support for line styles in the Graph Editor, DopeSheet
and NLA Editor.
This commit is contained in:
parent
28d618e41b
commit
af07527d35
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
@ -678,6 +679,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
|
|||
ale->key_data= (adt) ? adt->action : NULL;
|
||||
ale->datatype= ALE_ACT;
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue