diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-09-18 04:31:22 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-09-18 04:31:22 +0400 |
commit | 56303415e4d534d4f2f4075a818a2aa19ea19fbd (patch) | |
tree | 768355c547c5a9971dfa1120d4e41ba64454a9b4 /source/blender/blenkernel/intern/linestyle.c | |
parent | fdb4b0c3ed9279473eb0edf4bac0333e7e929727 (diff) |
Added support for animation of line style parameters.
Most stylization parameters in line style datablocks are now
animatable by means of keyframes. Right click on a line
style parameter, and you will see a list of keyframe-related
commands in the context menu.
Concerning the implementation, RNA path resolution has been
extended to properly address color ramps in line style color
modifiers. File I/O has been also improved to load/save the
animation data associated with line style datablocks.
Known issue: Freestyle-related options in render layers are
not animatable at the moment, because of general inability (or
maybe a bug) that keyframes cannot be inserted with respect to
render layer options.
Diffstat (limited to 'source/blender/blenkernel/intern/linestyle.c')
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index acd8f0e4368..ef4ce16328f 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -34,6 +34,7 @@ #include "MEM_guardedalloc.h" #include "DNA_material_types.h" /* for ramp blend */ +#include "DNA_texture_types.h" #include "BKE_global.h" #include "BKE_library.h" @@ -41,6 +42,7 @@ #include "BKE_main.h" #include "BKE_texture.h" #include "BKE_colortools.h" +#include "BKE_animsys.h" #include "BLI_blenlib.h" @@ -80,6 +82,7 @@ void FRS_free_linestyle(FreestyleLineStyle *linestyle) { LineStyleModifier *m; + BKE_free_animdata(&linestyle->id); while ((m = (LineStyleModifier *)linestyle->color_modifiers.first)) FRS_remove_linestyle_color_modifier(linestyle, m); while ((m = (LineStyleModifier *)linestyle->alpha_modifiers.first)) @@ -308,3 +311,57 @@ void FRS_move_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineSt { move_modifier(&linestyle->thickness_modifiers, modifier, direction); } + +void FRS_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase) +{ + LineStyleModifier *m; + ColorBand *color_ramp; + LinkData *link; + + listbase->first = listbase->last = NULL; + for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) { + switch (m->type) { + case LS_MODIFIER_ALONG_STROKE: + color_ramp = ((LineStyleColorModifier_AlongStroke *)m)->color_ramp; + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + color_ramp = ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp; + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + color_ramp = ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp; + break; + default: + continue; + } + link = (LinkData *) MEM_callocN( sizeof(LinkData), "link to color ramp"); + link->data = color_ramp; + BLI_addtail(listbase, link); + } +} + +char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp) +{ + LineStyleModifier *m; + + for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) { + switch (m->type) { + case LS_MODIFIER_ALONG_STROKE: + if (color_ramp == ((LineStyleColorModifier_AlongStroke *)m)->color_ramp) + goto found; + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + if (color_ramp == ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp) + goto found; + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + if (color_ramp == ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp) + goto found; + break; + } + } + printf("FRS_path_from_ID_to_color_ramp: No color ramps correspond to the given pointer.\n"); + return NULL; + +found: + return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", m->name); +} |